Issue Feature Closed

#14834Clipboard Paste in Firefox - without FF-extension (with patch)

Guillaume Crico 06/22/05, 15:06 updated 08/12/06, 14:24

Description

This patch enable Clipboard Paste in Firefox…
…ONLY with Keyboard Accelerator (ex: CTRL-V).

On paste button click, it keeps the standard behavior (confirm, etc…).

Todo : maybe works with Mozilla “Suite” => if so, change :
“navigator.userAgent.indexOf(‘Firefox’) != -1“
to
“HTMLArea.is_gecko && !HTMLArea.is_safari”

Todo: tested with Firefox 1.0.4 on MsWindows => more browser testing

—- htmlarea.js
+++ htmlarea.js
@@ 1847,27 1847,44
if(HTMLArea.is_gecko && !HTMLArea.is_safari) {
- if(this.config.enableMozillaExtension) {
- if(typeof HTMLArea.I18N.msg[“Moz-Extension”] "undefined") {
- HTMLArea.I18N.msg["Moz-Extension"] =
- "Unprivileged scripts cannot access the clipboard programatically " +
- "for security reasons. Click OK to install a component that will " +
- "enable scripts from this TYPO3 site to access the clipboard.\n\n";
- }
- if(confirm(HTMLArea.I18N.msg["Moz-Extension"])) {
- if(InstallTrigger.enabled()) {
- function mozillaInstallCallback(url,returnCode) {
- if(returnCode 0) {
- alert(HTMLArea.I18N.msg[“Moz-Extension-Success”]);
- return;
- } else {
- alert(HTMLArea.I18N.msg[“Moz-Extension-Failure”]);
- HTMLArea._appendToLog(“WARNING [HTMLArea::execCommand]: Mozilla install return code was: “ + returnCode + “.”);
- return;
- }
- };
- var xpi = new Object();
- xpi[“TYPO3 htmlArea RTE Preferences”] = “../uploads/tx_rtehtmlarea/typo3_rtehtmlarea_prefs.xpi”;
- InstallTrigger.install(xpi, mozillaInstallCallback);
- } else {
- alert(HTMLArea.I18N.msg[“Moz-Extension-Install-Not-Enabled”]);
- HTMLArea._appendToLog(“WARNING [HTMLArea::execCommand]: Mozilla install was not enabled.”);
- return;
if (navigator.userAgent.indexOf(‘Firefox’) != 1 && UI != undefined) {
+ //*** Firefox lauch an exception, but can paste anyway on ctrl-V…
+ //*** UI is false on keyboard shortcut, and undefined on button click…
+ this._doc.execCommand(cmdID, UI, param);
+ if(this.config.killWordOnPaste) HTMLArea._wordClean(editor._doc.body);
+ } else{
+ if(HTMLArea.is_gecko && !HTMLArea.is_safari) {
+ if(this.config.enableMozillaExtension) {
+ if(typeof HTMLArea.I18N.msg[“Moz-Extension”] "undefined") {
+ HTMLArea.I18N.msg["Moz-Extension"] =
+ "Unprivileged scripts cannot access the clipboard programatically " +
+ "for security reasons. Click OK to install a component that will " +
+ "enable scripts from this TYPO3 site to access the clipboard.\n\n";
+ }
+ if(confirm(HTMLArea.I18N.msg["Moz-Extension"])) {
+ if(InstallTrigger.enabled()) {
+ function mozillaInstallCallback(url,returnCode) {
+ if(returnCode 0) {
+ alert(HTMLArea.I18N.msg[“Moz-Extension-Success”]);
+ return;
+ } else {
+ alert(HTMLArea.I18N.msg[“Moz-Extension-Failure”]);
+ HTMLArea._appendToLog(“WARNING [HTMLArea::execCommand]: Mozilla install return code was: “ + returnCode + “.”);
+ return;
+ }
+ };
+ var xpi = new Object();
+ xpi[“TYPO3 htmlArea RTE Preferences”] = “../uploads/tx_rtehtmlarea/typo3_rtehtmlarea_prefs.xpi”;
+ InstallTrigger.install(xpi, mozillaInstallCallback);
+ } else {
+ alert(HTMLArea.I18N.msg[“Moz-Extension-Install-Not-Enabled”]);
+ HTMLArea._appendToLog(“WARNING [HTMLArea::execCommand]: Mozilla install was not enabled.”);
+ return;
+ }
+ }
+ } else {
+ if (typeof HTMLArea.I18N.msg[“Moz-Clipboard”] "undefined") {
+ HTMLArea.I18N.msg["Moz-Clipboard"] =
+ "Unprivileged scripts cannot access Cut/Copy/Paste programatically " +
+ "for security reasons. Click OK to see a technical note at mozilla.org " +
+ "which shows you how to allow a script to access the clipboard.\n\n";
+ }
+ if (confirm(HTMLArea.I18N.msg["Moz-Clipboard"])) {
+ window.open("http://mozilla.org/editor/midasdemo/securityprefs.html");
@@ -1875,10 +1891,0 @@
- }
- } else {
- if (typeof HTMLArea.I18N.msg["Moz-Clipboard"] “undefined”) {
HTMLArea.I18N.msg[“Moz-Clipboard”] =
- “Unprivileged scripts cannot access Cut/Copy/Paste programatically “ +
- “for security reasons. Click OK to see a technical note at mozilla.org “ +
- “which shows you how to allow a script to access the clipboard.\n\n”;
- }
- if (confirm(HTMLArea.I18N.msg[“Moz-Clipboard”])) {
- window.open(“http://mozilla.org/editor/midasdemo/securityprefs.html”);

(issue imported from #M1231)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.