mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
This commit is contained in:
parent
acb99f8abe
commit
e4e973e4b0
5 changed files with 33 additions and 5 deletions
|
|
@ -46,7 +46,7 @@ import {Backlink} from "../layout/dock/Backlink";
|
|||
import {webFrame} from "electron";
|
||||
/// #endif
|
||||
import {openHistory} from "../history/history";
|
||||
import {openCard} from "../card/openCard";
|
||||
import {openCard, openCardByData} from "../card/openCard";
|
||||
import {lockScreen} from "../dialog/processSystem";
|
||||
import {isWindow} from "../util/functions";
|
||||
import {reloadProtyle} from "../protyle/util/reload";
|
||||
|
|
@ -553,7 +553,7 @@ export const globalShortcut = () => {
|
|||
return;
|
||||
}
|
||||
|
||||
if (event.key === "ArrowUp" || event.key === "ArrowDown" ) {
|
||||
if (event.key === "ArrowUp" || event.key === "ArrowDown") {
|
||||
const viewCardsDialog = window.siyuan.dialogs.find(item => {
|
||||
if (item.element.getAttribute("data-key") === "viewCards") {
|
||||
return true;
|
||||
|
|
@ -660,9 +660,6 @@ export const globalShortcut = () => {
|
|||
}
|
||||
if (!isTabWindow && matchHotKey(window.siyuan.config.keymap.general.dailyNote.custom, event)) {
|
||||
newDailyNote();
|
||||
if (document.activeElement) {
|
||||
(document.activeElement as HTMLElement).blur();
|
||||
}
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return;
|
||||
|
|
@ -1095,6 +1092,13 @@ const editKeydown = (event: KeyboardEvent) => {
|
|||
event.preventDefault();
|
||||
return true;
|
||||
}
|
||||
if (!isFileFocus && matchHotKey(window.siyuan.config.keymap.editor.general.spaceRepetition.custom, event)) {
|
||||
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: protyle.block.rootID}, (response) => {
|
||||
openCardByData(response.data, "doc", protyle.block.rootID, protyle.title.editElement.textContent);
|
||||
});
|
||||
event.preventDefault();
|
||||
return true;
|
||||
}
|
||||
if (!isFileFocus && matchHotKey(window.siyuan.config.keymap.general.move.custom, event)) {
|
||||
let range: Range;
|
||||
let nodeElement: false | HTMLElement;
|
||||
|
|
@ -1207,6 +1211,20 @@ const fileTreeKeydown = (event: KeyboardEvent) => {
|
|||
const notebookId = topULElement.getAttribute("data-url");
|
||||
const pathString = liElements[0].getAttribute("data-path");
|
||||
const isFile = liElements[0].getAttribute("data-type") === "navigation-file";
|
||||
|
||||
if (matchHotKey(window.siyuan.config.keymap.editor.general.spaceRepetition.custom, event)) {
|
||||
if (isFile) {
|
||||
const id = liElements[0].getAttribute("data-node-id");
|
||||
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: id}, (response) => {
|
||||
openCardByData(response.data, "doc", id, getDisplayName(liElements[0].getAttribute("data-name"), false, true));
|
||||
});
|
||||
} else {
|
||||
fetchPost("/api/riff/getNotebookRiffDueCards", {notebook: notebookId}, (response) => {
|
||||
openCardByData(response.data, "notebook", notebookId, getNotebookName(notebookId));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (matchHotKey(window.siyuan.config.keymap.editor.general.rename.custom, event)) {
|
||||
window.siyuan.menus.menu.remove();
|
||||
rename({
|
||||
|
|
|
|||
|
|
@ -182,6 +182,7 @@ export abstract class Constants {
|
|||
outline: {default: "⌥O", custom: "⌥O"},
|
||||
backlinks: {default: "⌥B", custom: "⌥B"},
|
||||
graphView: {default: "⌥G", custom: "⌥G"},
|
||||
spaceRepetition: {default: "⌥F", custom: "⌥F"},
|
||||
fullscreen: {default: "⌥Y", custom: "⌥Y"},
|
||||
alignLeft: {default: "⌥L", custom: "⌥L"},
|
||||
alignCenter: {default: "⌥C", custom: "⌥C"},
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
|
|||
submenu: [{
|
||||
iconHTML: Constants.ZWSP,
|
||||
label: window.siyuan.languages.spaceRepetition,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.spaceRepetition.custom,
|
||||
click: () => {
|
||||
fetchPost("/api/riff/getNotebookRiffDueCards", {notebook: notebookId}, (response) => {
|
||||
openCardByData(response.data, "notebook", notebookId, name);
|
||||
|
|
@ -339,6 +340,7 @@ export const initFileMenu = (notebookId: string, pathString: string, liElement:
|
|||
submenu: [{
|
||||
iconHTML: Constants.ZWSP,
|
||||
label: window.siyuan.languages.spaceRepetition,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.spaceRepetition.custom,
|
||||
click: () => {
|
||||
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: id}, (response) => {
|
||||
openCardByData(response.data, "doc", id, name);
|
||||
|
|
|
|||
|
|
@ -353,6 +353,7 @@ export class Title {
|
|||
const riffCardMenu = [{
|
||||
iconHTML: Constants.ZWSP,
|
||||
label: window.siyuan.languages.spaceRepetition,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.spaceRepetition.custom,
|
||||
click: () => {
|
||||
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: protyle.block.rootID}, (response) => {
|
||||
openCardByData(response.data, "doc", protyle.block.rootID, this.editElement.textContent);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,12 @@ export const commonHotkey = (protyle: IProtyle, event: KeyboardEvent) => {
|
|||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
if (matchHotKey(window.siyuan.config.keymap.editor.general.spaceRepetition.custom, event) ||
|
||||
matchHotKey(window.siyuan.config.keymap.general.dailyNote.custom, event)) {
|
||||
// 阻止输入 https://ld246.com/article/1679618995926
|
||||
event.preventDefault();
|
||||
return true;
|
||||
}
|
||||
/// #if !MOBILE
|
||||
if (protyle.model) {
|
||||
if (matchHotKey(window.siyuan.config.keymap.editor.general.backlinks.custom, event)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue