From 734abe050c713a3109bb247a821d26b20ef47a01 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 23 Sep 2022 22:10:11 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/5932 --- app/src/protyle/toolbar/Font.ts | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/app/src/protyle/toolbar/Font.ts b/app/src/protyle/toolbar/Font.ts index bbde437ac..1428343c3 100644 --- a/app/src/protyle/toolbar/Font.ts +++ b/app/src/protyle/toolbar/Font.ts @@ -70,6 +70,11 @@ export const fontMenu = (protyle: IProtyle) => { }); lastColorHTML += ""; } + const textElement = protyle.toolbar.range.cloneContents().querySelector('[data-type~="text"]') as HTMLElement; + let fontSize = "16px"; + if (textElement) { + fontSize = textElement.style.fontSize; + } element.innerHTML = `${lastColorHTML}
${window.siyuan.languages.colorFont}
${colorHTML} @@ -86,18 +91,18 @@ export const fontMenu = (protyle: IProtyle) => {
${window.siyuan.languages.fontSize}
`; element.addEventListener(getEventName(), function (event: Event) {