diff --git a/packages/editor/src/extensions/link/helpers/clickHandler.ts b/packages/editor/src/extensions/link/helpers/clickHandler.ts
index 68795dd75..be5fc0689 100644
--- a/packages/editor/src/extensions/link/helpers/clickHandler.ts
+++ b/packages/editor/src/extensions/link/helpers/clickHandler.ts
@@ -17,12 +17,13 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import { getAttributes } from "@tiptap/core";
+import { Editor, getAttributes } from "@tiptap/core";
import { MarkType } from "@tiptap/pm/model";
import { Plugin, PluginKey } from "@tiptap/pm/state";
type ClickHandlerOptions = {
type: MarkType;
+ editor: Editor;
};
export function clickHandler(options: ClickHandlerOptions): Plugin {
@@ -50,10 +51,12 @@ export function clickHandler(options: ClickHandlerOptions): Plugin {
const link = event.target as HTMLLinkElement;
const href = link?.href ?? attrs.href;
- const target = link?.target ?? attrs.target;
+ // const target = link?.target ?? attrs.target;
if (link && href) {
- if (view.editable) window.open(href, target);
+ if (view.editable) {
+ options.editor.storage.openLink?.(href);
+ }
return true;
}
diff --git a/packages/editor/src/extensions/link/link.ts b/packages/editor/src/extensions/link/link.ts
index 29263c647..4d351071f 100644
--- a/packages/editor/src/extensions/link/link.ts
+++ b/packages/editor/src/extensions/link/link.ts
@@ -273,7 +273,8 @@ export const Link = Mark.create({
if (this.options.openOnClick) {
plugins.push(
clickHandler({
- type: this.type
+ type: this.type,
+ editor: this.editor
})
);
}