🎨 引用提示中属性、内容转义
This commit is contained in:
parent
8e5352438b
commit
a045989c15
2 changed files with 14 additions and 14 deletions
|
@ -307,13 +307,13 @@ export const hintRef = (key: string, protyle: IProtyle, isQuick = false): IHintD
|
|||
const iconName = getIconByType(item.type);
|
||||
let attrHTML = "";
|
||||
if (item.name) {
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconN"></use></svg> ${item.name}</span><span class="fn__space"></span>`;
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconN"></use></svg> ${escapeHtml(item.name)}</span><span class="fn__space"></span>`;
|
||||
}
|
||||
if (item.alias) {
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconA"></use></svg> ${item.alias}</span><span class="fn__space"></span>`;
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconA"></use></svg> ${escapeHtml(item.alias)}</span><span class="fn__space"></span>`;
|
||||
}
|
||||
if (item.memo) {
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg> ${item.memo}</span>`;
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg> ${escapeHtml(item.memo)}</span>`;
|
||||
}
|
||||
if (attrHTML) {
|
||||
attrHTML = `<div class="fn__flex b3-list-item__meta" style="line-height: 1">${attrHTML}</div>`;
|
||||
|
@ -326,9 +326,9 @@ export const hintRef = (key: string, protyle: IProtyle, isQuick = false): IHintD
|
|||
value,
|
||||
html: `${attrHTML}<div class="b3-list-item__first">
|
||||
<svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${iconName}"></use></svg>
|
||||
<span class="b3-list-item__text">${item.content}</span>
|
||||
<span class="b3-list-item__text">${escapeHtml(item.content)}</span>
|
||||
</div>
|
||||
<div class="b3-list-item__meta">${escapeHtml(item.hPath)}</div>`,
|
||||
<div class="b3-list-item__meta">${item.hPath}</div>`,
|
||||
});
|
||||
});
|
||||
if (isQuick) {
|
||||
|
@ -363,13 +363,13 @@ export const hintEmbed = (key: string, protyle: IProtyle): IHintData[] => {
|
|||
const iconName = getIconByType(item.type);
|
||||
let attrHTML = "";
|
||||
if (item.name) {
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconN"></use></svg> ${item.name}</span><span class="fn__space"></span>`;
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconN"></use></svg> ${escapeHtml(item.name)}</span><span class="fn__space"></span>`;
|
||||
}
|
||||
if (item.alias) {
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconA"></use></svg> ${item.alias}</span><span class="fn__space"></span>`;
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconA"></use></svg> ${escapeHtml(item.alias)}</span><span class="fn__space"></span>`;
|
||||
}
|
||||
if (item.memo) {
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg> ${item.memo}</span>`;
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg> ${escapeHtml(item.memo)}</span>`;
|
||||
}
|
||||
if (attrHTML) {
|
||||
attrHTML = `<div class="fn__flex b3-list-item__meta" style="line-height: 1">${attrHTML}</div>`;
|
||||
|
@ -378,7 +378,7 @@ export const hintEmbed = (key: string, protyle: IProtyle): IHintData[] => {
|
|||
value: `{{select * from blocks where id='${item.id}'}}`,
|
||||
html: `${attrHTML}<div class="b3-list-item__first">
|
||||
<svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${iconName}"></use></svg>
|
||||
<span class="b3-list-item__text">${item.content}</span>
|
||||
<span class="b3-list-item__text">${escapeHtml(item.content)}</span>
|
||||
</div>
|
||||
<div class="b3-list-item__meta">${item.hPath}</div>`,
|
||||
});
|
||||
|
|
|
@ -297,13 +297,13 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
|
|||
const iconName = getIconByType(item.type);
|
||||
let attrHTML = "";
|
||||
if (item.name) {
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconN"></use></svg> ${item.name}</span><span class="fn__space"></span>`;
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconN"></use></svg> ${escapeHtml(item.name)}</span><span class="fn__space"></span>`;
|
||||
}
|
||||
if (item.alias) {
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconA"></use></svg> ${item.alias}</span><span class="fn__space"></span>`;
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconA"></use></svg> ${escapeHtml(item.alias)}</span><span class="fn__space"></span>`;
|
||||
}
|
||||
if (item.memo) {
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg> ${item.memo}</span>`;
|
||||
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg> ${escapeHtml(item.memo)}</span>`;
|
||||
}
|
||||
if (attrHTML) {
|
||||
attrHTML = `<div class="fn__flex b3-list-item__meta" style="line-height: 1">${attrHTML}</div>`;
|
||||
|
@ -311,9 +311,9 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
|
|||
const blockRefHTML = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${oldValue}</span>`;
|
||||
searchHTML += `<button class="b3-list-item b3-list-item--two fn__block${index === 0 ? " b3-list-item--focus" : ""}" data-value="${encodeURIComponent(blockRefHTML)}">${attrHTML}<div class="b3-list-item__first">
|
||||
<svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${iconName}"></use></svg>
|
||||
<span class="b3-list-item__text">${item.content}</span>
|
||||
<span class="b3-list-item__text">${escapeHtml(item.content)}</span>
|
||||
</div>
|
||||
<div class="b3-list-item__meta">${escapeHtml(item.hPath)}</div></button>`;
|
||||
<div class="b3-list-item__meta">${item.hPath}</div></button>`;
|
||||
});
|
||||
if (searchHTML === "") {
|
||||
searchHTML = `<button class="b3-list-item b3-list-item--two fn__block" data-value="">${window.siyuan.languages.emptyContent}</button>`;
|
||||
|
|
Loading…
Add table
Reference in a new issue