Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Do not unintended remove or modify link titles, fixes #2699
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Jul 9, 2022
commit 0de91fd4e0b39219ba828d566d21a4c4d9490842
5 changes: 4 additions & 1 deletion src/marks/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ const Link = TipTapLink.extend({
href: {
default: null,
},
title: {
default: null,
},
}
},

Expand All @@ -48,14 +51,14 @@ const Link = TipTapLink.extend({
tag: 'a[href]',
getAttrs: dom => ({
href: parseHref(dom),
title: dom.getAttribute('title'),
}),
},
],

renderHTML: ({ mark, HTMLAttributes }) => ['a', {
...mark.attrs,
href: domHref(mark),
title: mark.attrs.href,
rel: 'noopener noreferrer nofollow',
}, 0],

Expand Down
1 change: 1 addition & 0 deletions src/tests/markdown.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ describe('Markdown though editor', () => {
})
test('links', () => {
expect(markdownThroughEditor('[test](foo)')).toBe('[test](foo)')
expect(markdownThroughEditor('[test](foo "bar")')).toBe('[test](foo "bar")')
})
test('images', () => {
expect(markdownThroughEditor('![test](foo)')).toBe('![test](foo)')
Expand Down