From e32f7919d03f6811c7c2e15d3bb09543583b861b Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 8 Mar 2024 23:39:18 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/10545 --- app/src/assets/scss/protyle/_attr.scss | 6 +++++- app/src/protyle/wysiwyg/transaction.ts | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/src/assets/scss/protyle/_attr.scss b/app/src/assets/scss/protyle/_attr.scss index 63ab6b23f..4d1b94469 100644 --- a/app/src/assets/scss/protyle/_attr.scss +++ b/app/src/assets/scss/protyle/_attr.scss @@ -9,6 +9,10 @@ align-items: center; line-height: 16px; + &--av span:hover { + color: var(--b3-protyle-inline-blockref-color); + } + & > div.protyle-attr--bookmark { flex: 1; } @@ -37,7 +41,7 @@ &--refcount { right: -16px; - top: 12px; // https://github.com/siyuan-note/siyuan/issues/8784 + top: 12px; // https://github.com/siyuan-note/siyuan/issues/8784 position: absolute; line-height: 16px; padding: 0 4px; diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts index 356e8f578..155234e4d 100644 --- a/app/src/protyle/wysiwyg/transaction.ts +++ b/app/src/protyle/wysiwyg/transaction.ts @@ -493,14 +493,17 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo: aliasHTML = `
${escapeHTML}
`; } else if (key === "memo") { memoHTML = `
`; - } else if (key === "custom-avs") { - avHTML = '
'; + } else if (key === "custom-avs" && data.new["av-names"]) { + avHTML = `
${data.new["av-names"]}
`; } }); let nodeAttrHTML = bookmarkHTML + nameHTML + aliasHTML + memoHTML + avHTML; if (protyle.block.rootID === operation.id) { // 文档 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"); if (refElement) { nodeAttrHTML += refElement.outerHTML; @@ -566,6 +569,9 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo: }, 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"); if (refElement) { nodeAttrHTML += refElement.outerHTML;