@frontify/fondue
Version:
Design system of Frontify
18 lines (17 loc) • 1.17 kB
JavaScript
import n from "escape-html";
import { BOLD_CLASSES as S } from "../../Plugins/MarkPlugin/BoldPlugin/BoldMarkupElement.es.js";
import { CODE_CLASSES as f } from "../../Plugins/MarkPlugin/CodePlugin/CodeMarkupElement.es.js";
import { ITALIC_CLASSES as m } from "../../Plugins/MarkPlugin/ItalicPlugin/ItalicMarkupElement.es.js";
import { STRIKETHROUGH_CLASSES as c } from "../../Plugins/MarkPlugin/StrikethroughPlugin/StrikethroughMarkupElement.es.js";
import { UNDERLINE_CLASSES as $ } from "../../Plugins/MarkPlugin/UnderlinePlugin/UnderlineMarkupElement.es.js";
const b = (r) => {
let s = n(r.text);
s === "" && (s = ""), s = s.replaceAll(`
`, "<br />");
const { bold: p, italic: i, underline: t, strikethrough: a, code: o, subscript: e, superscript: l } = r;
return p && (s = `<span class="${S}">${s}</span>`), i && (s = `<span class="${m}">${s}</span>`), t && (s = `<span class="${$}">${s}</span>`), a && (s = `<span class="${c}">${s}</span>`), o && (s = `<span class="${f}">${s}</span>`), e ? s = `<sub>${s}</sub>` : l && (s = `<sup>${s}</sup>`), s;
};
export {
b as serializeLeafToHtml
};
//# sourceMappingURL=serializeLeafToHtml.es.js.map