From fcf7924059ddf8e39a636d8dea54f8949075ff01 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 14 Jan 2026 15:14:27 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/16814 --- app/src/history/history.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/history/history.ts b/app/src/history/history.ts index a02cd111b..7efcf9e17 100644 --- a/app/src/history/history.ts +++ b/app/src/history/history.ts @@ -198,6 +198,8 @@ const renderRepoItem = (response: IWebSocketData, element: Element, type: string /// #endif let repoHTML = ""; const isPhone = isMobile(); + const selectId: { id: string, time: string }[] = ["getRepoTagSnapshots", "getRepoSnapshots"].includes(type) ? + JSON.parse(element.querySelector(".b3-button[data-type='compare']").getAttribute("data-ids") || "[]") : []; response.data.snapshots.forEach((item: { memo: string, id: string, @@ -234,8 +236,9 @@ ${window.siyuan.languages.fileCount} ${item.count}${item.id.substring(0, 7)} ${statHTML}`; + const hasSelected = selectId.find(subItem => subItem.id === item.id); /// #if MOBILE - repoHTML += `
  • + repoHTML += `
  • ${infoHTML}
    @@ -250,7 +253,7 @@ ${statHTML}`;
  • `; /// #else - repoHTML += `
  • + repoHTML += `
  • ${infoHTML}
    ${actionHTML}
  • `; @@ -678,9 +681,10 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => { const id = target.getAttribute("data-id"); if (target.classList.contains("b3-list-item--focus")) { target.classList.remove("b3-list-item--focus"); - idJSON.forEach((item: { id: string, time: string }, index: number) => { + idJSON.find((item: { id: string, time: string }, index: number) => { if (id === item.id) { idJSON.splice(index, 1); + return true; } }); } else { @@ -688,6 +692,8 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => { while (idJSON.length > 1) { if (idJSON[0].id !== id) { target.parentElement.querySelector(`.b3-list-item[data-id="${idJSON.splice(0, 1)[0].id}"]`)?.classList.remove("b3-list-item--focus"); + } else { + idJSON.splice(0, 1); } } idJSON.push({id, time: target.querySelector('[data-type="hCreated"]').textContent});