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

[livejournal] r19593: LJSUP-9367: Fix

Committer: vkurkin
LJSUP-9367: Fix
U   trunk/htdocs/js/ck/config.js
U   trunk/htdocs/js/ck/plugins/livejournal/plugin.js
Modified: trunk/htdocs/js/ck/config.js
===================================================================
--- trunk/htdocs/js/ck/config.js	2011-08-04 07:00:43 UTC (rev 19592)
+++ trunk/htdocs/js/ck/config.js	2011-08-04 07:16:26 UTC (rev 19593)
@@ -127,7 +127,7 @@
 
 	config.toolbar = 'Full';
 	config.enterMode = CKEDITOR.ENTER_BR;
-	config.forceEnterMode = false;
+	config.forceEnterMode = true;
 	config.shiftEnterMode = CKEDITOR.ENTER_P;
 
 	config.keystrokes = [

Modified: trunk/htdocs/js/ck/plugins/livejournal/plugin.js
===================================================================
--- trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2011-08-04 07:00:43 UTC (rev 19592)
+++ trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2011-08-04 07:16:26 UTC (rev 19593)
@@ -223,6 +223,13 @@
 				return html;
 			};
 
+			function addLastTag(){
+				var body = editor.document.getBody();
+				if(!body.getLast().is('br')){
+					body.appendHtml('<br />');
+				}
+			}
+
 			editor.on('dataReady', function(){
 
 				editor.document.on('mouseover', onFindCmd);
@@ -230,6 +237,9 @@
 				editor.document.on('keyup', onFindCmd);
 				editor.document.on('click', onFindCmd);
 
+				editor.document.on('keyup', addLastTag);
+				editor.document.on('click', addLastTag);
+
 				if(!note){
 					var timer,
 						state,
@@ -814,7 +824,7 @@
 									ljNoteData.LJLikeCommand.node.setAttribute('buttons', attr.join(','));
 									ljNoteData.LJLikeCommand.node.setHtml(likeHtml);
 								} else {
-									editor.insertHtml('<div class="lj-like" lj-cmd="LJLikeCommand" buttons="' + attr.join(',') + '">' + likeHtml + '</div>\n');
+									editor.insertHtml('<div class="lj-like" lj-cmd="LJLikeCommand" buttons="' + attr.join(',') + '">' + likeHtml + '</div>');
 								}
 							} else if(ljNoteData.LJLikeCommand.node){
 								ljNoteData.LJLikeCommand.node.remove();
@@ -1031,6 +1041,8 @@
 							ljLikeNode.isEmpty = true;
 							ljLikeNode.isOptionalClose = true;
 							return ljLikeNode;
+						} else if(!element.children.length){
+							return false;
 						}
 					},
 					span: function(element){

Tags: b_vladi, 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