Vanessa 2025-01-13 12:47:28 +08:00
parent 5a9bb84641
commit a635bcbafd
15 changed files with 63 additions and 64 deletions

View file

@ -19,8 +19,7 @@ import {resize} from "../protyle/util/resize";
export class BlockPanel { export class BlockPanel {
public element: HTMLElement; public element: HTMLElement;
public targetElement: HTMLElement; public targetElement: HTMLElement;
public nodeIds: string[]; public refDefs: IRefDefs[];
public defIds: string[] = [];
public id: string; public id: string;
private app: App; private app: App;
public x: number; public x: number;
@ -35,17 +34,15 @@ export class BlockPanel {
constructor(options: { constructor(options: {
app: App, app: App,
targetElement?: HTMLElement, targetElement?: HTMLElement,
nodeIds?: string[], refDefs: IRefDefs[]
defIds?: string[],
isBacklink: boolean, isBacklink: boolean,
originalRefBlockIDs?: IObject, // isBacklink 为 true 时有效
x?: number, x?: number,
y?: number, y?: number,
originalRefBlockIDs?: IObject, // isBacklink 为 true 时有效
}) { }) {
this.id = genUUID(); this.id = genUUID();
this.targetElement = options.targetElement; this.targetElement = options.targetElement;
this.nodeIds = options.nodeIds; this.refDefs = options.refDefs;
this.defIds = options.defIds || [];
this.app = options.app; this.app = options.app;
this.x = options.x; this.x = options.x;
this.y = options.y; this.y = options.y;
@ -61,7 +58,7 @@ export class BlockPanel {
this.element.setAttribute("data-oid", parentElement.getAttribute("data-oid")); this.element.setAttribute("data-oid", parentElement.getAttribute("data-oid"));
level = parseInt(parentElement.getAttribute("data-level")) + 1; level = parseInt(parentElement.getAttribute("data-level")) + 1;
} else { } else {
this.element.setAttribute("data-oid", this.nodeIds[0]); this.element.setAttribute("data-oid", this.refDefs[0].refID);
} }
// 移除同层级其他更高级的 block popover // 移除同层级其他更高级的 block popover
this.element.setAttribute("data-level", level.toString()); this.element.setAttribute("data-level", level.toString());
@ -121,13 +118,13 @@ export class BlockPanel {
} }
} else if (type === "open") { } else if (type === "open") {
/// #if !BROWSER /// #if !BROWSER
openNewWindowById(this.nodeIds[0]); openNewWindowById(this.refDefs[0].refID);
/// #endif /// #endif
} else if (type === "stickTab") { } else if (type === "stickTab") {
openFileById({ openFileById({
app: options.app, app: options.app,
id: this.nodeIds[0], id: this.refDefs[0].refID,
action: this.editors[0].protyle.block.rootID !== this.nodeIds[0] ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_CONTEXT], action: this.editors[0].protyle.block.rootID !== this.refDefs[0].refID ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_CONTEXT],
}); });
} }
event.preventDefault(); event.preventDefault();
@ -150,7 +147,7 @@ export class BlockPanel {
private initProtyle(editorElement: HTMLElement, afterCB?: () => void) { private initProtyle(editorElement: HTMLElement, afterCB?: () => void) {
const index = parseInt(editorElement.getAttribute("data-index")); const index = parseInt(editorElement.getAttribute("data-index"));
fetchPost("/api/block/getBlockInfo", {id: this.nodeIds[index]}, (response) => { fetchPost("/api/block/getBlockInfo", {id: this.refDefs[index].refID}, (response) => {
if (response.code === 3) { if (response.code === 3) {
showMessage(response.msg); showMessage(response.msg);
return; return;
@ -159,7 +156,7 @@ export class BlockPanel {
return; return;
} }
const action: TProtyleAction[] = []; const action: TProtyleAction[] = [];
if (response.data.rootID !== this.nodeIds[index]) { if (response.data.rootID !== this.refDefs[index].refID) {
action.push(Constants.CB_GET_ALL); action.push(Constants.CB_GET_ALL);
} else { } else {
action.push(Constants.CB_GET_CONTEXT); action.push(Constants.CB_GET_CONTEXT);
@ -170,8 +167,8 @@ export class BlockPanel {
action.push(Constants.CB_GET_BACKLINK); action.push(Constants.CB_GET_BACKLINK);
} }
const editor = new Protyle(this.app, editorElement, { const editor = new Protyle(this.app, editorElement, {
blockId: this.nodeIds[index], blockId: this.refDefs[index].refID,
defId: this.defIds[index] || this.defIds[0] || "", defIds: this.refDefs[index].defIDs || [],
originalRefBlockIDs: this.isBacklink ? this.originalRefBlockIDs : undefined, originalRefBlockIDs: this.isBacklink ? this.originalRefBlockIDs : undefined,
action, action,
render: { render: {
@ -181,7 +178,7 @@ export class BlockPanel {
}, },
typewriterMode: false, typewriterMode: false,
after: (editor) => { after: (editor) => {
if (response.data.rootID !== this.nodeIds[index]) { if (response.data.rootID !== this.refDefs[index].refID) {
editor.protyle.breadcrumb.element.parentElement.lastElementChild.classList.remove("fn__none"); editor.protyle.breadcrumb.element.parentElement.lastElementChild.classList.remove("fn__none");
} }
if (afterCB) { if (afterCB) {
@ -235,7 +232,7 @@ export class BlockPanel {
return; return;
} }
let openHTML = ""; let openHTML = "";
if (this.nodeIds.length === 1) { if (this.refDefs.length === 1) {
openHTML = `<span data-type="stickTab" class="block__icon block__icon--show b3-tooltips b3-tooltips__sw" aria-label="${window.siyuan.languages.openBy}"><svg><use xlink:href="#iconOpen"></use></svg></span> openHTML = `<span data-type="stickTab" class="block__icon block__icon--show b3-tooltips b3-tooltips__sw" aria-label="${window.siyuan.languages.openBy}"><svg><use xlink:href="#iconOpen"></use></svg></span>
<span class="fn__space"></span>`; <span class="fn__space"></span>`;
/// #if !BROWSER /// #if !BROWSER
@ -250,10 +247,10 @@ export class BlockPanel {
<span data-type="close" class="block__icon block__icon--show b3-tooltips b3-tooltips__sw" aria-label="${window.siyuan.languages.close}"><svg style="width: 12px;margin: 0 1px;"><use xlink:href="#iconClose"></use></svg></span> <span data-type="close" class="block__icon block__icon--show b3-tooltips b3-tooltips__sw" aria-label="${window.siyuan.languages.close}"><svg style="width: 12px;margin: 0 1px;"><use xlink:href="#iconClose"></use></svg></span>
</div> </div>
<div class="block__content">`; <div class="block__content">`;
if (this.nodeIds.length === 0) { if (this.refDefs.length === 0) {
html += `<div class="ft__smaller ft__smaller ft__secondary b3-form__space--small" contenteditable="false">${window.siyuan.languages.refExpired}</div>`; html += `<div class="ft__smaller ft__smaller ft__secondary b3-form__space--small" contenteditable="false">${window.siyuan.languages.refExpired}</div>`;
} else { } else {
this.nodeIds.forEach((item, index) => { this.refDefs.forEach((item, index) => {
html += `<div class="block__edit fn__flex-1 protyle" data-index="${index}"></div>`; html += `<div class="block__edit fn__flex-1 protyle" data-index="${index}"></div>`;
}); });
} }

View file

@ -334,24 +334,23 @@ export const showPopover = async (app: App, showRef = false) => {
if (!popoverTargetElement || window.siyuan.menus.menu.data?.isSameNode(popoverTargetElement)) { if (!popoverTargetElement || window.siyuan.menus.menu.data?.isSameNode(popoverTargetElement)) {
return; return;
} }
let ids: string[]; let refDefs: IRefDefs[];
let defIds: string[];
let originalRefBlockIDs: IObject let originalRefBlockIDs: IObject
const dataId = popoverTargetElement.getAttribute("data-id"); const dataId = popoverTargetElement.getAttribute("data-id");
if (dataId) { if (dataId) {
// backlink/util/hint/正文标题 上的弹层 // backlink/util/hint/正文标题 上的弹层
if (showRef) { if (showRef) {
const postResponse = await fetchSyncPost("/api/block/getRefIDs", {id: dataId}); const postResponse = await fetchSyncPost("/api/block/getRefIDs", {id: dataId});
ids = postResponse.data.refIDs; refDefs = postResponse.data.refIDs;
defIds = postResponse.data.defIDs;
originalRefBlockIDs = postResponse.data.originalRefBlockIDs; originalRefBlockIDs = postResponse.data.originalRefBlockIDs;
} else { } else {
if (dataId.startsWith("[")) { if (dataId.startsWith("[")) {
ids = JSON.parse(dataId); JSON.parse(dataId).forEach((item: string) => {
refDefs.push({refID: item});
});
} else { } else {
ids = [dataId]; refDefs = [{refID: dataId}];
} }
defIds = JSON.parse(popoverTargetElement.getAttribute("data-defids") || "[]");
} }
} else if (popoverTargetElement.getAttribute("data-type")?.indexOf("virtual-block-ref") > -1) { } else if (popoverTargetElement.getAttribute("data-type")?.indexOf("virtual-block-ref") > -1) {
const nodeElement = hasClosestBlock(popoverTargetElement); const nodeElement = hasClosestBlock(popoverTargetElement);
@ -360,18 +359,18 @@ export const showPopover = async (app: App, showRef = false) => {
anchor: popoverTargetElement.textContent, anchor: popoverTargetElement.textContent,
excludeIDs: [nodeElement.getAttribute("data-node-id")] excludeIDs: [nodeElement.getAttribute("data-node-id")]
}); });
ids = postResponse.data; refDefs = postResponse.data.refDefs;
} }
} else if (popoverTargetElement.getAttribute("data-type")?.split(" ").includes("a")) { } else if (popoverTargetElement.getAttribute("data-type")?.split(" ").includes("a")) {
// 以思源协议开头的链接 // 以思源协议开头的链接
ids = [getIdFromSYProtocol(popoverTargetElement.getAttribute("data-href"))]; refDefs = [{refID: getIdFromSYProtocol(popoverTargetElement.getAttribute("data-href"))}];
} else if (popoverTargetElement.dataset.type === "url") { } else if (popoverTargetElement.dataset.type === "url") {
// 在 database 的 url 列中以思源协议开头的链接 // 在 database 的 url 列中以思源协议开头的链接
ids = [getIdFromSYProtocol(popoverTargetElement.textContent.trim())]; refDefs = [{refID: getIdFromSYProtocol(popoverTargetElement.textContent.trim())}];
} else if (popoverTargetElement.dataset.popoverUrl) { } else if (popoverTargetElement.dataset.popoverUrl) {
// 镜像数据库 // 镜像数据库
const postResponse = await fetchSyncPost(popoverTargetElement.dataset.popoverUrl, {avID: popoverTargetElement.dataset.avId}); const postResponse = await fetchSyncPost(popoverTargetElement.dataset.popoverUrl, {avID: popoverTargetElement.dataset.avId});
ids = postResponse.data; refDefs = postResponse.data.refDefs;
} else { } else {
// pdf // pdf
let targetId; let targetId;
@ -382,7 +381,9 @@ export const showPopover = async (app: App, showRef = false) => {
} else if (popoverTargetElement.classList.contains("pdf__rect")) { } else if (popoverTargetElement.classList.contains("pdf__rect")) {
const relationIds = popoverTargetElement.getAttribute("data-relations"); const relationIds = popoverTargetElement.getAttribute("data-relations");
if (relationIds) { if (relationIds) {
ids = relationIds.split(","); relationIds.split(",").forEach((item: string) => {
refDefs.push({refID: item});
});
url = ""; url = "";
} else { } else {
targetId = popoverTargetElement.getAttribute("data-node-id"); targetId = popoverTargetElement.getAttribute("data-node-id");
@ -394,8 +395,7 @@ export const showPopover = async (app: App, showRef = false) => {
} }
if (url) { if (url) {
const postResponse = await fetchSyncPost(url, {id: targetId}); const postResponse = await fetchSyncPost(url, {id: targetId});
ids = postResponse.data.refIDs; refDefs = postResponse.data.refIDs;
defIds = postResponse.data.defIDs;
originalRefBlockIDs = postResponse.data.originalRefBlockIDs; originalRefBlockIDs = postResponse.data.originalRefBlockIDs;
} }
} }
@ -403,7 +403,7 @@ export const showPopover = async (app: App, showRef = false) => {
let hasPin = false; let hasPin = false;
window.siyuan.blockPanels.find((item) => { window.siyuan.blockPanels.find((item) => {
if ((item.targetElement || typeof item.x === "number") && item.element.getAttribute("data-pin") === "true" if ((item.targetElement || typeof item.x === "number") && item.element.getAttribute("data-pin") === "true"
&& JSON.stringify(ids) === JSON.stringify(item.nodeIds)) { && JSON.stringify(refDefs) === JSON.stringify(item.refDefs)) {
hasPin = true; hasPin = true;
return true; return true;
} }
@ -415,8 +415,7 @@ export const showPopover = async (app: App, showRef = false) => {
app, app,
targetElement: popoverTargetElement, targetElement: popoverTargetElement,
isBacklink: showRef || popoverTargetElement.classList.contains("protyle-attr--refcount") || popoverTargetElement.classList.contains("counter"), isBacklink: showRef || popoverTargetElement.classList.contains("protyle-attr--refcount") || popoverTargetElement.classList.contains("counter"),
nodeIds: ids, refDefs,
defIds,
originalRefBlockIDs, originalRefBlockIDs,
})); }));
} }

View file

@ -184,7 +184,7 @@ export const setDefRefCount = (data: {
countElement.setAttribute("data-id", JSON.stringify(data.rootRefIDs)); countElement.setAttribute("data-id", JSON.stringify(data.rootRefIDs));
} }
} else if (data.rootRefCount > 0) { } else if (data.rootRefCount > 0) {
attrElement.insertAdjacentHTML("beforeend", `<div class="protyle-attr--refcount popover__block" data-defids="[&quot;${data.rootID}&quot;]" data-id="${JSON.stringify(data.rootRefIDs)}" style="">${data.rootRefCount}</div>`); attrElement.insertAdjacentHTML("beforeend", `<div class="protyle-attr--refcount popover__block">${data.rootRefCount}</div>`);
} }
} }
if (data.rootID === data.blockID) { if (data.rootID === data.blockID) {

View file

@ -798,7 +798,7 @@ data-type="navigation-root" data-path="/">
} else { } else {
counterElement.classList.add("fn__none"); counterElement.classList.add("fn__none");
} }
window.siyuan.storage[Constants.LOCAL_FILESPATHS].forEach((item: filesPath) => { window.siyuan.storage[Constants.LOCAL_FILESPATHS].forEach((item: IFilesPath) => {
item.openPaths.forEach((openPath) => { item.openPaths.forEach((openPath) => {
this.selectItem(item.notebookId, openPath, undefined, false); this.selectItem(item.notebookId, openPath, undefined, false);
}); });
@ -1137,9 +1137,9 @@ data-type="navigation-root" data-path="/">
} }
private getOpenPaths() { private getOpenPaths() {
const filesPaths: filesPath[] = []; const filesPaths: IFilesPath[] = [];
this.element.querySelectorAll(".b3-list[data-url]").forEach((item: HTMLElement) => { this.element.querySelectorAll(".b3-list[data-url]").forEach((item: HTMLElement) => {
const notebookPaths: filesPath = { const notebookPaths: IFilesPath = {
notebookId: item.getAttribute("data-url"), notebookId: item.getAttribute("data-url"),
openPaths: [] openPaths: []
}; };

View file

@ -755,7 +755,7 @@ export class Graph extends Model {
isBacklink: false, isBacklink: false,
x: params.event.center.x, x: params.event.center.x,
y: params.event.center.y, y: params.event.center.y,
nodeIds: [node.id], refDefs: [{refID: node.id}]
})); }));
} else { } else {
checkFold(node.id, (zoomIn, action: TProtyleAction[]) => { checkFold(node.id, (zoomIn, action: TProtyleAction[]) => {

View file

@ -314,7 +314,7 @@ export class MobileFiles extends Model {
} else { } else {
counterElement.classList.add("fn__none"); counterElement.classList.add("fn__none");
} }
window.siyuan.storage[Constants.LOCAL_FILESPATHS].forEach((item: filesPath) => { window.siyuan.storage[Constants.LOCAL_FILESPATHS].forEach((item: IFilesPath) => {
item.openPaths.forEach((openPath) => { item.openPaths.forEach((openPath) => {
this.selectItem(item.notebookId, openPath, undefined, false); this.selectItem(item.notebookId, openPath, undefined, false);
}); });
@ -684,9 +684,9 @@ export class MobileFiles extends Model {
} }
private getOpenPaths() { private getOpenPaths() {
const filesPaths: filesPath[] = []; const filesPaths: IFilesPath[] = [];
this.element.querySelectorAll(".b3-list[data-url]").forEach((item: HTMLElement) => { this.element.querySelectorAll(".b3-list[data-url]").forEach((item: HTMLElement) => {
const notebookPaths: filesPath = { const notebookPaths: IFilesPath = {
notebookId: item.getAttribute("data-url"), notebookId: item.getAttribute("data-url"),
openPaths: [] openPaths: []
}; };

View file

@ -379,13 +379,12 @@ export class Plugin {
} }
public addFloatLayer = (options: { public addFloatLayer = (options: {
ids: string[], refDefs: IRefDefs[],
defIds?: string[],
x?: number, x?: number,
y?: number, y?: number,
targetElement?: HTMLElement, targetElement?: HTMLElement,
isBacklink: boolean,
originalRefBlockIDs?: IObject, originalRefBlockIDs?: IObject,
isBacklink: boolean,
}) => { }) => {
window.siyuan.blockPanels.push(new BlockPanel({ window.siyuan.blockPanels.push(new BlockPanel({
app: this.app, app: this.app,
@ -393,8 +392,7 @@ export class Plugin {
isBacklink: options.isBacklink, isBacklink: options.isBacklink,
x: options.x, x: options.x,
y: options.y, y: options.y,
nodeIds: options.ids, refDefs: options.refDefs,
defIds: options.defIds,
})); }));
}; };

View file

@ -346,7 +346,7 @@ export class Title {
} }
this.element.querySelector(".protyle-attr").innerHTML = nodeAttrHTML; this.element.querySelector(".protyle-attr").innerHTML = nodeAttrHTML;
if (response.data.refCount !== 0) { if (response.data.refCount !== 0) {
this.element.querySelector(".protyle-attr").insertAdjacentHTML("beforeend", `<div class="protyle-attr--refcount popover__block" data-defids='${JSON.stringify([protyle.block.rootID])}' data-id='${JSON.stringify(response.data.refIDs)}'>${response.data.refCount}</div>`); this.element.querySelector(".protyle-attr").insertAdjacentHTML("beforeend", `<div class="protyle-attr--refcount popover__block">${response.data.refCount}</div>`);
} }
// 存在设置新建文档名模板,不能使用 Untitled 进行判断https://ld246.com/article/1649301009888 // 存在设置新建文档名模板,不能使用 Untitled 进行判断https://ld246.com/article/1649301009888
if (this.editElement && new Date().getTime() - dayjs(response.data.id.split("-")[0]).toDate().getTime() < 2000) { if (this.editElement && new Date().getTime() - dayjs(response.data.id.split("-")[0]).toDate().getTime() < 2000) {

View file

@ -233,7 +233,7 @@ export const getLocalStorage = (cb: () => void) => {
dark: "dark", dark: "dark",
annoColor: "var(--b3-pdf-background1)" annoColor: "var(--b3-pdf-background1)"
}; };
defaultStorage[Constants.LOCAL_LAYOUTS] = []; // {name: "", layout:{}, time: number, filespaths: filesPath[]} defaultStorage[Constants.LOCAL_LAYOUTS] = []; // {name: "", layout:{}, time: number, filespaths: IFilesPath[]}
defaultStorage[Constants.LOCAL_AI] = []; // {name: "", memo: ""} defaultStorage[Constants.LOCAL_AI] = []; // {name: "", memo: ""}
defaultStorage[Constants.LOCAL_PLUGIN_DOCKS] = {}; // { pluginName: {dockId: IPluginDockTab}} defaultStorage[Constants.LOCAL_PLUGIN_DOCKS] = {}; // { pluginName: {dockId: IPluginDockTab}}
defaultStorage[Constants.LOCAL_PLUGINTOPUNPIN] = []; defaultStorage[Constants.LOCAL_PLUGINTOPUNPIN] = [];
@ -284,7 +284,7 @@ export const getLocalStorage = (cb: () => void) => {
currentTab: "emoji" currentTab: "emoji"
}; };
defaultStorage[Constants.LOCAL_FONTSTYLES] = []; defaultStorage[Constants.LOCAL_FONTSTYLES] = [];
defaultStorage[Constants.LOCAL_FILESPATHS] = []; // filesPath[] defaultStorage[Constants.LOCAL_FILESPATHS] = []; // IFilesPath[]
defaultStorage[Constants.LOCAL_SEARCHDATA] = { defaultStorage[Constants.LOCAL_SEARCHDATA] = {
page: 1, page: 1,
sort: 0, sort: 0,

View file

@ -233,12 +233,12 @@ const setHTML = (options: {
protyle.block.id = protyle.block.rootID; protyle.block.id = protyle.block.rootID;
protyle.wysiwyg.element.setAttribute("data-doc-type", "NodeDocument"); protyle.wysiwyg.element.setAttribute("data-doc-type", "NodeDocument");
} }
if (protyle.options.defId) { protyle.options.defIds?.forEach(item => {
protyle.wysiwyg.element.querySelectorAll(`[data-id="${protyle.options.defId}"]`).forEach(item => { protyle.wysiwyg.element.querySelectorAll(`[data-id="${item}"]`).forEach(item => {
item.classList.add("def--mark"); item.classList.add("def--mark");
}); });
protyle.options.defId = undefined; });
} protyle.options.defIds = [];
if (options.action.includes(Constants.CB_GET_APPEND) || options.action.includes(Constants.CB_GET_BEFORE)) { if (options.action.includes(Constants.CB_GET_APPEND) || options.action.includes(Constants.CB_GET_BEFORE)) {
protyle.app.plugins.forEach(item => { protyle.app.plugins.forEach(item => {
item.eventBus.emit("loaded-protyle-dynamic", { item.eventBus.emit("loaded-protyle-dynamic", {

View file

@ -2436,7 +2436,7 @@ export class WYSIWYG {
app: protyle.app, app: protyle.app,
targetElement: embedItemElement, targetElement: embedItemElement,
isBacklink: false, isBacklink: false,
nodeIds: [embedId], refDefs: [{refID: embedId}]
})); }));
} }
/// #endif /// #endif

View file

@ -1775,7 +1775,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
app: protyle.app, app: protyle.app,
isBacklink: false, isBacklink: false,
targetElement: refElement, targetElement: refElement,
nodeIds: [id], refDefs: [{refID: id}]
})); }));
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();

View file

@ -217,7 +217,12 @@ interface Window {
destroyTheme(): Promise<void> destroyTheme(): Promise<void>
} }
interface filesPath { interface IRefDefs {
refID: string,
defIDs?: string[]
}
interface IFilesPath {
notebookId: string, notebookId: string,
openPaths: string[] openPaths: string[]
} }
@ -234,7 +239,7 @@ interface ISaveLayout {
name: string, name: string,
layout: IObject layout: IObject
time: number time: number
filesPaths: filesPath[] filesPaths: IFilesPath[]
} }
interface IWorkspace { interface IWorkspace {

View file

@ -448,7 +448,7 @@ interface IProtyleOptions {
rootId?: string rootId?: string
originalRefBlockIDs?: IObject originalRefBlockIDs?: IObject
key?: string key?: string
defId?: string defIds?: string[]
render?: { render?: {
background?: boolean background?: boolean
title?: boolean title?: boolean

View file

@ -126,12 +126,12 @@ ${item.label ? "data-label='" + item.label + "'" : ""}>
} }
let iconHTML; let iconHTML;
if (type === "outline") { if (type === "outline") {
iconHTML = `<svg data-defids='["${item.defID}"]' class="b3-list-item__graphic popover__block" data-id="${item.id}" style="height: 22px;width: 10px;"><use xlink:href="#${getIconByType(item.type, item.subType)}"></use></svg>`; iconHTML = `<svg data-showref="true" class="b3-list-item__graphic popover__block" data-id="${item.id}" style="height: 22px;width: 10px;"><use xlink:href="#${getIconByType(item.type, item.subType)}"></use></svg>`;
} else { } else {
if (item.type === "NodeDocument") { if (item.type === "NodeDocument") {
iconHTML = `<span data-defids='["${item.defID}"]' class="b3-list-item__graphic popover__block" data-id="${item.id}">${unicode2Emoji(item.ial.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].file)}</span>`; iconHTML = `<span data-showref="true" class="b3-list-item__graphic popover__block" data-id="${item.id}">${unicode2Emoji(item.ial.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].file)}</span>`;
} else { } else {
iconHTML = `<svg data-defids='["${item.defID}"]' class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${getIconByType(item.type, item.subType)}"></use></svg>`; iconHTML = `<svg data-showref="true" class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${getIconByType(item.type, item.subType)}"></use></svg>`;
} }
} }
let style = ""; let style = "";