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";
|
import {webFrame} from "electron";
|
||||||
/// #endif
|
/// #endif
|
||||||
import {openHistory} from "../history/history";
|
import {openHistory} from "../history/history";
|
||||||
import {openCard} from "../card/openCard";
|
import {openCard, openCardByData} from "../card/openCard";
|
||||||
import {lockScreen} from "../dialog/processSystem";
|
import {lockScreen} from "../dialog/processSystem";
|
||||||
import {isWindow} from "../util/functions";
|
import {isWindow} from "../util/functions";
|
||||||
import {reloadProtyle} from "../protyle/util/reload";
|
import {reloadProtyle} from "../protyle/util/reload";
|
||||||
|
|
@ -553,7 +553,7 @@ export const globalShortcut = () => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.key === "ArrowUp" || event.key === "ArrowDown" ) {
|
if (event.key === "ArrowUp" || event.key === "ArrowDown") {
|
||||||
const viewCardsDialog = window.siyuan.dialogs.find(item => {
|
const viewCardsDialog = window.siyuan.dialogs.find(item => {
|
||||||
if (item.element.getAttribute("data-key") === "viewCards") {
|
if (item.element.getAttribute("data-key") === "viewCards") {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -660,9 +660,6 @@ export const globalShortcut = () => {
|
||||||
}
|
}
|
||||||
if (!isTabWindow && matchHotKey(window.siyuan.config.keymap.general.dailyNote.custom, event)) {
|
if (!isTabWindow && matchHotKey(window.siyuan.config.keymap.general.dailyNote.custom, event)) {
|
||||||
newDailyNote();
|
newDailyNote();
|
||||||
if (document.activeElement) {
|
|
||||||
(document.activeElement as HTMLElement).blur();
|
|
||||||
}
|
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
|
|
@ -1095,6 +1092,13 @@ const editKeydown = (event: KeyboardEvent) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return true;
|
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)) {
|
if (!isFileFocus && matchHotKey(window.siyuan.config.keymap.general.move.custom, event)) {
|
||||||
let range: Range;
|
let range: Range;
|
||||||
let nodeElement: false | HTMLElement;
|
let nodeElement: false | HTMLElement;
|
||||||
|
|
@ -1207,6 +1211,20 @@ const fileTreeKeydown = (event: KeyboardEvent) => {
|
||||||
const notebookId = topULElement.getAttribute("data-url");
|
const notebookId = topULElement.getAttribute("data-url");
|
||||||
const pathString = liElements[0].getAttribute("data-path");
|
const pathString = liElements[0].getAttribute("data-path");
|
||||||
const isFile = liElements[0].getAttribute("data-type") === "navigation-file";
|
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)) {
|
if (matchHotKey(window.siyuan.config.keymap.editor.general.rename.custom, event)) {
|
||||||
window.siyuan.menus.menu.remove();
|
window.siyuan.menus.menu.remove();
|
||||||
rename({
|
rename({
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,7 @@ export abstract class Constants {
|
||||||
outline: {default: "⌥O", custom: "⌥O"},
|
outline: {default: "⌥O", custom: "⌥O"},
|
||||||
backlinks: {default: "⌥B", custom: "⌥B"},
|
backlinks: {default: "⌥B", custom: "⌥B"},
|
||||||
graphView: {default: "⌥G", custom: "⌥G"},
|
graphView: {default: "⌥G", custom: "⌥G"},
|
||||||
|
spaceRepetition: {default: "⌥F", custom: "⌥F"},
|
||||||
fullscreen: {default: "⌥Y", custom: "⌥Y"},
|
fullscreen: {default: "⌥Y", custom: "⌥Y"},
|
||||||
alignLeft: {default: "⌥L", custom: "⌥L"},
|
alignLeft: {default: "⌥L", custom: "⌥L"},
|
||||||
alignCenter: {default: "⌥C", custom: "⌥C"},
|
alignCenter: {default: "⌥C", custom: "⌥C"},
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,7 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
|
||||||
submenu: [{
|
submenu: [{
|
||||||
iconHTML: Constants.ZWSP,
|
iconHTML: Constants.ZWSP,
|
||||||
label: window.siyuan.languages.spaceRepetition,
|
label: window.siyuan.languages.spaceRepetition,
|
||||||
|
accelerator: window.siyuan.config.keymap.editor.general.spaceRepetition.custom,
|
||||||
click: () => {
|
click: () => {
|
||||||
fetchPost("/api/riff/getNotebookRiffDueCards", {notebook: notebookId}, (response) => {
|
fetchPost("/api/riff/getNotebookRiffDueCards", {notebook: notebookId}, (response) => {
|
||||||
openCardByData(response.data, "notebook", notebookId, name);
|
openCardByData(response.data, "notebook", notebookId, name);
|
||||||
|
|
@ -339,6 +340,7 @@ export const initFileMenu = (notebookId: string, pathString: string, liElement:
|
||||||
submenu: [{
|
submenu: [{
|
||||||
iconHTML: Constants.ZWSP,
|
iconHTML: Constants.ZWSP,
|
||||||
label: window.siyuan.languages.spaceRepetition,
|
label: window.siyuan.languages.spaceRepetition,
|
||||||
|
accelerator: window.siyuan.config.keymap.editor.general.spaceRepetition.custom,
|
||||||
click: () => {
|
click: () => {
|
||||||
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: id}, (response) => {
|
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: id}, (response) => {
|
||||||
openCardByData(response.data, "doc", id, name);
|
openCardByData(response.data, "doc", id, name);
|
||||||
|
|
|
||||||
|
|
@ -353,6 +353,7 @@ export class Title {
|
||||||
const riffCardMenu = [{
|
const riffCardMenu = [{
|
||||||
iconHTML: Constants.ZWSP,
|
iconHTML: Constants.ZWSP,
|
||||||
label: window.siyuan.languages.spaceRepetition,
|
label: window.siyuan.languages.spaceRepetition,
|
||||||
|
accelerator: window.siyuan.config.keymap.editor.general.spaceRepetition.custom,
|
||||||
click: () => {
|
click: () => {
|
||||||
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: protyle.block.rootID}, (response) => {
|
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: protyle.block.rootID}, (response) => {
|
||||||
openCardByData(response.data, "doc", protyle.block.rootID, this.editElement.textContent);
|
openCardByData(response.data, "doc", protyle.block.rootID, this.editElement.textContent);
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,12 @@ export const commonHotkey = (protyle: IProtyle, event: KeyboardEvent) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
return;
|
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 !MOBILE
|
||||||
if (protyle.model) {
|
if (protyle.model) {
|
||||||
if (matchHotKey(window.siyuan.config.keymap.editor.general.backlinks.custom, event)) {
|
if (matchHotKey(window.siyuan.config.keymap.editor.general.backlinks.custom, event)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue