@milkdown/preset-commonmark 6.2.0 → 6.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.es.js CHANGED
@@ -1,34 +1,17 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { createMark, createShortcut, createNode, createPlugin, AtomList } from "@milkdown/utils";
21
- import { createCmdKey, createCmd, schemaCtx, commandsCtx, editorViewCtx } from "@milkdown/core";
22
- import { markRule, calculateTextPosition, findSelectedNodeOfType } from "@milkdown/prose";
23
- import { toggleMark, wrapIn, setBlockType } from "@milkdown/prose/commands";
24
- import { InputRule, wrappingInputRule, textblockTypeInputRule } from "@milkdown/prose/inputrules";
25
- import { PluginKey, TextSelection, Plugin, NodeSelection, Selection } from "@milkdown/prose/state";
26
- import { Fragment } from "@milkdown/prose/model";
27
- import { ReplaceStep, AddMarkStep } from "@milkdown/prose/transform";
28
- import { splitListItem, sinkListItem, liftListItem } from "@milkdown/prose/schema-list";
29
- import links from "remark-inline-links";
30
- import { Decoration, DecorationSet } from "@milkdown/prose/view";
31
- const SupportedKeys = {
1
+ import { createMark as B, createShortcut as h, createNode as L, createPlugin as De, AtomList as ye } from "@milkdown/utils";
2
+ import { createCmdKey as I, createCmd as M, schemaCtx as A, commandsCtx as Ne, editorViewCtx as P, getPalette as He } from "@milkdown/core";
3
+ import { markRule as _, calculateTextPosition as Te, cloneTr as Oe, findSelectedNodeOfType as F, getNodeFromSchema as Ae } from "@milkdown/prose";
4
+ import { toggleMark as W, wrapIn as de, setBlockType as E } from "@milkdown/prose/commands";
5
+ import { expectDomTypeError as D, missingRootElement as Ee } from "@milkdown/exception";
6
+ import { InputRule as me, wrappingInputRule as q, textblockTypeInputRule as J } from "@milkdown/prose/inputrules";
7
+ import { PluginKey as T, TextSelection as ge, Plugin as H, NodeSelection as _e, Selection as Le } from "@milkdown/prose/state";
8
+ import { Fragment as R } from "@milkdown/prose/model";
9
+ import { ReplaceStep as ve, AddMarkStep as $e } from "@milkdown/prose/transform";
10
+ import { DecorationSet as O, Decoration as Q } from "@milkdown/prose/view";
11
+ import { splitListItem as Se, sinkListItem as Re, liftListItem as Be } from "@milkdown/prose/schema-list";
12
+ import Pe from "remark-inline-links";
13
+ import { visit as We } from "unist-util-visit";
14
+ const k = {
32
15
  HardBreak: "HardBreak",
33
16
  Blockquote: "Blockquote",
34
17
  BulletList: "BulletList",
@@ -40,6 +23,7 @@ const SupportedKeys = {
40
23
  H4: "H4",
41
24
  H5: "H5",
42
25
  H6: "H6",
26
+ DowngradeHeading: "DowngradeHeading",
43
27
  Text: "Text",
44
28
  CodeInline: "CodeInline",
45
29
  Em: "Em",
@@ -47,372 +31,283 @@ const SupportedKeys = {
47
31
  NextListItem: "NextListItem",
48
32
  SinkListItem: "SinkListItem",
49
33
  LiftListItem: "LiftListItem"
50
- };
51
- const id$a = "code_inline";
52
- const ToggleInlineCode = createCmdKey("ToggleInlineCode");
53
- const codeInline = createMark((utils) => {
54
- return {
55
- id: id$a,
56
- schema: () => ({
57
- priority: 100,
58
- code: true,
59
- inclusive: false,
60
- parseDOM: [{ tag: "code" }],
61
- toDOM: (mark) => ["code", { class: utils.getClassName(mark.attrs, "code-inline") }],
62
- parseMarkdown: {
63
- match: (node) => node.type === "inlineCode",
64
- runner: (state, node, markType) => {
65
- state.openMark(markType);
66
- state.addText(node["value"]);
67
- state.closeMark(markType);
68
- }
69
- },
70
- toMarkdown: {
71
- match: (mark) => mark.type.name === id$a,
72
- runner: (state, mark, node) => {
73
- state.withMark(mark, "inlineCode", node.text || "");
74
- }
34
+ }, pe = "code_inline", X = I("ToggleInlineCode"), qe = B((i) => ({
35
+ id: pe,
36
+ schema: () => ({
37
+ priority: 100,
38
+ code: !0,
39
+ inclusive: !1,
40
+ parseDOM: [{ tag: "code" }],
41
+ toDOM: (e) => ["code", { class: i.getClassName(e.attrs, "code-inline") }],
42
+ parseMarkdown: {
43
+ match: (e) => e.type === "inlineCode",
44
+ runner: (e, t, r) => {
45
+ e.openMark(r), e.addText(t.value), e.closeMark(r);
46
+ }
47
+ },
48
+ toMarkdown: {
49
+ match: (e) => e.type.name === pe,
50
+ runner: (e, t, r) => {
51
+ e.withMark(t, "inlineCode", r.text || "");
75
52
  }
76
- }),
77
- inputRules: (markType) => [markRule(/(?:^|[^`])(`([^`]+)`)$/, markType)],
78
- commands: (markType) => [createCmd(ToggleInlineCode, () => toggleMark(markType))],
79
- shortcuts: {
80
- [SupportedKeys.CodeInline]: createShortcut(ToggleInlineCode, "Mod-e")
81
53
  }
82
- };
83
- });
84
- const id$9 = "em";
85
- const ToggleItalic = createCmdKey("ToggleItalic");
86
- const em = createMark((utils) => ({
87
- id: id$9,
54
+ }),
55
+ inputRules: (e) => [_(/(?:^|[^`])(`([^`]+)`)$/, e)],
56
+ commands: (e) => [M(X, () => W(e))],
57
+ shortcuts: {
58
+ [k.CodeInline]: h(X, "Mod-e")
59
+ }
60
+ })), U = "em", Y = I("ToggleItalic"), Ke = B((i) => ({
61
+ id: U,
88
62
  schema: () => ({
89
63
  parseDOM: [
90
64
  { tag: "i" },
91
65
  { tag: "em" },
92
- { style: "font-style", getAttrs: (value) => value === "italic" }
66
+ { style: "font-style", getAttrs: (e) => e === "italic" }
93
67
  ],
94
- toDOM: (mark) => ["em", { class: utils.getClassName(mark.attrs, id$9) }],
68
+ toDOM: (e) => ["em", { class: i.getClassName(e.attrs, U) }],
95
69
  parseMarkdown: {
96
- match: (node) => node.type === "emphasis",
97
- runner: (state, node, markType) => {
98
- state.openMark(markType);
99
- state.next(node.children);
100
- state.closeMark(markType);
70
+ match: (e) => e.type === "emphasis",
71
+ runner: (e, t, r) => {
72
+ e.openMark(r), e.next(t.children), e.closeMark(r);
101
73
  }
102
74
  },
103
75
  toMarkdown: {
104
- match: (mark) => mark.type.name === id$9,
105
- runner: (state, mark) => {
106
- state.withMark(mark, "emphasis");
76
+ match: (e) => e.type.name === U,
77
+ runner: (e, t) => {
78
+ e.withMark(t, "emphasis");
107
79
  }
108
80
  }
109
81
  }),
110
- inputRules: (markType) => [
111
- markRule(/(?:^|[^_])(_([^_]+)_)$/, markType),
112
- markRule(/(?:^|[^*])(\*([^*]+)\*)$/, markType)
82
+ inputRules: (e) => [
83
+ _(/(?:^|[^_])(_([^_]+)_)$/, e),
84
+ _(/(?:^|[^*])(\*([^*]+)\*)$/, e)
113
85
  ],
114
- commands: (markType) => [createCmd(ToggleItalic, () => toggleMark(markType))],
86
+ commands: (e) => [M(Y, () => W(e))],
115
87
  shortcuts: {
116
- [SupportedKeys.Em]: createShortcut(ToggleItalic, "Mod-i")
88
+ [k.Em]: h(Y, "Mod-i")
117
89
  }
118
- }));
119
- const key$1 = new PluginKey("MILKDOWN_LINK_INPUT");
120
- const ToggleLink = createCmdKey("ToggleLink");
121
- const ModifyLink = createCmdKey("ModifyLink");
122
- const id$8 = "link";
123
- const link = createMark((utils, options) => {
124
- return {
125
- id: id$8,
126
- schema: () => ({
127
- attrs: {
128
- href: {},
129
- title: { default: null }
130
- },
131
- inclusive: false,
132
- parseDOM: [
133
- {
134
- tag: "a[href]",
135
- getAttrs: (dom) => {
136
- if (!(dom instanceof HTMLElement)) {
137
- throw new Error();
138
- }
139
- return { href: dom.getAttribute("href"), title: dom.getAttribute("title") };
140
- }
141
- }
142
- ],
143
- toDOM: (mark) => ["a", __spreadProps(__spreadValues({}, mark.attrs), { class: utils.getClassName(mark.attrs, id$8) })],
144
- parseMarkdown: {
145
- match: (node) => node.type === "link",
146
- runner: (state, node, markType) => {
147
- const url = node["url"];
148
- const title = node["title"];
149
- state.openMark(markType, { href: url, title });
150
- state.next(node.children);
151
- state.closeMark(markType);
152
- }
153
- },
154
- toMarkdown: {
155
- match: (mark) => mark.type.name === id$8,
156
- runner: (state, mark) => {
157
- state.withMark(mark, "link", void 0, {
158
- title: mark.attrs["title"],
159
- url: mark.attrs["href"]
160
- });
90
+ })), Fe = new T("MILKDOWN_LINK_INPUT"), we = I("ToggleLink"), Z = I("ModifyLink"), v = "link", Ue = B((i, e) => ({
91
+ id: v,
92
+ schema: () => ({
93
+ attrs: {
94
+ href: {},
95
+ title: { default: null }
96
+ },
97
+ inclusive: !1,
98
+ parseDOM: [
99
+ {
100
+ tag: "a[href]",
101
+ getAttrs: (t) => {
102
+ if (!(t instanceof HTMLElement))
103
+ throw D(t);
104
+ return { href: t.getAttribute("href"), title: t.getAttribute("title") };
161
105
  }
162
106
  }
163
- }),
164
- commands: (markType) => [
165
- createCmd(ToggleLink, (href = "") => toggleMark(markType, { href })),
166
- createCmd(ModifyLink, (href = "") => (state, dispatch) => {
167
- var _a;
168
- if (!dispatch)
169
- return false;
170
- const { marks: marks2 } = state.schema;
171
- let node;
172
- let pos = -1;
173
- const { selection } = state;
174
- const { from, to } = selection;
175
- state.doc.nodesBetween(from, from === to ? to + 1 : to, (n, p) => {
176
- var _a2;
177
- if ((_a2 = marks2["link"]) == null ? void 0 : _a2.isInSet(n.marks)) {
178
- node = n;
179
- pos = p;
180
- return false;
181
- }
182
- return;
183
- });
184
- if (!node)
185
- return false;
186
- const mark = node.marks.find(({ type }) => type === markType);
187
- if (!mark)
188
- return false;
189
- const start = pos;
190
- const end = pos + node.nodeSize;
191
- const { tr } = state;
192
- const linkMark = (_a = marks2["link"]) == null ? void 0 : _a.create(__spreadProps(__spreadValues({}, mark.attrs), { href }));
193
- if (!linkMark)
194
- return false;
195
- dispatch(tr.removeMark(start, end, mark).addMark(start, end, linkMark).setSelection(new TextSelection(tr.selection.$anchor)).scrollIntoView());
196
- return true;
197
- })
198
107
  ],
199
- inputRules: (markType, ctx) => [
200
- new InputRule(/\[(?<text>.*?)]\((?<href>.*?)(?=“|\))"?(?<title>[^"]+)?"?\)/, (state, match, start, end) => {
201
- const [okay, text2 = "", href, title] = match;
202
- const { tr } = state;
203
- if (okay) {
204
- const content = text2 || "link";
205
- tr.replaceWith(start, end, ctx.get(schemaCtx).text(content)).addMark(start, content.length + start, markType.create({ title, href }));
108
+ toDOM: (t) => ["a", { ...t.attrs, class: i.getClassName(t.attrs, v) }],
109
+ parseMarkdown: {
110
+ match: (t) => t.type === "link",
111
+ runner: (t, r, n) => {
112
+ const s = r.url, a = r.title;
113
+ t.openMark(n, { href: s, title: a }), t.next(r.children), t.closeMark(n);
114
+ }
115
+ },
116
+ toMarkdown: {
117
+ match: (t) => t.type.name === v,
118
+ runner: (t, r) => {
119
+ t.withMark(r, "link", void 0, {
120
+ title: r.attrs.title,
121
+ url: r.attrs.href
122
+ });
123
+ }
124
+ }
125
+ }),
126
+ commands: (t) => [
127
+ M(we, (r = "") => W(t, { href: r })),
128
+ M(Z, (r = "") => (n, s) => {
129
+ var y;
130
+ if (!s)
131
+ return !1;
132
+ const { marks: a } = n.schema;
133
+ let o, l = -1;
134
+ const { selection: c } = n, { from: u, to: f } = c;
135
+ if (n.doc.nodesBetween(u, u === f ? f + 1 : f, (N, x) => {
136
+ var w;
137
+ if ((w = a.link) != null && w.isInSet(N.marks))
138
+ return o = N, l = x, !1;
139
+ }), !o)
140
+ return !1;
141
+ const d = o.marks.find(({ type: N }) => N === t);
142
+ if (!d)
143
+ return !1;
144
+ const m = l, g = l + o.nodeSize, { tr: p } = n, b = (y = a.link) == null ? void 0 : y.create({ ...d.attrs, href: r });
145
+ return b ? (s(p.removeMark(m, g, d).addMark(m, g, b).setSelection(new ge(p.selection.$anchor)).scrollIntoView()), !0) : !1;
146
+ })
147
+ ],
148
+ inputRules: (t, r) => [
149
+ new me(/\[(?<text>.*?)]\((?<href>.*?)(?=“|\))"?(?<title>[^"]+)?"?\)/, (n, s, a, o) => {
150
+ const [l, c = "", u, f] = s, { tr: d } = n;
151
+ if (l) {
152
+ const m = c || "link";
153
+ d.replaceWith(a, o, r.get(A).text(m)).addMark(a, m.length + a, t.create({ title: f, href: u }));
154
+ }
155
+ return d;
156
+ })
157
+ ],
158
+ prosePlugins: (t, r) => {
159
+ let n = !1;
160
+ return [
161
+ new H({
162
+ key: Fe,
163
+ view: (s) => {
164
+ var u, f, d;
165
+ const a = i.themeManager.get("input-chip", {
166
+ placeholder: (f = (u = e == null ? void 0 : e.input) == null ? void 0 : u.placeholder) != null ? f : "Input Web Link",
167
+ buttonText: (d = e == null ? void 0 : e.input) == null ? void 0 : d.buttonText,
168
+ onUpdate: (m) => {
169
+ r.get(Ne).call(Z, m);
170
+ },
171
+ calculatePosition: (m, g) => {
172
+ Te(m, g, (p, b, y, N) => {
173
+ const x = m.dom.parentElement;
174
+ if (!x)
175
+ throw Ee();
176
+ const w = b.left - p.left;
177
+ let K = p.left - N.left - (y.width - w) / 2, fe = p.bottom - N.top + 14 + x.scrollTop;
178
+ return n && (fe = p.top - N.top - y.height - 14 + x.scrollTop), K < 0 && (K = 0), [fe, K];
179
+ });
180
+ }
181
+ });
182
+ if (!a)
183
+ return {};
184
+ const o = (m) => {
185
+ const { selection: g, doc: p } = m.state, { from: b, to: y } = g;
186
+ if (!m.hasFocus())
187
+ return !1;
188
+ if (g.empty && g instanceof ge && y < p.content.size && b < p.content.size && p.rangeHasMark(b, b === y ? y + 1 : y, t))
189
+ return n = !1, !0;
190
+ if (g instanceof _e) {
191
+ const { node: N } = g;
192
+ if (N.type.name === "image" && N.marks.findIndex((x) => x.type.name === v) > -1)
193
+ return n = !0, !0;
194
+ }
195
+ return !1;
196
+ }, l = (m) => {
197
+ const { selection: g } = m.state;
198
+ let p;
199
+ const { from: b, to: y } = g;
200
+ if (m.state.doc.nodesBetween(b, b === y ? y + 1 : y, (w) => {
201
+ if (t.isInSet(w.marks))
202
+ return p = w, !1;
203
+ }), !p)
204
+ return;
205
+ const N = p.marks.find((w) => w.type === t);
206
+ return N ? N.attrs.href : void 0;
207
+ }, c = (m) => {
208
+ if (!m.editable)
209
+ return;
210
+ o(m) ? (a.show(m), a.update(l(m))) : a.hide();
211
+ };
212
+ return a.init(s), c(s), {
213
+ update: (m, g) => {
214
+ (g == null ? void 0 : g.doc.eq(m.state.doc)) && g.selection.eq(m.state.selection) || requestAnimationFrame(() => {
215
+ c(m);
216
+ });
217
+ },
218
+ destroy: () => {
219
+ a.destroy();
220
+ }
221
+ };
206
222
  }
207
- return tr;
208
223
  })
224
+ ];
225
+ }
226
+ })), V = "strong", ee = I("ToggleBold"), Ve = B((i) => ({
227
+ id: V,
228
+ schema: () => ({
229
+ parseDOM: [
230
+ { tag: "b" },
231
+ { tag: "strong" },
232
+ { style: "font-style", getAttrs: (e) => e === "bold" }
209
233
  ],
210
- prosePlugins: (type, ctx) => {
211
- let renderOnTop = false;
212
- return [
213
- new Plugin({
214
- key: key$1,
215
- view: (editorView) => {
216
- var _a, _b, _c;
217
- const inputChipRenderer = utils.themeManager.get("input-chip", {
218
- placeholder: (_b = (_a = options == null ? void 0 : options.input) == null ? void 0 : _a.placeholder) != null ? _b : "Input Web Link",
219
- buttonText: (_c = options == null ? void 0 : options.input) == null ? void 0 : _c.buttonText,
220
- onUpdate: (value) => {
221
- ctx.get(commandsCtx).call(ModifyLink, value);
222
- },
223
- calculatePosition: (view, input) => {
224
- calculateTextPosition(view, input, (start, end, target, parent) => {
225
- const $editor = view.dom.parentElement;
226
- if (!$editor) {
227
- throw new Error();
228
- }
229
- const selectionWidth = end.left - start.left;
230
- let left = start.left - parent.left - (target.width - selectionWidth) / 2;
231
- let top = start.bottom - parent.top + 14 + $editor.scrollTop;
232
- if (renderOnTop) {
233
- top = start.top - parent.top - target.height - 14 + $editor.scrollTop;
234
- }
235
- if (left < 0)
236
- left = 0;
237
- return [top, left];
238
- });
239
- }
240
- });
241
- if (!inputChipRenderer)
242
- return {};
243
- const shouldDisplay = (view) => {
244
- const { selection, doc: doc2 } = view.state;
245
- const { from, to } = selection;
246
- if (!view.hasFocus()) {
247
- return false;
248
- }
249
- if (selection.empty && selection instanceof TextSelection && to < doc2.content.size && from < doc2.content.size && doc2.rangeHasMark(from, from === to ? to + 1 : to, type)) {
250
- renderOnTop = false;
251
- return true;
252
- }
253
- if (selection instanceof NodeSelection) {
254
- const { node } = selection;
255
- if (node.type.name === "image" && node.marks.findIndex((mark) => mark.type.name === id$8) > -1) {
256
- renderOnTop = true;
257
- return true;
258
- }
259
- }
260
- return false;
261
- };
262
- const getCurrentLink = (view) => {
263
- const { selection } = view.state;
264
- let node;
265
- const { from, to } = selection;
266
- view.state.doc.nodesBetween(from, from === to ? to + 1 : to, (n) => {
267
- if (type.isInSet(n.marks)) {
268
- node = n;
269
- return false;
270
- }
271
- return;
272
- });
273
- if (!node)
274
- return;
275
- const mark = node.marks.find((m) => m.type === type);
276
- if (!mark)
277
- return;
278
- const value = mark.attrs["href"];
279
- return value;
280
- };
281
- const renderByView = (view) => {
282
- if (!view.editable) {
283
- return;
284
- }
285
- const display = shouldDisplay(view);
286
- if (display) {
287
- inputChipRenderer.show(view);
288
- inputChipRenderer.update(getCurrentLink(view));
289
- } else {
290
- inputChipRenderer.hide();
291
- }
292
- };
293
- inputChipRenderer.init(editorView);
294
- renderByView(editorView);
295
- return {
296
- update: (view, prevState) => {
297
- const isEqualSelection = (prevState == null ? void 0 : prevState.doc.eq(view.state.doc)) && prevState.selection.eq(view.state.selection);
298
- if (isEqualSelection)
299
- return;
300
- requestAnimationFrame(() => {
301
- renderByView(view);
302
- });
303
- },
304
- destroy: () => {
305
- inputChipRenderer.destroy();
306
- }
307
- };
308
- }
309
- })
310
- ];
311
- }
312
- };
313
- });
314
- const id$7 = "strong";
315
- const ToggleBold = createCmdKey("ToggleBold");
316
- const strong = createMark((utils) => {
317
- return {
318
- id: id$7,
319
- schema: () => ({
320
- parseDOM: [
321
- { tag: "b" },
322
- { tag: "strong" },
323
- { style: "font-style", getAttrs: (value) => value === "bold" }
324
- ],
325
- toDOM: (mark) => ["strong", { class: utils.getClassName(mark.attrs, id$7) }],
326
- parseMarkdown: {
327
- match: (node) => node.type === "strong",
328
- runner: (state, node, markType) => {
329
- state.openMark(markType);
330
- state.next(node.children);
331
- state.closeMark(markType);
332
- }
333
- },
334
- toMarkdown: {
335
- match: (mark) => mark.type.name === id$7,
336
- runner: (state, mark) => {
337
- state.withMark(mark, "strong");
338
- }
234
+ toDOM: (e) => ["strong", { class: i.getClassName(e.attrs, V) }],
235
+ parseMarkdown: {
236
+ match: (e) => e.type === "strong",
237
+ runner: (e, t, r) => {
238
+ e.openMark(r), e.next(t.children), e.closeMark(r);
239
+ }
240
+ },
241
+ toMarkdown: {
242
+ match: (e) => e.type.name === V,
243
+ runner: (e, t) => {
244
+ e.withMark(t, "strong");
339
245
  }
340
- }),
341
- inputRules: (markType) => [
342
- markRule(/(?:__)([^_]+)(?:__)$/, markType),
343
- markRule(/(?:\*\*)([^*]+)(?:\*\*)$/, markType)
344
- ],
345
- commands: (markType) => [createCmd(ToggleBold, () => toggleMark(markType))],
346
- shortcuts: {
347
- [SupportedKeys.Bold]: createShortcut(ToggleBold, "Mod-b")
348
246
  }
349
- };
350
- });
351
- const marks = [codeInline(), em(), strong(), link()];
352
- const id$6 = "blockquote";
353
- const WrapInBlockquote = createCmdKey("WrapInBlockquote");
354
- const blockquote = createNode((utils) => {
355
- return {
356
- id: id$6,
357
- schema: () => ({
358
- content: "block+",
359
- group: "block",
360
- defining: true,
361
- parseDOM: [{ tag: "blockquote" }],
362
- toDOM: (node) => ["blockquote", { class: utils.getClassName(node.attrs, id$6) }, 0],
363
- parseMarkdown: {
364
- match: ({ type }) => type === id$6,
365
- runner: (state, node, type) => {
366
- state.openNode(type).next(node.children).closeNode();
367
- }
368
- },
369
- toMarkdown: {
370
- match: (node) => node.type.name === id$6,
371
- runner: (state, node) => {
372
- state.openNode("blockquote").next(node.content).closeNode();
373
- }
247
+ }),
248
+ inputRules: (e) => [
249
+ _(/(?:__)([^_]+)(?:__)$/, e),
250
+ _(/(?:\*\*)([^*]+)(?:\*\*)$/, e)
251
+ ],
252
+ commands: (e) => [M(ee, () => W(e))],
253
+ shortcuts: {
254
+ [k.Bold]: h(ee, "Mod-b")
255
+ }
256
+ })), je = [qe(), Ke(), Ve(), Ue()], $ = "blockquote", te = I("WrapInBlockquote"), ze = L((i) => ({
257
+ id: $,
258
+ schema: () => ({
259
+ content: "block+",
260
+ group: "block",
261
+ defining: !0,
262
+ parseDOM: [{ tag: "blockquote" }],
263
+ toDOM: (e) => ["blockquote", { class: i.getClassName(e.attrs, $) }, 0],
264
+ parseMarkdown: {
265
+ match: ({ type: e }) => e === $,
266
+ runner: (e, t, r) => {
267
+ e.openNode(r).next(t.children).closeNode();
268
+ }
269
+ },
270
+ toMarkdown: {
271
+ match: (e) => e.type.name === $,
272
+ runner: (e, t) => {
273
+ e.openNode("blockquote").next(t.content).closeNode();
374
274
  }
375
- }),
376
- inputRules: (nodeType) => [wrappingInputRule(/^\s*>\s$/, nodeType)],
377
- commands: (nodeType) => [createCmd(WrapInBlockquote, () => wrapIn(nodeType))],
378
- shortcuts: {
379
- [SupportedKeys.Blockquote]: createShortcut(WrapInBlockquote, "Mod-Shift-b")
380
275
  }
381
- };
382
- });
383
- const WrapInBulletList = createCmdKey("WrapInBulletList");
384
- const bulletList = createNode((utils) => {
385
- const id2 = "bullet_list";
276
+ }),
277
+ inputRules: (e) => [q(/^\s*>\s$/, e)],
278
+ commands: (e) => [M(te, () => de(e))],
279
+ shortcuts: {
280
+ [k.Blockquote]: h(te, "Mod-Shift-b")
281
+ }
282
+ })), re = I("WrapInBulletList"), Ge = L((i) => {
283
+ const e = "bullet_list";
386
284
  return {
387
- id: id2,
285
+ id: e,
388
286
  schema: () => ({
389
287
  content: "listItem+",
390
288
  group: "block",
391
289
  parseDOM: [{ tag: "ul" }],
392
- toDOM: (node) => {
393
- return ["ul", { class: utils.getClassName(node.attrs, "bullet-list") }, 0];
394
- },
290
+ toDOM: (t) => ["ul", { class: i.getClassName(t.attrs, "bullet-list") }, 0],
395
291
  parseMarkdown: {
396
- match: ({ type, ordered }) => type === "list" && !ordered,
397
- runner: (state, node, type) => {
398
- state.openNode(type).next(node.children).closeNode();
292
+ match: ({ type: t, ordered: r }) => t === "list" && !r,
293
+ runner: (t, r, n) => {
294
+ t.openNode(n).next(r.children).closeNode();
399
295
  }
400
296
  },
401
297
  toMarkdown: {
402
- match: (node) => node.type.name === id2,
403
- runner: (state, node) => {
404
- state.openNode("list", void 0, { ordered: false }).next(node.content).closeNode();
298
+ match: (t) => t.type.name === e,
299
+ runner: (t, r) => {
300
+ t.openNode("list", void 0, { ordered: !1 }).next(r.content).closeNode();
405
301
  }
406
302
  }
407
303
  }),
408
- inputRules: (nodeType) => [wrappingInputRule(/^\s*([-+*])\s$/, nodeType)],
409
- commands: (nodeType) => [createCmd(WrapInBulletList, () => wrapIn(nodeType))],
304
+ inputRules: (t) => [q(/^\s*([-+*])\s$/, t)],
305
+ commands: (t) => [M(re, () => de(t))],
410
306
  shortcuts: {
411
- [SupportedKeys.BulletList]: createShortcut(WrapInBulletList, "Mod-Alt-8")
307
+ [k.BulletList]: h(re, "Mod-Alt-8")
412
308
  }
413
309
  };
414
- });
415
- const languageOptions = [
310
+ }), Je = [
416
311
  "",
417
312
  "javascript",
418
313
  "typescript",
@@ -429,304 +324,354 @@ const languageOptions = [
429
324
  "go",
430
325
  "rust",
431
326
  "markdown"
432
- ];
433
- const backtickInputRegex = /^```(?<language>[a-z]*)?[\s\n]$/;
434
- const tildeInputRegex = /^~~~(?<language>[a-z]*)?[\s\n]$/;
435
- const TurnIntoCodeFence = createCmdKey("TurnIntoCodeFence");
436
- const id$5 = "fence";
437
- const codeFence = createNode((utils, options) => {
438
- const languageList = (options == null ? void 0 : options.languageList) || languageOptions;
327
+ ], Qe = /^```(?<language>[a-z]*)?[\s\n]$/, Xe = /^~~~(?<language>[a-z]*)?[\s\n]$/, ne = I("TurnIntoCodeFence"), j = "fence", Ye = L((i, e) => {
328
+ const t = (e == null ? void 0 : e.languageList) || Je;
439
329
  return {
440
- id: id$5,
441
- schema: (ctx) => ({
330
+ id: j,
331
+ schema: (r) => ({
442
332
  content: "text*",
443
333
  group: "block",
444
334
  marks: "",
445
- defining: true,
446
- code: true,
335
+ defining: !0,
336
+ code: !0,
447
337
  attrs: {
448
338
  language: {
449
339
  default: ""
450
340
  },
451
341
  fold: {
452
- default: true
342
+ default: !0
453
343
  }
454
344
  },
455
345
  parseDOM: [
456
346
  {
457
347
  tag: "div.code-fence-container",
458
348
  preserveWhitespace: "full",
459
- getAttrs: (dom) => {
460
- var _a;
461
- if (!(dom instanceof HTMLElement)) {
462
- throw new Error("Parse DOM error.");
463
- }
464
- return { language: (_a = dom.querySelector("pre")) == null ? void 0 : _a.dataset["language"] };
349
+ getAttrs: (n) => {
350
+ var s;
351
+ if (!(n instanceof HTMLElement))
352
+ throw D(n);
353
+ return { language: (s = n.querySelector("pre")) == null ? void 0 : s.dataset.language };
465
354
  },
466
- getContent: (dom, schema) => {
467
- var _a, _b;
468
- if (!(dom instanceof HTMLElement)) {
469
- throw new Error("Parse DOM error.");
470
- }
471
- const textNode = schema.text((_b = (_a = dom.querySelector("pre")) == null ? void 0 : _a.textContent) != null ? _b : "");
472
- return Fragment.from(textNode);
355
+ getContent: (n, s) => {
356
+ var l, c;
357
+ if (!(n instanceof HTMLElement))
358
+ throw D(n);
359
+ const a = (c = (l = n.querySelector("pre")) == null ? void 0 : l.textContent) != null ? c : "";
360
+ if (!a)
361
+ return R.empty;
362
+ const o = s.text(a);
363
+ return R.from(o);
473
364
  }
474
365
  },
475
366
  {
476
367
  tag: "pre",
477
368
  preserveWhitespace: "full",
478
- getAttrs: (dom) => {
479
- if (!(dom instanceof HTMLElement)) {
480
- throw new Error("Parse DOM error.");
481
- }
482
- return { language: dom.dataset["language"] };
369
+ getAttrs: (n) => {
370
+ if (!(n instanceof HTMLElement))
371
+ throw D(n);
372
+ return { language: n.dataset.language };
483
373
  }
484
374
  }
485
375
  ],
486
- toDOM: (node) => {
487
- const select = document.createElement("select");
488
- languageList.forEach((lang) => {
489
- const option = document.createElement("option");
490
- option.value = lang;
491
- option.innerText = !lang ? "--" : lang;
492
- if (lang === node.attrs["language"]) {
493
- option.selected = true;
494
- }
495
- select.appendChild(option);
496
- });
497
- select.onchange = (e) => {
498
- const target = e.target;
499
- if (!(target instanceof HTMLSelectElement)) {
376
+ toDOM: (n) => {
377
+ const s = document.createElement("select");
378
+ return t.forEach((a) => {
379
+ const o = document.createElement("option");
380
+ o.value = a, o.innerText = a || "--", a === n.attrs.language && (o.selected = !0), s.appendChild(o);
381
+ }), s.onchange = (a) => {
382
+ const o = a.target;
383
+ if (!(o instanceof HTMLSelectElement))
500
384
  return;
501
- }
502
- const view = ctx.get(editorViewCtx);
503
- if (!view.editable) {
504
- target.value = node.attrs["language"];
385
+ const l = r.get(P);
386
+ if (!l.editable) {
387
+ o.value = n.attrs.language;
505
388
  return;
506
389
  }
507
- const { top, left } = target.getBoundingClientRect();
508
- const result = view.posAtCoords({ top, left });
509
- if (!result)
390
+ const { top: c, left: u } = o.getBoundingClientRect(), f = l.posAtCoords({ top: c, left: u });
391
+ if (!f)
510
392
  return;
511
- const { tr } = view.state;
512
- view.dispatch(tr.setNodeMarkup(result.inside, void 0, __spreadProps(__spreadValues({}, node.attrs), {
513
- language: target.value
514
- })));
515
- };
516
- return [
393
+ const { tr: d } = l.state;
394
+ l.dispatch(d.setNodeMarkup(f.inside, void 0, {
395
+ ...n.attrs,
396
+ language: o.value
397
+ }));
398
+ }, [
517
399
  "div",
518
400
  {
519
401
  class: "code-fence-container"
520
402
  },
521
- select,
403
+ s,
522
404
  [
523
405
  "pre",
524
406
  {
525
- "data-language": node.attrs["language"],
526
- class: utils.getClassName(node.attrs, "code-fence")
407
+ "data-language": n.attrs.language,
408
+ class: i.getClassName(n.attrs, "code-fence")
527
409
  },
528
410
  ["code", { spellCheck: "false" }, 0]
529
411
  ]
530
412
  ];
531
413
  },
532
414
  parseMarkdown: {
533
- match: ({ type }) => type === "code",
534
- runner: (state, node, type) => {
535
- const language = node["lang"];
536
- const value = node["value"];
537
- state.openNode(type, { language });
538
- if (value) {
539
- state.addText(value);
540
- }
541
- state.closeNode();
415
+ match: ({ type: n }) => n === "code",
416
+ runner: (n, s, a) => {
417
+ const o = s.lang, l = s.value;
418
+ n.openNode(a, { language: o }), l && n.addText(l), n.closeNode();
542
419
  }
543
420
  },
544
421
  toMarkdown: {
545
- match: (node) => node.type.name === id$5,
546
- runner: (state, node) => {
547
- var _a;
548
- state.addNode("code", void 0, ((_a = node.content.firstChild) == null ? void 0 : _a.text) || "", {
549
- lang: node.attrs["language"]
422
+ match: (n) => n.type.name === j,
423
+ runner: (n, s) => {
424
+ var a;
425
+ n.addNode("code", void 0, ((a = s.content.firstChild) == null ? void 0 : a.text) || "", {
426
+ lang: s.attrs.language
550
427
  });
551
428
  }
552
429
  }
553
430
  }),
554
- inputRules: (nodeType) => [
555
- textblockTypeInputRule(backtickInputRegex, nodeType, (match) => {
556
- const [ok, language] = match;
557
- if (!ok)
558
- return;
559
- return { language };
431
+ inputRules: (r) => [
432
+ J(Qe, r, (n) => {
433
+ const [s, a] = n;
434
+ if (!!s)
435
+ return { language: a };
560
436
  }),
561
- textblockTypeInputRule(tildeInputRegex, nodeType, (match) => {
562
- const [ok, language] = match;
563
- if (!ok)
564
- return;
565
- return { language };
437
+ J(Xe, r, (n) => {
438
+ const [s, a] = n;
439
+ if (!!s)
440
+ return { language: a };
566
441
  })
567
442
  ],
568
- commands: (nodeType) => [createCmd(TurnIntoCodeFence, () => setBlockType(nodeType))],
443
+ commands: (r) => [M(ne, () => E(r))],
569
444
  shortcuts: {
570
- [SupportedKeys.CodeFence]: createShortcut(TurnIntoCodeFence, "Mod-Alt-c")
445
+ [k.CodeFence]: h(ne, "Mod-Alt-c")
571
446
  },
572
- view: () => (node, view, getPos) => {
573
- let currNode = node;
574
- const onSelectLanguage = (language) => {
575
- const { tr } = view.state;
576
- view.dispatch(tr.setNodeMarkup(getPos(), void 0, {
577
- fold: true,
578
- language
447
+ view: () => (r, n, s) => {
448
+ let a = r;
449
+ const o = (p) => {
450
+ const { tr: b } = n.state;
451
+ n.dispatch(b.setNodeMarkup(s(), void 0, {
452
+ fold: !0,
453
+ language: p
579
454
  }));
580
- };
581
- const onBlur = () => {
582
- const { tr } = view.state;
583
- view.dispatch(tr.setNodeMarkup(getPos(), void 0, __spreadProps(__spreadValues({}, currNode.attrs), {
584
- fold: true
585
- })));
586
- };
587
- const onFocus = () => {
588
- const { tr } = view.state;
589
- view.dispatch(tr.setNodeMarkup(getPos(), void 0, __spreadProps(__spreadValues({}, currNode.attrs), {
590
- fold: false
591
- })));
592
- };
593
- const renderer = utils.themeManager.get("code-fence", {
594
- onBlur,
595
- onFocus,
596
- onSelectLanguage,
597
- editable: () => view.editable,
598
- languageList
455
+ }, l = () => {
456
+ const { tr: p } = n.state;
457
+ n.dispatch(p.setNodeMarkup(s(), void 0, {
458
+ ...a.attrs,
459
+ fold: !0
460
+ }));
461
+ }, c = () => {
462
+ const { tr: p } = n.state;
463
+ n.dispatch(p.setNodeMarkup(s(), void 0, {
464
+ ...a.attrs,
465
+ fold: !1
466
+ }));
467
+ }, u = i.themeManager.get("code-fence", {
468
+ onBlur: l,
469
+ onFocus: c,
470
+ onSelectLanguage: o,
471
+ editable: () => n.editable,
472
+ languageList: t
599
473
  });
600
- if (!renderer)
474
+ if (!u)
601
475
  return {};
602
- const { dom, contentDOM, onUpdate, onDestroy } = renderer;
603
- onUpdate(currNode);
604
- return {
605
- dom,
606
- contentDOM,
607
- update: (updatedNode) => {
608
- if (updatedNode.type.name !== id$5)
609
- return false;
610
- currNode = updatedNode;
611
- onUpdate(currNode);
612
- return true;
613
- },
614
- destroy: onDestroy
476
+ const { dom: f, contentDOM: d, onUpdate: m, onDestroy: g } = u;
477
+ return m(a), {
478
+ dom: f,
479
+ contentDOM: d,
480
+ update: (p) => p.type.name !== j ? !1 : (a = p, m(a), !0),
481
+ destroy: g
615
482
  };
616
483
  }
617
484
  };
618
- });
619
- const doc = createNode(() => {
620
- return {
621
- id: "doc",
622
- schema: () => ({
623
- content: "block+",
624
- parseMarkdown: {
625
- match: ({ type }) => type === "root",
626
- runner: (state, node, type) => {
627
- state.injectRoot(node, type);
628
- }
629
- },
630
- toMarkdown: {
631
- match: (node) => node.type.name === "doc",
632
- runner: (state, node) => {
633
- state.openNode("root");
634
- state.next(node.content);
635
- }
485
+ }), Ze = L(() => ({
486
+ id: "doc",
487
+ schema: () => ({
488
+ content: "block+",
489
+ parseMarkdown: {
490
+ match: ({ type: i }) => i === "root",
491
+ runner: (i, e, t) => {
492
+ i.injectRoot(e, t);
636
493
  }
637
- })
638
- };
639
- });
640
- const InsertHardbreak = createCmdKey("InsertHardbreak");
641
- const hardbreak = createNode((utils) => {
494
+ },
495
+ toMarkdown: {
496
+ match: (i) => i.type.name === "doc",
497
+ runner: (i, e) => {
498
+ i.openNode("root"), i.next(e.content);
499
+ }
500
+ }
501
+ })
502
+ })), se = I("InsertHardbreak"), et = new T("MILKDOWN_HARDBREAK_FILTER"), tt = L((i, e) => {
503
+ var r;
504
+ const t = (r = e == null ? void 0 : e.notIn) != null ? r : ["table", "fence"];
642
505
  return {
643
506
  id: "hardbreak",
644
507
  schema: () => ({
645
- inline: true,
508
+ inline: !0,
646
509
  group: "inline",
647
- selectable: false,
510
+ selectable: !1,
648
511
  parseDOM: [{ tag: "br" }],
649
- toDOM: (node) => ["br", { class: utils.getClassName(node.attrs, "hardbreak") }],
512
+ toDOM: (n) => ["br", { class: i.getClassName(n.attrs, "hardbreak") }],
650
513
  parseMarkdown: {
651
- match: ({ type }) => type === "break",
652
- runner: (state, _, type) => {
653
- state.addNode(type);
514
+ match: ({ type: n }) => n === "break",
515
+ runner: (n, s, a) => {
516
+ n.addNode(a);
654
517
  }
655
518
  },
656
519
  toMarkdown: {
657
- match: (node) => node.type.name === "hardbreak",
658
- runner: (state) => {
659
- state.addNode("break");
520
+ match: (n) => n.type.name === "hardbreak",
521
+ runner: (n) => {
522
+ n.addNode("break");
660
523
  }
661
524
  }
662
525
  }),
663
- commands: (type) => [
664
- createCmd(InsertHardbreak, () => (state, dispatch) => {
665
- var _a;
666
- const { selection, tr } = state;
667
- if (selection.empty) {
668
- const node = selection.$from.node();
669
- if (node.childCount > 0 && ((_a = node.lastChild) == null ? void 0 : _a.type.name) === "hardbreak") {
670
- dispatch == null ? void 0 : dispatch(tr.replaceRangeWith(selection.to - 1, selection.to, state.schema.node("paragraph")).setSelection(Selection.near(tr.doc.resolve(selection.to))).scrollIntoView());
671
- return true;
672
- }
526
+ commands: (n) => [
527
+ M(se, () => (s, a) => {
528
+ var c;
529
+ const { selection: o, tr: l } = s;
530
+ if (o.empty) {
531
+ const u = o.$from.node();
532
+ if (u.childCount > 0 && ((c = u.lastChild) == null ? void 0 : c.type.name) === "hardbreak")
533
+ return a == null || a(l.replaceRangeWith(o.to - 1, o.to, s.schema.node("paragraph")).setSelection(Le.near(l.doc.resolve(o.to))).scrollIntoView()), !0;
673
534
  }
674
- dispatch == null ? void 0 : dispatch(tr.setMeta("hardbreak", true).replaceSelectionWith(type.create()).scrollIntoView());
675
- return true;
535
+ return a == null || a(l.setMeta("hardbreak", !0).replaceSelectionWith(n.create()).scrollIntoView()), !0;
676
536
  })
677
537
  ],
678
538
  shortcuts: {
679
- [SupportedKeys.HardBreak]: createShortcut(InsertHardbreak, "Shift-Enter")
539
+ [k.HardBreak]: h(se, "Shift-Enter")
680
540
  },
681
- prosePlugins: (type) => [
682
- new Plugin({
683
- key: new PluginKey("MILKDOWN_HARDBREAK_MARKS"),
684
- appendTransaction: (trs, _oldState, newState) => {
685
- if (!trs.length)
541
+ prosePlugins: (n) => [
542
+ new H({
543
+ key: et,
544
+ filterTransaction: (s, a) => {
545
+ const o = s.getMeta("hardbreak"), [l] = s.steps;
546
+ if (o && l) {
547
+ const { from: c } = l, u = a.doc.resolve(c);
548
+ let f = u.depth, d = !0;
549
+ for (; f > 0; )
550
+ t.includes(u.node(f).type.name) && (d = !1), f--;
551
+ return d;
552
+ }
553
+ return !0;
554
+ }
555
+ }),
556
+ new H({
557
+ key: new T("MILKDOWN_HARDBREAK_MARKS"),
558
+ appendTransaction: (s, a, o) => {
559
+ if (!s.length)
686
560
  return;
687
- const [tr] = trs;
688
- if (!tr)
561
+ const [l] = s;
562
+ if (!l)
689
563
  return;
690
- const [step] = tr.steps;
691
- const isInsertHr = tr.getMeta("hardbreak");
692
- if (isInsertHr) {
693
- if (!(step instanceof ReplaceStep)) {
564
+ const [c] = l.steps;
565
+ if (l.getMeta("hardbreak")) {
566
+ if (!(c instanceof ve))
694
567
  return;
695
- }
696
- const { from } = step;
697
- return newState.tr.setNodeMarkup(from, type, void 0, []);
568
+ const { from: d } = c;
569
+ return o.tr.setNodeMarkup(d, n, void 0, []);
698
570
  }
699
- const isAddMarkStep = step instanceof AddMarkStep;
700
- if (isAddMarkStep) {
701
- let _tr = newState.tr;
702
- const { from, to } = step;
703
- newState.doc.nodesBetween(from, to, (node, pos) => {
704
- if (node.type === type) {
705
- _tr = _tr.setNodeMarkup(pos, type, void 0, []);
706
- }
707
- });
708
- return _tr;
571
+ if (c instanceof $e) {
572
+ let d = o.tr;
573
+ const { from: m, to: g } = c;
574
+ return o.doc.nodesBetween(m, g, (p, b) => {
575
+ p.type === n && (d = d.setNodeMarkup(b, n, void 0, []));
576
+ }), d;
709
577
  }
710
- return;
711
578
  }
712
579
  })
713
580
  ]
714
581
  };
715
- });
716
- const headingIndex = Array(6).fill(0).map((_, i) => i + 1);
717
- const TurnIntoHeading = createCmdKey("TurnIntoHeading");
718
- const headingPluginKey = new PluginKey("MILKDOWN_ID");
719
- const createId = (node) => node.textContent.replace(/[\p{P}\p{S}]/gu, "").replace(/\s/g, "-").toLowerCase().trim();
720
- const heading = createNode((utils, options) => {
721
- var _a;
722
- const id2 = "heading";
723
- const getId = (_a = options == null ? void 0 : options.getId) != null ? _a : createId;
582
+ }), he = Array(6).fill(0).map((i, e) => e + 1), C = I("TurnIntoHeading"), ke = I("DowngradeHeading"), z = new T("MILKDOWN_HEADING_ID"), rt = new T("MILKDOWN_HEADING_HASH"), nt = (i) => i.textContent.replace(/[\p{P}\p{S}]/gu, "").replace(/\s/g, "-").toLowerCase().trim(), st = (i, e, t) => {
583
+ let r = !1;
584
+ const n = (s, a) => {
585
+ const o = s.tr;
586
+ s.doc.descendants((l, c) => {
587
+ if (l.type === e && !r) {
588
+ if (l.textContent.trim().length === 0)
589
+ return;
590
+ const u = l.attrs, f = t(l);
591
+ u.id !== f && o.setMeta(z, !0).setNodeMarkup(c, void 0, {
592
+ ...u,
593
+ id: f
594
+ });
595
+ }
596
+ }), a(o);
597
+ };
598
+ return new H({
599
+ key: z,
600
+ props: {
601
+ handleDOMEvents: {
602
+ compositionstart: () => (r = !0, !1),
603
+ compositionend: () => {
604
+ r = !1;
605
+ const s = i.get(P);
606
+ return setTimeout(() => {
607
+ n(s.state, (a) => s.dispatch(a));
608
+ }, 0), !1;
609
+ }
610
+ }
611
+ },
612
+ appendTransaction: (s, a, o) => {
613
+ let l = null;
614
+ return s.every((c) => !c.getMeta(z)) && s.some((c) => c.docChanged) && n(o, (c) => {
615
+ l = c;
616
+ }), l;
617
+ },
618
+ view: (s) => {
619
+ const a = s.state.doc;
620
+ let o = s.state.tr;
621
+ return a.descendants((l, c) => {
622
+ l.type.name === "heading" && l.attrs.level && (l.attrs.id || (o = o.setNodeMarkup(c, void 0, {
623
+ ...l.attrs,
624
+ id: t(l)
625
+ })));
626
+ }), s.dispatch(o), {};
627
+ }
628
+ });
629
+ }, ot = (i, e, t) => new H({
630
+ key: rt,
631
+ state: {
632
+ init: () => O.empty,
633
+ apply: (r) => {
634
+ const n = i.get(P);
635
+ if (!n.hasFocus || !n.editable)
636
+ return O.empty;
637
+ const { $from: s } = r.selection, a = s.node();
638
+ if (a.type !== e)
639
+ return O.empty;
640
+ const o = a.attrs.level, l = (f) => Array(f).fill(0).map((d) => "#").join(""), c = document.createElement("span");
641
+ c.textContent = l(o), c.contentEditable = "false", t.themeManager.onFlush(() => {
642
+ const f = t.getStyle(({ css: d }) => {
643
+ const m = He(t.themeManager);
644
+ return d`
645
+ margin-right: 4px;
646
+ color: ${m("primary")};
647
+ `;
648
+ });
649
+ f && (c.className = f);
650
+ });
651
+ const u = Q.widget(s.before() + 1, c, { side: -1 });
652
+ return O.create(r.doc, [u]);
653
+ }
654
+ },
655
+ props: {
656
+ handleDOMEvents: {
657
+ focus: (r) => {
658
+ const n = Oe(r.state.tr);
659
+ return r.dispatch(n), !1;
660
+ }
661
+ },
662
+ decorations(r) {
663
+ return this.getState(r);
664
+ }
665
+ }
666
+ }), at = L((i, e) => {
667
+ var s, a;
668
+ const t = "heading", r = (s = e == null ? void 0 : e.getId) != null ? s : nt, n = (a = e == null ? void 0 : e.displayHashtag) != null ? a : !0;
724
669
  return {
725
- id: id2,
670
+ id: t,
726
671
  schema: () => ({
727
672
  content: "inline*",
728
673
  group: "block",
729
- defining: true,
674
+ defining: !0,
730
675
  attrs: {
731
676
  id: {
732
677
  default: ""
@@ -735,422 +680,351 @@ const heading = createNode((utils, options) => {
735
680
  default: 1
736
681
  }
737
682
  },
738
- parseDOM: headingIndex.map((x) => ({
739
- tag: `h${x}`,
740
- getAttrs: (node) => {
741
- if (!(node instanceof HTMLElement)) {
742
- throw new Error();
743
- }
744
- return { level: x, id: node.id };
683
+ parseDOM: he.map((o) => ({
684
+ tag: `h${o}`,
685
+ getAttrs: (l) => {
686
+ if (!(l instanceof HTMLElement))
687
+ throw D(l);
688
+ return { level: o, id: l.id };
745
689
  }
746
690
  })),
747
- toDOM: (node) => {
748
- return [
749
- `h${node.attrs["level"]}`,
750
- {
751
- id: node.attrs["id"] || getId(node),
752
- class: utils.getClassName(node.attrs, `heading h${node.attrs["level"]}`)
753
- },
754
- 0
755
- ];
756
- },
691
+ toDOM: (o) => [
692
+ `h${o.attrs.level}`,
693
+ {
694
+ id: o.attrs.id || r(o),
695
+ class: i.getClassName(o.attrs, `heading h${o.attrs.level}`)
696
+ },
697
+ 0
698
+ ],
757
699
  parseMarkdown: {
758
- match: ({ type }) => type === id2,
759
- runner: (state, node, type) => {
760
- const depth = node["depth"];
761
- state.openNode(type, { level: depth });
762
- state.next(node.children);
763
- state.closeNode();
700
+ match: ({ type: o }) => o === t,
701
+ runner: (o, l, c) => {
702
+ const u = l.depth;
703
+ o.openNode(c, { level: u }), o.next(l.children), o.closeNode();
764
704
  }
765
705
  },
766
706
  toMarkdown: {
767
- match: (node) => node.type.name === id2,
768
- runner: (state, node) => {
769
- var _a2;
770
- state.openNode("heading", void 0, { depth: node.attrs["level"] });
771
- const lastIsHardbreak = node.childCount >= 1 && ((_a2 = node.lastChild) == null ? void 0 : _a2.type.name) === "hardbreak";
772
- if (lastIsHardbreak) {
773
- const contentArr = [];
774
- node.content.forEach((n, _, i) => {
775
- if (i === node.childCount - 1) {
776
- return;
777
- }
778
- contentArr.push(n);
779
- });
780
- state.next(Fragment.fromArray(contentArr));
781
- } else {
782
- state.next(node.content);
783
- }
784
- state.closeNode();
707
+ match: (o) => o.type.name === t,
708
+ runner: (o, l) => {
709
+ var u;
710
+ if (o.openNode("heading", void 0, { depth: l.attrs.level }), l.childCount >= 1 && ((u = l.lastChild) == null ? void 0 : u.type.name) === "hardbreak") {
711
+ const f = [];
712
+ l.content.forEach((d, m, g) => {
713
+ g !== l.childCount - 1 && f.push(d);
714
+ }), o.next(R.fromArray(f));
715
+ } else
716
+ o.next(l.content);
717
+ o.closeNode();
785
718
  }
786
719
  }
787
720
  }),
788
- inputRules: (type) => headingIndex.map((x) => textblockTypeInputRule(new RegExp(`^(#{1,${x}})\\s$`), type, () => ({
789
- level: x
790
- }))),
791
- commands: (type) => [createCmd(TurnIntoHeading, (level = 1) => setBlockType(type, { level }))],
721
+ inputRules: (o, l) => he.map((c) => J(new RegExp(`^(#{1,${c}})\\s$`), o, () => {
722
+ const u = l.get(P), { $from: f } = u.state.selection, d = f.node();
723
+ if (d.type.name === "heading") {
724
+ let m = Number(d.attrs.level) + Number(c);
725
+ return m > 6 && (m = 6), {
726
+ level: m
727
+ };
728
+ }
729
+ return {
730
+ level: c
731
+ };
732
+ })),
733
+ commands: (o, l) => [
734
+ M(C, (c = 1) => c < 1 ? E(c === 0 && l.get(A).nodes.paragraph || o) : E(c === 0 && l.get(A).nodes.paragraph || o, { level: c })),
735
+ M(ke, () => (c, u, f) => {
736
+ const { $from: d } = c.selection, m = d.node();
737
+ if (m.type !== o || !c.selection.empty || d.parentOffset !== 0)
738
+ return !1;
739
+ const g = m.attrs.level - 1;
740
+ return g ? (u == null || u(c.tr.setNodeMarkup(c.selection.$from.before(), void 0, {
741
+ ...m.attrs,
742
+ level: g
743
+ })), !0) : E(l.get(A).nodes.paragraph || o)(c, u, f);
744
+ })
745
+ ],
792
746
  shortcuts: {
793
- [SupportedKeys.H1]: createShortcut(TurnIntoHeading, "Mod-Alt-1", 1),
794
- [SupportedKeys.H2]: createShortcut(TurnIntoHeading, "Mod-Alt-2", 2),
795
- [SupportedKeys.H3]: createShortcut(TurnIntoHeading, "Mod-Alt-3", 3),
796
- [SupportedKeys.H4]: createShortcut(TurnIntoHeading, "Mod-Alt-4", 4),
797
- [SupportedKeys.H5]: createShortcut(TurnIntoHeading, "Mod-Alt-5", 5),
798
- [SupportedKeys.H6]: createShortcut(TurnIntoHeading, "Mod-Alt-6", 6)
747
+ [k.H1]: h(C, "Mod-Alt-1", 1),
748
+ [k.H2]: h(C, "Mod-Alt-2", 2),
749
+ [k.H3]: h(C, "Mod-Alt-3", 3),
750
+ [k.H4]: h(C, "Mod-Alt-4", 4),
751
+ [k.H5]: h(C, "Mod-Alt-5", 5),
752
+ [k.H6]: h(C, "Mod-Alt-6", 6),
753
+ [k.DowngradeHeading]: h(ke, ["Backspace", "Delete"])
799
754
  },
800
- prosePlugins: (type, ctx) => {
801
- let lock = false;
802
- const walkThrough = (state, callback) => {
803
- const tr = state.tr;
804
- state.doc.descendants((node, pos) => {
805
- if (node.type === type && !lock) {
806
- if (node.textContent.trim().length === 0) {
807
- return;
808
- }
809
- const attrs = node.attrs;
810
- const id22 = getId(node);
811
- if (attrs["id"] !== id22) {
812
- tr.setMeta(headingPluginKey, true).setNodeMarkup(pos, void 0, __spreadProps(__spreadValues({}, attrs), {
813
- id: id22
814
- }));
815
- }
816
- }
817
- });
818
- callback(tr);
819
- };
820
- return [
821
- new Plugin({
822
- key: headingPluginKey,
823
- props: {
824
- handleDOMEvents: {
825
- compositionstart: () => {
826
- lock = true;
827
- return false;
828
- },
829
- compositionend: () => {
830
- lock = false;
831
- const view = ctx.get(editorViewCtx);
832
- setTimeout(() => {
833
- walkThrough(view.state, (tr) => view.dispatch(tr));
834
- }, 0);
835
- return false;
836
- }
837
- }
838
- },
839
- appendTransaction: (transactions, _, nextState) => {
840
- let tr = null;
841
- if (transactions.every((transaction) => !transaction.getMeta(headingPluginKey)) && transactions.some((transaction) => transaction.docChanged)) {
842
- walkThrough(nextState, (t) => {
843
- tr = t;
844
- });
845
- }
846
- return tr;
847
- },
848
- view: (view) => {
849
- const doc2 = view.state.doc;
850
- let tr = view.state.tr;
851
- doc2.descendants((node, pos) => {
852
- if (node.type.name === "heading" && node.attrs["level"]) {
853
- if (!node.attrs["id"]) {
854
- tr = tr.setNodeMarkup(pos, void 0, __spreadProps(__spreadValues({}, node.attrs), {
855
- id: getId(node)
856
- }));
857
- }
858
- }
859
- });
860
- view.dispatch(tr);
861
- return {};
862
- }
863
- })
864
- ];
755
+ prosePlugins: (o, l) => {
756
+ const c = [st(l, o, r)];
757
+ return n && c.push(ot(l, o, i)), c;
865
758
  }
866
759
  };
867
- });
868
- const id$4 = "hr";
869
- const InsertHr = createCmdKey("InsertHr");
870
- const hr = createNode((utils) => {
871
- return {
872
- id: id$4,
873
- schema: () => ({
874
- group: "block",
875
- parseDOM: [{ tag: "hr" }],
876
- toDOM: (node) => ["hr", { class: utils.getClassName(node.attrs, id$4) }],
877
- parseMarkdown: {
878
- match: ({ type }) => type === "thematicBreak",
879
- runner: (state, _, type) => {
880
- state.addNode(type);
881
- }
882
- },
883
- toMarkdown: {
884
- match: (node) => node.type.name === id$4,
885
- runner: (state) => {
886
- state.addNode("thematicBreak");
887
- }
760
+ }), G = "hr", xe = I("InsertHr"), lt = L((i) => ({
761
+ id: G,
762
+ schema: () => ({
763
+ group: "block",
764
+ parseDOM: [{ tag: "hr" }],
765
+ toDOM: (e) => ["hr", { class: i.getClassName(e.attrs, G) }],
766
+ parseMarkdown: {
767
+ match: ({ type: e }) => e === "thematicBreak",
768
+ runner: (e, t, r) => {
769
+ e.addNode(r);
888
770
  }
889
- }),
890
- inputRules: (type) => [
891
- new InputRule(/^(?:---|___\s|\*\*\*\s)$/, (state, match, start, end) => {
892
- const { tr } = state;
893
- if (match[0]) {
894
- tr.replaceWith(start - 1, end, type.create());
895
- }
896
- return tr;
897
- })
898
- ],
899
- commands: (type, ctx) => [
900
- createCmd(InsertHr, () => (state, dispatch) => {
901
- if (!dispatch)
902
- return true;
903
- const paragraph2 = ctx.get(schemaCtx).node("paragraph");
904
- const { tr, selection } = state;
905
- const { from } = selection;
906
- const node = type.create();
907
- if (!node) {
908
- return true;
909
- }
910
- const _tr = tr.replaceSelectionWith(node).insert(from, paragraph2);
911
- const sel = Selection.findFrom(_tr.doc.resolve(from), 1, true);
912
- if (!sel) {
913
- return true;
914
- }
915
- dispatch(_tr.setSelection(sel).scrollIntoView());
916
- return true;
917
- })
918
- ]
919
- };
920
- });
921
- const ModifyImage = createCmdKey("ModifyImage");
922
- const InsertImage = createCmdKey("InsertImage");
923
- const id$3 = "image";
924
- const key = new PluginKey("MILKDOWN_IMAGE_INPUT");
925
- const image = createNode((utils, options) => {
926
- return {
927
- id: "image",
928
- schema: () => ({
929
- inline: true,
930
- group: "inline",
931
- selectable: true,
932
- draggable: true,
933
- marks: "",
934
- atom: true,
935
- defining: true,
936
- isolating: true,
937
- attrs: {
938
- src: { default: "" },
939
- alt: { default: null },
940
- title: { default: null }
941
- },
942
- parseDOM: [
943
- {
944
- tag: "img[src]",
945
- getAttrs: (dom) => {
946
- if (!(dom instanceof HTMLElement)) {
947
- throw new Error();
948
- }
949
- return {
950
- src: dom.getAttribute("src") || "",
951
- alt: dom.getAttribute("alt"),
952
- title: dom.getAttribute("title") || dom.getAttribute("alt"),
953
- width: dom.getAttribute("width")
954
- };
955
- }
956
- }
957
- ],
958
- toDOM: (node) => {
959
- return [
960
- "img",
961
- __spreadProps(__spreadValues({}, node.attrs), {
962
- class: utils.getClassName(node.attrs, id$3)
963
- })
964
- ];
965
- },
966
- parseMarkdown: {
967
- match: ({ type }) => type === id$3,
968
- runner: (state, node, type) => {
969
- const url = node["url"];
970
- const alt = node["alt"];
971
- const title = node["title"];
972
- state.addNode(type, {
973
- src: url,
974
- alt,
975
- title
976
- });
977
- }
978
- },
979
- toMarkdown: {
980
- match: (node) => node.type.name === id$3,
981
- runner: (state, node) => {
982
- state.addNode("image", void 0, void 0, {
983
- title: node.attrs["title"],
984
- url: node.attrs["src"],
985
- alt: node.attrs["alt"]
986
- });
987
- }
771
+ },
772
+ toMarkdown: {
773
+ match: (e) => e.type.name === G,
774
+ runner: (e) => {
775
+ e.addNode("thematicBreak");
988
776
  }
989
- }),
990
- commands: (type) => [
991
- createCmd(InsertImage, (src = "") => (state, dispatch) => {
992
- if (!dispatch)
993
- return true;
994
- const { tr } = state;
995
- const node = type.create({ src });
996
- if (!node) {
997
- return true;
777
+ }
778
+ }),
779
+ inputRules: (e) => [
780
+ new me(/^(?:---|___\s|\*\*\*\s)$/, (t, r, n, s) => {
781
+ const { tr: a } = t;
782
+ return r[0] && a.replaceWith(n - 1, s, e.create()), a;
783
+ })
784
+ ],
785
+ commands: (e, t) => [
786
+ M(xe, () => (r, n) => {
787
+ if (!n)
788
+ return !0;
789
+ const s = t.get(A).node("paragraph"), { tr: a, selection: o } = r, { from: l } = o, c = e.create();
790
+ if (!c)
791
+ return !0;
792
+ const u = a.replaceSelectionWith(c).insert(l, s), f = Le.findFrom(u.doc.resolve(l), 1, !0);
793
+ return f && n(u.setSelection(f).scrollIntoView()), !0;
794
+ })
795
+ ]
796
+ })), oe = I("ModifyImage"), Ce = I("InsertImage"), S = "image", ct = new T("MILKDOWN_IMAGE_INPUT"), it = L((i, e) => ({
797
+ id: "image",
798
+ schema: () => ({
799
+ inline: !0,
800
+ group: "inline",
801
+ selectable: !0,
802
+ draggable: !0,
803
+ marks: "",
804
+ atom: !0,
805
+ defining: !0,
806
+ isolating: !0,
807
+ attrs: {
808
+ src: { default: "" },
809
+ alt: { default: null },
810
+ title: { default: null }
811
+ },
812
+ parseDOM: [
813
+ {
814
+ tag: "img[src]",
815
+ getAttrs: (t) => {
816
+ if (!(t instanceof HTMLElement))
817
+ throw D(t);
818
+ return {
819
+ src: t.getAttribute("src") || "",
820
+ alt: t.getAttribute("alt"),
821
+ title: t.getAttribute("title") || t.getAttribute("alt"),
822
+ width: t.getAttribute("width")
823
+ };
998
824
  }
999
- const _tr = tr.replaceSelectionWith(node);
1000
- dispatch(_tr.scrollIntoView());
1001
- return true;
1002
- }),
1003
- createCmd(ModifyImage, (src = "") => (state, dispatch) => {
1004
- const node = findSelectedNodeOfType(state.selection, type);
1005
- if (!node)
1006
- return false;
1007
- const { tr } = state;
1008
- dispatch == null ? void 0 : dispatch(tr.setNodeMarkup(node.pos, void 0, __spreadProps(__spreadValues({}, node.node.attrs), { loading: true, src })).scrollIntoView());
1009
- return true;
1010
- })
825
+ }
1011
826
  ],
1012
- inputRules: (type) => [
1013
- new InputRule(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/, (state, match, start, end) => {
1014
- const [okay, alt, src = "", title] = match;
1015
- const { tr } = state;
1016
- if (okay) {
1017
- tr.replaceWith(start, end, type.create({ src, alt, title }));
1018
- }
1019
- return tr;
1020
- })
827
+ toDOM: (t) => [
828
+ "img",
829
+ {
830
+ ...t.attrs,
831
+ class: i.getClassName(t.attrs, S)
832
+ }
1021
833
  ],
1022
- view: () => (node) => {
1023
- var _a, _b;
1024
- let currNode = node;
1025
- const placeholder = (_a = options == null ? void 0 : options.placeholder) != null ? _a : "Add an Image";
1026
- const isBlock = (_b = options == null ? void 0 : options.isBlock) != null ? _b : false;
1027
- const renderer = utils.themeManager.get("image", {
1028
- placeholder,
1029
- isBlock
1030
- });
1031
- if (!renderer) {
1032
- return {};
834
+ parseMarkdown: {
835
+ match: ({ type: t }) => t === S,
836
+ runner: (t, r, n) => {
837
+ const s = r.url, a = r.alt, o = r.title;
838
+ t.addNode(n, {
839
+ src: s,
840
+ alt: a,
841
+ title: o
842
+ });
1033
843
  }
1034
- const { dom, onUpdate } = renderer;
1035
- onUpdate(currNode);
1036
- return {
1037
- dom,
1038
- update: (updatedNode) => {
1039
- if (updatedNode.type.name !== id$3)
1040
- return false;
1041
- currNode = updatedNode;
1042
- onUpdate(currNode);
1043
- return true;
1044
- },
1045
- selectNode: () => {
1046
- dom.classList.add("ProseMirror-selectednode");
1047
- },
1048
- deselectNode: () => {
1049
- dom.classList.remove("ProseMirror-selectednode");
1050
- }
1051
- };
1052
844
  },
1053
- prosePlugins: (type, ctx) => {
1054
- return [
1055
- new Plugin({
1056
- key,
1057
- view: (editorView) => {
1058
- var _a, _b, _c;
1059
- const inputChipRenderer = utils.themeManager.get("input-chip", {
1060
- placeholder: (_b = (_a = options == null ? void 0 : options.input) == null ? void 0 : _a.placeholder) != null ? _b : "Input Image Link",
1061
- buttonText: (_c = options == null ? void 0 : options.input) == null ? void 0 : _c.buttonText,
1062
- onUpdate: (value) => {
1063
- ctx.get(commandsCtx).call(ModifyImage, value);
1064
- }
1065
- });
1066
- if (!inputChipRenderer)
1067
- return {};
1068
- const shouldDisplay = (view) => {
1069
- return Boolean(view.hasFocus() && type && findSelectedNodeOfType(view.state.selection, type));
1070
- };
1071
- const getCurrentLink = (view) => {
1072
- const result = findSelectedNodeOfType(view.state.selection, type);
1073
- if (!result)
1074
- return;
1075
- const value = result.node.attrs["src"];
1076
- return value;
1077
- };
1078
- const renderByView = (view) => {
1079
- if (!view.editable) {
1080
- return;
1081
- }
1082
- const display = shouldDisplay(view);
1083
- if (display) {
1084
- inputChipRenderer.show(view);
1085
- inputChipRenderer.update(getCurrentLink(view));
1086
- } else {
1087
- inputChipRenderer.hide();
1088
- }
1089
- };
1090
- inputChipRenderer.init(editorView);
1091
- renderByView(editorView);
1092
- return {
1093
- update: (view, prevState) => {
1094
- const isEqualSelection = (prevState == null ? void 0 : prevState.doc.eq(view.state.doc)) && prevState.selection.eq(view.state.selection);
1095
- if (isEqualSelection)
1096
- return;
1097
- renderByView(view);
1098
- },
1099
- destroy: () => {
1100
- inputChipRenderer.destroy();
1101
- }
1102
- };
1103
- }
1104
- })
1105
- ];
845
+ toMarkdown: {
846
+ match: (t) => t.type.name === S,
847
+ runner: (t, r) => {
848
+ t.addNode("image", void 0, void 0, {
849
+ title: r.attrs.title,
850
+ url: r.attrs.src,
851
+ alt: r.attrs.alt
852
+ });
853
+ }
1106
854
  }
855
+ }),
856
+ commands: (t) => [
857
+ M(Ce, (r = "") => (n, s) => {
858
+ if (!s)
859
+ return !0;
860
+ const { tr: a } = n, o = t.create({ src: r });
861
+ if (!o)
862
+ return !0;
863
+ const l = a.replaceSelectionWith(o);
864
+ return s(l.scrollIntoView()), !0;
865
+ }),
866
+ M(oe, (r = "") => (n, s) => {
867
+ const a = F(n.selection, t);
868
+ if (!a)
869
+ return !1;
870
+ const { tr: o } = n;
871
+ return s == null || s(o.setNodeMarkup(a.pos, void 0, { ...a.node.attrs, loading: !0, src: r }).scrollIntoView()), !0;
872
+ })
873
+ ],
874
+ inputRules: (t) => [
875
+ new me(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/, (r, n, s, a) => {
876
+ const [o, l, c = "", u] = n, { tr: f } = r;
877
+ return o && f.replaceWith(s, a, t.create({ src: c, alt: l, title: u })), f;
878
+ })
879
+ ],
880
+ view: () => (t) => {
881
+ var c, u;
882
+ let r = t;
883
+ const n = (c = e == null ? void 0 : e.placeholder) != null ? c : "Add an Image", s = (u = e == null ? void 0 : e.isBlock) != null ? u : !1, a = i.themeManager.get("image", {
884
+ placeholder: n,
885
+ isBlock: s
886
+ });
887
+ if (!a)
888
+ return {};
889
+ const { dom: o, onUpdate: l } = a;
890
+ return l(r), {
891
+ dom: o,
892
+ update: (f) => f.type.name !== S ? !1 : (r = f, l(r), !0),
893
+ selectNode: () => {
894
+ o.classList.add("ProseMirror-selectednode");
895
+ },
896
+ deselectNode: () => {
897
+ o.classList.remove("ProseMirror-selectednode");
898
+ }
899
+ };
900
+ },
901
+ prosePlugins: (t, r) => [
902
+ new H({
903
+ key: ct,
904
+ view: (n) => {
905
+ var c, u, f;
906
+ const s = i.themeManager.get("input-chip", {
907
+ placeholder: (u = (c = e == null ? void 0 : e.input) == null ? void 0 : c.placeholder) != null ? u : "Input Image Link",
908
+ buttonText: (f = e == null ? void 0 : e.input) == null ? void 0 : f.buttonText,
909
+ onUpdate: (d) => {
910
+ r.get(Ne).call(oe, d);
911
+ }
912
+ });
913
+ if (!s)
914
+ return {};
915
+ const a = (d) => Boolean(d.hasFocus() && t && F(d.state.selection, t)), o = (d) => {
916
+ const m = F(d.state.selection, t);
917
+ return m ? m.node.attrs.src : void 0;
918
+ }, l = (d) => {
919
+ if (!d.editable)
920
+ return;
921
+ a(d) ? (s.show(d), s.update(o(d))) : s.hide();
922
+ };
923
+ return s.init(n), l(n), {
924
+ update: (d, m) => {
925
+ (m == null ? void 0 : m.doc.eq(d.state.doc)) && m.selection.eq(d.state.selection) || l(d);
926
+ },
927
+ destroy: () => {
928
+ s.destroy();
929
+ }
930
+ };
931
+ }
932
+ })
933
+ ]
934
+ })), Me = "list_item", ae = I("SplitListItem"), le = I("SinkListItem"), ce = I("LiftListItem"), ut = new T("MILKDOWN_KEEP_LIST_ORDER"), dt = (i) => {
935
+ const e = (t, r) => {
936
+ const n = Ae("ordered_list", t.schema);
937
+ let s = t.tr;
938
+ t.doc.descendants((a, o, l, c) => {
939
+ if (a.type === i && (l == null ? void 0 : l.type) === n) {
940
+ let u = !1;
941
+ const f = { ...a.attrs };
942
+ a.attrs.listType !== "ordered" && (f.listType = "ordered", u = !0);
943
+ const d = l == null ? void 0 : l.maybeChild(0);
944
+ if (d && d.type === i && d.attrs.listType === "ordered") {
945
+ const m = d.attrs.label;
946
+ f.label = `${Number(m.slice(0, -1)) + c}.`, u = !0;
947
+ }
948
+ a.attrs.label === "\u2022" && (f.label = `${c + 1}.`, u = !0), u && (s = s.setNodeMarkup(o, void 0, f));
949
+ }
950
+ }), r(s);
1107
951
  };
1108
- });
1109
- const id$2 = "list_item";
1110
- const SplitListItem = createCmdKey("SplitListItem");
1111
- const SinkListItem = createCmdKey("SinkListItem");
1112
- const LiftListItem = createCmdKey("LiftListItem");
1113
- const listItem = createNode((utils) => ({
1114
- id: id$2,
952
+ return new H({
953
+ key: ut,
954
+ appendTransaction: (t, r, n) => {
955
+ let s = null;
956
+ return t.some((a) => a.docChanged) && e(n, (a) => {
957
+ s = a;
958
+ }), s;
959
+ }
960
+ });
961
+ }, mt = L((i) => ({
962
+ id: Me,
1115
963
  schema: () => ({
1116
964
  group: "listItem",
1117
965
  content: "paragraph block*",
1118
- defining: true,
1119
- parseDOM: [{ tag: "li" }],
1120
- toDOM: (node) => ["li", { class: utils.getClassName(node.attrs, "list-item") }, 0],
966
+ attrs: {
967
+ label: {
968
+ default: "\u2022"
969
+ },
970
+ listType: {
971
+ default: "bullet"
972
+ }
973
+ },
974
+ defining: !0,
975
+ parseDOM: [
976
+ {
977
+ tag: "li.list-item",
978
+ getAttrs: (e) => {
979
+ if (!(e instanceof HTMLElement))
980
+ throw D(e);
981
+ return {
982
+ label: e.dataset.label,
983
+ listType: e.dataset["list-type"]
984
+ };
985
+ },
986
+ contentElement: "div.list-item_body"
987
+ },
988
+ { tag: "li" }
989
+ ],
990
+ toDOM: (e) => [
991
+ "li",
992
+ {
993
+ class: i.getClassName(e.attrs, "list-item"),
994
+ "data-label": e.attrs.label,
995
+ "data-list-type": e.attrs.listType
996
+ },
997
+ ["div", { class: i.getClassName(e.attrs, "list-item_label") }, e.attrs.label],
998
+ ["div", { class: i.getClassName(e.attrs, "list-item_body") }, 0]
999
+ ],
1121
1000
  parseMarkdown: {
1122
- match: ({ type, checked }) => type === "listItem" && checked === null,
1123
- runner: (state, node, type) => {
1124
- state.openNode(type);
1125
- state.next(node.children);
1126
- state.closeNode();
1001
+ match: ({ type: e, checked: t }) => e === "listItem" && t === null,
1002
+ runner: (e, t, r) => {
1003
+ const n = t.label != null ? `${t.label}.` : "\u2022", s = t.label != null ? "ordered" : "bullet";
1004
+ e.openNode(r, { label: n, listType: s }), e.next(t.children), e.closeNode();
1127
1005
  }
1128
1006
  },
1129
1007
  toMarkdown: {
1130
- match: (node) => node.type.name === id$2,
1131
- runner: (state, node) => {
1132
- state.openNode("listItem");
1133
- state.next(node.content);
1134
- state.closeNode();
1008
+ match: (e) => e.type.name === Me,
1009
+ runner: (e, t) => {
1010
+ e.openNode("listItem"), e.next(t.content), e.closeNode();
1135
1011
  }
1136
1012
  }
1137
1013
  }),
1138
- inputRules: (nodeType) => [wrappingInputRule(/^\s*([-+*])\s$/, nodeType)],
1139
- commands: (nodeType) => [
1140
- createCmd(SplitListItem, () => splitListItem(nodeType)),
1141
- createCmd(SinkListItem, () => sinkListItem(nodeType)),
1142
- createCmd(LiftListItem, () => liftListItem(nodeType))
1014
+ inputRules: (e) => [q(/^\s*([-+*])\s$/, e)],
1015
+ commands: (e) => [
1016
+ M(ae, () => Se(e)),
1017
+ M(le, () => Re(e)),
1018
+ M(ce, () => Be(e))
1143
1019
  ],
1144
1020
  shortcuts: {
1145
- [SupportedKeys.NextListItem]: createShortcut(SplitListItem, "Enter"),
1146
- [SupportedKeys.SinkListItem]: createShortcut(SinkListItem, "Mod-]"),
1147
- [SupportedKeys.LiftListItem]: createShortcut(LiftListItem, "Mod-[")
1148
- }
1149
- }));
1150
- const WrapInOrderedList = createCmdKey("WrapInOrderedList");
1151
- const id$1 = "ordered_list";
1152
- const orderedList = createNode((utils) => ({
1153
- id: id$1,
1021
+ [k.NextListItem]: h(ae, "Enter"),
1022
+ [k.SinkListItem]: h(le, "Mod-]"),
1023
+ [k.LiftListItem]: h(ce, "Mod-[")
1024
+ },
1025
+ prosePlugins: (e) => [dt(e)]
1026
+ })), ie = I("WrapInOrderedList"), Ie = "ordered_list", ft = L((i) => ({
1027
+ id: Ie,
1154
1028
  schema: () => ({
1155
1029
  content: "listItem+",
1156
1030
  group: "block",
@@ -1162,244 +1036,262 @@ const orderedList = createNode((utils) => ({
1162
1036
  parseDOM: [
1163
1037
  {
1164
1038
  tag: "ol",
1165
- getAttrs: (dom) => {
1166
- if (!(dom instanceof HTMLElement)) {
1167
- throw new Error();
1168
- }
1169
- return { order: dom.hasAttribute("start") ? Number(dom.getAttribute("start")) : 1 };
1039
+ getAttrs: (e) => {
1040
+ if (!(e instanceof HTMLElement))
1041
+ throw D(e);
1042
+ return { order: e.hasAttribute("start") ? Number(e.getAttribute("start")) : 1 };
1170
1043
  }
1171
1044
  }
1172
1045
  ],
1173
- toDOM: (node) => [
1046
+ toDOM: (e) => [
1174
1047
  "ol",
1175
- __spreadProps(__spreadValues({}, node.attrs["order"] === 1 ? {} : node.attrs["order"]), {
1176
- class: utils.getClassName(node.attrs, "ordered-list")
1177
- }),
1048
+ {
1049
+ ...e.attrs.order === 1 ? {} : e.attrs.order,
1050
+ class: i.getClassName(e.attrs, "ordered-list")
1051
+ },
1178
1052
  0
1179
1053
  ],
1180
1054
  parseMarkdown: {
1181
- match: ({ type, ordered }) => type === "list" && !!ordered,
1182
- runner: (state, node, type) => {
1183
- state.openNode(type).next(node.children).closeNode();
1055
+ match: ({ type: e, ordered: t }) => e === "list" && !!t,
1056
+ runner: (e, t, r) => {
1057
+ e.openNode(r).next(t.children).closeNode();
1184
1058
  }
1185
1059
  },
1186
1060
  toMarkdown: {
1187
- match: (node) => node.type.name === id$1,
1188
- runner: (state, node) => {
1189
- state.openNode("list", void 0, { ordered: true, start: 1 });
1190
- state.next(node.content);
1191
- state.closeNode();
1061
+ match: (e) => e.type.name === Ie,
1062
+ runner: (e, t) => {
1063
+ e.openNode("list", void 0, { ordered: !0, start: 1 }), e.next(t.content), e.closeNode();
1192
1064
  }
1193
1065
  }
1194
1066
  }),
1195
- inputRules: (nodeType) => [
1196
- wrappingInputRule(/^(\d+)\.\s$/, nodeType, (match) => ({ order: Number(match[1]) }), (match, node) => node.childCount + node.attrs["order"] === Number(match[1]))
1067
+ inputRules: (e) => [
1068
+ q(/^(\d+)\.\s$/, e, (t) => ({ order: Number(t[1]) }), (t, r) => r.childCount + r.attrs.order === Number(t[1]))
1197
1069
  ],
1198
- commands: (nodeType) => [createCmd(WrapInOrderedList, () => wrapIn(nodeType))],
1070
+ commands: (e) => [M(ie, () => de(e))],
1199
1071
  shortcuts: {
1200
- [SupportedKeys.OrderedList]: createShortcut(WrapInOrderedList, "Mod-Alt-7")
1072
+ [k.OrderedList]: h(ie, "Mod-Alt-7")
1201
1073
  }
1202
- }));
1203
- const TurnIntoText = createCmdKey("TurnIntoText");
1204
- const id = "paragraph";
1205
- const paragraph = createNode((utils) => {
1206
- return {
1207
- id,
1208
- schema: () => ({
1209
- content: "inline*",
1210
- group: "block",
1211
- parseDOM: [{ tag: "p" }],
1212
- toDOM: (node) => ["p", { class: utils.getClassName(node.attrs, id) }, 0],
1213
- parseMarkdown: {
1214
- match: (node) => node.type === "paragraph",
1215
- runner: (state, node, type) => {
1216
- state.openNode(type);
1217
- if (node.children) {
1218
- state.next(node.children);
1219
- } else {
1220
- state.addText(node["value"]);
1221
- }
1222
- state.closeNode();
1223
- }
1224
- },
1225
- toMarkdown: {
1226
- match: (node) => node.type.name === "paragraph",
1227
- runner: (state, node) => {
1228
- var _a;
1229
- state.openNode("paragraph");
1230
- const lastIsHardbreak = node.childCount >= 1 && ((_a = node.lastChild) == null ? void 0 : _a.type.name) === "hardbreak";
1231
- if (lastIsHardbreak) {
1232
- const contentArr = [];
1233
- node.content.forEach((n, _, i) => {
1234
- if (i === node.childCount - 1) {
1235
- return;
1236
- }
1237
- contentArr.push(n);
1238
- });
1239
- state.next(Fragment.fromArray(contentArr));
1240
- } else {
1241
- state.next(node.content);
1242
- }
1243
- state.closeNode();
1244
- }
1074
+ })), ue = I("TurnIntoText"), be = "paragraph", gt = L((i) => ({
1075
+ id: be,
1076
+ schema: () => ({
1077
+ content: "inline*",
1078
+ group: "block",
1079
+ parseDOM: [{ tag: "p" }],
1080
+ toDOM: (e) => ["p", { class: i.getClassName(e.attrs, be) }, 0],
1081
+ parseMarkdown: {
1082
+ match: (e) => e.type === "paragraph",
1083
+ runner: (e, t, r) => {
1084
+ e.openNode(r), t.children ? e.next(t.children) : e.addText(t.value), e.closeNode();
1085
+ }
1086
+ },
1087
+ toMarkdown: {
1088
+ match: (e) => e.type.name === "paragraph",
1089
+ runner: (e, t) => {
1090
+ var n;
1091
+ if (e.openNode("paragraph"), t.childCount >= 1 && ((n = t.lastChild) == null ? void 0 : n.type.name) === "hardbreak") {
1092
+ const s = [];
1093
+ t.content.forEach((a, o, l) => {
1094
+ l !== t.childCount - 1 && s.push(a);
1095
+ }), e.next(R.fromArray(s));
1096
+ } else
1097
+ e.next(t.content);
1098
+ e.closeNode();
1245
1099
  }
1246
- }),
1247
- commands: (nodeType) => [createCmd(TurnIntoText, () => setBlockType(nodeType))],
1248
- shortcuts: {
1249
- [SupportedKeys.Text]: createShortcut(TurnIntoText, "Mod-Alt-0")
1250
1100
  }
1251
- };
1252
- });
1253
- const text = createNode(() => ({
1101
+ }),
1102
+ commands: (e) => [M(ue, () => E(e))],
1103
+ shortcuts: {
1104
+ [k.Text]: h(ue, "Mod-Alt-0")
1105
+ }
1106
+ })), pt = L(() => ({
1254
1107
  id: "text",
1255
1108
  schema: () => ({
1256
1109
  group: "inline",
1257
1110
  parseMarkdown: {
1258
- match: ({ type }) => type === "text",
1259
- runner: (state, node) => {
1260
- state.addText(node["value"]);
1111
+ match: ({ type: i }) => i === "text",
1112
+ runner: (i, e) => {
1113
+ i.addText(e.value);
1261
1114
  }
1262
1115
  },
1263
1116
  toMarkdown: {
1264
- match: (node) => node.type.name === "text",
1265
- runner: (state, node) => {
1266
- state.addNode("text", void 0, node.text);
1117
+ match: (i) => i.type.name === "text",
1118
+ runner: (i, e) => {
1119
+ i.addNode("text", void 0, e.text);
1267
1120
  }
1268
1121
  }
1269
1122
  })
1270
- }));
1271
- const nodes = [
1272
- doc(),
1273
- paragraph(),
1274
- hardbreak(),
1275
- blockquote(),
1276
- codeFence(),
1277
- bulletList(),
1278
- orderedList(),
1279
- listItem(),
1280
- heading(),
1281
- hr(),
1282
- image(),
1283
- text()
1284
- ];
1285
- const isParent = (node) => !!node.children;
1286
- const isHTML = (node) => node.type === "html";
1287
- function flatMapWithDepth(ast, fn) {
1288
- return transform(ast, 0, null)[0];
1289
- function transform(node, index, parent) {
1290
- if (isParent(node)) {
1291
- const out = [];
1292
- for (let i = 0, n = node.children.length; i < n; i++) {
1293
- const nthChild = node.children[i];
1294
- if (nthChild) {
1295
- const xs = transform(nthChild, i, node);
1296
- if (xs) {
1297
- for (let j = 0, m = xs.length; j < m; j++) {
1298
- const item = xs[j];
1299
- if (item) {
1300
- out.push(item);
1301
- }
1123
+ })), ht = [
1124
+ Ze(),
1125
+ gt(),
1126
+ tt(),
1127
+ ze(),
1128
+ Ye(),
1129
+ Ge(),
1130
+ ft(),
1131
+ mt(),
1132
+ at(),
1133
+ lt(),
1134
+ it(),
1135
+ pt()
1136
+ ], kt = () => {
1137
+ function i(e) {
1138
+ We(e, "list", (t) => {
1139
+ var r;
1140
+ if (t.ordered) {
1141
+ const n = (r = t.start) != null ? r : 1;
1142
+ t.children.forEach((s, a) => {
1143
+ s.label = a + n;
1144
+ });
1145
+ return;
1146
+ }
1147
+ });
1148
+ }
1149
+ return i;
1150
+ }, Mt = (i) => !!i.children, It = (i) => i.type === "html";
1151
+ function bt(i, e) {
1152
+ return t(i, 0, null)[0];
1153
+ function t(r, n, s) {
1154
+ if (Mt(r)) {
1155
+ const a = [];
1156
+ for (let o = 0, l = r.children.length; o < l; o++) {
1157
+ const c = r.children[o];
1158
+ if (c) {
1159
+ const u = t(c, o, r);
1160
+ if (u)
1161
+ for (let f = 0, d = u.length; f < d; f++) {
1162
+ const m = u[f];
1163
+ m && a.push(m);
1302
1164
  }
1303
- }
1304
1165
  }
1305
1166
  }
1306
- node.children = out;
1167
+ r.children = a;
1307
1168
  }
1308
- return fn(node, index, parent);
1169
+ return e(r, n, s);
1309
1170
  }
1310
1171
  }
1311
- const filterHTMLPlugin = () => {
1312
- function transformer(tree) {
1313
- flatMapWithDepth(tree, (node) => {
1314
- if (!isHTML(node)) {
1315
- return [node];
1316
- }
1317
- return [];
1318
- });
1172
+ const yt = () => {
1173
+ function i(e) {
1174
+ bt(e, (t) => It(t) ? [] : [t]);
1319
1175
  }
1320
- return transformer;
1321
- };
1322
- const inlineNodesCursorPluginKey = new PluginKey("MILKDOWN_INLINE_NODES_CURSOR");
1323
- const inlineNodesCursorPlugin = new Plugin({
1324
- key: inlineNodesCursorPluginKey,
1325
- state: {
1326
- init() {
1327
- return false;
1328
- },
1329
- apply(tr) {
1330
- if (!tr.selection.empty) {
1331
- return false;
1332
- }
1333
- const pos = tr.selection.$from;
1334
- const left = pos.nodeBefore;
1335
- const right = pos.nodeAfter;
1336
- if (left && right && left.isInline && !left.isText && right.isInline && !right.isText) {
1337
- return true;
1338
- }
1339
- return false;
1340
- }
1341
- },
1342
- props: {
1343
- handleDOMEvents: {
1344
- beforeinput: (view, e) => {
1345
- const active = inlineNodesCursorPlugin.getState(view.state);
1346
- if (active && e instanceof InputEvent) {
1347
- const from = view.state.selection.from;
1348
- e.preventDefault();
1349
- view.dispatch(view.state.tr.insertText(e.data || "", from));
1350
- return true;
1351
- }
1352
- return false;
1176
+ return i;
1177
+ }, Nt = new T("MILKDOWN_INLINE_NODES_CURSOR"), Lt = () => {
1178
+ let i = !1;
1179
+ const e = new H({
1180
+ key: Nt,
1181
+ state: {
1182
+ init() {
1183
+ return !1;
1184
+ },
1185
+ apply(t) {
1186
+ if (!t.selection.empty)
1187
+ return !1;
1188
+ const r = t.selection.$from, n = r.nodeBefore, s = r.nodeAfter;
1189
+ return !!(n && s && n.isInline && !n.isText && s.isInline && !s.isText);
1353
1190
  }
1354
1191
  },
1355
- decorations(state) {
1356
- const active = inlineNodesCursorPlugin.getState(state);
1357
- if (active) {
1358
- const pos = state.selection.$from;
1359
- const position = pos.pos;
1360
- const left = document.createElement("span");
1361
- const leftDec = Decoration.widget(position, left, {
1362
- side: -1
1363
- });
1364
- const right = document.createElement("span");
1365
- const rightDec = Decoration.widget(position, right);
1366
- setTimeout(() => {
1367
- left.contentEditable = "true";
1368
- right.contentEditable = "true";
1369
- });
1370
- return DecorationSet.create(state.doc, [leftDec, rightDec]);
1192
+ props: {
1193
+ handleDOMEvents: {
1194
+ compositionend: (t, r) => i ? (i = !1, requestAnimationFrame(() => {
1195
+ if (e.getState(t.state)) {
1196
+ const s = t.state.selection.from;
1197
+ r.preventDefault(), t.dispatch(t.state.tr.insertText(r.data || "", s));
1198
+ }
1199
+ }), !0) : !1,
1200
+ compositionstart: (t) => (e.getState(t.state) && (i = !0), !1),
1201
+ beforeinput: (t, r) => {
1202
+ if (e.getState(t.state) && r instanceof InputEvent && r.data && !i) {
1203
+ const s = t.state.selection.from;
1204
+ return r.preventDefault(), t.dispatch(t.state.tr.insertText(r.data || "", s)), !0;
1205
+ }
1206
+ return !1;
1207
+ }
1208
+ },
1209
+ decorations(t) {
1210
+ if (e.getState(t)) {
1211
+ const s = t.selection.$from.pos, a = document.createElement("span"), o = Q.widget(s, a, {
1212
+ side: -1
1213
+ }), l = document.createElement("span"), c = Q.widget(s, l);
1214
+ return setTimeout(() => {
1215
+ a.contentEditable = "true", l.contentEditable = "true";
1216
+ }), O.create(t.doc, [o, c]);
1217
+ }
1218
+ return O.empty;
1371
1219
  }
1372
- return DecorationSet.empty;
1373
1220
  }
1374
- }
1375
- });
1376
- const commonmarkPlugins = [
1377
- createPlugin(() => ({
1378
- prosePlugins: () => [inlineNodesCursorPlugin],
1379
- remarkPlugins: () => [links, filterHTMLPlugin]
1221
+ });
1222
+ return e;
1223
+ }, wt = [
1224
+ De(() => ({
1225
+ prosePlugins: () => [Lt()],
1226
+ remarkPlugins: () => [Pe, yt, kt]
1380
1227
  }))()
1381
- ];
1382
- const commonmarkNodes = AtomList.create([...nodes, ...marks]);
1383
- const commonmark = AtomList.create([...commonmarkPlugins, ...commonmarkNodes]);
1384
- const commands = {
1385
- ToggleInlineCode,
1386
- ToggleItalic,
1387
- ToggleLink,
1388
- ToggleBold,
1389
- ModifyLink,
1390
- ModifyImage,
1391
- WrapInBlockquote,
1392
- WrapInBulletList,
1393
- WrapInOrderedList,
1394
- TurnIntoCodeFence,
1395
- TurnIntoHeading,
1396
- TurnIntoText,
1397
- InsertHardbreak,
1398
- InsertHr,
1399
- InsertImage,
1400
- SplitListItem,
1401
- SinkListItem,
1402
- LiftListItem
1228
+ ], xt = ye.create([...ht, ...je]), Pt = ye.create([...wt, ...xt]), Wt = {
1229
+ ToggleInlineCode: X,
1230
+ ToggleItalic: Y,
1231
+ ToggleLink: we,
1232
+ ToggleBold: ee,
1233
+ ModifyLink: Z,
1234
+ ModifyImage: oe,
1235
+ WrapInBlockquote: te,
1236
+ WrapInBulletList: re,
1237
+ WrapInOrderedList: ie,
1238
+ TurnIntoCodeFence: ne,
1239
+ TurnIntoHeading: C,
1240
+ TurnIntoText: ue,
1241
+ InsertHardbreak: se,
1242
+ InsertHr: xe,
1243
+ InsertImage: Ce,
1244
+ SplitListItem: ae,
1245
+ SinkListItem: le,
1246
+ LiftListItem: ce
1247
+ };
1248
+ export {
1249
+ ke as DowngradeHeading,
1250
+ et as HardbreakFilterPluginKey,
1251
+ se as InsertHardbreak,
1252
+ xe as InsertHr,
1253
+ Ce as InsertImage,
1254
+ ce as LiftListItem,
1255
+ oe as ModifyImage,
1256
+ Z as ModifyLink,
1257
+ le as SinkListItem,
1258
+ ae as SplitListItem,
1259
+ k as SupportedKeys,
1260
+ ee as ToggleBold,
1261
+ X as ToggleInlineCode,
1262
+ Y as ToggleItalic,
1263
+ we as ToggleLink,
1264
+ ne as TurnIntoCodeFence,
1265
+ C as TurnIntoHeading,
1266
+ ue as TurnIntoText,
1267
+ te as WrapInBlockquote,
1268
+ re as WrapInBulletList,
1269
+ ie as WrapInOrderedList,
1270
+ Qe as backtickInputRegex,
1271
+ ze as blockquote,
1272
+ Ge as bulletList,
1273
+ Ye as codeFence,
1274
+ qe as codeInline,
1275
+ Wt as commands,
1276
+ Pt as commonmark,
1277
+ xt as commonmarkNodes,
1278
+ wt as commonmarkPlugins,
1279
+ Ze as doc,
1280
+ Ke as em,
1281
+ tt as hardbreak,
1282
+ at as heading,
1283
+ rt as headingHashPluginKey,
1284
+ z as headingIdPluginKey,
1285
+ lt as hr,
1286
+ it as image,
1287
+ Ue as link,
1288
+ mt as listItem,
1289
+ je as marks,
1290
+ ht as nodes,
1291
+ ft as orderedList,
1292
+ gt as paragraph,
1293
+ Ve as strong,
1294
+ pt as text,
1295
+ Xe as tildeInputRegex
1403
1296
  };
1404
- export { InsertHardbreak, InsertHr, InsertImage, LiftListItem, ModifyImage, ModifyLink, SinkListItem, SplitListItem, SupportedKeys, ToggleBold, ToggleInlineCode, ToggleItalic, ToggleLink, TurnIntoCodeFence, TurnIntoHeading, TurnIntoText, WrapInBlockquote, WrapInBulletList, WrapInOrderedList, backtickInputRegex, blockquote, bulletList, codeFence, codeInline, commands, commonmark, commonmarkNodes, commonmarkPlugins, doc, em, hardbreak, heading, headingPluginKey, hr, image, link, listItem, marks, nodes, orderedList, paragraph, strong, text, tildeInputRegex };
1405
1297
  //# sourceMappingURL=index.es.js.map