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

[livejournal] r19506: LJSUP-9253: in Rich text cannot delete l...

Committer: vkurkin
LJSUP-9253: in Rich text cannot delete lj-like buttons
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-07-21 08:10:40 UTC (rev 19505)
+++ trunk/htdocs/js/ck/config.js	2011-07-22 07:04:00 UTC (rev 19506)
@@ -144,12 +144,12 @@
 	config.colorButton_colors = '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,808080,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF';
 	config.font_names = 'Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana';
 	config.fontSize_sizes = 'smaller;larger;xx-small;x-small;small;medium;large;x-large;xx-large';
-	config.disableObjectResizing = false;
+	config.disableObjectResizing = true;
 	config.disableNativeTableHandles = true;
 	config.format_tags = 'p;h1;h2;h3;h4;h5;h6;pre;address;div';
 	config.bodyId = '';
 	config.bodyClass = '';
-	config.fontSize_defaultLabel = 'Size';
+	config.fontSize_defaultLabel = '';
 	config.removeFormatTags = 'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var';
 	config.removeFormatAttributes = 'class,style,lang,width,height,align,hspace,valign';
 	config.stylesSet = [{

Modified: trunk/htdocs/js/ck/plugins/livejournal/plugin.js
===================================================================
--- trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2011-07-21 08:10:40 UTC (rev 19505)
+++ trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2011-07-22 07:04:00 UTC (rev 19506)
@@ -535,7 +535,6 @@
 						onClick : function(evt){
 							var dialog = evt.data.dialog, attr = [];
 							var likeNode = currentLjLikeNode || new CKEDITOR.dom.element('div');
-							likeNode.$.readOnly = true;
 							likeNode.remove();
 							likeNode.setHtml('');
 
@@ -545,6 +544,7 @@
 								if(buttonNode.getValue('checked')){
 									attr.push(button.id);
 									likeNode.appendHtml(button.html);
+									likeNode.getLast().addClass(button.abbr);
 								}
 							}
 
@@ -726,7 +726,7 @@
 						return isFlashEmbed(element) ? createFakeElement(editor, element) : null;
 					},
 					'lj-like': function(element){
-						var html = '', attr = [];
+						var attr = [];
 
 						var fakeElement = new CKEDITOR.htmlParser.element('div');
 						fakeElement.attributes['class'] = 'lj-like';
@@ -739,13 +739,14 @@
 							var buttonName = currentButtons[i].replace(/^\s*([a-z]{2,})\s*$/i, '$1');
 							var button = likeButtons[buttonName];
 							if(button){
-								html += button.html;
+								var buttonNode = new CKEDITOR.htmlParser.fragment.fromHtml(button.html).children[0];
+								buttonNode.attributes['class'] += (' ' + button.abbr);
+								fakeElement.add(buttonNode);
 								attr.push(buttonName);
 							}
 						}
 
 						fakeElement.attributes.buttons = attr.join(',');
-						fakeElement.add(new CKEDITOR.htmlParser.fragment.fromHtml(html));
 						return fakeElement;
 					},
 					'lj': function(element){
@@ -816,9 +817,18 @@
 					'div': function(element){
 						if(element.attributes['class'] == 'lj-like'){
 							var ljLikeNode = new CKEDITOR.htmlParser.element('lj-like');
-							if(element.attributes.buttons && element.attributes.buttons.length){
-								ljLikeNode.attributes.buttons = element.attributes.buttons;
+
+							var childs = element.children, attr = [];
+							for(var i = 0; i < childs.length; i++){
+								var abbr = /.*?([a-z]{2})$/.exec(childs[i].attributes['class'])[1];
+								if(abbr && likeButtons.hasOwnProperty(abbr)){
+									attr.push(abbr);
+								}
 							}
+
+							if(attr.length){
+								ljLikeNode.attributes.buttons = attr.join(',');
+							}
 							ljLikeNode.isEmpty = true;
 							ljLikeNode.isOptionalClose = true;
 							return ljLikeNode;

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