Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/danielw93/quill into dan…
Browse files Browse the repository at this point in the history
…ielw93-develop
  • Loading branch information
jhchen committed Sep 9, 2019
2 parents 2f608ab + b2f7b58 commit 0797898
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions formats/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
10 changes: 5 additions & 5 deletions test/unit/formats/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Link', function() {
.insert('3\n'),
);
expect(editor.scroll.domNode).toEqualHTML(
'<p>0<a href="https://quilljs.com" target="_blank">12</a>3</p>',
'<p>0<a href="https://quilljs.com" target="_blank" rel="noopener noreferrer">12</a>3</p>',
);
});

Expand All @@ -38,14 +38,14 @@ describe('Link', function() {
.insert('3\n'),
);
expect(editor.scroll.domNode).toEqualHTML(
'<p>0<a href="about:blank" target="_blank">12</a>3</p>',
'<p>0<a href="about:blank" target="_blank" rel="noopener noreferrer">12</a>3</p>',
);
});

it('change', function() {
const editor = this.initialize(
Editor,
'<p>0<a href="https://github.com" target="_blank">12</a>3</p>',
'<p>0<a href="https://github.com" target="_blank" rel="noopener noreferrer">12</a>3</p>',
);
editor.formatText(1, 2, { link: 'https://quilljs.com' });
expect(editor.getDelta()).toEqual(
Expand All @@ -55,14 +55,14 @@ describe('Link', function() {
.insert('3\n'),
);
expect(editor.scroll.domNode).toEqualHTML(
'<p>0<a href="https://quilljs.com" target="_blank">12</a>3</p>',
'<p>0<a href="https://quilljs.com" target="_blank" rel="noopener noreferrer">12</a>3</p>',
);
});

it('remove', function() {
const editor = this.initialize(
Editor,
'<p>0<a class="ql-size-large" href="https://quilljs.com" target="_blank">12</a>3</p>',
'<p>0<a class="ql-size-large" href="https://quilljs.com" target="_blank" rel="noopener noreferrer">12</a>3</p>',
);
editor.formatText(1, 2, { link: false });
const delta = new Delta()
Expand Down

0 comments on commit 0797898

Please sign in to comment.