Fixed bug #10337: htmlArea RTE: Allow Clipboard Helper does not work with Firefox 3
authorStanislas Rolland <typo3@sjbr.ca>
Wed, 4 Feb 2009 04:45:38 +0000 (04:45 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Wed, 4 Feb 2009 04:45:38 +0000 (04:45 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4943 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php
typo3/sysext/rtehtmlarea/doc/manual.sxw
typo3/sysext/rtehtmlarea/ext_conf_template.txt
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.js
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/CopyPaste/copy-paste.js

index 6a8f1c9..d2d5855 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
        * Follow-up for bug #10326: htmlArea RTE: Cleaning on paste broken in older versions of Mozilla/Firefox
        * Fixed bug #9894: htmlArea RTE: copy/cut/paste with hotkeys does not work in some browsers/settings
+       * Fixed bug #10337: htmlArea RTE: Allow Clipboard Helper does not work with Firefox 3
 
 2009-02-03  Francois Suter  <francois@typo3.org>
 
index 30f63f0..272b3ee 100644 (file)
@@ -2,6 +2,7 @@
 
        * Follow-up for bug #10326: htmlArea RTE: Cleaning on paste broken in older versions of Mozilla/Firefox
        * Fixed bug #9894: htmlArea RTE: copy/cut/paste with hotkeys does not work in some browsers/settings
+       * Fixed bug #10337: htmlArea RTE: Allow Clipboard Helper does not work with Firefox 3
 
 2009-02-01  Stanislas Rolland  <typo3@sjbr.ca>
 
index a84d1bf..5b6c7f5 100644 (file)
@@ -804,7 +804,8 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                                _editor_debug_mode = ' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableDebugMode'] ? 'true' : 'false') . ';
                                _editor_compressed_scripts = ' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'] ? 'true' : 'false') . ';'
                                . (($this->client['BROWSER'] == 'gecko') ? ('
-                               _editor_mozAllowClipboard_url = "' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['mozAllowClipboardURL'] ? $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['mozAllowClipboardURL'] : '') . '";')
+                               RTEarea[0].enableMozillaExtension = ' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableMozillaExtension'] ?'true' : 'false') . ';
+                               RTEarea[0].mozillaAllowClipboardURL = "' . ($TYPO3_CONF_VARS['EXTCONF'][$this->ID]['mozAllowClipboardURL'] ? $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['mozAllowClipboardURL'] : '') . '";')
                                : '') . '
                        }
                /*]]>*/
@@ -870,7 +871,6 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                        RTEarea[editornumber]["disablePCexamples"] = ' . (trim($this->thisConfig['disablePCexamples'])?'true':'false') . ';
                        RTEarea[editornumber]["showTagFreeClasses"] = ' . (trim($this->thisConfig['showTagFreeClasses'])?'true':'false') . ';
                        RTEarea[editornumber]["useHTTPS"] = ' . ((trim(stristr($this->siteURL, 'https')) || $this->thisConfig['forceHTTPS'])?'true':'false') . ';
-                       RTEarea[editornumber]["enableMozillaExtension"] = ' . (($this->client['BROWSER'] == 'gecko' && $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableMozillaExtension'])?'true':'false') . ';
                        RTEarea[editornumber].tceformsNested = ' . (is_object($this->TCEform) && method_exists($this->TCEform, 'getDynNestedStack') ? $this->TCEform->getDynNestedStack(true) : '[]') . ';
                        RTEarea[editornumber].dialogueWindows = new Object();
                        RTEarea[editornumber].dialogueWindows.defaultPositionFromTop = ' . (isset($this->thisConfig['dialogueWindows.']['defaultPositionFromTop'])? intval($this->thisConfig['dialogueWindows.']['defaultPositionFromTop']) : '100') . ';
index 13e851d..9d45ed3 100644 (file)
Binary files a/typo3/sysext/rtehtmlarea/doc/manual.sxw and b/typo3/sysext/rtehtmlarea/doc/manual.sxw differ
index 8dcd081..9f752a8 100644 (file)
@@ -47,4 +47,4 @@ enableDebugMode = 0
 enableCompressedScripts = 1
 
   # cat=basic; type=string; label=Url of AllowClipboard Helper: Full absolute Url of the AllowClipboard Helper extension for Mozilla and Firefox.
-mozAllowClipboardURL =
\ No newline at end of file
+mozAllowClipboardURL = http://typo3.org/fileadmin/allowclipboardhelper-0.6.xpi
\ No newline at end of file
index 6c80e72..d463aed 100644 (file)
@@ -535,46 +535,6 @@ HTMLArea.NestedHandler = function(ev,editor,nestedObj,noOpenCloseAction) {
 };
 
 /*
- * Paste exception handler
- */
-HTMLArea.prototype._mozillaPasteException = function(cmdID, UI, param) {
-               // Mozilla lauches an exception, but can paste anyway on ctrl-V
-               // UI is false on keyboard shortcut, and undefined on button click
-       if(typeof(UI) != "undefined") {
-               try { this._doc.execCommand(cmdID, UI, param); } catch(e) { }
-               if (cmdID == "Paste" && this._toolbarObjects.CleanWord) {
-                       this._toolbarObjects.CleanWord.cmd(this, "CleanWord");
-               }
-       } else if (this.config.enableMozillaExtension) {
-               if (confirm(HTMLArea.I18N.msg["Allow-Clipboard-Helper-Extension"])) {
-                       if (InstallTrigger.enabled()) {
-                               HTMLArea._mozillaXpi = new Object();
-                               HTMLArea._mozillaXpi["AllowClipboard Helper"] = _editor_mozAllowClipboard_url;
-                               InstallTrigger.install(HTMLArea._mozillaXpi,HTMLArea._mozillaInstallCallback);
-                       } else {
-                               alert(HTMLArea.I18N.msg["Mozilla-Org-Install-Not-Enabled"]);
-                               HTMLArea._appendToLog("WARNING [HTMLArea::execCommand]: Mozilla install was not enabled.");
-                               return;
-                       }
-               }
-       } else if (confirm(HTMLArea.I18N.msg["Moz-Clipboard"])) {
-               window.open("http://mozilla.org/editor/midasdemo/securityprefs.html");
-       }
-}
-
-HTMLArea._mozillaInstallCallback = function(url,returnCode) {
-       if (returnCode == 0) {
-               if (HTMLArea._mozillaXpi["TYPO3 htmlArea RTE Preferences"]) alert(HTMLArea.I18N.msg["Moz-Extension-Success"]);
-                       else alert(HTMLArea.I18N.msg["Allow-Clipboard-Helper-Extension-Success"]);
-               return;
-       } else {
-               alert(HTMLArea.I18N.msg["Moz-Extension-Failure"]);
-               HTMLArea._appendToLog("WARNING [HTMLArea::execCommand]: Mozilla install return code was: " + returnCode + ".");
-               return;
-       }
-};
-
-/*
  * Backspace event handler
  */
 HTMLArea.prototype._checkBackspace = function() {
index bf7f993..e142fb5 100644 (file)
@@ -3057,7 +3057,7 @@ HTMLArea.Plugin = HTMLArea.Base.extend({
         * @return      string          the localization of the label
         */
        localize : function (label) {
-               return this.I18N[label] || HTMLArea.I18N.dialogs[label] || HTMLArea.I18N.tooltips[label];
+               return this.I18N[label] || HTMLArea.I18N.dialogs[label] || HTMLArea.I18N.tooltips[label] || HTMLArea.I18N.msg[label];
        },
 
        /**
index eedb6e6..1a33b1b 100644 (file)
@@ -122,11 +122,11 @@ CopyPaste = HTMLArea.Plugin.extend({
                                case "Paste":
                                        if (buttonId == id) {
                                                        // If we are handling a button, not a hotkey
-                                               this.applyBrowserCommand(buttonId, true);
+                                               this.applyBrowserCommand(buttonId);
                                        }
                                                // In FF3, the paste operation will indeed trigger the onPaste even; not in FF2; nor in Opera
                                        if (HTMLArea.is_opera || (HTMLArea.is_gecko && navigator.productSub < 2008020514)) {
-                                               var cleanLaterFunctRef = this.editor.getPluginInstance("DefaultClean") ? this.editor.getPluginInstance("DefaultClean").cleanLaterFunctRef : (this.editor.getPluginInstance("TYPO3HtmlParser") ? this.editor.getPluginInstance("TYPO3HtmlParser").cleanLaterFunctRef : null);
+                                               var cleanLaterFunctRef = this.getPluginInstance("DefaultClean") ? this.getPluginInstance("DefaultClean").cleanLaterFunctRef : (this.getPluginInstance("TYPO3HtmlParser") ? this.getPluginInstance("TYPO3HtmlParser").cleanLaterFunctRef : null);
                                                if (cleanLaterFunctRef) {
                                                        window.setTimeout(cleanLaterFunctRef, 50);
                                                }
@@ -142,12 +142,12 @@ CopyPaste = HTMLArea.Plugin.extend({
                }
        },
        
-       applyBrowserCommand : function (buttonId, buttonPress) {
+       applyBrowserCommand : function (buttonId) {
                try {
                        this.editor._doc.execCommand(buttonId, false, null);
                } catch (e) {
-                       if (buttonId == "Paste" && HTMLArea.is_gecko && !HTMLArea.is_safari && !HTMLArea.is_opera) {
-                               this.editor._mozillaPasteException(buttonId, buttonPress, null);
+                       if (HTMLArea.is_gecko && !HTMLArea.is_safari && !HTMLArea.is_opera) {
+                               this.mozillaClipboardAccessException();
                        }
                }
        },
@@ -350,6 +350,41 @@ CopyPaste = HTMLArea.Plugin.extend({
                                }
                        }
                }
+       },
+
+       /*
+        * Mozilla clipboard access exception handler
+        */
+       mozillaClipboardAccessException : function () {
+               if (RTEarea[0].enableMozillaExtension) {
+                       if (confirm(this.localize("Allow-Clipboard-Helper-Extension"))) {
+                               if (InstallTrigger.enabled()) {
+                                       var mozillaXpi = new Object();
+                                       mozillaXpi["AllowClipboard Helper"] = RTEarea[0].mozillaAllowClipboardURL;
+                                       var mozillaInstallCallback = this.makeFunctionReference("mozillaInstallCallback");
+                                       InstallTrigger.install(mozillaXpi, mozillaInstallCallback);
+                               } else {
+                                       alert(this.localize("Mozilla-Org-Install-Not-Enabled"));
+                                       this.appendToLog("mozillaClipboardAccessException", "Mozilla install was not enabled.");
+                                       return;
+                               }
+                       }
+               } else if (confirm(this.localize("Moz-Clipboard"))) {
+                       window.open("http://mozilla.org/editor/midasdemo/securityprefs.html");
+               }
+       },
+       
+       /*
+        * Mozilla Add-on installer call back
+        */
+       mozillaInstallCallback : function (url, returnCode) {
+               if (returnCode == 0) {
+                       alert(this.localize("Allow-Clipboard-Helper-Extension-Success"));
+               } else {
+                       alert(this.localize("Moz-Extension-Failure"));
+                       this.appendToLog("mozillaInstallCallback", "Mozilla install return code was: " + returnCode + ".");
+               }
+               return;
        }
 });