Vanessa 2022-11-27 17:44:51 +08:00
parent 81224760da
commit a593bc7503
4 changed files with 13 additions and 5 deletions

View file

@ -380,9 +380,13 @@ export const globalShortcut = () => {
}).forEach(item => {
let icon = `<svg class="b3-list-item__graphic"><use xlink:href="#${item.icon}"></use></svg>`;
let rootId = "";
const initData = item.headElement.getAttribute("data-initdata")
if (item.model instanceof Editor) {
rootId = ` data-node-id="${item.model.editor.protyle.block.rootID}"`;
icon = unicode2Emoji(item.docIcon || Constants.SIYUAN_IMAGE_FILE, false, "b3-list-item__graphic", true);
} else if (initData) {
rootId = ` data-node-id="${JSON.parse(initData).rootId}"`;
icon = unicode2Emoji(item.docIcon || Constants.SIYUAN_IMAGE_FILE, false, "b3-list-item__graphic", true);
}
tabHtml += `<li data-id="${item.id}"${rootId} class="b3-list-item${currentId === item.id ? " b3-list-item--focus" : ""}"${currentId === item.id ? ' data-original="true"' : ""}>${icon}<span class="b3-list-item__text">${escapeHtml(item.title)}</span></li>`;
});

View file

@ -132,7 +132,7 @@ export const movePathTo = (paths?: string[], range?: Range, cb?: (toPath: string
<span class="b3-list-item__toggle b3-list-item__toggle--hl">
<svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg>
</span>
<span class="b3-list-item__graphic">${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_NOTE)}</span>
${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_NOTE, false, "b3-list-item__graphic", true)}
<span class="b3-list-item__text">${escapeHtml(item.name)}</span>
</li></ul>`;
}
@ -158,7 +158,7 @@ export const movePathTo = (paths?: string[], range?: Range, cb?: (toPath: string
let fileHTML = "";
data.data.forEach((item: { boxIcon: string, box: string, hPath: string, path: string }) => {
fileHTML += `<li style="padding: 4px" class="b3-list-item${fileHTML === "" ? " b3-list-item--focus" : ""}" data-path="${item.path}" data-box="${item.box}">
<span class="b3-list-item__graphic">${unicode2Emoji(item.boxIcon || Constants.SIYUAN_IMAGE_NOTE)}</span>
${unicode2Emoji(item.boxIcon || Constants.SIYUAN_IMAGE_NOTE, false, "b3-list-item__graphic", true)}
<span class="b3-list-item__showall">${escapeHtml(item.hPath)}</span>
</li>`;
});