diff --git a/app/src/asset/index.ts b/app/src/asset/index.ts index 01f68d46a..cb69751de 100644 --- a/app/src/asset/index.ts +++ b/app/src/asset/index.ts @@ -169,19 +169,23 @@ export class Asset extends Model {
@@ -235,28 +239,28 @@ export class Asset extends Model {
- - - -
- - @@ -276,7 +280,7 @@ export class Asset extends Model { - diff --git a/app/src/asset/pdf/app.js b/app/src/asset/pdf/app.js index 15103b089..bba303ce7 100644 --- a/app/src/asset/pdf/app.js +++ b/app/src/asset/pdf/app.js @@ -3080,24 +3080,24 @@ function webViewerKeyDown (evt) { } } - if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC || CHROME')) { - // CTRL or META without shift - if (cmd === 1 || cmd === 8) { - switch (evt.keyCode) { - case 83: // s - eventBus.dispatch('download', {source: window}) - handled = true - break - - case 79: // o - if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) { - eventBus.dispatch('openfile', {source: window}) - handled = true - } - break - } - } - } + // NOTE if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC || CHROME')) { + // // CTRL or META without shift + // if (cmd === 1 || cmd === 8) { + // switch (evt.keyCode) { + // case 83: // s + // eventBus.dispatch('download', {source: window}) + // handled = true + // break + // + // case 79: // o + // if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) { + // eventBus.dispatch('openfile', {source: window}) + // handled = true + // } + // break + // } + // } + // } // CTRL+ALT or Option+Command if (cmd === 3 || cmd === 10) { diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.ts index 1c2cde443..4f72c95e5 100644 --- a/app/src/util/globalShortcut.ts +++ b/app/src/util/globalShortcut.ts @@ -387,9 +387,9 @@ export const globalShortcut = () => { if (document.getElementById("errorLog") || event.isComposing) { return; } - + const target = event.target as HTMLElement; if (!event.ctrlKey && !event.metaKey && !event.shiftKey && !event.altKey && - !["INPUT", "TEXTAREA"].includes((event.target as HTMLElement).tagName) && + !["INPUT", "TEXTAREA"].includes(target.tagName) && ["1", "2", "3", "4", "j", "k", "l", ";", "s", " ", "p"].includes(event.key.toLowerCase())) { const openCardDialog = window.siyuan.dialogs.find(item => { if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.riffCard.custom) { @@ -540,7 +540,7 @@ export const globalShortcut = () => { return; } /// #if !BROWSER - if (matchHotKey("⌘=", event)) { + if (matchHotKey("⌘=", event) && !hasClosestByClassName(target, "pdf__outer")) { Constants.SIZE_ZOOM.find((item, index) => { if (item === window.siyuan.storage[Constants.LOCAL_ZOOM]) { window.siyuan.storage[Constants.LOCAL_ZOOM] = Constants.SIZE_ZOOM[index + 1] || 3; @@ -559,7 +559,7 @@ export const globalShortcut = () => { event.preventDefault(); return; } - if (matchHotKey("⌘-", event)) { + if (matchHotKey("⌘-", event) && !hasClosestByClassName(target, "pdf__outer")) { Constants.SIZE_ZOOM.find((item, index) => { if (item === window.siyuan.storage[Constants.LOCAL_ZOOM]) { window.siyuan.storage[Constants.LOCAL_ZOOM] = Constants.SIZE_ZOOM[index - 1] || 0.25; @@ -600,7 +600,6 @@ export const globalShortcut = () => { event.preventDefault(); return; } - const target = event.target as HTMLElement; if (matchHotKey("⌘A", event) && target.tagName !== "INPUT" && target.tagName !== "TEXTAREA") { event.preventDefault(); return;