mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-07 17:28:50 +01:00
This commit is contained in:
parent
fbc166e7b4
commit
efd2adb4fd
2 changed files with 8 additions and 2 deletions
|
|
@ -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 菜单
|
||||
|
|
|
|||
|
|
@ -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: `<span class="b3-menu__icon">${item.icon.toUpperCase()}</span>`,
|
||||
label: `<span style="color: ${item.color}">${item.type}</span>`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue