diff --git a/app/src/history/history.ts b/app/src/history/history.ts index 94a4c605d7a..6ec06f421ae 100644 --- a/app/src/history/history.ts +++ b/app/src/history/history.ts @@ -20,6 +20,7 @@ let historyEditor: Protyle; const renderDoc = (element: HTMLElement, currentPage: number) => { const previousElement = element.querySelector('[data-type="docprevious"]'); const nextElement = element.querySelector('[data-type="docnext"]'); + const pageElement = nextElement.nextElementSibling.nextElementSibling; element.setAttribute("data-page", currentPage.toString()); if (currentPage > 1) { previousElement.removeAttribute("disabled"); @@ -83,10 +84,10 @@ const renderDoc = (element: HTMLElement, currentPage: number) => { } else { nextElement.setAttribute("disabled", "disabled"); } - pageBtn.setAttribute("data-totalpage", (response.data.pageCount || 1).toString()); + pageBtn.setAttribute("data-totalPage", (response.data.pageCount || 1).toString()); // nextElement.nextElementSibling.nextElementSibling.textContent = `${currentPage}/${response.data.pageCount || 1}`; - const titleElement = nextElement.nextElementSibling.nextElementSibling; - titleElement.textContent = `${window.siyuan.languages.pageCountAndHistoryCount.replace("${x}", response.data.pageCount).replace("${y}", response.data.totalCount || 1)}`; + pageElement.textContent = `${window.siyuan.languages.pageCountAndHistoryCount.replace("${x}", response.data.pageCount).replace("${y}", response.data.totalCount || 1)}`; + pageElement.classList.remove("fn__none"); if (response.data.histories.length === 0) { listElement.innerHTML = `
  • ${window.siyuan.languages.emptyContent}
  • `; return; @@ -265,7 +266,6 @@ const renderRepo = (element: Element, currentPage: number) => { } else { previousElement.classList.remove("fn__none"); nextElement.classList.remove("fn__none"); - pageElement.classList.remove("fn__none"); pageBtn.classList.remove("fn__none"); element.setAttribute("data-page", currentPage.toString()); if (currentPage > 1) { @@ -280,8 +280,9 @@ const renderRepo = (element: Element, currentPage: number) => { } else { nextElement.setAttribute("disabled", "disabled"); } - element.setAttribute("total-page", response.data.pageCount.toString()); + pageBtn.setAttribute("data-totalPage", (response.data.pageCount || 1).toString()); pageElement.textContent = `${window.siyuan.languages.pageCountAndSnapshotCount.replace("${x}", response.data.pageCount).replace("${y}", response.data.totalCount || 1)}`; + pageElement.classList.remove("fn__none"); renderRepoItem(response, element, selectValue); }); } @@ -354,10 +355,10 @@ export const openHistory = (app: App) => {
    - + - ${window.siyuan.languages.pageCountAndHistoryCount} + ${window.siyuan.languages.pageCountAndHistoryCount}
    @@ -405,10 +406,10 @@ export const openHistory = (app: App) => {
    - + - ${window.siyuan.languages.pageCountAndSnapshotCount} + ${window.siyuan.languages.pageCountAndSnapshotCount}