diff --git a/app/src/constants.ts b/app/src/constants.ts index b4c072fc9..c8c3cfc11 100644 --- a/app/src/constants.ts +++ b/app/src/constants.ts @@ -275,6 +275,7 @@ export abstract class Constants { public static readonly MENU_SEARCH_REPLACE_HISTORY = "search-replace-history"; // 替换历史菜单 public static readonly MENU_SEARCH_ASSET_HISTORY = "search-asset-history"; // 资源文件搜索历史菜单 public static readonly MENU_MOVE_PATH_HISTORY = "move-path-history"; // 移动文档窗口搜索历史菜单 + public static readonly MENU_CALLOUT_SELECT = "callout-select"; // 提示选择菜单 public static readonly MENU_BACKGROUND_ASSET = "background-asset"; // 资源文件选择器菜单 public static readonly MENU_AI = "ai"; // 块 AI 菜单 diff --git a/app/src/protyle/wysiwyg/callout.ts b/app/src/protyle/wysiwyg/callout.ts index 6f4f2af41..ce171d428 100644 --- a/app/src/protyle/wysiwyg/callout.ts +++ b/app/src/protyle/wysiwyg/callout.ts @@ -5,6 +5,7 @@ import {Dialog} from "../../dialog"; import {escapeHtml} from "../../util/escape"; import {Menu} from "../../plugin/Menu"; import {isMobile} from "../../util/functions"; +import {Constants} from "../../constants"; export const updateCalloutType = (titleElement: HTMLElement, protyle: IProtyle) => { const blockElement = hasClosestBlock(titleElement); @@ -74,7 +75,11 @@ export const updateCalloutType = (titleElement: HTMLElement, protyle: IProtyle) textElements[0].select(); let updateIcon = ""; dialog.element.querySelector(".b3-form__icona-icon").addEventListener("click", (event) => { - const menu = new Menu(); + const menu = new Menu(Constants.MENU_CALLOUT_SELECT, () => { + if (document.activeElement.tagName === "BODY") { + textElements[0].focus(); + } + }); if (menu.isOpen) { menu.close(); return; @@ -89,7 +94,7 @@ export const updateCalloutType = (titleElement: HTMLElement, protyle: IProtyle) icon: "⚠️", type: "Warning", color: "var(--b3-callout-warning)" }, { icon: "🚨", type: "Caution", color: "var(--b3-theme-error)" - }].forEach(item => { + }].forEach((item) => { menu.addItem({ iconHTML: `${item.icon.toUpperCase()}`, label: `${item.type}`,