Skip to content

Commit

Permalink
Fix links getting an unnecessary 'isadded' attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks committed May 23, 2018
1 parent 7d35c92 commit 65c08e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions editor/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -809,20 +809,20 @@ export class RichText extends Component {
return;
}

const { value: href, ...params } = formatValue;
const { value: href, target } = formatValue;

if ( ! this.isFormatActive( 'link' ) && this.editor.selection.isCollapsed() ) {
// When no link or text is selected, insert a link with the URL as its text
const anchorHTML = this.editor.dom.createHTML(
'a',
{ href, ...params },
{ href, target },
this.editor.dom.encode( href )
);
this.editor.insertContent( anchorHTML );
} else {
// Use built-in TinyMCE command turn the selection into a link. This takes
// care of deleting any existing links within the selection
this.editor.execCommand( 'mceInsertLink', false, { href, ...params } );
this.editor.execCommand( 'mceInsertLink', false, { href, target } );
}
} else {
this.editor.execCommand( 'Unlink' );
Expand Down

0 comments on commit 65c08e4

Please sign in to comment.