Vlad Kurkin (b_vladi) wrote in changelog,
Vlad Kurkin
b_vladi
changelog

[livejournal] r20544: LJSUP-10410 Erases all data under lj-cut...

Committer: vkurkin
LJSUP-10410 Erases all data under lj-cut (ie8)
U   trunk/htdocs/js/ck/plugins/livejournal/plugin.js
Modified: trunk/htdocs/js/ck/plugins/livejournal/plugin.js
===================================================================
--- trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2011-11-16 04:48:11 UTC (rev 20543)
+++ trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2011-11-16 05:06:37 UTC (rev 20544)
@@ -655,7 +655,16 @@
 							var selection = new CKEDITOR.dom.selection(editor.document),
 								ranges = selection.getRanges();
 
-							var startContainer = selection.getRanges()[0].getTouchedStartNode().getPrevious();
+							var startContainer = selection.getRanges()[0].getTouchedStartNode();
+
+							if(startContainer){
+								if (startContainer.type == 1 && !startContainer.is('body')) {
+									startContainer = startContainer.getPrevious();
+								}
+							} else {
+								startContainer = editor.document.getBody();
+							}
+
 							var fragment = new CKEDITOR.dom.documentFragment(editor.document);
 
 							var iframeOpen = new CKEDITOR.dom.element('iframe', editor.document);
@@ -680,10 +689,11 @@
 							if (text != top.CKLang.ReadMore) {
 								iframeOpen.setAttribute('text', text);
 							}
-							if (startContainer) {
+
+							if (startContainer.is && startContainer.is('body')) {
+								startContainer.append(fragment, true);
+							} else {
 								fragment.insertAfterNode(startContainer);
-							} else {
-								editor.document.getBody().append(fragment, true);
 							}
 						}
 

Tags: b_vladi, js, livejournal, vkurkin
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments