mirror of
https://github.com/zotero/zotero.git
synced 2026-09-22 00:32:47 +00:00
Restore platform edit menu behavior without #ifdef (#2674)
This commit is contained in:
parent
f0aef79c7a
commit
6295050fa6
3 changed files with 35 additions and 16 deletions
14
chrome/content/zotero/platformKeys.js
Normal file
14
chrome/content/zotero/platformKeys.js
Normal file
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd"> %globalDTD;
|
||||
<!ENTITY % editMenuOverlayDTD SYSTEM "chrome://zotero/locale/mozilla/editMenuOverlay.dtd" > %editMenuOverlayDTD;
|
||||
<!ENTITY % standaloneDTD SYSTEM "chrome://zotero/locale/standalone.dtd" > %standaloneDTD;
|
||||
<!ENTITY % zoteroDTD SYSTEM "chrome://zotero/locale/zotero.dtd"> %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"/>
|
||||
</keyset>
|
||||
|
||||
<keyset id="editMenuKeys">
|
||||
<key id="key_undo" data-l10n-id="text-action-undo-shortcut" modifiers="accel" command="cmd_undo"/>
|
||||
<!-- l10n and modifiers set in platformKeys.js -->
|
||||
<key id="key_redo" command="cmd_redo"/>
|
||||
<key id="key_cut" data-l10n-id="text-action-cut-shortcut" modifiers="accel" command="cmd_cut"/>
|
||||
<key id="key_copy" data-l10n-id="text-action-copy-shortcut" modifiers="accel" command="cmd_copy"/>
|
||||
<key id="key_paste" data-l10n-id="text-action-paste-shortcut" modifiers="accel" command="cmd_paste"/>
|
||||
<key id="key_delete" keycode="VK_DELETE" command="cmd_delete"/>
|
||||
<key id="key_selectAll" data-l10n-id="text-action-select-all-shortcut" modifiers="accel" command="cmd_selectAll"/>
|
||||
<key id="key_find" key="&findCmd.key;" modifiers="accel" command="cmd_find"/>
|
||||
<key id="key_findAgain" key="&findAgainCmd.key;" modifiers="accel" command="cmd_findAgain"/>
|
||||
<key id="key_findPrevious" key="&findAgainCmd.key;" modifiers="shift,accel" command="cmd_findPrevious"/>
|
||||
<key id="key_findAgain2" keycode="&findAgainCmd.key2;" command="cmd_findAgain"/>
|
||||
<key id="key_findPrevious2" keycode="&findAgainCmd.key2;" modifiers="shift" command="cmd_findPrevious"/>
|
||||
</keyset>
|
||||
|
||||
<!-- TODO: Localize -->
|
||||
<tooltip id="iframeTooltip" page="true"/>
|
||||
|
|
|
|||
|
|
@ -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 @@
|
|||
<key id="key_forward"/>
|
||||
</keyset>
|
||||
|
||||
<!--
|
||||
|
||||
TODO: Customize per platform without ifdef?
|
||||
|
||||
<keyset id="editMenuKeys">
|
||||
<key id="key_undo" data-l10n-id="text-action-undo-shortcut" modifiers="accel" command="cmd_undo"/>
|
||||
<key id="key_redo"
|
||||
|
||||
#ifdef XP_UNIX
|
||||
data-l10n-id="text-action-undo-shortcut"
|
||||
modifiers="accel,shift"
|
||||
#else
|
||||
data-l10n-id="text-action-redo-shortcut"
|
||||
modifiers="accel"
|
||||
#endif
|
||||
command="cmd_redo"/>
|
||||
<!-- l10n and modifiers set in platformKeys.js -->
|
||||
<key id="key_redo" command="cmd_redo"/>
|
||||
<key id="key_cut" data-l10n-id="text-action-cut-shortcut" modifiers="accel" command="cmd_cut"/>
|
||||
<key id="key_copy" data-l10n-id="text-action-copy-shortcut" modifiers="accel" command="cmd_copy"/>
|
||||
<key id="key_paste" data-l10n-id="text-action-paste-shortcut" modifiers="accel" command="cmd_paste"/>
|
||||
|
|
@ -160,8 +149,6 @@
|
|||
<key id="key_findAgain2" keycode="&findAgainCmd.key2;" command="cmd_findAgain"/>
|
||||
<key id="key_findPrevious2" keycode="&findAgainCmd.key2;" modifiers="shift" command="cmd_findPrevious"/>
|
||||
</keyset>
|
||||
|
||||
-->
|
||||
|
||||
<vbox id="titlebar">
|
||||
<hbox id="titlebar-buttonbox-container" skipintoolbarset="true">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue