From 6295050fa6d5621b2bab08fcd81856ec96b830df Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Mon, 27 Jun 2022 23:06:01 -0400 Subject: [PATCH] Restore platform edit menu behavior without #ifdef (#2674) --- chrome/content/zotero/platformKeys.js | 14 ++++++++++++++ chrome/content/zotero/reader.xhtml | 18 ++++++++++++++++++ chrome/content/zotero/zoteroPane.xhtml | 19 +++---------------- 3 files changed, 35 insertions(+), 16 deletions(-) create mode 100644 chrome/content/zotero/platformKeys.js diff --git a/chrome/content/zotero/platformKeys.js b/chrome/content/zotero/platformKeys.js new file mode 100644 index 0000000000..c49f68d62a --- /dev/null +++ b/chrome/content/zotero/platformKeys.js @@ -0,0 +1,14 @@ +window.addEventListener('DOMContentLoaded', () => { + let redoKey = document.getElementById('key_redo'); + if (redoKey) { + // Don't need to depend on Zotero object here + if (AppConstants.platform == 'win') { + redoKey.setAttribute('data-l10n-id', 'text-action-redo-shortcut'); + redoKey.setAttribute('modifiers', 'accel'); + } + else { + redoKey.setAttribute('data-l10n-id', 'text-action-undo-shortcut'); + redoKey.setAttribute('modifiers', 'accel,shift'); + } + } +}); diff --git a/chrome/content/zotero/reader.xhtml b/chrome/content/zotero/reader.xhtml index 9a7fe55158..b4eb05e992 100644 --- a/chrome/content/zotero/reader.xhtml +++ b/chrome/content/zotero/reader.xhtml @@ -6,6 +6,7 @@ %globalDTD; + %editMenuOverlayDTD; %standaloneDTD; %zoteroDTD; ]> @@ -27,6 +28,7 @@ var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); Services.scriptloader.loadSubScript("chrome://zotero/content/include.js", this); Services.scriptloader.loadSubScript("resource://zotero/require.js", this); + Services.scriptloader.loadSubScript("chrome://zotero/content/platformKeys.js", this); // Mozilla scripts Services.scriptloader.loadSubScript("chrome://global/content/globalOverlay.js", this); @@ -67,6 +69,22 @@ key="&minimizeWindow.key;" modifiers="accel"/> + + + + + + + + + + + + + + + + diff --git a/chrome/content/zotero/zoteroPane.xhtml b/chrome/content/zotero/zoteroPane.xhtml index ef314b3ddc..4d6e87877b 100644 --- a/chrome/content/zotero/zoteroPane.xhtml +++ b/chrome/content/zotero/zoteroPane.xhtml @@ -65,6 +65,7 @@ Services.scriptloader.loadSubScript("resource://zotero/require.js", this); Services.scriptloader.loadSubScript("chrome://zotero/content/standalone/standalone.js", this); + Services.scriptloader.loadSubScript("chrome://zotero/content/platformKeys.js", this); // Mozilla scripts Services.scriptloader.loadSubScript("chrome://global/content/globalOverlay.js", this); @@ -133,22 +134,10 @@ - + @@ -160,8 +149,6 @@ - - -->