From f34d56ca83aec54f7170227ac9e0b32afdcd1eb3 Mon Sep 17 00:00:00 2001 From: Sahatsawat Kanpai Date: Mon, 20 Jan 2025 20:06:29 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=A0=20font-size=20can=20pre-process=20?= =?UTF-8?q?but=20with=20not=20mathlive=20size=20and=20font-style=20stucks?= =?UTF-8?q?=20with=20out=20of=20control=20on=20escaping=20characters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/import.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/import.ts b/src/import.ts index c211814..c65c01f 100644 --- a/src/import.ts +++ b/src/import.ts @@ -76,6 +76,20 @@ export default class Import extends Plugin { scriptElement.textContent = latex; mathmlElement.replaceWith(scriptElement); }); + // font-family for concat with , serif + const spans = body.querySelectorAll("span"); + spans.forEach(span => { + span.style.fontFamily += ", serif"; + // check if it's

tag has font-size attribute, then apply to tag + const p = span.parentElement; + if (p && p.tagName === "P") { + const fontSize = p.style.fontSize; + if (fontSize) { + span.style.fontSize = fontSize; + } + } + }); + console.log("Converted HTML:", body.innerHTML); this.editor.setData(body.innerHTML); } catch (error) { console.error("Error uploading file:", error);