diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index 0b3d282cc..53a7fe867 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -75,9 +75,9 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => { inputElement.addEventListener("keydown", (event) => { if (event.key === "Enter" && !event.isComposing) { window.siyuan.menus.menu.remove(); + } else if (electronUndo(event)) { return; } - electronUndo(event); }); } }).element); @@ -231,7 +231,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => { const rect = element.getBoundingClientRect(); window.siyuan.menus.menu.popup({ x: rect.left, - y: rect.top + 13, + y: rect.top + 26, h: 26 }); window.siyuan.menus.menu.element.querySelector("input").select(); @@ -645,14 +645,13 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText focusByRange(protyle.toolbar.range); } window.siyuan.menus.menu.remove(); - return; } else if (event.key === "Tab" && !event.isComposing) { event.preventDefault(); event.stopPropagation(); element.nextElementSibling.querySelector("input").focus(); + } else if (electronUndo(event)) { return; } - electronUndo(event); }); } }).element); @@ -688,7 +687,6 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText focusByRange(protyle.toolbar.range); } window.siyuan.menus.menu.remove(); - return; } else if (event.key === "Tab" && !event.isComposing) { event.preventDefault(); event.stopPropagation(); @@ -697,9 +695,9 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText } else { element.nextElementSibling.querySelector("input").focus(); } + } else if (electronUndo(event)) { return; } - electronUndo(event); }); } }).element); @@ -729,14 +727,13 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText focusByRange(protyle.toolbar.range); } window.siyuan.menus.menu.remove(); - return; } else if (event.key === "Tab" && event.shiftKey && !event.isComposing) { event.preventDefault(); event.stopPropagation(); element.previousElementSibling.querySelector("input").focus(); + } else if (electronUndo(event)) { return; } - electronUndo(event); }); } }).element); @@ -779,7 +776,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText const rect = linkElement.getBoundingClientRect(); window.siyuan.menus.menu.popup({ x: rect.left, - y: rect.top + 13, + y: rect.top + 26, h: 26 }); if (focusText || protyle.lute.IsValidLinkDest(linkAddress)) { diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts index 1d2fe0c5d..258863141 100644 --- a/app/src/protyle/hint/extend.ts +++ b/app/src/protyle/hint/extend.ts @@ -316,7 +316,7 @@ export const hintRef = (key: string, protyle: IProtyle, isQuick = false): IHintD attrHTML += ` ${escapeHtml(item.memo)}`; } if (attrHTML) { - attrHTML = `
${attrHTML}
`; + attrHTML = `
${attrHTML}
`; } let value = `${item.name || item.refText}`; if (isQuick) { @@ -328,7 +328,7 @@ export const hintRef = (key: string, protyle: IProtyle, isQuick = false): IHintD ${escapeHtml(item.content)} -
${item.hPath}
`, +
${item.hPath}
`, }); }); if (isQuick) { @@ -372,7 +372,7 @@ export const hintEmbed = (key: string, protyle: IProtyle): IHintData[] => { attrHTML += ` ${escapeHtml(item.memo)}`; } if (attrHTML) { - attrHTML = `
${attrHTML}
`; + attrHTML = `
${attrHTML}
`; } dataList.push({ value: `{{select * from blocks where id='${item.id}'}}`, @@ -380,7 +380,7 @@ export const hintEmbed = (key: string, protyle: IProtyle): IHintData[] => { ${escapeHtml(item.content)} -
${item.hPath}
`, +
${item.hPath}
`, }); }); if (dataList.length === 0) { diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts index f573e6770..703120f13 100644 --- a/app/src/protyle/hint/index.ts +++ b/app/src/protyle/hint/index.ts @@ -306,14 +306,14 @@ ${unicode2Emoji(emoji.unicode, true)}`; attrHTML += ` ${escapeHtml(item.memo)}`; } if (attrHTML) { - attrHTML = `
${attrHTML}
`; + attrHTML = `
${attrHTML}
`; } const blockRefHTML = `${oldValue}`; searchHTML += ``; +
${item.hPath}
`; }); if (searchHTML === "") { searchHTML = ``; diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index ee30225a5..5d31628f0 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -867,7 +867,6 @@ export class Toolbar { if (event.isComposing) { return; } - electronUndo(event); if (event.key === "Escape" || matchHotKey("⌘↩", event)) { this.subElement.classList.add("fn__none"); this.subElement.querySelector('[data-type="pin"]').classList.remove("block__icon--active"); @@ -883,6 +882,8 @@ export class Toolbar { // https://github.com/siyuan-note/siyuan/issues/5270 document.execCommand("insertText", false, "\t"); event.preventDefault(); + } else if (electronUndo(event)) { + return; } }); diff --git a/app/src/protyle/undo/index.ts b/app/src/protyle/undo/index.ts index e126be1e9..ba14dfac9 100644 --- a/app/src/protyle/undo/index.ts +++ b/app/src/protyle/undo/index.ts @@ -96,13 +96,14 @@ export const electronUndo = (event: KeyboardEvent) => { getCurrentWindow().webContents.undo(); event.preventDefault(); event.stopPropagation(); - return; + return true; } if (matchHotKey(window.siyuan.config.keymap.editor.general.redo.custom, event)) { getCurrentWindow().webContents.redo(); event.preventDefault(); event.stopPropagation(); - return; + return true; } /// #endif + return false; }; diff --git a/app/src/util/pathName.ts b/app/src/util/pathName.ts index e5b5defcd..465c88b9c 100644 --- a/app/src/util/pathName.ts +++ b/app/src/util/pathName.ts @@ -6,6 +6,7 @@ import {isMobile} from "./functions"; import {focusByRange} from "../protyle/util/selection"; import {hasClosestByClassName} from "../protyle/util/hasClosest"; import {unicode2Emoji} from "../emoji"; +import {Constants} from "../constants"; export const addBaseURL = () => { let baseURLElement = document.getElementById("baseURL"); @@ -105,7 +106,7 @@ export const movePathTo = async (notebookId: string, path: string, focus = true) return; } fileHTML += `
  • - ${item.boxIcon ? ('' + unicode2Emoji(item.boxIcon) + "") : ""} + ${unicode2Emoji(item.boxIcon || Constants.SIYUAN_IMAGE_NOTE)} ${escapeHtml(item.hPath)}
  • `; });