mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-27 10:46:09 +01:00
This commit is contained in:
parent
cfdea78c1e
commit
04ce6c3fed
1 changed files with 8 additions and 3 deletions
|
|
@ -398,14 +398,19 @@ export const globalShortcut = (app: App) => {
|
|||
if (!event.ctrlKey && !event.metaKey && !event.shiftKey && !event.altKey &&
|
||||
!["INPUT", "TEXTAREA"].includes(target.tagName) &&
|
||||
["0", "1", "2", "3", "4", "j", "k", "l", ";", "s", " ", "p"].includes(event.key.toLowerCase())) {
|
||||
const openCardDialog = window.siyuan.dialogs.find(item => {
|
||||
let cardElement: Element;
|
||||
window.siyuan.dialogs.find(item => {
|
||||
if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.riffCard.custom) {
|
||||
cardElement = item.element;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (openCardDialog) {
|
||||
if (!cardElement) {
|
||||
cardElement = document.querySelector(`.layout__wnd--active div[data-key="${window.siyuan.config.keymap.general.riffCard.custom}"]:not(.fn__none)`)
|
||||
}
|
||||
if (cardElement) {
|
||||
event.preventDefault();
|
||||
openCardDialog.element.dispatchEvent(new CustomEvent("click", {detail: event.key.toLowerCase()}));
|
||||
cardElement.dispatchEvent(new CustomEvent("click", {detail: event.key.toLowerCase()}));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue