From cf2079edf91fd3d542f6a85e1cb182ded51981f9 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 3 Apr 2024 09:07:40 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/10846 --- app/src/history/doc.ts | 1 - app/src/history/history.ts | 13 +++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/history/doc.ts b/app/src/history/doc.ts index 97e80558d9f..51221293a5f 100644 --- a/app/src/history/doc.ts +++ b/app/src/history/doc.ts @@ -181,7 +181,6 @@ export const openDocHistory = (options: { }); }; - const getHistoryPath = (target: Element, op: string, id: string, cb: (path: string) => void) => { isLoading = true; const path = target.getAttribute("data-path"); diff --git a/app/src/history/history.ts b/app/src/history/history.ts index d404b990395..8b5182da3e3 100644 --- a/app/src/history/history.ts +++ b/app/src/history/history.ts @@ -312,7 +312,7 @@ export const openHistory = (app: App) => { } }); - let notebookSelectHTML = ``; + let notebookSelectHTML = ``; window.siyuan.notebooks.forEach((item) => { if (!item.closed) { notebookSelectHTML += ` `; @@ -510,7 +510,7 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => { }); } else if (dataType === "doc") { fetchPost("/api/history/rollbackDocHistory", { - notebook: (firstPanelElement.querySelector('.b3-select[data-type="notebookselect"]') as HTMLSelectElement).value, + notebook: target.parentElement.getAttribute("data-notebook-id"), historyPath: target.parentElement.getAttribute("data-path") }); } else if (dataType === "notebook") { @@ -557,7 +557,12 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => { }, (response) => { iconElement.classList.add("b3-list-item__arrow--open"); let html = ""; - response.data.items.forEach((docItem: { title: string, path: string, op: string }) => { + response.data.items.forEach((docItem: { + title: string, + path: string, + op: string, + notebook: string + }) => { let chipClass = " b3-chip b3-chip--list "; if (docItem.op === "clean") { chipClass += "b3-chip--primary "; @@ -572,7 +577,7 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => { } else if (docItem.op === "replace") { chipClass += "b3-chip--secondary "; } - html += `
  • + html += `
  • ${docItem.op.substring(0, 1).toUpperCase()} ${escapeHtml(docItem.title)}