From fbe8c2347f39fb8c1a761dcbf0d816d8e6aaed6e Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 14 Sep 2022 23:44:14 +0800 Subject: [PATCH] :sparkles: https://github.com/siyuan-note/siyuan/issues/2911 file-annotation-ref --- app/src/assets/scss/_wysiwyg.scss | 2 +- app/src/protyle/toolbar/index.ts | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/assets/scss/_wysiwyg.scss b/app/src/assets/scss/_wysiwyg.scss index 151da52a3..7280aa7b8 100644 --- a/app/src/assets/scss/_wysiwyg.scss +++ b/app/src/assets/scss/_wysiwyg.scss @@ -246,7 +246,7 @@ transition: var(--b3-transition); } - span[data-type="file-annotation-ref"]:before { + span[data-type~="file-annotation-ref"]:before { content: "🔖 "; } diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index 29d0251d5..9ea647162 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -126,7 +126,7 @@ export class Toolbar { }); const types = this.getCurrentType(); types.forEach(item => { - if (item === "block-ref" || item === "text") { + if (item === "block-ref" || item === "text" || item === "file-annotation-ref") { return; } this.element.querySelector(`[data-type="${item}"]`).classList.add("protyle-toolbar__item--current"); @@ -725,9 +725,7 @@ export class Toolbar { focusByWbr(nodeElement, this.range); }); const anchorElement = this.subElement.querySelector('[data-type="anchor"]') as HTMLInputElement; - if (refElement.getAttribute("data-subtype") === "s") { - anchorElement.value = refElement.textContent; - } + anchorElement.value = refElement.textContent; anchorElement.addEventListener("change", (event) => { refElement.after(document.createElement("wbr")); nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));