瀏覽代碼

:bug: fix https://github.com/siyuan-note/siyuan/issues/5466

Vanessa 3 年之前
父節點
當前提交
3306098a03
共有 2 個文件被更改,包括 9 次插入11 次删除
  1. 1 0
      app/src/assets/scss/_function.scss
  2. 8 11
      app/src/util/history.ts

+ 1 - 0
app/src/assets/scss/_function.scss

@@ -165,6 +165,7 @@
       padding: 0 8px;
       font-size: 12px;
       line-height: 16px;
+      margin-right: 8px;
     }
   }
 

+ 8 - 11
app/src/util/history.ts

@@ -116,22 +116,23 @@ const renderRepoItem = (response: IWebSocketData, element: Element, type: string
     let repoHTML = "";
     response.data.snapshots.forEach((item: { memo: string, id: string, hCreated: string, count: number, hSize: string, tag: string }) => {
         if (isMobile()) {
-            repoHTML += `<li class="b3-list-item b3-list-item--two" data-id="${item.id}" data-tag="${item.tag}">
+            repoHTML += `<li class="b3-list-item b3-list-item--two">
     <div class="b3-list-item__first">
+        <span class="b3-list-item__text">${escapeHtml(item.memo)}</span>
         <span class="b3-chip b3-chip--secondary${item.tag ? "" : " fn__none"}">${item.tag}</span>
-        ${item.hCreated}<span class="fn__space"></span>
+    </div>
+    <div>
+        <span class="ft__smaller ft__on-surface">${item.hCreated}</span>
         <span class="b3-list-item__meta">${item.hSize}</span>
-        <span class="fn__flex-1"></span>
-        ${actionHTML}
+        <span class="b3-list-item__meta">${window.siyuan.languages.fileCount}${item.count}</span>
     </div>
-    <span class="b3-list-item__meta">${escapeHtml(item.memo)}</span>
+    <div class="fn__flex" style="justify-content: flex-end;" data-id="${item.id}" data-tag="${item.tag}">${actionHTML}</div>
 </li>`;
         } else {
             repoHTML += `<li class="b3-list-item b3-list-item--hide-action" data-id="${item.id}" data-tag="${item.tag}">
     <div class="fn__flex-1">
         <div class="b3-list-item__text">
             ${escapeHtml(item.memo)}
-            <span class="fn__space"></span>
             <span class="b3-chip b3-chip--secondary${item.tag ? "" : " fn__none"}">${item.tag}</span>
         </div>
         <div>
@@ -440,11 +441,7 @@ export const openHistory = () => {
                 const tag = target.parentElement.getAttribute("data-tag");
                 confirmDialog(window.siyuan.languages.delete, `${window.siyuan.languages.confirmDelete} <i>${tag}</i>?`, () => {
                     fetchPost("/api/repo/" + type, {tag}, () => {
-                        if (target.parentElement.parentElement.childElementCount === 1) {
-                            target.parentElement.parentElement.innerHTML = `<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`;
-                        } else {
-                            target.parentElement.remove();
-                        }
+                        renderRepo(repoElement, type === "removeRepoTagSnapshot" ? -1 : -2);
                     });
                 });
                 break;