diff --git a/app/src/asset/renderAssets.ts b/app/src/asset/renderAssets.ts
index 521177956..7c1053a82 100644
--- a/app/src/asset/renderAssets.ts
+++ b/app/src/asset/renderAssets.ts
@@ -13,6 +13,6 @@ export const renderAssetsPreview = (pathString: string) => {
} else if (Constants.SIYUAN_ASSETS_VIDEO.includes(type)) {
return ``;
} else {
- return "";
+ return pathString;
}
};
diff --git a/app/src/assets/scss/_function.scss b/app/src/assets/scss/_function.scss
index 6ce98a884..2ff18ac7a 100644
--- a/app/src/assets/scss/_function.scss
+++ b/app/src/assets/scss/_function.scss
@@ -158,12 +158,6 @@
color: var(--b3-theme-on-background);
}
- &__asset {
- background-color: var(--b3-theme-background);
- padding: 16px;
- border-radius: 0 0 4px 0;
- }
-
&__repo {
background-color: var(--b3-theme-background);
display: flex;
diff --git a/app/src/util/history.ts b/app/src/util/history.ts
index 42b8ce8d7..3a28fa79e 100644
--- a/app/src/util/history.ts
+++ b/app/src/util/history.ts
@@ -17,27 +17,34 @@ const renderDoc = (element: HTMLElement, currentPage: number) => {
previousElement.setAttribute("disabled", "disabled");
}
const inputElement = element.querySelector(".b3-text-field") as HTMLInputElement;
- const selectElements = element.querySelectorAll(".b3-select");
- window.localStorage.setItem(Constants.LOCAL_HISTORYNOTEID, (selectElements[1] as HTMLSelectElement).value);
+ const opElement = element.querySelector('.b3-select[data-type="opselect"]') as HTMLSelectElement;
+ const typeElement = element.querySelector('.b3-select[data-type="typeselect"]') as HTMLSelectElement;
+ const notebookElement = element.querySelector('.b3-select[data-type="notebookselect"]') as HTMLSelectElement;
+ window.localStorage.setItem(Constants.LOCAL_HISTORYNOTEID, notebookElement.value);
+ if (typeElement.value === "0") {
+ opElement.removeAttribute("disabled")
+ notebookElement.removeAttribute("disabled")
+ } else {
+ opElement.setAttribute("disabled", "disabled")
+ notebookElement.setAttribute("disabled", "disabled")
+ }
fetchPost("/api/history/searchHistory", {
- notebook: (selectElements[1] as HTMLSelectElement).value,
+ notebook: notebookElement.value,
query: inputElement.value,
page: currentPage,
- op: (selectElements[0] as HTMLSelectElement).value,
- type: 0
+ op: opElement.value,
+ type: parseInt(typeElement.value)
}, (response) => {
if (currentPage < response.data.pageCount) {
nextElement.removeAttribute("disabled");
} else {
nextElement.setAttribute("disabled", "disabled");
}
-
if (response.data.histories.length === 0) {
element.lastElementChild.lastElementChild.innerHTML = "";
element.lastElementChild.firstElementChild.innerHTML = `
${window.siyuan.languages.emptyContent}`;
return;
}
-
let logsHTML = "";
response.data.histories.forEach((item: { items: { path: string, title: string }[], hCreated: string }, index: number) => {
logsHTML += `
@@ -47,7 +54,7 @@ const renderDoc = (element: HTMLElement, currentPage: number) => {
if (item.items.length > 0) {
logsHTML += ``;
item.items.forEach((docItem, docIndex) => {
- logsHTML += `-
+ logsHTML += `
-
${escapeHtml(docItem.title)}
@@ -56,13 +63,16 @@ const renderDoc = (element: HTMLElement, currentPage: number) => {
`;
});
logsHTML += "
";
-
if (index === 0) {
- fetchPost("/api/history/getDocHistoryContent", {
- historyPath: item.items[0].path
- }, (contentResponse) => {
- element.lastElementChild.lastElementChild.innerHTML = contentResponse.data.content;
- });
+ if (typeElement.value === "1") {
+ element.lastElementChild.lastElementChild.innerHTML = renderAssetsPreview(item.items[0].path);
+ } else {
+ fetchPost("/api/history/getDocHistoryContent", {
+ historyPath: item.items[0].path
+ }, (contentResponse) => {
+ element.lastElementChild.lastElementChild.innerHTML = contentResponse.data.content;
+ });
+ }
}
}
});
@@ -70,42 +80,6 @@ const renderDoc = (element: HTMLElement, currentPage: number) => {
});
};
-const renderAssets = (element: HTMLElement) => {
- element.setAttribute("data-init", "true");
- fetchPost("/api/history/getAssetsHistory", {}, (response) => {
- if (response.data.histories.length === 0) {
- element.lastElementChild.innerHTML = "";
- element.firstElementChild.innerHTML = `${window.siyuan.languages.emptyContent}`;
- return;
- }
- let logsHTML = "";
- response.data.histories.forEach((item: { items: { path: string, title: string }[], hCreated: string }, index: number) => {
- logsHTML += `
-
- ${item.hCreated}
-`;
- if (item.items.length > 0) {
- logsHTML += ``;
- item.items.forEach((docItem, docIndex) => {
- logsHTML += `-
- ${escapeHtml(docItem.title)}
-
-
-
-
-
`;
- });
- logsHTML += "
";
-
- if (index === 0) {
- element.lastElementChild.innerHTML = renderAssetsPreview(item.items[0].path);
- }
- }
- });
- element.firstElementChild.innerHTML = logsHTML;
- });
-};
-
const renderRepoItem = (response: IWebSocketData, element: Element, type: string) => {
if (response.data.snapshots.length === 0) {
element.lastElementChild.innerHTML = `${window.siyuan.languages.emptyContent}`;
@@ -248,8 +222,7 @@ export const openHistory = () => {
const dialog = new Dialog({
content: `
-
${window.siyuan.languages.doc}
-
${window.siyuan.languages.assets}
+
${window.siyuan.languages.dataHistory}
${window.siyuan.languages.removedNotebook}
${window.siyuan.languages.dataSnapshot}
@@ -265,7 +238,12 @@ export const openHistory = () => {
-