Hi,
I'm trying to convert selected text in CKEditor into a link using Javascript, but without using the normal insert link dialog that CKEditor provides. Here's the code I'm trying:
// convert selected text to a link to google
// (doesn't work as hoped: opens the UI to enter the URL)
CKEDITOR.instances.editor1.execCommand('link',
'http://www.google.com');
// also tried this, but it does nothing
var style = new CKEDITOR.style({
element: 'a',
attributes: {
href: 'http://www.google.com'
}});
CKEDITOR.instances.editor1.applyStyle(style);
What is the correct way to programmatically apply a link to the selected text (with no user interaction)?
Many thanks
