🧠 font-size can pre-process but with not mathlive size and font-style stucks with out of control on escaping characters

This commit is contained in:
Sahatsawat Kanpai 2025-01-20 20:06:29 +07:00
parent b52225bcf1
commit f34d56ca83

View File

@ -76,6 +76,20 @@ export default class Import extends Plugin {
scriptElement.textContent = latex; scriptElement.textContent = latex;
mathmlElement.replaceWith(scriptElement); mathmlElement.replaceWith(scriptElement);
}); });
// font-family for <span> concat with , serif
const spans = body.querySelectorAll("span");
spans.forEach(span => {
span.style.fontFamily += ", serif";
// check if it's <p> tag has font-size attribute, then apply to <span> 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); this.editor.setData(body.innerHTML);
} catch (error) { } catch (error) {
console.error("Error uploading file:", error); console.error("Error uploading file:", error);