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

[livejournal] r20039: LJSUP-9754: RTE tooltips

Committer: vkurkin
LJSUP-9754: RTE tooltips
LJSV-1790: When edit "old" entries, created with RTE, lj-cut broken
LJSV-1723: RTE randomly creates div's and p's causing unnecessary spaces and messing up the markup
LJSV-1768: Creates new lj-cut after alignment of elements in created lj-cut
LJSV-1770: not working correctly right align in lj-cut
LJSV-1773: If lj-cut added in RTE, content for cutting erased from entry
LJSV-1779: Editing an entry with an lj-cut does not work correctly in RTE
LJSV-1789: and tag on update.bml removed after switching from html to rte
LJSV-1792: Link wizard shows blank URL for existing link in RTE / removes link if cursor is inside link itself
LJSV-1793: Created poll with using button in RTE (with using poll wizard) showed wrong and additionally contain in RTE unnecessary elements of poll in html
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-09-14 07:19:54 UTC (rev 20038)
+++ trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2011-09-14 07:40:13 UTC (rev 20039)
@@ -165,6 +165,7 @@
 			if (currentData.hasOwnProperty(cmd)) {
 				currentNoteNode = ljNoteData[cmd].node = currentData[cmd].node;
 				editor.execCommand(cmd);
+				note.hide(true);
 			}
 			return false;
 		}
@@ -248,10 +249,9 @@
 
 				while (node) {
 					if (!attr) {
-						if (node.type == 1 && node.is('img') && node.isEditable()) {
+						if (node.type == 1 && node.is('img') && node.getParent().getParent() && node.getParent().getParent().getAttribute('contentEditable') != 'false') {
 							node.setAttribute('lj-cmd', 'LJImage');
-						} else if (node.is('a') && node.isEditable()) {
-							console.log(node);
+						} else if (node.is('a') && node.getParent().getAttribute('contentEditable') != 'false') {
 							node.setAttribute('lj-cmd', 'LJLink');
 						}
 					}
@@ -280,13 +280,7 @@
 						editor.getCommand(command).setState(CKEDITOR.TRISTATE_OFF);
 					}
 				}
-
 			}
-
-			CKEDITOR.dtd.pre = CKEDITOR.dtd.div;
-			CKEDITOR.dtd.pre['lj-poll'] = 1;
-			CKEDITOR.dtd.pre['lj-cut'] = 1;
-			CKEDITOR.dtd.$block.pre = 1;
 			
 			editor.dataProcessor.toHtml = function(html, fixForBody) {
 				html = html
@@ -333,7 +327,8 @@
 				}
 			}
 
-			function showDialog(evt){
+			editor.on('selectionChange', findLJTags);
+			editor.on('doubleclick', function(evt) {
 				var node = evt.data.element;
 
 				if (node.type != 1) {
@@ -353,11 +348,8 @@
 					}
 					node = node.getParent();
 				}
-			}
+			});
 
-			editor.on('selectionChange', findLJTags);
-			editor.on('doubleclick', showDialog);
-
 			editor.on('dataReady', function() {
 				note = note || createNote(editor);
 
@@ -445,7 +437,7 @@
 							jQuery('#updateForm').photouploader({
 								type: 'upload'
 							}).photouploader('show').bind('htmlready', function (event, html) {
-								editor.insertHtml(html);
+								editor.insertElement(new CKEDITOR.dom.element.createFromHtml(html, editor.document));
 							});
 						} else {
 							editor.openDialog('image');
@@ -716,7 +708,7 @@
 			function doEmbed(content) {
 				if (content && content.length) {
 					if (window.switchedRteOn) {
-						editor.insertHtml('<div class="lj-embed" contentEditable="false">' + content + '</div><br/>');
+						editor.insertElement(CKEDITOR.dom.element.createFromHtml('<div class="lj-embed" contentEditable="false">' + content + '</div><br/>', editor.document));
 					}
 				}
 			}
@@ -729,7 +721,6 @@
 			editor.addCommand('LJCut', {
 				exec: function() {
 					var text;
-					note.hide(true);
 					if (ljNoteData.LJCut.node) {
 						text = prompt(top.CKLang.CutPrompt, ljNoteData.LJCut.node.getAttribute('text') || top.CKLang.ReadMore);
 						if (text) {
@@ -759,6 +750,7 @@
 							editor.insertElement(br);
 							ljNoteData.LJCut.node.insertBefore(br);
 						}
+						note.hide(true);
 					}
 				}
 			});
@@ -825,7 +817,7 @@
 									ljNoteData.LJPollLink.node.insertBeforeMe(node);
 									ljNoteData.LJPollLink.node.remove();
 								} else {
-									editor.insertHtml(pollSource);
+									editor.insertElement(CKEDITOR.dom.element.createFromHtml(pollSource, editor.document));
 								}
 								ljNoteData.LJPollLink.node = null;
 							}
@@ -970,8 +962,9 @@
 								ljNoteData.LJLike.node.setAttribute('buttons', attr.join(','));
 								ljNoteData.LJLike.node.setHtml(likeHtml);
 							} else {
-								editor.insertHtml('<div contentEditable="false" class="lj-like" lj-cmd="LJLike" buttons="' + attr
-									.join(',') + '">' + likeHtml + '</div><br/>');
+								editor.insertElement(CKEDITOR.dom.element
+									.createFromHtml('<div contentEditable="false" class="lj-like" lj-cmd="LJLike" buttons="' + attr
+									.join(',') + '">' + likeHtml + '</div><br/>', editor.document));
 							}
 						} else if (likeNode) {
 							ljNoteData.LJLike.node.remove();

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