This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/app/components/html-with-links.js

16 lines
337 B
JavaScript

import {
openLinkInNewTab,
shouldOpenInNewTab,
} from "discourse/lib/click-track";
import Component from "@ember/component";
export default Component.extend({
click(event) {
if (event?.target?.tagName === "A") {
if (shouldOpenInNewTab(event.target.href)) {
openLinkInNewTab(event.target);
}
}
},
});