can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[livejournal] r19912: LJSUP-9668: Cannot create post after ins...

Committer: dpetrov
LJSUP-9668: Cannot create post after insert image
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 08:09:17 UTC (rev 19911)
+++ trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2011-08-31 08:13:37 UTC (rev 19912)
@@ -383,12 +383,23 @@
 				}
 			}
 
+			function checkLastLine() {
+				var body = editor.document.getBody();
+				var last = body.getLast();
+				if (last && last.type == 1 && !last.is('br')) {
+					body.appendHtml('<br />');
+				}
+			}
+
 			editor.on('dataReady', function() {
 				note = note || createNote(editor);
 
 				editor.on('selectionChange', onSelectionChange);
 				editor.document.on('mouseout', note.hide.bind(note));
 				editor.document.on('mouseover', onMouseOver);
+				editor.document.on('keyup', checkLastLine );
+				editor.document.on('click', checkLastLine );
+				editor.document.on('selectionChange', checkLastLine );
 			});
 
 			//////////  LJ User Button //////////////

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