summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Stjerneman2013-03-08 11:14:19 (GMT)
committerEmil Stjerneman2013-03-08 11:14:19 (GMT)
commit7aab8b260db30ec2b344c7be3a4546a226c37d5e (patch)
tree3b60562b9d34d9b9b3f8b93f14c511f678e0989d
parent35cbe4958f05cd116a10895c7030e904015b1660 (diff)
Fixed #1915086: Inserting link not working in IE9 and below when making text selection (with ckeditor 4)
-rw-r--r--editors/ckeditor/plugin.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/editors/ckeditor/plugin.js b/editors/ckeditor/plugin.js
index fedb556..10a9527 100644
--- a/editors/ckeditor/plugin.js
+++ b/editors/ckeditor/plugin.js
@@ -134,13 +134,12 @@
if (!linkitCache.selectedElement) {
// We have not selected any link element so lets create a new one.
- var ranges = selection.getRanges( true );
- if (ranges.length == 1 && ranges[0].collapsed) {
- var content = (Drupal.linkitCache.link_tmp_title) ? Drupal.linkitCache.link_tmp_title : data.path;
- var text = new CKEDITOR.dom.text(content, editor.document);
- ranges[0].insertNode(text);
- ranges[0].selectNodeContents(text);
- selection.selectRanges(ranges);
+ var range = selection.getRanges(1)[0];
+ if (range.collapsed) {
+ var content = (Drupal.settings.linkit.currentInstance.linkContent) ? Drupal.settings.linkit.currentInstance.linkContent : data.path;
+ var text = new CKEDITOR.dom.text(content , editor.document );
+ range.insertNode(text);
+ range.selectNodeContents(text);
}
// Delete all attributes that are empty.
@@ -151,7 +150,8 @@
// Apply style.
var style = new CKEDITOR.style({element : 'a', attributes : data.attributes});
style.type = CKEDITOR.STYLE_INLINE;
- style.apply(editor.document);
+ style.applyToRange(range);
+ range.select();
}
else {
// We are editing an existing link, so just overwrite the attributes.