DEV: removes jquery usage from html-with-links (#14966)

This commit is contained in:
Joffrey JAFFEUX 2021-11-16 13:16:43 +01:00 committed by GitHub
parent 32c6c4f417
commit f9682f1c69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,19 +5,11 @@ import {
import Component from "@ember/component";
export default Component.extend({
didInsertElement() {
this._super(...arguments);
$(this.element).on("click.discourse-open-tab", "a", (event) => {
if (event.target && event.target.tagName === "A") {
if (shouldOpenInNewTab(event.target.href)) {
openLinkInNewTab(event.target);
}
click(event) {
if (event?.target?.tagName === "A") {
if (shouldOpenInNewTab(event.target.href)) {
openLinkInNewTab(event.target);
}
});
},
willDestroyElement() {
this._super(...arguments);
$(this.element).off("click.discourse-open-tab", "a");
}
},
});