diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts index 4c4f1c243..366a56d3c 100644 --- a/app/src/protyle/hint/extend.ts +++ b/app/src/protyle/hint/extend.ts @@ -18,6 +18,7 @@ import {escapeHtml} from "../../util/escape"; import {zoomOut} from "../../menus/protyle"; import {hideElements} from "../ui/hideElements"; import {genAssetHTML} from "../../asset/renderAssets"; +import {unicode2Emoji} from "../../emoji"; export const hintSlash = (key: string, protyle: IProtyle) => { const allList: IHintData[] = [{ @@ -319,7 +320,13 @@ export const hintRef = (key: string, protyle: IProtyle, isQuick = false): IHintD }); } response.data.blocks.forEach((item: IBlock) => { - const iconName = getIconByType(item.type); + let iconHTML; + if (item.type === "NodeDocument" && item.ial.icon){ + iconHTML = unicode2Emoji(item.ial.icon, false, "b3-list-item__graphic popover__block", true); + iconHTML = iconHTML.replace('popover__block"', `popover__block" data-id="${item.id}"`) + } else { + iconHTML = ``; + } let attrHTML = ""; if (item.name) { attrHTML += `${item.name}`; @@ -340,7 +347,7 @@ export const hintRef = (key: string, protyle: IProtyle, isQuick = false): IHintD dataList.push({ value, html: `${attrHTML}
- + ${iconHTML} ${item.content}
${item.hPath}
`, @@ -377,7 +384,13 @@ export const hintEmbed = (key: string, protyle: IProtyle): IHintData[] => { }, (response) => { const dataList: IHintData[] = []; response.data.blocks.forEach((item: IBlock) => { - const iconName = getIconByType(item.type); + let iconHTML; + if (item.type === "NodeDocument" && item.ial.icon){ + iconHTML = unicode2Emoji(item.ial.icon, false, "b3-list-item__graphic popover__block", true); + iconHTML = iconHTML.replace('popover__block"', `popover__block" data-id="${item.id}"`) + } else { + iconHTML = ``; + } let attrHTML = ""; if (item.name) { attrHTML += `${item.name}`; @@ -394,7 +407,7 @@ export const hintEmbed = (key: string, protyle: IProtyle): IHintData[] => { dataList.push({ value: `{{select * from blocks where id='${item.id}'}}`, html: `${attrHTML}
- + ${iconHTML} ${item.content}
${item.hPath}
`, diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts index 0a7635676..e8efff8e7 100644 --- a/app/src/protyle/hint/index.ts +++ b/app/src/protyle/hint/index.ts @@ -288,7 +288,10 @@ ${unicode2Emoji(emoji.unicode, true)}`; searchElement.value = oldValue; searchElement.select(); searchElement.addEventListener("keydown", (event: KeyboardEvent) => { - event.stopPropagation(); + if (event.key !== "Meta" && event.key !== "Control") { + // 需要冒泡以满足光标在块标位置时 ctrl 弹出悬浮层 + event.stopPropagation(); + } if (event.isComposing) { return; } @@ -334,7 +337,13 @@ ${unicode2Emoji(emoji.unicode, true)}`; ${window.siyuan.languages.newFile} ${response.data.k}`; } response.data.blocks.forEach((item: IBlock, index: number) => { - const iconName = getIconByType(item.type); + let iconHTML; + if (item.type === "NodeDocument" && item.ial.icon) { + iconHTML = unicode2Emoji(item.ial.icon, false, "b3-list-item__graphic popover__block", true); + iconHTML = iconHTML.replace('popover__block"', `popover__block" data-id="${item.id}"`) + } else { + iconHTML = ``; + } let attrHTML = ""; if (item.name) { attrHTML += `${item.name}`; @@ -350,7 +359,7 @@ ${unicode2Emoji(emoji.unicode, true)}`; } const blockRefHTML = `${oldValue}`; searchHTML += ``;