UNPKG

@frontify/fondue

Version:
34 lines (33 loc) 1.35 kB
import { parseRawValue as i } from "../utils/parseRawValue.es.js"; import { serializeNodeToHtmlRecursive as d } from "./utils/serializeNodeToHtmlRecursive.es.js"; import { defaultPlugins as c } from "../Plugins/defaultPlugins.es.js"; import { mapMentionable as u } from "../Plugins/MentionPlugin/helpers/mapMentionable.es.js"; import { defaultStyles as $ } from "../utils/defaultStyles.es.js"; const T = (o, e = c, l = 1, r = "normal", t = "") => { const s = i({ raw: o, plugins: e }), n = e.getStyles; return y(s, { columns: l, columnGap: r, styles: n, customClass: t }); }, g = async (o, e = c, l = 1, r = "normal", t = "") => { const s = i({ raw: o, plugins: e }), n = e.getStyles; return Promise.resolve(y(s, { columns: l, columnGap: r, styles: n, customClass: t })); }, y = (o, { mentionable: e, columns: l = 1, columnGap: r = "normal", customClass: t = "", styles: s = $ } = {}) => { const n = e ? u(e) : /* @__PURE__ */ new Map(); let m = ""; for (let a = 0, f = o.length; a < f; a++) m += d(o[a], s, { mappedMentionable: n }); const p = `${t ? "" : `columns:${l};`} column-gap:${r};`; return l > 1 || t ? `<div style="${p}" class="${t}">${m}</div>` : m; }; export { y as serializeNodesToHtml, T as serializeRawToHtml, g as serializeRawToHtmlAsync }; //# sourceMappingURL=serializeToHtml.es.js.map