[pLog-svn] r982 - plog/trunk/js/htmlarea
mark at devel.plogworld.net
mark at devel.plogworld.net
Mon Feb 7 06:02:42 GMT 2005
Author: mark
Date: 2005-02-07 06:02:41 +0000 (Mon, 07 Feb 2005)
New Revision: 982
Modified:
plog/trunk/js/htmlarea/htmlarea.js
Log:
Fixed lose focus error for Mozilla. Okay till now, I think HTML can work the same behavior no matter in IE and FF. But, I have no idea how they work in Opera and Safari.
Modified: plog/trunk/js/htmlarea/htmlarea.js
===================================================================
--- plog/trunk/js/htmlarea/htmlarea.js 2005-02-07 04:59:26 UTC (rev 981)
+++ plog/trunk/js/htmlarea/htmlarea.js 2005-02-07 06:02:41 UTC (rev 982)
@@ -16,8 +16,10 @@
// Date: 2005/02/05
// Purpose: Base URL and Language setting for pLog
// -------------------------------------------------------------
+
var _editor_url = "js/htmlarea";
var _editor_lang = "en";
+
// -------------------------------------------------------------
if (typeof _editor_url == "string") {
@@ -76,9 +78,14 @@
// PLOG HTMLAREA TWEAK
// Changed by: Mark Wu
// Date: 2005/02/05
- // Purpose: Set the customUndo to "true" to fix Undo/Redo problem
+ // Purpose: Set the customUndo to "true" to fix Undo/Redo problem in IE
+ // Come From: http://www.htmlarea.com/forum/htmlArea_3_(beta)_C4/htmlArea_v3.0_-_Bug_Reports_%26_Fixes_F25/Bug_Reports_%26_Fixes_-_Forum_Rules_%2AREAD_THIS%2A_P37586/gforum.cgi?post=27292#27292
// -------------------------------------------------------------
+
this._customUndo = true;
+
+ //this._customUndo = false;
+
// -------------------------------------------------------------
this._mdoc = document; // cache the document, we need it in plugins
@@ -839,10 +846,37 @@
alert("ERROR: IFRAME can't be initialized.");
}
}
- if (HTMLArea.is_gecko) {
- // enable editable mode for Mozilla
- doc.designMode = "on";
- }
+
+ // -------------------------------------------------------------
+ // PLOG HTMLAREA TWEAK
+ // Changed by: Mark Wu
+ // Date: 2005/02/05
+ // Purpose: Fix lose focus error in Gecko-Based Browser
+ // Come From: http://www.htmlarea.com/forum/htmlArea_3_(beta)_C4/htmlArea_v3.0_-_Discussion_F14/gforum.cgi?post=24459
+ // Drawback: Need to click twice, first time for focus on frame, second time for set the position of cursor
+ // -------------------------------------------------------------
+
+ if (HTMLArea.is_gecko) {
+ // If we have multiple editors some bug in Mozilla makes some lose editing ability
+ HTMLArea._addEvents(
+ editor._iframe.contentWindow,
+ ["click"],
+ function(event) {if(doc.designMode !== 'on') { if(HTMLArea.last_on) HTMLArea.last_on.designMode = 'off'; doc.designMode = 'on'; } HTMLArea.last_on = doc;}
+ );
+ HTMLArea._addEvents(
+ editor._iframe.contentWindow,
+ ["blur"],
+ function(event) {if(doc.designMode !== 'on') { if(HTMLArea.last_on) HTMLArea.last_on.designMode = 'off'; } doc.designMode = 'off'; HTMLArea.last_on = null;}
+ );
+ }
+
+ // if (HTMLArea.is_gecko) {
+ // // enable editable mode for Mozilla
+ // doc.designMode = "on";
+ // }
+
+ // -------------------------------------------------------------
+
editor._doc = doc;
if (!editor.config.fullPage) {
doc.open();
@@ -920,10 +954,13 @@
// PLOG HTMLAREA TWEAK
// Changed by: Mark Wu
// Date: 2005/02/05
- // Purpose: Change for preserve the HTML source code format
+ // Purpose: Change for preserve the HTML source code format for IE and FF
// -------------------------------------------------------------
+
this._textArea.value = insertCRLF(this.getHTML());
+
// this._textArea.value = this.getHTML();
+
// -------------------------------------------------------------
this._iframe.style.display = "none";
@@ -2363,8 +2400,11 @@
// Date: 2005/02/05
// Purpose: Fix the multi-spaces converted to ASCII(160) errors.
// We need to convert them back to space ASCII(32) again.
+ // Come from: http://www.htmlarea.com/forum/htmlArea_3_(beta)_C4/htmlArea_v3.0_-_Bug_Reports_&_Fixes_F25/Bug_Reports_&_Fixes_-_Forum_Rules_*READ_THIS*_P37586/gforum.cgi?post=26900#26900
// -------------------------------------------------------------
+
str = str.replace(/\xA0/g, " ");
+
// -------------------------------------------------------------
str = str.replace(/\x22/ig, """);
@@ -2631,9 +2671,10 @@
// Added by: Mark Wu
// Original by: einSTein
// Date: 2005/02/05
-// Purpose: Add a CR/LF after some HTML Tag
-// Come From: http://www.htmlarea.com/forum/htmlArea_3_(beta)_C4/htmlArea_v3.0_-_Beta_Release_F14/html_output_is_one_*really*_long_line!_P17404/
+// Purpose: Add a CR/LF after some HTML Tag, maintain the source format
+// Come From: http://www.htmlarea.com/forum/htmlArea_3_(beta)_C4/htmlArea_v3.0_-_Bug_Reports_%26_Fixes_F25/Bug_Reports_%26_Fixes_-_Forum_Rules_%2AREAD_THIS%2A_P37586/gforum.cgi?post=22136#22136
// -------------------------------------------------------------
+
function insertCRLF( txt ) {
txt = txt.replace(/<br \/>([^\n])/g,"<br \/>\n$1");
@@ -2653,6 +2694,7 @@
return txt;
};
+
// -------------------------------------------------------------
// EOF
More information about the pLog-svn
mailing list