[pLog-svn] r2353 - plog/trunk/js/xinha
mark at devel.plogworld.net
mark at devel.plogworld.net
Thu Jul 21 02:55:23 GMT 2005
Author: mark
Date: 2005-07-21 02:55:21 +0000 (Thu, 21 Jul 2005)
New Revision: 2353
Modified:
plog/trunk/js/xinha/htmlarea-plog.js
plog/trunk/js/xinha/htmlarea.js
Log:
Fixed stripbaseurl error again. In Xinha, the stripbaseurl is controlled by editor.stripBaseHref = true; we just need to change it to false.
Mark
Modified: plog/trunk/js/xinha/htmlarea-plog.js
===================================================================
--- plog/trunk/js/xinha/htmlarea-plog.js 2005-07-20 19:44:50 UTC (rev 2352)
+++ plog/trunk/js/xinha/htmlarea-plog.js 2005-07-21 02:55:21 UTC (rev 2353)
@@ -23,6 +23,9 @@
// ------------------------------------------------------
postTextEditor = new HTMLArea("postText");
+ // Disable stripBaseUrl Function
+ postTextEditor.config.stripBaseHref = false;
+
// Config postText Toolbar
postTextEditor.config.registerButton({
id: "insertresource",
@@ -53,6 +56,9 @@
// ------------------------------------------------------
postExtendedTextEditor = new HTMLArea("postExtendedText");
+ // Disable stripBaseUrl Function
+ postExtendedTextEditor.config.stripBaseHref = false;
+
// Config postText Toolbar
postExtendedTextEditor.config.registerButton({
id: "insertresource",
Modified: plog/trunk/js/xinha/htmlarea.js
===================================================================
--- plog/trunk/js/xinha/htmlarea.js 2005-07-20 19:44:50 UTC (rev 2352)
+++ plog/trunk/js/xinha/htmlarea.js 2005-07-21 02:55:21 UTC (rev 2353)
@@ -42,6 +42,26 @@
var _editor_url = "js/xinha";
var _editor_lang = "en";
+// by default, we're not using farsi
+var langfarsi=false;
+var farsiSupportEnabled=false;
+
+// key mappings for farsi
+var farsikey = [
+ 0x0020, 0x0021, 0x061B, 0x066B, 0x00A4, 0x066A, 0x060C, 0x06AF,
+ 0x0029, 0x0028, 0x002A, 0x002B, 0x0648, 0x002D, 0x002E, 0x002F,
+ 0x06F0, 0x06F1, 0x06F2, 0x06F3, 0x06F4, 0x06F5, 0x06F6, 0x06F7,
+ 0x06F8, 0x06F9, 0x003A, 0x06A9, 0x003E, 0x003D, 0x003C, 0x061F,
+ 0x066C, 0x0624, 0x200C, 0x0698, 0X064a, 0x064D, 0x0625, 0x0623,
+ 0x0622, 0x0651, 0x0629, 0x00BB, 0x00AB, 0x0621, 0x004E, 0x005D,
+ 0x005B, 0x0652, 0x064B, 0x0626, 0x064F, 0x064E, 0x0056, 0x064C,
+ 0x0058, 0x0650, 0x0643, 0x062C, 0x0698, 0x0686, 0x00D7, 0x0640,
+ 0x067E, 0x0634, 0x0630, 0x0632, 0X06cc, 0x062B, 0x0628, 0x0644,
+ 0x0627, 0x0647, 0x062A, 0x0646, 0x0645, 0x0626, 0x062F, 0x062E,
+ 0x062D, 0x0636, 0x0642, 0x0633, 0x0641, 0x0639, 0x0631, 0x0635,
+ 0x0637, 0x063A, 0x0638, 0x007D, 0x007C, 0x007B, 0x007E
+];
+
// -------------------------------------------------------------
HTMLArea.version =
@@ -253,7 +273,7 @@
// we can strip the base href out of relative links to leave them relative, reason for this
// especially if you don't specify a baseHref is that mozilla at least (& IE ?) will prefix
// the baseHref to any relative links to make them absolute, which isn't what you want most the time.
- this.stripBaseHref = true;
+ this.stripBaseHref = false;
// and we can strip the url of the editor page from named links (eg <a href="#top">...</a>)
// reason for this is that mozilla at least (and IE ?) prefixes location.href to any
@@ -3543,6 +3563,25 @@
var editor = this;
var keyEvent = (HTMLArea.is_ie && ev.type == "keydown") || (!HTMLArea.is_ie && ev.type == "keypress");
+ // -------------------------------------------------------------
+ // PLOG HTMLAREA TWEAK
+ // Changed by: FiFtHeLeMeNt
+ // Date: 2005/07/20
+ // Purpose: For Farsi Language Support
+ // -------------------------------------------------------------
+ if( farsiSupportEnabled ) {
+ var key = ev.keyCode;
+ if (key==119 && ev.type == "keydown")
+ {
+ langfarsi=!langfarsi;
+ }
+ if ((langfarsi) && !(key < 0x0020 || key >= 0x00FF))
+ {
+ ev.keyCode = farsikey[key - 0x0020];
+ }
+ }
+ // -------------------------------------------------------------
+
//call events of textarea
if(typeof editor._textArea['on'+ev.type] == "function") {
editor._textArea['on'+ev.type]();
@@ -4807,18 +4846,19 @@
/** @see getHTMLWrapper (search for "value = a.nodeValue;") */
-// -------------------------------------------------------------
-// PLOG HTMLAREA TWEAK
-// Changed by: Mark Wu
-// Date: 2005/07/20
-// Purpose: Remove stripBaseURL for compatiability
-// -------------------------------------------------------------
-
HTMLArea.prototype.stripBaseURL = function(string)
{
- return string;
+ if(this.config.baseHref==null || !this.config.stripBaseHref)
+ {
+ return(string);
+ }
+ var baseurl = this.config.baseHref;
+
+ // strip host-part of URL which is added by MSIE to links relative to server root
+ baseurl = baseurl.replace(/^(https?:\/\/[^\/]+)(.*)$/, '$1');
+ basere = new RegExp(baseurl);
+ return string.replace(basere, "");
};
-// -------------------------------------------------------------
String.prototype.trim = function() {
return this.replace(/^\s+/, '').replace(/\s+$/, '');
More information about the pLog-svn
mailing list