@frontify/fondue
Version:
Design system of Frontify
106 lines (105 loc) • 2.9 kB
JavaScript
import { createAutoformatPlugin as i, autoformatPunctuation as p, autoformatArrow as u, autoformatLegal as c, autoformatSubscriptNumbers as n, autoformatSubscriptSymbols as f, autoformatSuperscriptNumbers as s, autoformatSuperscriptSymbols as l, autoformatFraction as d } from "@udecode/plate-autoformat";
import { MARK_UNDERLINE as y, MARK_BOLD as g, MARK_ITALIC as h, MARK_STRIKETHROUGH as E, MARK_CODE as T } from "@udecode/plate-basic-marks";
import { toggleList as r, unwrapList as m, ELEMENT_UL as e, ELEMENT_OL as a } from "@udecode/plate-list";
import { Plugin as b } from "../Plugin.es.js";
import { AUTOFORMAT_PLUGIN as k } from "./id.es.js";
import { TextStyles as o } from "../TextStylePlugin/types.es.js";
import { ELEMENT_CHECK_ITEM as L } from "../CheckboxListPlugin/id.es.js";
class O extends b {
constructor(t) {
super(k, {
...t
});
}
plugins() {
return [
i({
options: {
rules: [
...p,
...u,
...c,
...n,
...f,
...s,
...l,
...d,
{
mode: "mark",
type: [y],
match: ["_", "_"],
ignoreTrim: !0
},
{
mode: "mark",
type: [g],
match: ["**", "**"],
ignoreTrim: !0
},
{
mode: "mark",
type: [h],
match: ["*", "*"],
ignoreTrim: !0
},
{
mode: "mark",
type: [E],
match: ["~~", "~~"],
ignoreTrim: !0
},
{
mode: "mark",
type: [T],
match: ["`", "`"],
ignoreTrim: !0
},
{
mode: "block",
match: ["# "],
type: o.heading1
},
{
mode: "block",
match: ["## "],
type: o.heading2
},
{
mode: "block",
match: ["### "],
type: o.heading3
},
{
mode: "block",
match: ["#### "],
type: o.heading4
},
{
mode: "block",
type: e,
match: ["- "],
preFormat: m,
format: (t) => r(t, { type: e })
},
{
mode: "block",
type: a,
match: ["1. ", "1) "],
preFormat: m,
format: (t) => r(t, { type: a })
},
{
mode: "block",
type: L,
match: ["[] "]
}
]
}
})
];
}
}
export {
O as AutoformatPlugin
};
//# sourceMappingURL=index.es.js.map