@frontify/fondue
Version:
Design system of Frontify
57 lines (56 loc) • 1.67 kB
JavaScript
var a = Object.defineProperty;
var i = (s, t, e) => t in s ? a(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
var l = (s, t, e) => i(s, typeof t != "symbol" ? t + "" : t, e);
import { jsx as u } from "react/jsx-runtime";
import { createPluginFactory as c } from "@udecode/plate-core";
import { defaultStyles as p } from "../../../utils/defaultStyles.es.js";
import { merge as g } from "../../../../../utilities/merge.es.js";
import { MarkupElement as f } from "../../MarkupElement.es.js";
import { Plugin as y } from "../../Plugin.es.js";
import { alignmentClassnames as C } from "../../helper.es.js";
import { TextStyles as m } from "../types.es.js";
import { getColumnBreakClasses as d } from "../../ColumnBreakPlugin/utils/getColumnBreakClasses.es.js";
const k = "textstyle-custom2-plugin";
class B extends y {
constructor({ styles: e = p.custom2, ...o } = {}) {
super(m.custom2, {
label: "Custom 2",
markupElement: new x(),
...o
});
l(this, "styles", {});
this.styles = e;
}
plugins() {
return [E(this.styles)];
}
}
class x extends f {
constructor(t = k, e = n) {
super(t, e);
}
}
const n = ({ element: s, attributes: t, children: e, styles: o }) => {
const r = s.align;
return /* @__PURE__ */ u(
"p",
{
...t,
className: g([r && C[r], d(s)]),
style: o,
children: e
}
);
}, E = (s) => c({
key: m.custom2,
isElement: !0,
deserializeHtml: {
rules: [{ validClassName: m.custom2 }]
}
})({
component: (t) => /* @__PURE__ */ u(n, { ...t, styles: s })
});
export {
B as Custom2Plugin
};
//# sourceMappingURL=custom2Plugin.es.js.map