This commit is contained in:
Vanessa 2022-07-06 00:35:39 +08:00
parent df5d23a3ba
commit 69abf741b0
2 changed files with 12 additions and 12 deletions

View file

@ -89,7 +89,7 @@ export const setPadding = (protyle: IProtyle) => {
}); });
} }
if (window.siyuan.config.editor.displayBookmarkIcon) { if (window.siyuan.config.editor.displayBookmarkIcon) {
const editorAttrElement = document.getElementById("editorAttr") const editorAttrElement = document.getElementById("editorAttr");
if (editorAttrElement) { if (editorAttrElement) {
editorAttrElement.innerHTML = `.protyle-wysiwyg--attr .b3-tooltips:after { max-width: ${protyle.wysiwyg.element.clientWidth - min16 - min24}px; }`; editorAttrElement.innerHTML = `.protyle-wysiwyg--attr .b3-tooltips:after { max-width: ${protyle.wysiwyg.element.clientWidth - min16 - min24}px; }`;
} }

View file

@ -112,10 +112,10 @@ const renderRepoItem = (response: IWebSocketData, element: Element, type: string
let actionHTML = `<span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="genTag" aria-label="${window.siyuan.languages.tagSnapshot}"><svg><use xlink:href="#iconTags"></use></svg></span> let actionHTML = `<span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="genTag" aria-label="${window.siyuan.languages.tagSnapshot}"><svg><use xlink:href="#iconTags"></use></svg></span>
<span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="rollback" aria-label="${window.siyuan.languages.rollback}"><svg><use xlink:href="#iconUndo"></use></svg></span>`; <span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="rollback" aria-label="${window.siyuan.languages.rollback}"><svg><use xlink:href="#iconUndo"></use></svg></span>`;
if (type === "download") { if (type === "download") {
actionHTML = `<span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="downloadSnapshot" aria-label="${window.siyuan.languages.download}"><svg><use xlink:href="#iconDownload"></use></svg></span>` actionHTML = `<span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="downloadSnapshot" aria-label="${window.siyuan.languages.download}"><svg><use xlink:href="#iconDownload"></use></svg></span>`;
} else if (type === "upload") { } else if (type === "upload") {
actionHTML = `<span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="uploadSnapshot" aria-label="${window.siyuan.languages.upload}"><svg><use xlink:href="#iconUpload"></use></svg></span> actionHTML = `<span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="uploadSnapshot" aria-label="${window.siyuan.languages.upload}"><svg><use xlink:href="#iconUpload"></use></svg></span>
<span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="rollback" aria-label="${window.siyuan.languages.rollback}"><svg><use xlink:href="#iconUndo"></use></svg></span>` <span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="rollback" aria-label="${window.siyuan.languages.rollback}"><svg><use xlink:href="#iconUndo"></use></svg></span>`;
} }
let repoHTML = ""; let repoHTML = "";
response.data.snapshots.forEach((item: { memo: string, id: string, hCreated: string, count: number, hSize: string, tag: string }) => { response.data.snapshots.forEach((item: { memo: string, id: string, hCreated: string, count: number, hSize: string, tag: string }) => {
@ -131,7 +131,7 @@ const renderRepoItem = (response: IWebSocketData, element: Element, type: string
</li>`; </li>`;
}); });
element.lastElementChild.innerHTML = `${repoHTML}`; element.lastElementChild.innerHTML = `${repoHTML}`;
} };
const renderRepo = (element: Element, currentPage: number) => { const renderRepo = (element: Element, currentPage: number) => {
const previousElement = element.querySelector('[data-type="previous"]'); const previousElement = element.querySelector('[data-type="previous"]');
@ -140,18 +140,18 @@ const renderRepo = (element: Element, currentPage: number) => {
if (currentPage === -1) { if (currentPage === -1) {
fetchPost("/api/repo/getRepoTagSnapshots", {}, (response) => { fetchPost("/api/repo/getRepoTagSnapshots", {}, (response) => {
renderRepoItem(response, element, "upload"); renderRepoItem(response, element, "upload");
}) });
} }
if (currentPage === -2) { if (currentPage === -2) {
fetchPost("/api/repo/getCloudRepoTagSnapshots", {}, (response) => { fetchPost("/api/repo/getCloudRepoTagSnapshots", {}, (response) => {
renderRepoItem(response, element, "download"); renderRepoItem(response, element, "download");
}) });
} }
previousElement.classList.add("fn__none") previousElement.classList.add("fn__none");
nextElement.classList.add("fn__none") nextElement.classList.add("fn__none");
} else { } else {
previousElement.classList.remove("fn__none") previousElement.classList.remove("fn__none");
nextElement.classList.remove("fn__none") nextElement.classList.remove("fn__none");
element.setAttribute("data-init", "true"); element.setAttribute("data-init", "true");
element.setAttribute("data-page", currentPage.toString()); element.setAttribute("data-page", currentPage.toString());
if (currentPage > 1) { if (currentPage > 1) {
@ -299,7 +299,7 @@ export const openHistory = () => {
} else if (value === "2") { } else if (value === "2") {
renderRepo(repoElement, -2); renderRepo(repoElement, -2);
} }
}) });
dialog.element.addEventListener("click", (event) => { dialog.element.addEventListener("click", (event) => {
let target = event.target as HTMLElement; let target = event.target as HTMLElement;
while (target && !target.isEqualNode(dialog.element)) { while (target && !target.isEqualNode(dialog.element)) {
@ -436,7 +436,7 @@ export const openHistory = () => {
fetchPost("/api/repo/downloadCloudSnapshot", { fetchPost("/api/repo/downloadCloudSnapshot", {
tag: target.parentElement.getAttribute("data-tag"), tag: target.parentElement.getAttribute("data-tag"),
id: target.parentElement.getAttribute("data-id") id: target.parentElement.getAttribute("data-id")
}) });
} else if (type === "genTag") { } else if (type === "genTag") {
const genTagDialog = new Dialog({ const genTagDialog = new Dialog({
title: window.siyuan.languages.tagSnapshot, title: window.siyuan.languages.tagSnapshot,