From 72d6174d7b0b61be8db42dcf7a21512fafbc1f2d Mon Sep 17 00:00:00 2001 From: Hufe921 Date: Thu, 29 Dec 2022 15:54:12 +0800 Subject: [PATCH] feat:add font selection and font wysiwyg --- index.html | 22 +++++++++++++++++----- src/main.ts | 3 ++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index cdff544..ee164bd 100644 --- a/index.html +++ b/index.html @@ -31,11 +31,23 @@ 微软雅黑
diff --git a/src/main.ts b/src/main.ts index 7303242..efd83b9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -925,9 +925,10 @@ window.onload = function () { // 富文本 fontOptionDom.querySelectorAll('li').forEach(li => li.classList.remove('active')) - const curFontDom = fontOptionDom.querySelector(`[data-family=${payload.font}]`) + const curFontDom = fontOptionDom.querySelector(`[data-family='${payload.font}']`) if (curFontDom) { fontSelectDom.innerText = curFontDom.innerText + fontSelectDom.style.fontFamily = payload.font curFontDom.classList.add('active') } payload.bold ? boldDom.classList.add('active') : boldDom.classList.remove('active')