Skip to content

改进数据历史类型悬浮提示 https://ld246.com/article/1714662110914 #11228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion app/src/history/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {
}, (response) => {
iconElement.classList.add("b3-list-item__arrow--open");
let html = "";
let ariaLabel = "";
response.data.items.forEach((docItem: {
title: string,
path: string,
Expand All @@ -578,19 +579,28 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {
let chipClass = " b3-chip b3-chip--list ";
if (docItem.op === "clean") {
chipClass += "b3-chip--primary ";
ariaLabel = window.siyuan.languages.historyClean;
} else if (docItem.op === "update") {
chipClass += "b3-chip--info ";
ariaLabel = window.siyuan.languages.historyUpdate;
} else if (docItem.op === "delete") {
chipClass += "b3-chip--error ";
ariaLabel = window.siyuan.languages.historyDelete;
} else if (docItem.op === "format") {
chipClass += "b3-chip--pink ";
ariaLabel = window.siyuan.languages.historyFormat;
} else if (docItem.op === "sync") {
chipClass += "b3-chip--success ";
ariaLabel = window.siyuan.languages.historySync;
} else if (docItem.op === "replace") {
chipClass += "b3-chip--secondary ";
ariaLabel = window.siyuan.languages.historyReplace;
} else if (docItem.op === "outline") {
chipClass += "b3-chip--warning ";
ariaLabel = window.siyuan.languages.historyOutline;
}
html += `<li data-notebook-id="${docItem.notebook}" title="${escapeAttr(docItem.title)}" data-created="${created}" data-type="${typeElement.value === "2" ? "assets" : "doc"}" data-path="${docItem.path}" class="b3-list-item b3-list-item--hide-action" style="padding-left: 22px">
<span class="${opElement.value === "all" ? "" : "fn__none"}${chipClass}b3-tooltips b3-tooltips__n" aria-label="${docItem.op}">${docItem.op.substring(0, 1).toUpperCase()}</span>
<span class="${opElement.value === "all" ? "" : "fn__none"}${chipClass}b3-tooltips b3-tooltips__n" aria-label="${ariaLabel}">${docItem.op.substring(0, 1).toUpperCase()}</span>
<span class="b3-list-item__text">${escapeHtml(docItem.title)}</span>
<span class="fn__space"></span>
<span class="b3-list-item__action b3-tooltips b3-tooltips__n" data-type="rollback" aria-label="${window.siyuan.languages.rollback}">
Expand Down