소스 검색

:art: https://github.com/siyuan-note/siyuan/issues/10545

Vanessa 1 년 전
부모
커밋
e32f7919d0
2개의 변경된 파일13개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 1
      app/src/assets/scss/protyle/_attr.scss
  2. 8 2
      app/src/protyle/wysiwyg/transaction.ts

+ 5 - 1
app/src/assets/scss/protyle/_attr.scss

@@ -9,6 +9,10 @@
   align-items: center;
   align-items: center;
   line-height: 16px;
   line-height: 16px;
 
 
+  &--av span:hover {
+    color: var(--b3-protyle-inline-blockref-color);
+  }
+
   & > div.protyle-attr--bookmark {
   & > div.protyle-attr--bookmark {
     flex: 1;
     flex: 1;
   }
   }
@@ -37,7 +41,7 @@
 
 
   &--refcount {
   &--refcount {
     right: -16px;
     right: -16px;
-    top: 12px;  // https://github.com/siyuan-note/siyuan/issues/8784
+    top: 12px; // https://github.com/siyuan-note/siyuan/issues/8784
     position: absolute;
     position: absolute;
     line-height: 16px;
     line-height: 16px;
     padding: 0 4px;
     padding: 0 4px;

+ 8 - 2
app/src/protyle/wysiwyg/transaction.ts

@@ -493,14 +493,17 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
                 aliasHTML = `<div class="protyle-attr--alias"><svg><use xlink:href="#iconA"></use></svg>${escapeHTML}</div>`;
                 aliasHTML = `<div class="protyle-attr--alias"><svg><use xlink:href="#iconA"></use></svg>${escapeHTML}</div>`;
             } else if (key === "memo") {
             } else if (key === "memo") {
                 memoHTML = `<div class="protyle-attr--memo b3-tooltips b3-tooltips__sw" aria-label="${escapeHTML}"><svg><use xlink:href="#iconM"></use></svg></div>`;
                 memoHTML = `<div class="protyle-attr--memo b3-tooltips b3-tooltips__sw" aria-label="${escapeHTML}"><svg><use xlink:href="#iconM"></use></svg></div>`;
-            } else if (key === "custom-avs") {
-                avHTML = '<div class="protyle-attr--av"><svg><use xlink:href="#iconDatabase"></use></svg></div>';
+            } else if (key === "custom-avs" && data.new["av-names"]) {
+                avHTML = `<div class="protyle-attr--av"><svg><use xlink:href="#iconDatabase"></use></svg>${data.new["av-names"]}</div>`;
             }
             }
         });
         });
         let nodeAttrHTML = bookmarkHTML + nameHTML + aliasHTML + memoHTML + avHTML;
         let nodeAttrHTML = bookmarkHTML + nameHTML + aliasHTML + memoHTML + avHTML;
         if (protyle.block.rootID === operation.id) {
         if (protyle.block.rootID === operation.id) {
             // 文档
             // 文档
             if (protyle.title) {
             if (protyle.title) {
+                if (data.new["custom-avs"] && !data.new["av-names"]) {
+                    nodeAttrHTML += protyle.title.element.querySelector(".protyle-attr--av")?.outerHTML || "";
+                }
                 const refElement = protyle.title.element.querySelector(".protyle-attr--refcount");
                 const refElement = protyle.title.element.querySelector(".protyle-attr--refcount");
                 if (refElement) {
                 if (refElement) {
                     nodeAttrHTML += refElement.outerHTML;
                     nodeAttrHTML += refElement.outerHTML;
@@ -566,6 +569,9 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
                     }, 450);
                     }, 450);
                 }
                 }
             });
             });
+            if (data.new["custom-avs"] && !data.new["av-names"]) {
+                nodeAttrHTML += item.lastElementChild.querySelector(".protyle-attr--av")?.outerHTML || "";
+            }
             const refElement = item.lastElementChild.querySelector(".protyle-attr--refcount");
             const refElement = item.lastElementChild.querySelector(".protyle-attr--refcount");
             if (refElement) {
             if (refElement) {
                 nodeAttrHTML += refElement.outerHTML;
                 nodeAttrHTML += refElement.outerHTML;