This commit is contained in:
parent
15e40d2c2b
commit
e1e187dc37
2 changed files with 23 additions and 1 deletions
|
@ -135,6 +135,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
&__hinttext {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
&__hinticon {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
|
|
|
@ -1341,6 +1341,20 @@ const inputEvent = (element: Element, config: ISearchOption, inputTimeout: numbe
|
|||
return inputTimeout;
|
||||
};
|
||||
|
||||
const getAttr =(block:IBlock) => {
|
||||
let attrHTML = "";
|
||||
if (block.name) {
|
||||
attrHTML += `<span class="b3-list-item__meta fn__flex" style="max-width: 30%"><svg class="b3-list-item__hinticon"><use xlink:href="#iconN"></use></svg><span class="b3-list-item__hinttext">${block.name}</span></span>`;
|
||||
}
|
||||
if (block.alias) {
|
||||
attrHTML += `<span class="b3-list-item__meta fn__flex" style="max-width: 30%"><svg class="b3-list-item__hinticon"><use xlink:href="#iconA"></use></svg><span class="b3-list-item__hinttext">${block.alias}</span></span>`;
|
||||
}
|
||||
if (block.memo) {
|
||||
attrHTML += `<span class="b3-list-item__meta fn__flex" style="max-width: 30%"><svg class="b3-list-item__hinticon"><use xlink:href="#iconM"></use></svg><span class="b3-list-item__hinttext">${block.memo}</span></span>`;
|
||||
}
|
||||
return attrHTML;
|
||||
}
|
||||
|
||||
const onSearch = (data: IBlock[], edit: Protyle, element: Element, config: ISearchOption) => {
|
||||
let resultHTML = "";
|
||||
data.forEach((item, index) => {
|
||||
|
@ -1351,13 +1365,14 @@ const onSearch = (data: IBlock[], edit: Protyle, element: Element, config: ISear
|
|||
<svg class="b3-list-item__arrow b3-list-item__arrow--open"><use xlink:href="#iconRight"></use></svg>
|
||||
</span>
|
||||
${unicode2Emoji(getNotebookIcon(item.box) || Constants.SIYUAN_IMAGE_NOTE, "b3-list-item__graphic", true)}
|
||||
<span class="b3-list-item__text ariaLabel" style="color: var(--b3-theme-on-surface)" aria-label="${escapeAttr(title)}">${escapeGreat(title)}</span>
|
||||
<span class="b3-list-item__text ariaLabel" style="color: var(--b3-theme-on-surface)" aria-label="${escapeAriaLabel(title)}">${escapeGreat(title)}</span>
|
||||
</div><div>`;
|
||||
item.children.forEach((childItem, childIndex) => {
|
||||
resultHTML += `<div style="padding-left: 36px" data-type="search-item" class="b3-list-item${childIndex === 0 && index === 0 ? " b3-list-item--focus" : ""}" data-node-id="${childItem.id}" data-root-id="${childItem.rootID}">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#${getIconByType(childItem.type)}"></use></svg>
|
||||
${unicode2Emoji(childItem.ial.icon, "b3-list-item__graphic", true)}
|
||||
<span class="b3-list-item__text">${childItem.content}</span>
|
||||
${getAttr(childItem)}
|
||||
</div>`;
|
||||
});
|
||||
resultHTML += "</div>";
|
||||
|
@ -1366,6 +1381,7 @@ ${unicode2Emoji(childItem.ial.icon, "b3-list-item__graphic", true)}
|
|||
<svg class="b3-list-item__graphic"><use xlink:href="#${getIconByType(item.type)}"></use></svg>
|
||||
${unicode2Emoji(item.ial.icon, "b3-list-item__graphic", true)}
|
||||
<span class="b3-list-item__text">${item.content}</span>
|
||||
${getAttr(item)}
|
||||
<span class="b3-list-item__meta b3-list-item__meta--ellipsis ariaLabel" aria-label="${escapeAriaLabel(title)}">${escapeGreat(title)}</span>
|
||||
</div>`;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue