diff --git a/app/src/util/history.ts b/app/src/util/history.ts
index cdb836461..996abf898 100644
--- a/app/src/util/history.ts
+++ b/app/src/util/history.ts
@@ -8,6 +8,7 @@ import {hasClosestByClassName} from "../protyle/util/hasClosest";
import {renderAssetsPreview} from "../asset/renderAssets";
import {Protyle} from "../protyle";
import {disabledProtyle, onGet} from "../protyle/util/onGet";
+import * as dayjs from "dayjs";
let historyEditor: Protyle;
const renderDoc = (element: HTMLElement, currentPage: number) => {
@@ -57,24 +58,11 @@ const renderDoc = (element: HTMLElement, currentPage: number) => {
return;
}
let logsHTML = "";
- response.data.histories.forEach((item: { items: { path: string, title: string }[], hCreated: string }, index: number) => {
- logsHTML += `
-
- ${item.hCreated}
+ response.data.histories.forEach((item: string) => {
+ logsHTML += `
+
+ ${dayjs(parseInt(item) * 1000).format("YYYY-MM-DD HH:mm:ss")}
`;
- if (item.items.length > 0) {
- logsHTML += ``;
- item.items.forEach((docItem) => {
- logsHTML += `-
- ${escapeHtml(docItem.title)}
-
-
-
-
-
`;
- });
- logsHTML += "
";
- }
});
element.lastElementChild.firstElementChild.innerHTML = logsHTML;
});
@@ -179,7 +167,7 @@ const renderRmNotebook = (element: HTMLElement) => {
}
let logsHTML = "";
response.data.histories.forEach((item: { items: { path: string, title: string }[], hCreated: string }, index: number) => {
- logsHTML += `
+ logsHTML += `
${item.hCreated}
`;
@@ -393,6 +381,44 @@ export const openHistory = () => {
});
break;
} else if (type === "toggle") {
+ const iconElement = target.firstElementChild.firstElementChild
+ if (iconElement.classList.contains("b3-list-item__arrow--open")) {
+ target.nextElementSibling.classList.add("fn__none");
+ iconElement.classList.remove("b3-list-item__arrow--open");
+ } else {
+ if (target.nextElementSibling && target.nextElementSibling.tagName === "UL") {
+ target.nextElementSibling.classList.remove("fn__none");
+ iconElement.classList.add("b3-list-item__arrow--open");
+ } else {
+ const inputElement = firstPanelElement.querySelector(".b3-text-field") as HTMLInputElement;
+ 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;
+ fetchPost("/api/history/getHistoryItems", {
+ notebook: notebookElement.value,
+ query: inputElement.value,
+ op: opElement.value,
+ type: parseInt(typeElement.value),
+ created: target.getAttribute("data-created")
+ }, (response) => {
+ target.nextElementSibling.classList.remove("fn__none");
+ iconElement.classList.add("b3-list-item__arrow--open");
+ let html = "";
+ response.data.items.forEach((docItem: { title: string, path: string }) => {
+ html += `
+ ${escapeHtml(docItem.title)}
+
+
+
+
+`;
+ });
+ target.insertAdjacentHTML("afterend", ``);
+ });
+ }
+ }
+ break;
+ } else if (type === "rmtoggle") {
target.nextElementSibling.classList.toggle("fn__none");
target.firstElementChild.firstElementChild.classList.toggle("b3-list-item__arrow--open");
break;