mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-17 09:30:48 +08:00
This commit is contained in:
parent
f8ccb89876
commit
a33d2388fd
@ -1295,17 +1295,22 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!nodeElement.classList.contains("code-block") && !event.repeat) {
|
if (!nodeElement.classList.contains("code-block") && !event.repeat) {
|
||||||
const findToolbar = protyle.options.toolbar.find((menuItem: IMenuItem) => {
|
let findToolbar = false;
|
||||||
|
protyle.options.toolbar.find((menuItem: IMenuItem) => {
|
||||||
if (!menuItem.hotkey) {
|
if (!menuItem.hotkey) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (matchHotKey(menuItem.hotkey, event)) {
|
if (matchHotKey(menuItem.hotkey, event)) {
|
||||||
protyle.toolbar.range = getEditorRange(protyle.wysiwyg.element);
|
protyle.toolbar.range = getEditorRange(protyle.wysiwyg.element);
|
||||||
if (["a", "block-ref", "inline-math", "inline-memo", "text"].includes(menuItem.name)) {
|
if (["block-ref", "text"].includes(menuItem.name) && protyle.toolbar.range.toString() === "") {
|
||||||
protyle.toolbar.element.querySelector(`[data-type="${menuItem.name}"]`).dispatchEvent(new CustomEvent("click"));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
findToolbar = true;
|
||||||
|
if (["a", "block-ref", "inline-math", "inline-memo", "text"].includes(menuItem.name)) {
|
||||||
|
protyle.toolbar.element.querySelector(`[data-type="${menuItem.name}"]`).dispatchEvent(new CustomEvent("click"));
|
||||||
|
} else {
|
||||||
protyle.toolbar.setInlineMark(protyle, menuItem.name, "range");
|
protyle.toolbar.setInlineMark(protyle, menuItem.name, "range");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user