Skip to content

Commit

Permalink
fix(text editor): prevent default behaviour on link clicks
Browse files Browse the repository at this point in the history
  • Loading branch information
john-traas committed Jul 12, 2024
1 parent 766645a commit 67d7c51
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,18 @@ export const createLinkPlugin = (updateLinkCallback?: UpdateLinkCallback) => {

return true;
},
click: (_view, event) => {
if (!(event.target instanceof HTMLElement)) {
return;
}

// Prevent unhandled navigation and bubbling for link clicks
const link = event.target.closest('a');
if (link) {
event.preventDefault();
event.stopPropagation();
}
},
},
},
view: () => ({
Expand Down

0 comments on commit 67d7c51

Please sign in to comment.