If some text is selected, the link is made. However the selected text/link gets moved to the start of the alinea. If no text is selected, the link is placed at the right position.
My current code:
Any suggestions?
My current code:
var temp = new CKEDITOR.dom.element( 'span' ); temp.append(editor.getSelection().getRanges()[ 0 ].cloneContents()); if(temp.getText() == "") { editor.insertHtml('<a href=\"' + file_link + '\">' + file_link + '</a>'); } else { editor.insertHtml('<a href=\"' + file_link + '\">' + temp.getText() + '</a>'); }
Any suggestions?
Re: Inserting html around selected text
Re: Inserting html around selected text