Skip to content

Commit

Permalink
fix(extension-link): extract the scheme from the URL before checking …
Browse files Browse the repository at this point in the history
…whether it's javascript
  • Loading branch information
MUDRY Julien committed May 16, 2024
1 parent b79de07 commit 0ac4249
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/extension-link/src/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,7 @@ export const Link = Mark.create<LinkOptions>({
},

renderHTML({ HTMLAttributes }) {
// False positive; we're explicitly checking for javascript: links to ignore them
// eslint-disable-next-line no-script-url
if (HTMLAttributes.href?.toLowerCase().trim().startsWith('javascript:')) {
if (HTMLAttributes.href?.substring(0, HTMLAttributes.href.indexOf(':')).toLowerCase().trim() === 'javascript') {
// strip out the href
return ['a', mergeAttributes(this.options.HTMLAttributes, { ...HTMLAttributes, href: '' }), 0]
}
Expand Down

0 comments on commit 0ac4249

Please sign in to comment.