diff --git a/formats/link.js b/formats/link.js index 323241df17..f67356553a 100644 --- a/formats/link.js +++ b/formats/link.js @@ -4,6 +4,7 @@ class Link extends Inline { static create(value) { const node = super.create(value); node.setAttribute('href', this.sanitize(value)); + node.setAttribute('rel', 'noopener noreferrer'); node.setAttribute('target', '_blank'); return node; } diff --git a/test/unit/formats/link.js b/test/unit/formats/link.js index 8d09d33f81..4197d1b9a0 100644 --- a/test/unit/formats/link.js +++ b/test/unit/formats/link.js @@ -13,7 +13,7 @@ describe('Link', function() { .insert('3\n'), ); expect(editor.scroll.domNode).toEqualHTML( - '

0123

', + '

0123

', ); }); @@ -38,14 +38,14 @@ describe('Link', function() { .insert('3\n'), ); expect(editor.scroll.domNode).toEqualHTML( - '

0123

', + '

0123

', ); }); it('change', function() { const editor = this.initialize( Editor, - '

0123

', + '

0123

', ); editor.formatText(1, 2, { link: 'https://quilljs.com' }); expect(editor.getDelta()).toEqual( @@ -55,14 +55,14 @@ describe('Link', function() { .insert('3\n'), ); expect(editor.scroll.domNode).toEqualHTML( - '

0123

', + '

0123

', ); }); it('remove', function() { const editor = this.initialize( Editor, - '

0123

', + '

0123

', ); editor.formatText(1, 2, { link: false }); const delta = new Delta()