vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[livejournal] r19789: =LJSV-1721: Changes in entries not saved...

Committer: vad
=LJSV-1721: Changes in entries not saved and still showed old content, if user use RTE for editing
_U  branches/r83/
U   branches/r83/htdocs/js/ck/config.js
U   branches/r83/htdocs/js/ck/plugins/livejournal/plugin.js
U   branches/r83/htdocs/js/rte.js
Property changes on: branches/r83
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/mobile:18667-19395
/branches/oauth:16278-17088
/branches/r74:17971
/trunk:19673,19675-19676,19682,19686-19687,19689,19691-19696,19698-19702,19704-19712,19714-19717,19721,19728,19731,19734-19736,19738-19739,19741,19744-19745,19747-19748,19751-19754,19763-19764,19766-19770
   + /branches/mobile:18667-19395
/branches/oauth:16278-17088
/branches/r74:17971
/trunk:19673,19675-19676,19682,19686-19687,19689,19691-19696,19698-19702,19704-19712,19714-19717,19721,19728,19731,19734-19736,19738-19739,19741,19744-19745,19747-19748,19751-19754,19763-19764,19766-19770,19780

Modified: branches/r83/htdocs/js/ck/config.js
===================================================================
--- branches/r83/htdocs/js/ck/config.js	2011-08-19 09:27:30 UTC (rev 19788)
+++ branches/r83/htdocs/js/ck/config.js	2011-08-19 09:52:02 UTC (rev 19789)
@@ -31,6 +31,7 @@
 		'link,' +
 		'list,' +
 		'liststyle,' +
+		'pastefromword,' +
 		'specialchar,' +
 		'tab,' +
 		'toolbar,' +
@@ -46,6 +47,7 @@
 	config.entities_additional = '#39';
 	config.entities_greek = true;
 	config.entities_latin = true;
+	config.enableTabKeyTools = true;
 	config.fillEmptyBlocks = false;
 	config.startupFocus = false;
 	config.forcePasteAsPlainText = false;

Modified: branches/r83/htdocs/js/ck/plugins/livejournal/plugin.js
===================================================================
--- branches/r83/htdocs/js/ck/plugins/livejournal/plugin.js	2011-08-19 09:27:30 UTC (rev 19788)
+++ branches/r83/htdocs/js/ck/plugins/livejournal/plugin.js	2011-08-19 09:52:02 UTC (rev 19789)
@@ -343,8 +343,8 @@
 					}
 
 					note = {
-						show: function(data, cmd, node) {
-							if (data == tempData.data && cmd == tempData.cmd && node === tempData.node) {
+						show: function(data, cmd, node, isNow) {
+							if (!isNow && data == tempData.data && cmd == tempData.cmd && node === tempData.node) {
 								return;
 							}
 
@@ -354,11 +354,12 @@
 							}
 
 							state = 1;
-							timer = setTimeout(applyNote, 1000);
 
 							tempData.data = data;
 							tempData.cmd = cmd;
 							tempData.node = node;
+
+							isNow === true ? applyNote() : timer = setTimeout(applyNote, 1000);
 						},
 						hide: function(isNow) {
 							if (state) {
@@ -905,7 +906,7 @@
 			} else {
 				editor.addCommand('LJPollLink', {
 					exec: function() {
-						note.show(top.CKLang.Poll_AccountLevelNotice);
+						note.show(top.CKLang.Poll_AccountLevelNotice, null, null, true);
 					}
 				});
 

Modified: branches/r83/htdocs/js/rte.js
===================================================================
--- branches/r83/htdocs/js/rte.js	2011-08-19 09:27:30 UTC (rev 19788)
+++ branches/r83/htdocs/js/rte.js	2011-08-19 09:52:02 UTC (rev 19789)
@@ -4,28 +4,42 @@
 	var CKEditor,
 		draftData;
 
+	function initDraftData(){
+		draftData = {
+			textArea: $('#draft'),
+			statusNode: $('#draftstatus')
+		};
+		
+		draftData.lastValue = draftData.textArea.val();
+		draftData.textArea.val(draftData.lastValue.replace(/<br\s?\/>\n?/g, '\n'));
+	}
+
 	window.initDraft = function(data) {
-		draftData = data;
+		initDraftData();
 
-		data.textArea = $('#draft');
-		data.lastValue = draftData.textArea.val();
-		data.statusNode = $('#draftstatus');
+		for(var prop in data){
+			if(data.hasOwnProperty(prop)){
+				draftData[prop] = data[prop];
+			}
+		}
 
-		if (data.ask && data.restoreData) {
-			if (confirm(data.confirmMsg)) {
-				data.lastValue = data.restoreData;
-				data.statusNode.val(data.draftStatus);
+		if (draftData.ask && draftData.restoreData) {
+			if (confirm(draftData.confirmMsg)) {
+				draftData.lastValue = draftData.restoreData;
+				draftData.statusNode.val(draftData.draftStatus);
 			}
 		} else {
-			data.statusNode.val('');
+			draftData.statusNode.val('');
 		}
 
-		draftData.textArea.val(draftData.lastValue.replace(/<br\s?\/>\n?/g, '\n'));
-
 		$('#updateForm').delegate('#draft', 'keypress click', checkDraftTimer);
 	};
 
 	window.useRichText = function (statPrefix) {
+		if (!draftData) {
+			initDraftData();
+		}
+
 		if (!window.switchedRteOn) {
 			window.switchedRteOn = true;
 			$('#switched_rte_on').value = '1';
@@ -41,10 +55,9 @@
 
 				editor.on('instanceReady', function() {
 					CKEditor = editor;
-
 					editor.resetDirty();
 
-					$('#updateForm').bind('submit', function() {
+					$('#updateForm')[0].onsubmit = function() {
 						if (window.switchedRteOn) {
 							draftData.textArea.val(CKEditor.getData());
 						}
@@ -85,6 +98,10 @@
 	};
 
 	window.usePlainText = function() {
+		if (!draftData) {
+			initDraftData();
+		}
+
 		if (window.switchedRteOn) {
 			window.switchedRteOn = false;
 			$('#switched_rte_on').value = '0';
@@ -185,4 +202,4 @@
 		}
 	}
 
-})(jQuery, this);
\ No newline at end of file
+})(jQuery, this);

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