can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[livejournal] r19906: LJSV-1742: If lj-cut added in RTE, conte...

Committer: dpetrov
LJSV-1742: If lj-cut added in RTE, content for cutting moved up to begining of entry
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-08-31 06:14:02 UTC (rev 19905)
+++ trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2011-08-31 06:18:06 UTC (rev 19906)
@@ -777,22 +777,23 @@
 					} else {
 						text = prompt(top.CKLang.CutPrompt, top.CKLang.ReadMore);
 						if (text) {
-							var br = editor.document.createElement('br');
+							var br = editor.document.createElement('br'),
+								selection = editor.document.getSelection();
 
-							ljNoteData.LJCut.node = editor.document.createElement('p');
+							ljNoteData.LJCut.node = editor.document.createElement('div');
 							ljNoteData.LJCut.node.setAttribute('lj-cmd', 'LJCut');
 							ljNoteData.LJCut.node.setAttribute('class', 'lj-cut');
 							if (text != top.CKLang.ReadMore) {
 								ljNoteData.LJCut.node.setAttribute('text', text);
 							}
-							editor.getSelection().getRanges()[0].extractContents().appendTo(ljNoteData.LJCut.node);
+							selection.getRanges()[0].extractContents().appendTo(ljNoteData.LJCut.node);
 							editor.insertElement( br );
 							ljNoteData.LJCut.node.insertBefore(br);
 
 							var range = new CKEDITOR.dom.range(editor.document);
 							range.moveToPosition( ljNoteData.LJCut.node, CKEDITOR.POSITION_AFTER_END );
 							range.selectNodeContents(ljNoteData.LJCut.node);
-							editor.getSelection().selectRanges([range]);
+							editor.document.getSelection().selectRanges([range]);
 
 						}
 					}

Tags: can3p, js, livejournal
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