Hello I cannot reach to add an href different than the value.
this.editor.execute( 'link', 'link name', { linkHref: 'http://google.com' } );
true is all the time set.
Can you help ?
thanks
Hi, if you'd like to create a link, use the following syntax:
const linkCommand = editor.commands.get( 'link' );
linkCommand.execute( 'http://google.com', {
linkIsExternal: true
} );
You'll find more information here.
Thank's for the answer, what i don't get it's how to have a text different than the href
exemple get <a href="http://google.com">google</a>
For this case, it'd be better to use a writer:
const linkText = 'text';
const linkUrl = 'https://google.com';
editor.model.change( writer => {
const insertPosition = editor.model.document.selection.getFirstPosition();
writer.insertText( linkText, { linkHref: linkUrl }, insertPosition );
} );
Perfect thank's alot
Most helpful comment
For this case, it'd be better to use a writer: