mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-05 20:30:15 +01:00
This commit is contained in:
parent
a9abf0ebcb
commit
81eaf66621
3 changed files with 20 additions and 18 deletions
|
|
@ -60,6 +60,7 @@ import {Search} from "../../search";
|
|||
import {Custom} from "../../layout/dock/Custom";
|
||||
import {Protyle} from "../../protyle";
|
||||
import {transaction} from "../../protyle/wysiwyg/transaction";
|
||||
import {quickMakeCard} from "../../card/makeCard";
|
||||
|
||||
const switchDialogEvent = (app: App, event: MouseEvent) => {
|
||||
event.preventDefault();
|
||||
|
|
@ -253,6 +254,25 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
|
|||
event.preventDefault();
|
||||
return true;
|
||||
}
|
||||
if (!isFileFocus && matchHotKey(window.siyuan.config.keymap.editor.general.quickMakeCard.custom, event)) {
|
||||
if (protyle.title.editElement.contains(range.startContainer)) {
|
||||
quickMakeCard(protyle, [protyle.title.element]);
|
||||
} else {
|
||||
const selectElement: Element[] = [];
|
||||
protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select").forEach(item => {
|
||||
selectElement.push(item);
|
||||
});
|
||||
if (selectElement.length === 0) {
|
||||
const nodeElement = hasClosestBlock(range.startContainer);
|
||||
if (nodeElement) {
|
||||
selectElement.push(nodeElement);
|
||||
}
|
||||
}
|
||||
quickMakeCard(protyle, selectElement);
|
||||
}
|
||||
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(app, response.data, "doc", protyle.block.rootID, protyle.title.editElement.textContent || "Untitled");
|
||||
|
|
|
|||
|
|
@ -144,11 +144,6 @@ export class Title {
|
|||
});
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
} else if (matchHotKey(window.siyuan.config.keymap.editor.general.quickMakeCard.custom, event)) {
|
||||
quickMakeCard(protyle, [this.element]);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return true;
|
||||
} else if (matchHotKey("⌘A", event)) {
|
||||
getEditorRange(this.editElement).selectNodeContents(this.editElement);
|
||||
event.preventDefault();
|
||||
|
|
|
|||
|
|
@ -1033,19 +1033,6 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (matchHotKey(window.siyuan.config.keymap.editor.general.quickMakeCard.custom, event)) {
|
||||
const selectElement: Element[] = [];
|
||||
protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select").forEach(item => {
|
||||
selectElement.push(item);
|
||||
});
|
||||
if (selectElement.length === 0) {
|
||||
selectElement.push(nodeElement);
|
||||
}
|
||||
quickMakeCard(protyle, selectElement);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return true;
|
||||
}
|
||||
if (matchHotKey(window.siyuan.config.keymap.editor.general.attr.custom, event)) {
|
||||
const topElement = getTopAloneElement(nodeElement);
|
||||
if (selectText === "") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue