From ec2ac0259d1bc11c1b38e37e0b623f7d900c5691 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 18 Mar 2024 12:06:35 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/10634 --- app/src/assets/scss/component/_chip.scss | 6 ++++++ app/src/history/history.ts | 23 +++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/src/assets/scss/component/_chip.scss b/app/src/assets/scss/component/_chip.scss index 355e0d300..1af2d9841 100644 --- a/app/src/assets/scss/component/_chip.scss +++ b/app/src/assets/scss/component/_chip.scss @@ -36,6 +36,12 @@ font-size: 12px; } + &--list { + padding: 0 4px; + margin-right: 4px; + font-family: var(--b3-font-family-code); + } + &--secondary { background-color: var(--b3-theme-secondary); color: var(--b3-theme-on-secondary); diff --git a/app/src/history/history.ts b/app/src/history/history.ts index 14537efcb..c593d635b 100644 --- a/app/src/history/history.ts +++ b/app/src/history/history.ts @@ -537,7 +537,7 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => { const opElement = firstPanelElement.querySelector('.b3-select[data-type="opselect"]') as HTMLSelectElement; const typeElement = firstPanelElement.querySelector('.b3-select[data-type="typeselect"]') as HTMLSelectElement; const notebookElement = firstPanelElement.querySelector('.b3-select[data-type="notebookselect"]') as HTMLSelectElement; - const created = target.getAttribute("data-created"); + const created = target.getAttribute("data-created"); fetchPost("/api/history/getHistoryItems", { notebook: notebookElement.value, query: inputElement.value, @@ -547,11 +547,26 @@ 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 }) => { - html += `
  • + response.data.items.forEach((docItem: { title: string, path: string, op: string }) => { + let chipClass = " b3-chip b3-chip--list " + if (docItem.op === "clean") { + chipClass += "b3-chip--primary "; + } else if (docItem.op === "update") { + chipClass += "b3-chip--info "; + } else if (docItem.op === "delete") { + chipClass += "b3-chip--error "; + } else if (docItem.op === "format") { + chipClass += "b3-chip--pink "; + } else if (docItem.op === "sync") { + chipClass += "b3-chip--success "; + } else if (docItem.op === "replace") { + chipClass += "b3-chip--secondary "; + } + html += `
  • + ${docItem.op.substring(0, 1).toUpperCase()} ${escapeHtml(docItem.title)} - +
  • `;