From 718e5f91b60f953ece0797e7982fa45d75389c38 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 23 Sep 2024 09:00:43 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/pull/12547 --- app/src/protyle/hint/extend.ts | 30 +++++++++++++++++++----------- app/src/protyle/hint/index.ts | 4 ++-- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts index 95527ed14..219698eb1 100644 --- a/app/src/protyle/hint/extend.ts +++ b/app/src/protyle/hint/extend.ts @@ -21,6 +21,14 @@ import {genAssetHTML} from "../../asset/renderAssets"; import {unicode2Emoji} from "../../emoji"; import {avRender} from "../render/av/render"; +const getHotkeyOrMarker = (hotkey: string, marker: string) => { + if (hotkey) { + return `${updateHotkeyTip(hotkey)}`; + } else { + return `${marker}`; + } +} + export const hintSlash = (key: string, protyle: IProtyle) => { const allList: IHintData[] = [{ filter: ["模版", "moban", "muban", "mb", "template"], @@ -75,57 +83,57 @@ export const hintSlash = (key: string, protyle: IProtyle) => { filter: ["yijibiaoti", "一级标题", "yjbt", "h1", "heading"], id: "heading1", value: "# " + Lute.Caret, - html: `
${window.siyuan.languages.heading1}${window.siyuan.config.keymap.editor.heading.heading1.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.heading.heading1.custom))}` : ''}
`, + html: `
${window.siyuan.languages.heading1}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.heading.heading1.custom, "# ")}
`, }, { filter: ["erjibiaoti", "二级标题", "ejbt", "h2", "heading"], id: "heading2", value: "## " + Lute.Caret, - html: `
${window.siyuan.languages.heading2}${window.siyuan.config.keymap.editor.heading.heading2.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.heading.heading2.custom))}` : '## '}
`, + html: `
${window.siyuan.languages.heading2}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.heading.heading2.custom, "## ")}
`, }, { filter: ["sanjibiaoti", "三级标题", "sjbt", "h3", "heading"], id: "heading3", value: "### " + Lute.Caret, - html: `
${window.siyuan.languages.heading3}${window.siyuan.config.keymap.editor.heading.heading3.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.heading.heading3.custom))}` : '### '}
`, + html: `
${window.siyuan.languages.heading3}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.heading.heading3.custom, "### ")}
`, }, { filter: ["sijibiaoti", "四级标题", "sjbt", "h4", "heading"], id: "heading4", value: "#### " + Lute.Caret, - html: `
${window.siyuan.languages.heading4}${window.siyuan.config.keymap.editor.heading.heading4.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.heading.heading4.custom))}` : '#### '}
`, + html: `
${window.siyuan.languages.heading4}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.heading.heading4.custom, "#### ")}
`, }, { filter: ["wujibiaoti", "五级标题", "wjbt", "h5", "heading"], id: "heading5", value: "##### " + Lute.Caret, - html: `
${window.siyuan.languages.heading5}${window.siyuan.config.keymap.editor.heading.heading5.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.heading.heading5.custom))}` : '##### '}
`, + html: `
${window.siyuan.languages.heading5}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.heading.heading5.custom, "##### ")}
`, }, { filter: ["liujibiaoti", "六级标题", "ljbt", "h6", "heading"], id: "heading6", value: "###### " + Lute.Caret, - html: `
${window.siyuan.languages.heading6}${window.siyuan.config.keymap.editor.heading.heading6.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.heading.heading6.custom))}` : '###### '}
`, + html: `
${window.siyuan.languages.heading6}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.heading.heading6.custom, "###### ")}
`, }, { filter: ["无序列表", "wuxuliebiao", "wxlb", "unordered list"], id: "list", value: "* " + Lute.Caret, - html: `
${window.siyuan.languages.list}${window.siyuan.config.keymap.editor.insert.list.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.list.custom))}` : ''}
`, + html: `
${window.siyuan.languages.list}${getHotkeyOrMarker(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"]}${window.siyuan.config.keymap.editor.insert["ordered-list"].custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.insert["ordered-list"].custom))}` : '1. '}
`, + html: `
${window.siyuan.languages["ordered-list"]}${getHotkeyOrMarker(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}${window.siyuan.config.keymap.editor.insert.check.custom ? `${updateHotkeyTip((window.siyuan.config.keymap.editor.insert.check.custom))}` : '[ ]'}
`, + html: `
${window.siyuan.languages.check}${getHotkeyOrMarker(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))}` : '>'}
`, + html: `
${window.siyuan.languages.quote}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.insert.quote.custom, ">")}
`, }, { filter: ["代码块", "daimakuai", "dmk", "code block"], id: "code", value: "```", - 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}`}
`, + html: `
${window.siyuan.languages.code}${getHotkeyOrMarker(window.siyuan.config.keymap.editor.insert.code.custom, "```" + window.siyuan.languages.enterKey)}
`, }, { filter: ["表格", "biaoge", "bg", "table"], id: "table", diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts index 7083e8668..5368e594e 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}`;