Skip to content

Commit 0de91fd

Browse files
committed
Do not unintended remove or modify link titles, fixes #2699
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 806f6c5 commit 0de91fd

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/marks/Link.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ const Link = TipTapLink.extend({
3838
href: {
3939
default: null,
4040
},
41+
title: {
42+
default: null,
43+
},
4144
}
4245
},
4346

@@ -48,14 +51,14 @@ const Link = TipTapLink.extend({
4851
tag: 'a[href]',
4952
getAttrs: dom => ({
5053
href: parseHref(dom),
54+
title: dom.getAttribute('title'),
5155
}),
5256
},
5357
],
5458

5559
renderHTML: ({ mark, HTMLAttributes }) => ['a', {
5660
...mark.attrs,
5761
href: domHref(mark),
58-
title: mark.attrs.href,
5962
rel: 'noopener noreferrer nofollow',
6063
}, 0],
6164

src/tests/markdown.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ describe('Markdown though editor', () => {
8383
})
8484
test('links', () => {
8585
expect(markdownThroughEditor('[test](foo)')).toBe('[test](foo)')
86+
expect(markdownThroughEditor('[test](foo "bar")')).toBe('[test](foo "bar")')
8687
})
8788
test('images', () => {
8889
expect(markdownThroughEditor('![test](foo)')).toBe('![test](foo)')

0 commit comments

Comments
 (0)