diff --git a/app/src/assets/scss/_function.scss b/app/src/assets/scss/_function.scss index 26b97eefc..70c6a0f78 100644 --- a/app/src/assets/scss/_function.scss +++ b/app/src/assets/scss/_function.scss @@ -157,7 +157,9 @@ display: flex; flex-direction: column; height: 100%; - box-sizing: border-box + box-sizing: border-box; + border-radius: 0 0 4px 4px; + overflow: hidden; } &__repoheader { diff --git a/app/src/assets/scss/_list.scss b/app/src/assets/scss/_list.scss index ed9eff012..9f30cd60b 100644 --- a/app/src/assets/scss/_list.scss +++ b/app/src/assets/scss/_list.scss @@ -64,8 +64,8 @@ display: none; } - &:hover .b3-list-item__action, - &:hover .fn__space { + &:hover > .b3-list-item__action, + &:hover > .fn__space { display: flex; } } diff --git a/app/src/util/history.ts b/app/src/util/history.ts index f7170e693..fe380b61e 100644 --- a/app/src/util/history.ts +++ b/app/src/util/history.ts @@ -39,7 +39,7 @@ const renderDoc = (notebook: INotebook, element: HTMLElement) => { logsHTML += `
  • ${escapeHtml(docItem.title)} - +
  • `; @@ -79,7 +79,7 @@ const renderAssets = (element: HTMLElement) => { logsHTML += `
  • ${escapeHtml(docItem.title)} - +
  • `; @@ -121,32 +121,29 @@ const renderRepo = (element: Element, currentPage: number) => { nextElement.setAttribute("disabled", "disabled"); } if (response.data.logs.length === 0) { - element.lastElementChild.firstElementChild.innerHTML = `
  • ${window.siyuan.languages.emptyContent}
  • `; + element.lastElementChild.innerHTML = `
  • ${window.siyuan.languages.emptyContent}
  • `; return; } let repoHTML = ""; response.data.logs.forEach((item: { memo: string, id: string, hCreated: string, count: number, hSize: string }, index: number) => { - repoHTML += `
  • - ${item.hCreated} - - + repoHTML += `
  • +
    + ${item.hCreated} + + ${escapeHtml(item.memo)} + + ${item.hSize} +
    + + + + + ${item.count}
  • `; - if (index === 0) { - element.lastElementChild.lastElementChild.innerHTML = `
    - ${window.siyuan.languages.fileSize} - ${item.hSize} - - - ${window.siyuan.languages.fileCount} - ${item.count} -
    -
    -

    ${escapeHtml(item.memo)}

    `; - } }); - element.lastElementChild.firstElementChild.innerHTML = `${repoHTML}`; + element.lastElementChild.innerHTML = `${repoHTML}`; }); }; @@ -169,7 +166,7 @@ const renderRmNotebook = (element: HTMLElement) => { logsHTML += `
  • ${escapeHtml(docItem.title)} - + ${window.siyuan.languages.rollback}
  • `; @@ -222,14 +219,13 @@ export const openHistory = () => {
    - + -
    - -
    -
    + `, @@ -310,7 +306,7 @@ export const openHistory = () => { window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY}); window.siyuan.menus.menu.element.style.zIndex = "310"; break; - } else if (target.classList.contains("b3-list-item__action") && !window.siyuan.config.readonly) { + } else if (target.classList.contains("b3-list-item__action") && type === "rollback" && !window.siyuan.config.readonly) { confirmDialog("⚠️ " + window.siyuan.languages.rollback, `${window.siyuan.languages.rollbackConfirm.replace("${date}", target.parentElement.textContent.trim())}`, () => { const dataType = target.parentElement.getAttribute("data-type"); if (dataType === "assets") { @@ -337,7 +333,7 @@ export const openHistory = () => { target.nextElementSibling.classList.toggle("fn__none"); target.firstElementChild.firstElementChild.classList.toggle("b3-list-item__arrow--open"); break; - } else if (target.classList.contains("b3-list-item") && type !== "notebook") { + } else if (target.classList.contains("b3-list-item") && (type === "assets" || type === "doc")) { const dataPath = target.getAttribute("data-path"); if (type === "assets") { const type = dataPath.substr(dataPath.lastIndexOf(".")).toLowerCase(); @@ -356,17 +352,6 @@ export const openHistory = () => { }, (response) => { firstPanelElement.lastElementChild.innerHTML = response.data.content; }); - } else if (type === "repo") { - target.parentElement.nextElementSibling.innerHTML = `
    - ${window.siyuan.languages.fileSize} - ${target.getAttribute("data-hsize")} - - - ${window.siyuan.languages.fileCount} - ${target.getAttribute("data-count")} -
    -
    -

    ${escapeHtml(decodeURIComponent(target.getAttribute("data-memo")))}

    `; } let currentItem = hasClosestByClassName(target, "b3-list") as HTMLElement; if (currentItem) { @@ -402,6 +387,34 @@ export const openHistory = () => { genRepoDialog.destroy(); }); break; + } else if (type === "genTag") { + const genTagDialog = new Dialog({ + title: window.siyuan.languages.snapshotMemo, + content: `
    + +
    +
    +
    + +
    `, + width: isMobile() ? "80vw" : "520px", + }); + const textareaElement = genTagDialog.element.querySelector("textarea"); + textareaElement.focus(); + const btnsElement = genTagDialog.element.querySelectorAll(".b3-button"); + btnsElement[0].addEventListener("click", () => { + genTagDialog.destroy(); + }); + btnsElement[1].addEventListener("click", () => { + fetchPost("/api/repo/tagSnapshot", { + id: target.parentElement.getAttribute("data-id"), + name: textareaElement.value + }, () => { + renderRepo(repoElement, 1); + }); + genTagDialog.destroy(); + }); + break; } else if ((type === "previous" || type === "next") && target.getAttribute("disabled") !== "disabled") { const currentPage = parseInt(repoElement.getAttribute("data-page")); renderRepo(repoElement, type === "previous" ? currentPage - 1 : currentPage + 1);