diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts index bf24e1ebc..d0c09ce2f 100644 --- a/app/src/protyle/gutter/index.ts +++ b/app/src/protyle/gutter/index.ts @@ -1454,9 +1454,9 @@ export class Gutter { submenu: iframeMenu(protyle, nodeElement) }).element); } else if (type === "NodeHTMLBlock" && !protyle.disabled) { - window.siyuan.menus.menu.append(new MenuItem({id: "separator_HTML", type: "separator"}).element); + window.siyuan.menus.menu.append(new MenuItem({id: "separator_html", type: "separator"}).element); window.siyuan.menus.menu.append(new MenuItem({ - id: "HTML", + id: "html", icon: "iconHTML5", label: "HTML", click() { @@ -1989,7 +1989,7 @@ export class Gutter { }]; ["25%", "33%", "50%", "67%", "75%", "100%"].forEach((item) => { styles.push({ - id: "width" + item, + id: "width_" + item, iconHTML: "", label: item, click: () => { @@ -2079,7 +2079,7 @@ export class Gutter { }]; ["25%", "33%", "50%", "67%", "75%", "100%"].forEach((item) => { styles.push({ - id: "height" + item, + id: "height_" + item, iconHTML: "", label: item, click: () => { diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts index 1a72b176c..95527ed14 100644 --- a/app/src/protyle/hint/extend.ts +++ b/app/src/protyle/hint/extend.ts @@ -24,234 +24,293 @@ import {avRender} from "../render/av/render"; export const hintSlash = (key: string, protyle: IProtyle) => { const allList: IHintData[] = [{ filter: ["模版", "moban", "muban", "mb", "template"], + id: "template", value: Constants.ZWSP, html: `
${window.siyuan.languages.template}
`, }, { filter: ["挂件", "widget", "gj", "guajian"], + id: "widget", value: Constants.ZWSP + 1, html: `
${window.siyuan.languages.widget}
`, }, { filter: ["资源", "assets", "zy", "ziyuan"], + id: "assets", value: Constants.ZWSP + 2, html: `
${window.siyuan.languages.assets}
`, }, { filter: ["块引用", "kuaiyinyong", "kyy", "block reference"], + id: "ref", value: "((", html: `
${window.siyuan.languages.ref}((
`, }, { filter: ["嵌入块", "qianrukuai", "qrk", "embed block"], + id: "blockEmbed", value: "{{", html: `
${window.siyuan.languages.blockEmbed}{{
`, }, { filter: ["人工智能", "ai", "rgzn"], + id: "aiWriting", value: Constants.ZWSP + 5, html: `
${window.siyuan.languages.aiWriting}
`, }, { filter: ["数据库", "视图", "shujuku", "shitu", "sjk", "st", "database", "view", "db"], + id: "database", value: '
', html: `
${window.siyuan.languages.database}
`, }, { filter: ["新建文档并引用", "xinjianwendangbingyinyong", "xjwdbyy", "new doc"], + id: "newFileRef", value: Constants.ZWSP + 4, html: `
${window.siyuan.languages.newFileRef}
`, }, { filter: ["新建子文档并引用", "xinjianziwendangbingyinyong", "xjzwdbyy", "create sub doc"], + id: "newSubDocRef", value: Constants.ZWSP + 6, html: `
${window.siyuan.languages.newSubDocRef}
`, }, { value: "", + id: "separator_1", html: "separator", }, { filter: ["yijibiaoti", "一级标题", "yjbt", "h1", "heading"], + id: "heading1", value: "# " + Lute.Caret, - html: `
${window.siyuan.languages.heading1}${updateHotkeyTip(window.siyuan.config.keymap.editor.heading.heading1.custom)}
`, + html: `
${window.siyuan.languages.heading1}${window.siyuan.config.keymap.editor.heading.heading1.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.heading.heading1.custom))}` : ''}
`, }, { filter: ["erjibiaoti", "二级标题", "ejbt", "h2", "heading"], + id: "heading2", value: "## " + Lute.Caret, - html: `
${window.siyuan.languages.heading2}${updateHotkeyTip(window.siyuan.config.keymap.editor.heading.heading2.custom)}
`, + html: `
${window.siyuan.languages.heading2}${window.siyuan.config.keymap.editor.heading.heading2.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.heading.heading2.custom))}` : '## '}
`, }, { filter: ["sanjibiaoti", "三级标题", "sjbt", "h3", "heading"], + id: "heading3", value: "### " + Lute.Caret, - html: `
${window.siyuan.languages.heading3}${updateHotkeyTip(window.siyuan.config.keymap.editor.heading.heading3.custom)}
`, + html: `
${window.siyuan.languages.heading3}${window.siyuan.config.keymap.editor.heading.heading3.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.heading.heading3.custom))}` : '### '}
`, }, { filter: ["sijibiaoti", "四级标题", "sjbt", "h4", "heading"], + id: "heading4", value: "#### " + Lute.Caret, - html: `
${window.siyuan.languages.heading4}${updateHotkeyTip(window.siyuan.config.keymap.editor.heading.heading4.custom)}
`, + html: `
${window.siyuan.languages.heading4}${window.siyuan.config.keymap.editor.heading.heading4.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.heading.heading4.custom))}` : '#### '}
`, }, { filter: ["wujibiaoti", "五级标题", "wjbt", "h5", "heading"], + id: "heading5", value: "##### " + Lute.Caret, - html: `
${window.siyuan.languages.heading5}${updateHotkeyTip(window.siyuan.config.keymap.editor.heading.heading5.custom)}
`, + html: `
${window.siyuan.languages.heading5}${window.siyuan.config.keymap.editor.heading.heading5.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.heading.heading5.custom))}` : '##### '}
`, }, { filter: ["liujibiaoti", "六级标题", "ljbt", "h6", "heading"], + id: "heading6", value: "###### " + Lute.Caret, - html: `
${window.siyuan.languages.heading6}${updateHotkeyTip((window.siyuan.config.keymap.editor.heading.heading6.custom))}
`, + html: `
${window.siyuan.languages.heading6}${window.siyuan.config.keymap.editor.heading.heading6.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.heading.heading6.custom))}` : '###### '}
`, }, { filter: ["无序列表", "wuxuliebiao", "wxlb", "unordered list"], + id: "list", value: "* " + Lute.Caret, - html: `
${window.siyuan.languages.list}
`, + html: `
${window.siyuan.languages.list}${window.siyuan.config.keymap.editor.insert.list.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.list.custom))}` : ''}
`, }, { filter: ["有序列表", "youxuliebiao", "yxlb", "ordered list"], + id: "orderedList", value: "1. " + Lute.Caret, - html: `
${window.siyuan.languages["ordered-list"]}1. 
`, + html: `
${window.siyuan.languages["ordered-list"]}${window.siyuan.config.keymap.editor.insert["ordered-list"].custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.insert["ordered-list"].custom))}` : '1. '}
`, }, { filter: ["任务列表", "renwuliebiao", "rwlb", "task list", "todo list"], + id: "check", value: "* [ ] " + Lute.Caret, - html: `
${window.siyuan.languages.check}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.check.custom))}
`, + html: `
${window.siyuan.languages.check}${window.siyuan.config.keymap.editor.insert.check.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.check.custom))}` : '[ ]'}
`, }, { filter: ["引述", "yinshu", "ys", "bq", "blockquote"], + id: "quote", value: "> " + Lute.Caret, html: `
${window.siyuan.languages.quote}${window.siyuan.config.keymap.editor.insert.quote.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.quote.custom))}` : '>'}
`, }, { filter: ["代码块", "daimakuai", "dmk", "code block"], + id: "code", value: "```", - html: `
${window.siyuan.languages.code}\`\`\`${window.siyuan.languages.enterKey}
`, + html: `
${window.siyuan.languages.code}${window.siyuan.config.keymap.editor.insert.code.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.code.custom))}` : ````${window.siyuan.languages.enterKey}`}
`, }, { filter: ["表格", "biaoge", "bg", "table"], + id: "table", value: `| ${Lute.Caret} | | |\n| --- | --- | --- |\n| | | |\n| | | |`, html: `
${window.siyuan.languages.table}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.table.custom))}
`, }, { filter: ["分割线", "分隔线", "fengexian", "fgx", "divider", "thematic", "break"], + id: "line", value: "---", html: `
${window.siyuan.languages.line}---
`, }, { filter: ["数学公式块", "shuxuegongshikuai", "sxgsk", "math block"], + id: "math", value: "$$", html: `
${window.siyuan.languages.math}$$
`, }, { filter: ["html"], + id: "html", value: "
", html: '
HTML
', }, { value: "", + id: "separator_2", html: "separator", }, { filter: ["表情", "biaoqing", "bq", "emoji"], + id: "emoji", value: "emoji", html: `
${window.siyuan.languages.emoji}:
`, }, { filter: ["链接", "lianjie", "lj", "link", "a"], + id: "link", value: "a", html: `
${window.siyuan.languages.link}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.link.custom))}
`, }, { filter: ["粗体", "cuti", "ct", "bold", "strong"], + id: "bold", value: "strong", html: `
${window.siyuan.languages.bold}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.bold.custom))}
`, }, { filter: ["斜体", "xieti", "xt", "italic", "em"], + id: "italic", value: "em", html: `
${window.siyuan.languages.italic}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.italic.custom))}
`, }, { filter: ["下划线", "xiahuaxian", "xhx", "underline"], + id: "underline", value: "u", html: `
${window.siyuan.languages.underline}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.underline.custom))}
`, }, { filter: ["删除线", "shanchuxian", "scx", "strike"], + id: "strike", value: "s", html: `
${window.siyuan.languages.strike}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.strike.custom))}
`, }, { filter: ["标记", "biaoji", "bj", "mark"], + id: "mark", value: "mark", html: `
${window.siyuan.languages.mark}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.mark.custom))}
`, }, { filter: ["上标", "shangbiao", "sb", "superscript"], + id: "sup", value: "sup", html: `
${window.siyuan.languages.sup}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.sup.custom))}
`, }, { filter: ["下标", "xiaobiao", "xb", "subscript"], + id: "sub", value: "sub", html: `
${window.siyuan.languages.sub}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.sub.custom))}
`, }, { filter: ["标签", "biaoqian", "bq", "tag"], + id: "tag", value: "tag", html: `
${window.siyuan.languages.tag}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.tag.custom))}
`, }, { filter: ["行级代码", "hangjidaima", "hjdm", "行内代码", "hangneidaima", "hndm", "inline code"], + id: "inlineCode", value: "code", html: `
${window.siyuan.languages["inline-code"]}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert["inline-code"].custom))}
`, }, { filter: ["行级公式", "hangjigongshi", "hjgs", "行级数学公式", "hangjishuxuegongshi", "hjsxgs", "行内数学公式", "hangneishuxuegongshi", "hnsxgs", "inline math"], + id: "inlineMath", value: "inline-math", html: `
${window.siyuan.languages["inline-math"]}${updateHotkeyTip((window.siyuan.config.keymap.editor.insert["inline-math"].custom))}
`, }, { value: "", + id: "separator_3", html: "separator", }, { filter: ["插入图片或文件", "upload", "上传", "crtphwj", "sc"], + id: "insertAsset", value: Constants.ZWSP + 3, html: `
${window.siyuan.languages.insertAsset}
`, }, { filter: ["iframe", "嵌入网址", "qianruwangzhan", "qrwz"], + id: "insertIframeURL", value: '', html: `
${window.siyuan.languages.insertIframeURL}
`, }, { filter: ["插入图片链接", "insert image link", "charutupianlianjie", "crtptp"], + id: "insertImgURL", value: "![]()", html: `
${window.siyuan.languages.insertImgURL}
`, }, { filter: ["插入视频链接", "charushipinlianjie", "crsplj", "insert video url"], + id: "insertVideoURL", value: '', html: `
${window.siyuan.languages.insertVideoURL}
`, }, { filter: ["插入音频链接", "charuyinpinlianjie", "cryplj", "insert audio url"], + id: "insertAudioURL", value: '', html: `
${window.siyuan.languages.insertAudioURL}
`, }, { value: "", + id: "separator_4", html: "separator", }, { filter: ["五线谱", "wuxianpu", "wxp", "staff"], + id: "staff", value: "```abc\n```", html: `
ABC${window.siyuan.languages.staff}
`, }, { filter: ["图表", "tubiao", "tb", "chart"], + id: "chart", value: "```echarts\n```", html: `
Chart${window.siyuan.languages.chart}
`, }, { filter: ["流程图", "liuchengtu", "lct", "flow chart"], + id: "flowChart", value: "```flowchart\n```", html: '
FlowChartFlow Chart
', }, { filter: ["状态图", "zhuangtaitu", "ztt", "graph viz"], + id: "graph", value: "```graphviz\n```", html: '
GraphvizGraph
', }, { filter: ["流程图", "时序图", "甘特图", "liuchengtu", "shixutu", "gantetu", "lct", "sxt", "gtt", "mermaid"], + id: "mermaid", value: "```mermaid\n```", html: '
MermaidMermaid
', }, { filter: ["脑图", "naotu", "nt", "mind map"], + id: "mindmap", value: "```mindmap\n```", html: `
Mind map${window.siyuan.languages.mindmap}
`, }, { filter: ["统一建模语言", "tongyijianmoyuyan", "tyjmyy", "plant uml"], + id: "UML", value: "```plantuml\n```", html: '
PlantUMLUML
', }, { value: "", + id: "separator_5", html: "separator", }, { filter: ["信息样式", "xinxiyangshi", "xxys", "info style"], + id: "infoStyle", value: `style${Constants.ZWSP}color: var(--b3-card-info-color);background-color: var(--b3-card-info-background);`, html: `
A
${window.siyuan.languages.infoStyle}
`, }, { filter: ["成功样式", "chenggongyangshi", "cgys", "success style"], + id: "successStyle", value: `style${Constants.ZWSP}color: var(--b3-card-success-color);background-color: var(--b3-card-success-background);`, html: `
A
${window.siyuan.languages.successStyle}
`, }, { filter: ["警告样式", "jinggaoyangshi", "jgys", "warning style"], + id: "warningStyle", value: `style${Constants.ZWSP}color: var(--b3-card-warning-color);background-color: var(--b3-card-warning-background);`, html: `
A
${window.siyuan.languages.warningStyle}
`, }, { filter: ["错误样式", "cuowuyangshi", "cwys", "error style"], + id: "errorStyle", value: `style${Constants.ZWSP}color: var(--b3-card-error-color);background-color: var(--b3-card-error-background);`, html: `
A
${window.siyuan.languages.errorStyle}
`, }, { - filter: ["移除样式", "yichuyangshi", "ycys", "remove style"], + filter: ["清除样式", "qingchuyangshi", "qcys", "remove style"], + id: "clearFontStyle", value: `style${Constants.ZWSP}`, html: `
A
${window.siyuan.languages.clearFontStyle}
`, }, { value: "", + id: "separator_6", html: "separator", }]; let hasPlugin = false; diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts index d96370f19..7083e8668 100644 --- a/app/src/protyle/hint/index.ts +++ b/app/src/protyle/hint/index.ts @@ -248,9 +248,9 @@ ${unicode2Emoji(emoji.unicode)}`; focusClass = " b3-list-item--focus"; } if (hintData.html === "separator") { - hintsHTML += '
'; + hintsHTML += ``; } else { - hintsHTML += ``; + hintsHTML += ``; } }); return `${hintsHTML}
`; diff --git a/app/src/types/protyle.d.ts b/app/src/types/protyle.d.ts index 79c1a434c..caa37a9d4 100644 --- a/app/src/types/protyle.d.ts +++ b/app/src/types/protyle.d.ts @@ -370,6 +370,7 @@ interface IPreviewActionCustom { } interface IHintData { + id?: string; html: string; value: string; filter?: string[]