[BUGFIX] RTE: Remove cut, copy and paste buttons in Firefox 68/33368/2
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 17 Oct 2014 15:55:25 +0000 (11:55 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 17 Oct 2014 16:02:53 +0000 (18:02 +0200)
Support for allowClipboard policy has been dropped by Firefox 29.
Therefore, remove cut, copy and paste buttons from the RTE toolbar
in Firefox. Remove also dialogue for installing AllowClipboard Helper
Firefox Addon.

Releases: master, 6.2
Resolves: #62296
Change-Id: I772b07cdca148c60ef8f61097f96fe5872fc0309
Reviewed-on: http://review.typo3.org/33367
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
(cherry picked from commit c0d6353654071bdcc614e138da4b7dac7e53876f)
Reviewed-on: http://review.typo3.org/33368

typo3/sysext/rtehtmlarea/Classes/Extension/CopyPaste.php
typo3/sysext/rtehtmlarea/htmlarea/plugins/CopyPaste/copy-paste.js

index c970de1..ca04067 100644 (file)
@@ -54,7 +54,8 @@ class CopyPaste extends \TYPO3\CMS\Rtehtmlarea\RteHtmlAreaApi {
 
        // Hide buttons not implemented in client browsers
        protected $hideButtonsFromClient = array(
-               'webkit' => array('paste'),
+               'gecko' => array('copy', 'cut', 'paste'),
+               'webkit' => array('copy', 'cut', 'paste'),
                'opera' => array('copy', 'cut', 'paste')
        );
 
index 6f87de6..4bcbe6a 100644 (file)
@@ -68,7 +68,8 @@ HTMLArea.CopyPaste = Ext.extend(HTMLArea.Plugin, {
                Ext.iterate(this.buttonList, function (buttonId, button) {
                                // Remove button from toolbar, if command is not supported
                                // Starting with Safari 5 and Chrome 6, cut and copy commands are not supported anymore by WebKit
-                       if (!Ext.isGecko && !this.editor.document.queryCommandSupported(buttonId)) {
+                               // Starting with Firefox 29, cut, copy and paste commands are not supported anymore by Firefox
+                       if (Ext.isGecko || !this.editor.document.queryCommandSupported(buttonId)) {
                                this.editor.toolbar.remove(buttonId);
                        }
                                // Add hot key handling if the button is not enabled in the toolbar
@@ -166,10 +167,7 @@ HTMLArea.CopyPaste = Ext.extend(HTMLArea.Plugin, {
         * In the case of hot key, the browser does it automatically
         */
        applyBrowserCommand: function (buttonId) {
-               var success = this.editor.getSelection().execCommand(buttonId, false, null);
-               if (!success && Ext.isGecko) {
-                       this.mozillaClipboardAccessException();
-               }
+               this.editor.getSelection().execCommand(buttonId, false, null);
        },
        /*
         * Handler for hotkeys configured through the hotKeyMap while button not enabled in toolbar (see onGenerate above)
@@ -419,69 +417,5 @@ HTMLArea.CopyPaste = Ext.extend(HTMLArea.Plugin, {
                                button.setDisabled(true);
                        }
                }
-       },
-       /*
-        * Mozilla clipboard access exception handler
-        */
-       mozillaClipboardAccessException: function () {
-               if (InstallTrigger && this.buttonsConfiguration.paste && this.buttonsConfiguration.paste.mozillaAllowClipboardURL) {
-                       TYPO3.Dialog.QuestionDialog({
-                               title: this.localize('Allow-Clipboard-Helper-Add-On-Title'),
-                               msg: this.localize('Allow-Clipboard-Helper-Extension'),
-                               fn: this.installAllowClipboardHelperExtension,
-                               scope: this
-                       });
-               } else {
-                       TYPO3.Dialog.QuestionDialog({
-                               title: this.localize('Firefox-Security-Prefs-Question-Title'),
-                               msg: this.localize('Moz-Clipboard'),
-                               fn: function (button) {
-                                       if (button == 'yes') {
-                                               window.open('http://mozilla.org/editor/midasdemo/securityprefs.html');
-                                       }
-                               }
-                       });
-                       if (!InstallTrigger) {
-                               this.appendToLog('mozillaClipboardAccessException', 'Firefox InstallTrigger was not defined.', 'warn');
-                       }
-               }
-       },
-       /*
-        * Install AllowClipboardHelperExtension
-        *
-        * @param       string          button: yes or no button was clicked in the dialogue
-        *
-        * @return      void
-        */
-       installAllowClipboardHelperExtension: function (button) {
-               if (button == 'yes') {
-                       if (InstallTrigger.enabled()) {
-                               var self = this;
-                               function mozillaInstallCallback(url, returnCode) {
-                                       if (returnCode == 0) {
-                                               TYPO3.Dialog.InformationDialog({
-                                                       title: self.localize('Allow-Clipboard-Helper-Add-On-Title'),
-                                                       msg: self.localize('Allow-Clipboard-Helper-Extension-Success')
-                                               });
-                                       } else {
-                                               TYPO3.Dialog.ErrorDialog({
-                                                       title: self.localize('Allow-Clipboard-Helper-Add-On-Title'),
-                                                       msg: self.localize('Moz-Extension-Failure')
-                                               });
-                                               self.appendToLog('installAllowClipboardHelperExtension', 'Mozilla install return code was: ' + returnCode + '.', 'warn');
-                                       }
-                                       return false;
-                               }
-                               var mozillaXpi = new Object();
-                               mozillaXpi['AllowClipboard Helper'] = this.buttonsConfiguration.paste.mozillaAllowClipboardURL;
-                               InstallTrigger.install(mozillaXpi, mozillaInstallCallback);
-                       } else {
-                               TYPO3.Dialog.ErrorDialog({
-                                       title: this.localize('Allow-Clipboard-Helper-Add-On-Title'),
-                                       msg: this.localize('Mozilla-Org-Install-Not-Enabled')
-                               });
-                               this.appendToLog('installAllowClipboardHelperExtension', 'Mozilla install was not enabled.', 'warn');
-                       }
-               }
        }
 });