@milkdown/preset-gfm 6.5.0 → 6.5.3
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/footnote/definition.d.ts +1 -1
- package/lib/footnote/definition.d.ts.map +1 -1
- package/lib/footnote/index.d.ts.map +1 -1
- package/lib/footnote/reference.d.ts +1 -1
- package/lib/footnote/reference.d.ts.map +1 -1
- package/lib/footnote/utils.d.ts.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.es.js +1007 -863
- package/lib/index.es.js.map +1 -1
- package/lib/strike-through.d.ts +1 -1
- package/lib/strike-through.d.ts.map +1 -1
- package/lib/supported-keys.d.ts +1 -1
- package/lib/supported-keys.d.ts.map +1 -1
- package/lib/table/command.d.ts +2 -2
- package/lib/table/command.d.ts.map +1 -1
- package/lib/table/index.d.ts +1 -1
- package/lib/table/index.d.ts.map +1 -1
- package/lib/table/nodes/index.d.ts +1 -1
- package/lib/table/nodes/index.d.ts.map +1 -1
- package/lib/table/operator-plugin/actions.d.ts +5 -5
- package/lib/table/operator-plugin/actions.d.ts.map +1 -1
- package/lib/table/operator-plugin/calc-pos.d.ts +1 -1
- package/lib/table/operator-plugin/calc-pos.d.ts.map +1 -1
- package/lib/table/operator-plugin/constant.d.ts.map +1 -1
- package/lib/table/operator-plugin/helper.d.ts +3 -3
- package/lib/table/operator-plugin/helper.d.ts.map +1 -1
- package/lib/table/operator-plugin/index.d.ts +2 -2
- package/lib/table/operator-plugin/index.d.ts.map +1 -1
- package/lib/table/operator-plugin/style.d.ts +1 -1
- package/lib/table/operator-plugin/style.d.ts.map +1 -1
- package/lib/table/operator-plugin/widget.d.ts +2 -2
- package/lib/table/operator-plugin/widget.d.ts.map +1 -1
- package/lib/table/plugin/auto-insert-zero-space.d.ts.map +1 -1
- package/lib/table/plugin/cell-selection.d.ts +5 -3
- package/lib/table/plugin/cell-selection.d.ts.map +1 -1
- package/lib/table/plugin/column-resizing.d.ts +2 -1
- package/lib/table/plugin/column-resizing.d.ts.map +1 -1
- package/lib/table/plugin/commands.d.ts +2 -2
- package/lib/table/plugin/commands.d.ts.map +1 -1
- package/lib/table/plugin/copy-paste.d.ts +6 -5
- package/lib/table/plugin/copy-paste.d.ts.map +1 -1
- package/lib/table/plugin/fix-tables.d.ts +3 -2
- package/lib/table/plugin/fix-tables.d.ts.map +1 -1
- package/lib/table/plugin/index.d.ts.map +1 -1
- package/lib/table/plugin/schema.d.ts +1 -1
- package/lib/table/plugin/schema.d.ts.map +1 -1
- package/lib/table/plugin/table-editing.d.ts +1 -1
- package/lib/table/plugin/table-editing.d.ts.map +1 -1
- package/lib/table/plugin/table-map.d.ts +2 -2
- package/lib/table/plugin/table-map.d.ts.map +1 -1
- package/lib/table/plugin/table-view.d.ts +2 -2
- package/lib/table/plugin/table-view.d.ts.map +1 -1
- package/lib/table/plugin/types.d.ts +2 -2
- package/lib/table/plugin/types.d.ts.map +1 -1
- package/lib/table/plugin/util.d.ts +2 -2
- package/lib/table/plugin/util.d.ts.map +1 -1
- package/lib/table/utils.d.ts +5 -5
- package/lib/table/utils.d.ts.map +1 -1
- package/lib/task-list-item.d.ts +2 -2
- package/lib/task-list-item.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/footnote/definition.ts +172 -166
- package/src/footnote/index.ts +2 -2
- package/src/footnote/reference.ts +166 -162
- package/src/footnote/utils.ts +2 -2
- package/src/index.ts +83 -83
- package/src/strike-through.ts +36 -36
- package/src/supported-keys.ts +9 -8
- package/src/table/command.ts +17 -16
- package/src/table/index.ts +9 -9
- package/src/table/nodes/index.ts +177 -174
- package/src/table/operator-plugin/actions.ts +103 -102
- package/src/table/operator-plugin/calc-pos.ts +31 -24
- package/src/table/operator-plugin/constant.ts +3 -3
- package/src/table/operator-plugin/helper.ts +31 -32
- package/src/table/operator-plugin/index.ts +104 -95
- package/src/table/operator-plugin/style.ts +10 -9
- package/src/table/operator-plugin/widget.ts +47 -45
- package/src/table/plugin/auto-insert-zero-space.ts +41 -41
- package/src/table/plugin/cell-selection.ts +325 -296
- package/src/table/plugin/column-resizing.ts +226 -198
- package/src/table/plugin/commands.ts +464 -421
- package/src/table/plugin/copy-paste.ts +256 -240
- package/src/table/plugin/fix-tables.ts +103 -88
- package/src/table/plugin/index.ts +3 -3
- package/src/table/plugin/schema.ts +100 -94
- package/src/table/plugin/table-editing.ts +324 -230
- package/src/table/plugin/table-map.ts +294 -229
- package/src/table/plugin/table-view.ts +66 -62
- package/src/table/plugin/types.ts +8 -8
- package/src/table/plugin/util.ts +78 -66
- package/src/table/utils.ts +141 -138
- package/src/task-list-item.ts +151 -146
package/lib/index.es.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
1
|
+
var lt = Object.defineProperty;
|
|
2
|
+
var rt = (o, e, t) => e in o ? lt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var I = (o, e, t) => (rt(o, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { SupportedKeys as it, commonmark as ct, commands as at } from "@milkdown/preset-commonmark";
|
|
5
|
+
import { InsertHardbreak as uo, InsertHr as po, InsertImage as ho, LiftListItem as mo, ModifyImage as go, ModifyLink as wo, SinkListItem as bo, SplitListItem as Co, ToggleBold as yo, ToggleInlineCode as ko, ToggleItalic as Ao, ToggleLink as Mo, TurnIntoCodeFence as So, TurnIntoHeading as No, TurnIntoText as xo, WrapInBlockquote as Ro, WrapInBulletList as To, WrapInOrderedList as Lo, blockquote as vo, bulletList as Eo, codeFence as $o, codeInline as Io, commonmark as Do, commonmarkNodes as Oo, commonmarkPlugins as _o, doc as zo, em as Fo, HardbreakFilterPluginKey as Bo, heading as Wo, hr as Po, image as Ho, link as jo, listItem as Ko, orderedList as qo, paragraph as Xo, strong as Uo, text as Vo } from "@milkdown/preset-commonmark";
|
|
6
|
+
import { createNode as ke, createPlugin as dt, createShortcut as O, createMark as ft, AtomList as ut, $remark as pt } from "@milkdown/utils";
|
|
7
|
+
import ht from "remark-gfm";
|
|
8
|
+
import { createCmdKey as R, editorViewCtx as U, createCmd as N, commandsCtx as Ve, themeManagerCtx as L, ThemeIcon as v, getPalette as mt, ThemeSize as Te, ThemeBorder as gt, ThemeShadow as wt, schemaCtx as J } from "@milkdown/core";
|
|
9
|
+
import { expectDomTypeError as Ae, missingRootElement as bt } from "@milkdown/exception";
|
|
10
|
+
import { findSelectedNodeOfType as W, findParentNode as Ct, cloneTr as Ge, calculateNodePosition as yt, browser as Le } from "@milkdown/prose";
|
|
11
|
+
import { wrappingInputRule as Je, InputRule as ue } from "@milkdown/prose/inputrules";
|
|
12
|
+
import { PluginKey as B, NodeSelection as oe, Plugin as H, Selection as S, SelectionRange as kt, TextSelection as E } from "@milkdown/prose/state";
|
|
13
|
+
import { toggleMark as At, wrapIn as Mt } from "@milkdown/prose/commands";
|
|
14
|
+
import { Fragment as $, Slice as _ } from "@milkdown/prose/model";
|
|
15
|
+
import { Decoration as Me, DecorationSet as Se } from "@milkdown/prose/view";
|
|
16
|
+
import { keydownHandler as St } from "@milkdown/prose/keymap";
|
|
17
|
+
import { Transform as Nt } from "@milkdown/prose/transform";
|
|
18
|
+
import { splitListItem as xt, sinkListItem as Rt, liftListItem as Tt } from "@milkdown/prose/schema-list";
|
|
19
|
+
const Ye = (o) => `footnote-ref-${o}`, Ze = (o) => `footnote-def-${o}`, Lt = new B("MILKDOWN_FOOTNOTE_DEF_INPUT"), ve = R("ModifyFootnoteDef"), vt = ke((o) => {
|
|
17
20
|
const e = "footnote_definition", t = "footnoteDefinition";
|
|
18
21
|
return {
|
|
19
22
|
id: e,
|
|
@@ -29,95 +32,100 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
|
|
|
29
32
|
parseDOM: [
|
|
30
33
|
{
|
|
31
34
|
tag: `div[data-type="${e}"]`,
|
|
32
|
-
getAttrs: (
|
|
33
|
-
if (!(
|
|
34
|
-
throw
|
|
35
|
+
getAttrs: (s) => {
|
|
36
|
+
if (!(s instanceof HTMLElement))
|
|
37
|
+
throw Ae(s);
|
|
35
38
|
return {
|
|
36
|
-
label:
|
|
39
|
+
label: s.dataset.label
|
|
37
40
|
};
|
|
38
41
|
},
|
|
39
42
|
contentElement: "dd"
|
|
40
43
|
}
|
|
41
44
|
],
|
|
42
|
-
toDOM: (
|
|
43
|
-
const
|
|
44
|
-
a.textContent = `[${
|
|
45
|
-
const c = n.get(
|
|
45
|
+
toDOM: (s) => {
|
|
46
|
+
const l = s.attrs.label, r = o.getClassName(s.attrs, "footnote-definition"), a = document.createElement("dt");
|
|
47
|
+
a.textContent = `[${l}]:`, a.onclick = () => {
|
|
48
|
+
const c = n.get(U), d = oe.create(c.state.doc, c.state.selection.from - 2);
|
|
46
49
|
c.dispatch(c.state.tr.setSelection(d));
|
|
47
50
|
};
|
|
48
51
|
const i = document.createElement("a");
|
|
49
|
-
return i.href = `#${
|
|
52
|
+
return i.href = `#${Ye(l)}`, i.contentEditable = "false", i.textContent = "\u21A9", i.onmousedown = (c) => {
|
|
50
53
|
c.preventDefault();
|
|
51
54
|
}, [
|
|
52
55
|
"div",
|
|
53
56
|
{
|
|
54
57
|
class: r,
|
|
55
|
-
"data-label":
|
|
58
|
+
"data-label": l,
|
|
56
59
|
"data-type": e,
|
|
57
|
-
id:
|
|
60
|
+
id: Ze(l)
|
|
58
61
|
},
|
|
59
62
|
["div", { class: "footnote-definition_content" }, a, ["dd", 0]],
|
|
60
63
|
["div", { class: "footnote-definition_anchor" }, i]
|
|
61
64
|
];
|
|
62
65
|
},
|
|
63
66
|
parseMarkdown: {
|
|
64
|
-
match: ({ type:
|
|
65
|
-
runner: (
|
|
66
|
-
|
|
67
|
-
label:
|
|
68
|
-
}).next(
|
|
67
|
+
match: ({ type: s }) => s === t,
|
|
68
|
+
runner: (s, l, r) => {
|
|
69
|
+
s.openNode(r, {
|
|
70
|
+
label: l.label
|
|
71
|
+
}).next(l.children).closeNode();
|
|
69
72
|
}
|
|
70
73
|
},
|
|
71
74
|
toMarkdown: {
|
|
72
|
-
match: (
|
|
73
|
-
runner: (
|
|
74
|
-
|
|
75
|
-
label:
|
|
76
|
-
identifier:
|
|
77
|
-
}).next(
|
|
75
|
+
match: (s) => s.type.name === e,
|
|
76
|
+
runner: (s, l) => {
|
|
77
|
+
s.openNode(t, void 0, {
|
|
78
|
+
label: l.attrs.label,
|
|
79
|
+
identifier: l.attrs.label
|
|
80
|
+
}).next(l.content).closeNode();
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
83
|
}),
|
|
81
84
|
commands: (n) => [
|
|
82
|
-
|
|
83
|
-
const a =
|
|
85
|
+
N(ve, (s = "") => (l, r) => {
|
|
86
|
+
const a = W(l.selection, n);
|
|
84
87
|
if (!a)
|
|
85
88
|
return !1;
|
|
86
|
-
const { tr: i } =
|
|
87
|
-
return r == null || r(c.setSelection(
|
|
89
|
+
const { tr: i } = l, c = i.setNodeMarkup(a.pos, void 0, { ...a.node.attrs, label: s });
|
|
90
|
+
return r == null || r(c.setSelection(oe.create(c.doc, a.pos))), !0;
|
|
88
91
|
})
|
|
89
92
|
],
|
|
90
93
|
inputRules: (n) => [
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
Je(
|
|
95
|
+
/(?:\[\^)([^:]+)(?::)$/,
|
|
96
|
+
n,
|
|
97
|
+
(s) => {
|
|
98
|
+
var r;
|
|
99
|
+
return {
|
|
100
|
+
label: (r = s[1]) != null ? r : "footnote"
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
() => !1
|
|
104
|
+
)
|
|
97
105
|
],
|
|
98
|
-
prosePlugins: (n,
|
|
99
|
-
new
|
|
100
|
-
key:
|
|
101
|
-
view: (
|
|
106
|
+
prosePlugins: (n, s) => [
|
|
107
|
+
new H({
|
|
108
|
+
key: Lt,
|
|
109
|
+
view: (l) => {
|
|
102
110
|
const r = o.themeManager.get("input-chip", {
|
|
103
111
|
width: "12em",
|
|
104
112
|
placeholder: "Input Footnote Label",
|
|
105
113
|
onUpdate: (d) => {
|
|
106
|
-
|
|
114
|
+
s.get(Ve).call(ve, d);
|
|
107
115
|
},
|
|
108
116
|
isBindMode: !0
|
|
109
117
|
});
|
|
110
118
|
if (!r)
|
|
111
119
|
return {};
|
|
112
|
-
const a = (d) => Boolean(n &&
|
|
113
|
-
const f =
|
|
120
|
+
const a = (d) => Boolean(n && W(d.state.selection, n)), i = (d) => {
|
|
121
|
+
const f = W(d.state.selection, n);
|
|
114
122
|
return f ? f.node.attrs.label : void 0;
|
|
115
123
|
}, c = (d) => {
|
|
116
124
|
if (!d.editable)
|
|
117
125
|
return;
|
|
118
126
|
a(d) ? (r.show(d), r.update(i(d))) : r.hide();
|
|
119
127
|
};
|
|
120
|
-
return r.init(
|
|
128
|
+
return r.init(l), c(l), {
|
|
121
129
|
update: (d, f) => {
|
|
122
130
|
(f == null ? void 0 : f.doc.eq(d.state.doc)) && f.selection.eq(d.state.selection) || c(d);
|
|
123
131
|
},
|
|
@@ -129,7 +137,7 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
|
|
|
129
137
|
})
|
|
130
138
|
]
|
|
131
139
|
};
|
|
132
|
-
}),
|
|
140
|
+
}), Ee = R("ModifyFootnoteRef"), Et = new B("MILKDOWN_FOOTNOTE_REF_INPUT"), $t = ke((o) => {
|
|
133
141
|
const e = "footnote_reference";
|
|
134
142
|
return {
|
|
135
143
|
id: e,
|
|
@@ -147,7 +155,7 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
|
|
|
147
155
|
tag: `sup[data-type="${e}"]`,
|
|
148
156
|
getAttrs: (n) => {
|
|
149
157
|
if (!(n instanceof HTMLElement))
|
|
150
|
-
throw
|
|
158
|
+
throw Ae(n);
|
|
151
159
|
return {
|
|
152
160
|
label: n.dataset.label
|
|
153
161
|
};
|
|
@@ -155,254 +163,276 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
|
|
|
155
163
|
}
|
|
156
164
|
],
|
|
157
165
|
toDOM: (n) => {
|
|
158
|
-
const
|
|
159
|
-
return
|
|
160
|
-
t.get(
|
|
161
|
-
},
|
|
162
|
-
t.get(
|
|
166
|
+
const s = n.attrs.label, l = document.createElement("a"), r = `#${Ze(s)}`;
|
|
167
|
+
return l.href = r, l.textContent = `[${s}]`, l.onclick = (a) => {
|
|
168
|
+
t.get(U).editable && a.preventDefault();
|
|
169
|
+
}, l.ondblclick = () => {
|
|
170
|
+
t.get(U).editable && (window.location.href = r);
|
|
163
171
|
}, [
|
|
164
172
|
"sup",
|
|
165
173
|
{
|
|
166
|
-
"data-label":
|
|
174
|
+
"data-label": s,
|
|
167
175
|
"data-type": e,
|
|
168
|
-
id:
|
|
176
|
+
id: Ye(s)
|
|
169
177
|
},
|
|
170
|
-
|
|
178
|
+
l
|
|
171
179
|
];
|
|
172
180
|
},
|
|
173
181
|
parseMarkdown: {
|
|
174
182
|
match: ({ type: n }) => n === "footnoteReference",
|
|
175
|
-
runner: (n,
|
|
176
|
-
n.addNode(
|
|
177
|
-
label:
|
|
183
|
+
runner: (n, s, l) => {
|
|
184
|
+
n.addNode(l, {
|
|
185
|
+
label: s.label
|
|
178
186
|
});
|
|
179
187
|
}
|
|
180
188
|
},
|
|
181
189
|
toMarkdown: {
|
|
182
190
|
match: (n) => n.type.name === e,
|
|
183
|
-
runner: (n,
|
|
191
|
+
runner: (n, s) => {
|
|
184
192
|
n.addNode("footnoteReference", void 0, void 0, {
|
|
185
|
-
label:
|
|
186
|
-
identifier:
|
|
193
|
+
label: s.attrs.label,
|
|
194
|
+
identifier: s.attrs.label
|
|
187
195
|
});
|
|
188
196
|
}
|
|
189
197
|
}
|
|
190
198
|
}),
|
|
191
199
|
commands: (t) => [
|
|
192
|
-
|
|
193
|
-
const r =
|
|
200
|
+
N(Ee, (n = "") => (s, l) => {
|
|
201
|
+
const r = W(s.selection, t);
|
|
194
202
|
if (!r)
|
|
195
203
|
return !1;
|
|
196
|
-
const { tr: a } =
|
|
197
|
-
return
|
|
204
|
+
const { tr: a } = s, i = a.setNodeMarkup(r.pos, void 0, { ...r.node.attrs, label: n });
|
|
205
|
+
return l == null || l(i.setSelection(oe.create(i.doc, r.pos))), !0;
|
|
198
206
|
})
|
|
199
207
|
],
|
|
200
208
|
inputRules: (t) => [
|
|
201
|
-
new
|
|
202
|
-
const a = n.doc.resolve(
|
|
209
|
+
new ue(/(?:\[\^)([^\]]+)(?:\])$/, (n, s, l, r) => {
|
|
210
|
+
const a = n.doc.resolve(l), i = a.index(), c = n.doc.resolve(r);
|
|
203
211
|
if (!a.parent.canReplaceWith(i, c.index(), t))
|
|
204
212
|
return null;
|
|
205
|
-
const d =
|
|
206
|
-
return n.tr.replaceRangeWith(
|
|
207
|
-
|
|
208
|
-
|
|
213
|
+
const d = s[1];
|
|
214
|
+
return n.tr.replaceRangeWith(
|
|
215
|
+
l,
|
|
216
|
+
r,
|
|
217
|
+
t.create({
|
|
218
|
+
label: d
|
|
219
|
+
})
|
|
220
|
+
);
|
|
209
221
|
})
|
|
210
222
|
],
|
|
211
223
|
prosePlugins: (t, n) => {
|
|
212
|
-
const
|
|
224
|
+
const s = o.themeManager.get("input-chip", {
|
|
213
225
|
width: "12em",
|
|
214
226
|
placeholder: "Input Footnote Label",
|
|
215
227
|
onUpdate: (i) => {
|
|
216
|
-
n.get(
|
|
228
|
+
n.get(Ve).call(Ee, i);
|
|
217
229
|
},
|
|
218
230
|
isBindMode: !0
|
|
219
231
|
});
|
|
220
|
-
if (!
|
|
232
|
+
if (!s)
|
|
221
233
|
return [];
|
|
222
|
-
const
|
|
223
|
-
const c =
|
|
234
|
+
const l = (i) => Boolean(t && W(i.state.selection, t)), r = (i) => {
|
|
235
|
+
const c = W(i.state.selection, t);
|
|
224
236
|
return c ? c.node.attrs.label : void 0;
|
|
225
237
|
}, a = (i) => {
|
|
226
238
|
if (!i.editable)
|
|
227
239
|
return;
|
|
228
|
-
|
|
240
|
+
l(i) ? (s.show(i), s.update(r(i))) : s.hide();
|
|
229
241
|
};
|
|
230
242
|
return [
|
|
231
|
-
new
|
|
232
|
-
key:
|
|
233
|
-
view: (i) => (
|
|
243
|
+
new H({
|
|
244
|
+
key: Et,
|
|
245
|
+
view: (i) => (s.init(i), a(i), {
|
|
234
246
|
update: (c, d) => {
|
|
235
247
|
(d == null ? void 0 : d.doc.eq(c.state.doc)) && d.selection.eq(c.state.selection) || a(c);
|
|
236
248
|
},
|
|
237
249
|
destroy: () => {
|
|
238
|
-
|
|
250
|
+
s.destroy();
|
|
239
251
|
}
|
|
240
252
|
})
|
|
241
253
|
})
|
|
242
254
|
];
|
|
243
255
|
}
|
|
244
256
|
};
|
|
245
|
-
}),
|
|
246
|
-
class
|
|
247
|
-
constructor(e, t, n,
|
|
248
|
-
this
|
|
257
|
+
}), Qe = /* @__PURE__ */ new WeakMap(), It = (o) => Qe.get(o), Dt = (o, e) => (Qe.set(o, e), e);
|
|
258
|
+
class $e {
|
|
259
|
+
constructor(e, t, n, s) {
|
|
260
|
+
I(this, "tableStart");
|
|
261
|
+
I(this, "map");
|
|
262
|
+
I(this, "table");
|
|
263
|
+
this.left = e, this.top = t, this.right = n, this.bottom = s;
|
|
249
264
|
}
|
|
250
265
|
}
|
|
251
266
|
class g {
|
|
252
|
-
constructor(e, t, n,
|
|
253
|
-
this.width = e, this.height = t, this.map = n, this.problems =
|
|
267
|
+
constructor(e, t, n, s) {
|
|
268
|
+
this.width = e, this.height = t, this.map = n, this.problems = s, this.width = e, this.height = t, this.map = n, this.problems = s;
|
|
254
269
|
}
|
|
255
270
|
findCell(e) {
|
|
256
271
|
for (let t = 0; t < this.map.length; t++) {
|
|
257
272
|
const n = this.map[t];
|
|
258
273
|
if (n != e)
|
|
259
274
|
continue;
|
|
260
|
-
const
|
|
261
|
-
let r =
|
|
275
|
+
const s = t % this.width, l = t / this.width | 0;
|
|
276
|
+
let r = s + 1, a = l + 1;
|
|
262
277
|
for (let i = 1; r < this.width && this.map[t + i] == n; i++)
|
|
263
278
|
r++;
|
|
264
279
|
for (let i = 1; a < this.height && this.map[t + this.width * i] == n; i++)
|
|
265
280
|
a++;
|
|
266
|
-
return new
|
|
281
|
+
return new $e(s, l, r, a);
|
|
267
282
|
}
|
|
268
|
-
throw new RangeError(
|
|
283
|
+
throw new RangeError(`No cell with offset ${e} found`);
|
|
269
284
|
}
|
|
270
285
|
colCount(e) {
|
|
271
286
|
for (let t = 0; t < this.map.length; t++)
|
|
272
287
|
if (this.map[t] == e)
|
|
273
288
|
return t % this.width;
|
|
274
|
-
throw new RangeError(
|
|
289
|
+
throw new RangeError(`No cell with offset ${e} found`);
|
|
275
290
|
}
|
|
276
291
|
nextCell(e, t, n) {
|
|
277
|
-
const { left:
|
|
278
|
-
return t == "horiz" ? (n < 0 ?
|
|
292
|
+
const { left: s, right: l, top: r, bottom: a } = this.findCell(e);
|
|
293
|
+
return t == "horiz" ? (n < 0 ? s == 0 : l == this.width) ? void 0 : this.map[r * this.width + (n < 0 ? s - 1 : l)] : (n < 0 ? r == 0 : a == this.height) ? void 0 : this.map[s + this.width * (n < 0 ? r - 1 : a)];
|
|
279
294
|
}
|
|
280
295
|
rectBetween(e, t) {
|
|
281
|
-
const {
|
|
282
|
-
|
|
296
|
+
const {
|
|
297
|
+
left: n,
|
|
298
|
+
right: s,
|
|
299
|
+
top: l,
|
|
300
|
+
bottom: r
|
|
301
|
+
} = this.findCell(e), {
|
|
302
|
+
left: a,
|
|
303
|
+
right: i,
|
|
304
|
+
top: c,
|
|
305
|
+
bottom: d
|
|
306
|
+
} = this.findCell(t);
|
|
307
|
+
return new $e(
|
|
308
|
+
Math.min(n, a),
|
|
309
|
+
Math.min(l, c),
|
|
310
|
+
Math.max(s, i),
|
|
311
|
+
Math.max(r, d)
|
|
312
|
+
);
|
|
283
313
|
}
|
|
284
314
|
cellsInRect(e) {
|
|
285
315
|
const t = [], n = {};
|
|
286
|
-
for (let
|
|
287
|
-
for (let
|
|
288
|
-
const r =
|
|
289
|
-
n[a] || (n[a] = !0, (
|
|
316
|
+
for (let s = e.top; s < e.bottom; s++)
|
|
317
|
+
for (let l = e.left; l < e.right; l++) {
|
|
318
|
+
const r = s * this.width + l, a = this.map[r];
|
|
319
|
+
n[a] || (n[a] = !0, (l != e.left || !l || this.map[r - 1] != a) && (s != e.top || !s || this.map[r - this.width] != a) && t.push(a));
|
|
290
320
|
}
|
|
291
321
|
return t;
|
|
292
322
|
}
|
|
293
323
|
positionAt(e, t, n) {
|
|
294
|
-
for (let
|
|
295
|
-
const r =
|
|
296
|
-
if (
|
|
324
|
+
for (let s = 0, l = 0; ; s++) {
|
|
325
|
+
const r = l + n.child(s).nodeSize;
|
|
326
|
+
if (s == e) {
|
|
297
327
|
let a = t + e * this.width;
|
|
298
328
|
const i = (e + 1) * this.width;
|
|
299
|
-
for (; a < i && this.map[a] <
|
|
329
|
+
for (; a < i && this.map[a] < l; )
|
|
300
330
|
a++;
|
|
301
331
|
return a == i ? r - 1 : this.map[a];
|
|
302
332
|
}
|
|
303
|
-
|
|
333
|
+
l = r;
|
|
304
334
|
}
|
|
305
335
|
}
|
|
306
336
|
static get(e) {
|
|
307
|
-
return
|
|
337
|
+
return It(e) || Dt(e, Ot(e));
|
|
308
338
|
}
|
|
309
339
|
}
|
|
310
|
-
function
|
|
340
|
+
function Ot(o) {
|
|
311
341
|
if (o.type.spec.tableRole != "table")
|
|
312
|
-
throw new RangeError(
|
|
313
|
-
const e =
|
|
314
|
-
let
|
|
342
|
+
throw new RangeError(`Not a table node: ${o.type.name}`);
|
|
343
|
+
const e = _t(o), t = o.childCount, n = [], s = [];
|
|
344
|
+
let l = 0, r;
|
|
315
345
|
for (let c = 0, d = e * t; c < d; c++)
|
|
316
346
|
n[c] = 0;
|
|
317
347
|
for (let c = 0, d = 0; c < t; c++) {
|
|
318
348
|
const f = o.child(c);
|
|
319
349
|
d++;
|
|
320
350
|
for (let h = 0; ; h++) {
|
|
321
|
-
for (;
|
|
322
|
-
|
|
351
|
+
for (; l < n.length && n[l] != 0; )
|
|
352
|
+
l++;
|
|
323
353
|
if (h == f.childCount)
|
|
324
354
|
break;
|
|
325
|
-
const b = f.child(h), { colspan: w, rowspan: C, colwidth:
|
|
326
|
-
for (let
|
|
327
|
-
if (
|
|
355
|
+
const b = f.child(h), { colspan: w, rowspan: C, colwidth: Re } = b.attrs;
|
|
356
|
+
for (let j = 0; j < C; j++) {
|
|
357
|
+
if (j + c >= t) {
|
|
328
358
|
(r || (r = [])).push({
|
|
329
359
|
type: "overlong_rowspan",
|
|
330
360
|
pos: d,
|
|
331
|
-
n: C -
|
|
361
|
+
n: C - j
|
|
332
362
|
});
|
|
333
363
|
break;
|
|
334
364
|
}
|
|
335
|
-
const
|
|
336
|
-
for (let
|
|
337
|
-
n[
|
|
365
|
+
const re = l + j * e;
|
|
366
|
+
for (let z = 0; z < w; z++) {
|
|
367
|
+
n[re + z] == 0 ? n[re + z] = d : (r || (r = [])).push({
|
|
338
368
|
type: "collision",
|
|
339
369
|
row: c,
|
|
340
370
|
pos: d,
|
|
341
|
-
n: w -
|
|
371
|
+
n: w - z
|
|
342
372
|
});
|
|
343
|
-
const
|
|
344
|
-
if (
|
|
345
|
-
const
|
|
346
|
-
|
|
373
|
+
const G = Re && Re[z];
|
|
374
|
+
if (G) {
|
|
375
|
+
const K = (re + z) % e * 2, ie = s[K];
|
|
376
|
+
ie == null || ie != G && s[K + 1] == 1 ? (s[K] = G, s[K + 1] = 1) : ie == G && s[K + 1]++;
|
|
347
377
|
}
|
|
348
378
|
}
|
|
349
379
|
}
|
|
350
|
-
|
|
380
|
+
l += w, d += b.nodeSize;
|
|
351
381
|
}
|
|
352
382
|
const u = (c + 1) * e;
|
|
353
383
|
let p = 0;
|
|
354
|
-
for (;
|
|
355
|
-
n[
|
|
384
|
+
for (; l < u; )
|
|
385
|
+
n[l++] == 0 && p++;
|
|
356
386
|
p && (r || (r = [])).push({ type: "missing", row: c, n: p }), d++;
|
|
357
387
|
}
|
|
358
388
|
const a = new g(e, t, n, r);
|
|
359
389
|
let i = !1;
|
|
360
|
-
for (let c = 0; !i && c <
|
|
361
|
-
|
|
362
|
-
return i &&
|
|
390
|
+
for (let c = 0; !i && c < s.length; c += 2)
|
|
391
|
+
s[c] != null && s[c + 1] < t && (i = !0);
|
|
392
|
+
return i && zt(a, s, o), a;
|
|
363
393
|
}
|
|
364
|
-
function
|
|
394
|
+
function _t(o) {
|
|
365
395
|
let e = -1, t = !1;
|
|
366
396
|
for (let n = 0; n < o.childCount; n++) {
|
|
367
|
-
const
|
|
368
|
-
let
|
|
397
|
+
const s = o.child(n);
|
|
398
|
+
let l = 0;
|
|
369
399
|
if (t)
|
|
370
400
|
for (let r = 0; r < n; r++) {
|
|
371
401
|
const a = o.child(r);
|
|
372
402
|
for (let i = 0; i < a.childCount; i++) {
|
|
373
403
|
const c = a.child(i);
|
|
374
|
-
r + c.attrs.rowspan > n && (
|
|
404
|
+
r + c.attrs.rowspan > n && (l += c.attrs.colspan);
|
|
375
405
|
}
|
|
376
406
|
}
|
|
377
|
-
for (let r = 0; r <
|
|
378
|
-
const a =
|
|
379
|
-
|
|
407
|
+
for (let r = 0; r < s.childCount; r++) {
|
|
408
|
+
const a = s.child(r);
|
|
409
|
+
l += a.attrs.colspan, a.attrs.rowspan > 1 && (t = !0);
|
|
380
410
|
}
|
|
381
|
-
e == -1 ? e =
|
|
411
|
+
e == -1 ? e = l : e != l && (e = Math.max(e, l));
|
|
382
412
|
}
|
|
383
413
|
return e;
|
|
384
414
|
}
|
|
385
|
-
function
|
|
415
|
+
function zt(o, e, t) {
|
|
386
416
|
o.problems || (o.problems = []);
|
|
387
|
-
for (let n = 0,
|
|
388
|
-
const
|
|
389
|
-
if (l
|
|
417
|
+
for (let n = 0, s = {}; n < o.map.length; n++) {
|
|
418
|
+
const l = o.map[n];
|
|
419
|
+
if (s[l])
|
|
390
420
|
continue;
|
|
391
|
-
l
|
|
392
|
-
const r = t.nodeAt(
|
|
421
|
+
s[l] = !0;
|
|
422
|
+
const r = t.nodeAt(l);
|
|
393
423
|
let a = null;
|
|
394
424
|
for (let i = 0; i < r.attrs.colspan; i++) {
|
|
395
425
|
const c = (n + i) % o.width, d = e[c * 2];
|
|
396
|
-
d != null && (!r.attrs.colwidth || r.attrs.colwidth[i] != d) && ((a || (a =
|
|
426
|
+
d != null && (!r.attrs.colwidth || r.attrs.colwidth[i] != d) && ((a || (a = Ft(r.attrs)))[i] = d);
|
|
397
427
|
}
|
|
398
428
|
a && o.problems.unshift({
|
|
399
429
|
type: "colwidth mismatch",
|
|
400
|
-
pos:
|
|
430
|
+
pos: l,
|
|
401
431
|
colwidth: a
|
|
402
432
|
});
|
|
403
433
|
}
|
|
404
434
|
}
|
|
405
|
-
function
|
|
435
|
+
function Ft(o) {
|
|
406
436
|
if (o.colwidth)
|
|
407
437
|
return o.colwidth.slice();
|
|
408
438
|
const e = [];
|
|
@@ -410,127 +440,131 @@ function Ot(o) {
|
|
|
410
440
|
e.push(0);
|
|
411
441
|
return e;
|
|
412
442
|
}
|
|
413
|
-
class m extends
|
|
443
|
+
class m extends S {
|
|
414
444
|
constructor(e, t = e) {
|
|
415
|
-
const n = e.node(-1),
|
|
416
|
-
i.unshift(t.pos -
|
|
445
|
+
const n = e.node(-1), s = g.get(n), l = e.start(-1), r = s.rectBetween(e.pos - l, t.pos - l), a = e.node(0), i = s.cellsInRect(r).filter((d) => d != t.pos - l);
|
|
446
|
+
i.unshift(t.pos - l);
|
|
417
447
|
const c = i.map((d) => {
|
|
418
|
-
const f = n.nodeAt(d), u = d +
|
|
419
|
-
return new
|
|
448
|
+
const f = n.nodeAt(d), u = d + l + 1;
|
|
449
|
+
return new kt(a.resolve(u), a.resolve(u + f.content.size));
|
|
420
450
|
});
|
|
421
451
|
super(c[0].$from, c[0].$to, c), this.$anchorCell = e, this.$headCell = t, this.$anchorCell = e, this.$headCell = t;
|
|
422
452
|
}
|
|
423
453
|
map(e, t) {
|
|
424
|
-
const n = e.resolve(t.map(this.$anchorCell.pos)),
|
|
425
|
-
if (
|
|
426
|
-
const
|
|
427
|
-
return
|
|
454
|
+
const n = e.resolve(t.map(this.$anchorCell.pos)), s = e.resolve(t.map(this.$headCell.pos));
|
|
455
|
+
if (pe(n) && pe(s) && xe(n, s)) {
|
|
456
|
+
const l = this.$anchorCell.node(-1) != n.node(-1);
|
|
457
|
+
return l && this.isRowSelection() ? m.rowSelection(n, s) : l && this.isColSelection() ? m.colSelection(n, s) : new m(n, s);
|
|
428
458
|
}
|
|
429
|
-
return E.between(n,
|
|
459
|
+
return E.between(n, s);
|
|
430
460
|
}
|
|
431
461
|
content() {
|
|
432
|
-
const e = this.$anchorCell.node(-1), t = g.get(e), n = this.$anchorCell.start(-1),
|
|
433
|
-
for (let i =
|
|
462
|
+
const e = this.$anchorCell.node(-1), t = g.get(e), n = this.$anchorCell.start(-1), s = t.rectBetween(this.$anchorCell.pos - n, this.$headCell.pos - n), l = {}, r = [];
|
|
463
|
+
for (let i = s.top; i < s.bottom; i++) {
|
|
434
464
|
const c = [];
|
|
435
|
-
for (let d = i * t.width +
|
|
465
|
+
for (let d = i * t.width + s.left, f = s.left; f < s.right; f++, d++) {
|
|
436
466
|
const u = t.map[d];
|
|
437
|
-
if (!
|
|
438
|
-
|
|
467
|
+
if (!l[u]) {
|
|
468
|
+
l[u] = !0;
|
|
439
469
|
const p = t.findCell(u);
|
|
440
470
|
let h = e.nodeAt(u);
|
|
441
|
-
const b =
|
|
471
|
+
const b = s.left - p.left, w = p.right - s.right;
|
|
442
472
|
if (b > 0 || w > 0) {
|
|
443
473
|
let C = h.attrs;
|
|
444
|
-
b > 0 && (C =
|
|
474
|
+
b > 0 && (C = F(C, 0, b)), w > 0 && (C = F(C, C.colspan - w, w)), p.left < s.left ? h = h.type.createAndFill(C) : h = h.type.create(C, h.content);
|
|
445
475
|
}
|
|
446
|
-
if (p.top <
|
|
447
|
-
const C = y(
|
|
448
|
-
|
|
476
|
+
if (p.top < s.top || p.bottom > s.bottom) {
|
|
477
|
+
const C = y(
|
|
478
|
+
h.attrs,
|
|
479
|
+
"rowspan",
|
|
480
|
+
Math.min(p.bottom, s.bottom) - Math.max(p.top, s.top)
|
|
481
|
+
);
|
|
482
|
+
p.top < s.top ? h = h.type.createAndFill(C) : h = h.type.create(C, h.content);
|
|
449
483
|
}
|
|
450
484
|
c.push(h);
|
|
451
485
|
}
|
|
452
486
|
}
|
|
453
|
-
r.push(e.child(i).copy(
|
|
487
|
+
r.push(e.child(i).copy($.from(c)));
|
|
454
488
|
}
|
|
455
489
|
const a = this.isColSelection() && this.isRowSelection() ? e : r;
|
|
456
|
-
return new
|
|
490
|
+
return new _($.from(a), 1, 1);
|
|
457
491
|
}
|
|
458
|
-
replace(e, t =
|
|
459
|
-
const n = e.steps.length,
|
|
460
|
-
for (let r = 0; r <
|
|
461
|
-
const { $from: a, $to: i } =
|
|
462
|
-
e.replace(c.map(a.pos), c.map(i.pos), r ?
|
|
492
|
+
replace(e, t = _.empty) {
|
|
493
|
+
const n = e.steps.length, s = this.ranges;
|
|
494
|
+
for (let r = 0; r < s.length; r++) {
|
|
495
|
+
const { $from: a, $to: i } = s[r], c = e.mapping.slice(n);
|
|
496
|
+
e.replace(c.map(a.pos), c.map(i.pos), r ? _.empty : t);
|
|
463
497
|
}
|
|
464
|
-
const
|
|
465
|
-
|
|
498
|
+
const l = S.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)), -1);
|
|
499
|
+
l && e.setSelection(l);
|
|
466
500
|
}
|
|
467
501
|
replaceWith(e, t) {
|
|
468
|
-
this.replace(e, new
|
|
502
|
+
this.replace(e, new _($.from(t), 0, 0));
|
|
469
503
|
}
|
|
470
504
|
forEachCell(e) {
|
|
471
|
-
const t = this.$anchorCell.node(-1), n = g.get(t),
|
|
472
|
-
for (let r = 0; r <
|
|
473
|
-
e(t.nodeAt(
|
|
505
|
+
const t = this.$anchorCell.node(-1), n = g.get(t), s = this.$anchorCell.start(-1), l = n.cellsInRect(n.rectBetween(this.$anchorCell.pos - s, this.$headCell.pos - s));
|
|
506
|
+
for (let r = 0; r < l.length; r++)
|
|
507
|
+
e(t.nodeAt(l[r]), s + l[r]);
|
|
474
508
|
}
|
|
475
509
|
isColSelection() {
|
|
476
510
|
const e = this.$anchorCell.index(-1), t = this.$headCell.index(-1);
|
|
477
511
|
if (Math.min(e, t) > 0)
|
|
478
512
|
return !1;
|
|
479
|
-
const n = e + this.$anchorCell.nodeAfter.attrs.rowspan,
|
|
480
|
-
return Math.max(n,
|
|
513
|
+
const n = e + this.$anchorCell.nodeAfter.attrs.rowspan, s = t + this.$headCell.nodeAfter.attrs.rowspan;
|
|
514
|
+
return Math.max(n, s) == this.$headCell.node(-1).childCount;
|
|
481
515
|
}
|
|
482
516
|
static colSelection(e, t = e) {
|
|
483
|
-
const n = g.get(e.node(-1)),
|
|
484
|
-
if (
|
|
485
|
-
if (
|
|
486
|
-
const i = n.map[
|
|
487
|
-
e = a.resolve(
|
|
517
|
+
const n = g.get(e.node(-1)), s = e.start(-1), l = n.findCell(e.pos - s), r = n.findCell(t.pos - s), a = e.node(0);
|
|
518
|
+
if (l.top <= r.top) {
|
|
519
|
+
if (l.top > 0) {
|
|
520
|
+
const i = n.map[l.left];
|
|
521
|
+
e = a.resolve(s + i);
|
|
488
522
|
}
|
|
489
523
|
if (r.bottom < n.height) {
|
|
490
524
|
const i = n.map[n.width * (n.height - 1) + r.right - 1];
|
|
491
|
-
t = a.resolve(
|
|
525
|
+
t = a.resolve(s + i);
|
|
492
526
|
}
|
|
493
527
|
} else {
|
|
494
528
|
if (r.top > 0) {
|
|
495
|
-
const i = n.map[
|
|
496
|
-
t = a.resolve(
|
|
529
|
+
const i = n.map[l.left];
|
|
530
|
+
t = a.resolve(s + i);
|
|
497
531
|
}
|
|
498
|
-
if (
|
|
499
|
-
const i = n.map[n.width * (n.height - 1) +
|
|
500
|
-
e = a.resolve(
|
|
532
|
+
if (l.bottom < n.height) {
|
|
533
|
+
const i = n.map[n.width * (n.height - 1) + l.right - 1];
|
|
534
|
+
e = a.resolve(s + i);
|
|
501
535
|
}
|
|
502
536
|
}
|
|
503
537
|
return new m(e, t);
|
|
504
538
|
}
|
|
505
539
|
isRowSelection() {
|
|
506
|
-
const e = g.get(this.$anchorCell.node(-1)), t = this.$anchorCell.start(-1), n = e.colCount(this.$anchorCell.pos - t),
|
|
507
|
-
if (Math.min(n,
|
|
540
|
+
const e = g.get(this.$anchorCell.node(-1)), t = this.$anchorCell.start(-1), n = e.colCount(this.$anchorCell.pos - t), s = e.colCount(this.$headCell.pos - t);
|
|
541
|
+
if (Math.min(n, s) > 0)
|
|
508
542
|
return !1;
|
|
509
|
-
const
|
|
510
|
-
return Math.max(
|
|
543
|
+
const l = n + this.$anchorCell.nodeAfter.attrs.colspan, r = s + this.$headCell.nodeAfter.attrs.colspan;
|
|
544
|
+
return Math.max(l, r) == e.width;
|
|
511
545
|
}
|
|
512
546
|
eq(e) {
|
|
513
547
|
return e instanceof m && e.$anchorCell.pos == this.$anchorCell.pos && e.$headCell.pos == this.$headCell.pos;
|
|
514
548
|
}
|
|
515
549
|
static rowSelection(e, t = e) {
|
|
516
|
-
const n = g.get(e.node(-1)),
|
|
517
|
-
if (
|
|
518
|
-
if (
|
|
519
|
-
const i = n.map[
|
|
520
|
-
e = a.resolve(
|
|
550
|
+
const n = g.get(e.node(-1)), s = e.start(-1), l = n.findCell(e.pos - s), r = n.findCell(t.pos - s), a = e.node(0);
|
|
551
|
+
if (l.left <= r.left) {
|
|
552
|
+
if (l.left > 0) {
|
|
553
|
+
const i = n.map[l.top * n.width];
|
|
554
|
+
e = a.resolve(s + i);
|
|
521
555
|
}
|
|
522
556
|
if (r.right < n.width) {
|
|
523
557
|
const i = n.map[n.width * (r.top + 1) - 1];
|
|
524
|
-
t = a.resolve(
|
|
558
|
+
t = a.resolve(s + i);
|
|
525
559
|
}
|
|
526
560
|
} else {
|
|
527
561
|
if (r.left > 0) {
|
|
528
562
|
const i = n.map[r.top * n.width];
|
|
529
|
-
t = a.resolve(
|
|
563
|
+
t = a.resolve(s + i);
|
|
530
564
|
}
|
|
531
|
-
if (
|
|
532
|
-
const i = n.map[n.width * (
|
|
533
|
-
e = a.resolve(
|
|
565
|
+
if (l.right < n.width) {
|
|
566
|
+
const i = n.map[n.width * (l.top + 1) - 1];
|
|
567
|
+
e = a.resolve(s + i);
|
|
534
568
|
}
|
|
535
569
|
}
|
|
536
570
|
return new m(e, t);
|
|
@@ -553,7 +587,7 @@ class m extends N {
|
|
|
553
587
|
}
|
|
554
588
|
}
|
|
555
589
|
m.prototype.visible = !1;
|
|
556
|
-
|
|
590
|
+
S.jsonID("cell", m);
|
|
557
591
|
class Ne {
|
|
558
592
|
constructor(e, t) {
|
|
559
593
|
this.anchor = e, this.head = t, this.anchor = e, this.head = t;
|
|
@@ -563,91 +597,91 @@ class Ne {
|
|
|
563
597
|
}
|
|
564
598
|
resolve(e) {
|
|
565
599
|
const t = e.resolve(this.anchor), n = e.resolve(this.head);
|
|
566
|
-
return t.parent.type.spec.tableRole == "row" && n.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && n.index() < n.parent.childCount &&
|
|
600
|
+
return t.parent.type.spec.tableRole == "row" && n.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && n.index() < n.parent.childCount && xe(t, n) ? new m(t, n) : S.near(n, 1);
|
|
567
601
|
}
|
|
568
602
|
}
|
|
569
|
-
function
|
|
603
|
+
function Bt(o) {
|
|
570
604
|
if (!(o.selection instanceof m))
|
|
571
605
|
return null;
|
|
572
606
|
const e = [];
|
|
573
607
|
return o.selection.forEachCell((t, n) => {
|
|
574
|
-
e.push(
|
|
575
|
-
}),
|
|
608
|
+
e.push(Me.node(n, n + t.nodeSize, { class: "selectedCell" }));
|
|
609
|
+
}), Se.create(o.doc, e);
|
|
576
610
|
}
|
|
577
|
-
function
|
|
611
|
+
function Wt({ $from: o, $to: e }) {
|
|
578
612
|
if (o.pos == e.pos || o.pos < o.pos - 6)
|
|
579
613
|
return !1;
|
|
580
|
-
let t = o.pos, n = e.pos,
|
|
581
|
-
for (;
|
|
614
|
+
let t = o.pos, n = e.pos, s = o.depth;
|
|
615
|
+
for (; s >= 0 && !(o.after(s + 1) < o.end(s)); s--, t++)
|
|
582
616
|
;
|
|
583
|
-
for (let
|
|
617
|
+
for (let l = e.depth; l >= 0 && !(e.before(l + 1) > e.start(l)); l--, n--)
|
|
584
618
|
;
|
|
585
|
-
return t == n && /row|table/.test(o.node(
|
|
619
|
+
return t == n && /row|table/.test(o.node(s).type.spec.tableRole);
|
|
586
620
|
}
|
|
587
|
-
function
|
|
621
|
+
function Pt({ $from: o, $to: e }) {
|
|
588
622
|
let t, n;
|
|
589
|
-
for (let
|
|
590
|
-
const
|
|
591
|
-
if (
|
|
592
|
-
t =
|
|
623
|
+
for (let s = o.depth; s > 0; s--) {
|
|
624
|
+
const l = o.node(s);
|
|
625
|
+
if (l.type.spec.tableRole === "cell" || l.type.spec.tableRole === "header_cell") {
|
|
626
|
+
t = l;
|
|
593
627
|
break;
|
|
594
628
|
}
|
|
595
629
|
}
|
|
596
|
-
for (let
|
|
597
|
-
const
|
|
598
|
-
if (
|
|
599
|
-
n =
|
|
630
|
+
for (let s = e.depth; s > 0; s--) {
|
|
631
|
+
const l = e.node(s);
|
|
632
|
+
if (l.type.spec.tableRole === "cell" || l.type.spec.tableRole === "header_cell") {
|
|
633
|
+
n = l;
|
|
600
634
|
break;
|
|
601
635
|
}
|
|
602
636
|
}
|
|
603
637
|
return t !== n && e.parentOffset === 0;
|
|
604
638
|
}
|
|
605
|
-
function
|
|
606
|
-
const n = (e || o).selection,
|
|
607
|
-
let
|
|
608
|
-
if (n instanceof
|
|
639
|
+
function Ht(o, e, t) {
|
|
640
|
+
const n = (e || o).selection, s = (e || o).doc;
|
|
641
|
+
let l, r;
|
|
642
|
+
if (n instanceof oe && (r = n.node.type.spec.tableRole)) {
|
|
609
643
|
if (r == "cell" || r == "header_cell")
|
|
610
|
-
|
|
644
|
+
l = m.create(s, n.from);
|
|
611
645
|
else if (r == "row") {
|
|
612
|
-
const a =
|
|
613
|
-
|
|
646
|
+
const a = s.resolve(n.from + 1);
|
|
647
|
+
l = m.rowSelection(a, a);
|
|
614
648
|
} else if (!t) {
|
|
615
649
|
const a = g.get(n.node), i = n.from + 1, c = a.map[a.width * a.height - 1], d = i + c;
|
|
616
|
-
|
|
650
|
+
l = m.create(s, i + 1, d);
|
|
617
651
|
}
|
|
618
652
|
} else
|
|
619
|
-
n instanceof E &&
|
|
620
|
-
return
|
|
653
|
+
n instanceof E && Wt(n) ? l = E.create(s, n.from) : n instanceof E && Pt(n) && (l = E.create(s, n.$from.start(), n.$from.end()));
|
|
654
|
+
return l && (e || (e = o.tr)).setSelection(l), e;
|
|
621
655
|
}
|
|
622
656
|
function Ie(o, e) {
|
|
623
|
-
const t = o.getAttribute("data-colwidth"), n = t && /^\d+(,\d+)*$/.test(t) ? t.split(",").map((r) => Number(r)) : null,
|
|
624
|
-
colspan:
|
|
657
|
+
const t = o.getAttribute("data-colwidth"), n = t && /^\d+(,\d+)*$/.test(t) ? t.split(",").map((r) => Number(r)) : null, s = Number(o.getAttribute("colspan") || 1), l = {
|
|
658
|
+
colspan: s,
|
|
625
659
|
rowspan: Number(o.getAttribute("rowspan") || 1),
|
|
626
|
-
colwidth: n && n.length ==
|
|
660
|
+
colwidth: n && n.length == s ? n : null
|
|
627
661
|
};
|
|
628
662
|
for (const r in e) {
|
|
629
663
|
const a = e[r].getFromDOM, i = a && a(o);
|
|
630
|
-
i != null && (
|
|
664
|
+
i != null && (l[r] = i);
|
|
631
665
|
}
|
|
632
|
-
return
|
|
666
|
+
return l;
|
|
633
667
|
}
|
|
634
|
-
function
|
|
668
|
+
function De(o, e) {
|
|
635
669
|
const t = {};
|
|
636
670
|
o.attrs.colspan != 1 && (t.colspan = o.attrs.colspan), o.attrs.rowspan != 1 && (t.rowspan = o.attrs.rowspan), o.attrs.colwidth && (t["data-colwidth"] = o.attrs.colwidth.join(","));
|
|
637
671
|
for (const n in e) {
|
|
638
|
-
const
|
|
639
|
-
|
|
672
|
+
const s = e[n].setDOMAttr;
|
|
673
|
+
s && s(o.attrs[n], t);
|
|
640
674
|
}
|
|
641
675
|
return t;
|
|
642
676
|
}
|
|
643
|
-
function
|
|
677
|
+
function jt(o) {
|
|
644
678
|
const e = o.cellAttributes || {}, t = {
|
|
645
679
|
colspan: { default: 1 },
|
|
646
680
|
rowspan: { default: 1 },
|
|
647
681
|
colwidth: { default: null }
|
|
648
682
|
};
|
|
649
|
-
for (const
|
|
650
|
-
t[
|
|
683
|
+
for (const l in e)
|
|
684
|
+
t[l] = { default: e[l].default };
|
|
651
685
|
const n = t;
|
|
652
686
|
return {
|
|
653
687
|
table: {
|
|
@@ -673,9 +707,9 @@ function Pt(o) {
|
|
|
673
707
|
attrs: n,
|
|
674
708
|
tableRole: "cell",
|
|
675
709
|
isolating: !0,
|
|
676
|
-
parseDOM: [{ tag: "td", getAttrs: (
|
|
677
|
-
toDOM(
|
|
678
|
-
return ["td",
|
|
710
|
+
parseDOM: [{ tag: "td", getAttrs: (l) => Ie(l, e) }],
|
|
711
|
+
toDOM(l) {
|
|
712
|
+
return ["td", De(l, e), 0];
|
|
679
713
|
}
|
|
680
714
|
},
|
|
681
715
|
table_header: {
|
|
@@ -683,9 +717,9 @@ function Pt(o) {
|
|
|
683
717
|
attrs: n,
|
|
684
718
|
tableRole: "header_cell",
|
|
685
719
|
isolating: !0,
|
|
686
|
-
parseDOM: [{ tag: "th", getAttrs: (
|
|
687
|
-
toDOM(
|
|
688
|
-
return ["th",
|
|
720
|
+
parseDOM: [{ tag: "th", getAttrs: (l) => Ie(l, e) }],
|
|
721
|
+
toDOM(l) {
|
|
722
|
+
return ["th", De(l, e), 0];
|
|
689
723
|
}
|
|
690
724
|
}
|
|
691
725
|
};
|
|
@@ -695,13 +729,13 @@ function A(o) {
|
|
|
695
729
|
if (!e) {
|
|
696
730
|
e = o.cached.tableNodeTypes = {};
|
|
697
731
|
for (const t in o.nodes) {
|
|
698
|
-
const n = o.nodes[t],
|
|
699
|
-
|
|
732
|
+
const n = o.nodes[t], s = n == null ? void 0 : n.spec.tableRole;
|
|
733
|
+
s && (e[s] = n);
|
|
700
734
|
}
|
|
701
735
|
}
|
|
702
736
|
return e;
|
|
703
737
|
}
|
|
704
|
-
const
|
|
738
|
+
const Y = jt({
|
|
705
739
|
tableGroup: "block",
|
|
706
740
|
cellContent: "paragraph",
|
|
707
741
|
cellAttributes: {
|
|
@@ -714,35 +748,35 @@ const G = Pt({
|
|
|
714
748
|
}
|
|
715
749
|
}
|
|
716
750
|
});
|
|
717
|
-
function
|
|
751
|
+
function V(o) {
|
|
718
752
|
for (let e = o.depth - 1; e > 0; e--)
|
|
719
753
|
if (o.node(e).type.spec.tableRole == "row")
|
|
720
754
|
return o.node(0).resolve(o.before(e + 1));
|
|
721
755
|
}
|
|
722
|
-
function
|
|
756
|
+
function pe(o) {
|
|
723
757
|
return o.parent.type.spec.tableRole == "row" ? o.nodeAfter : null;
|
|
724
758
|
}
|
|
725
|
-
function
|
|
759
|
+
function Kt(o) {
|
|
726
760
|
return o.node(0).resolve(o.pos + o.nodeAfter.nodeSize);
|
|
727
761
|
}
|
|
728
|
-
function
|
|
762
|
+
function xe(o, e) {
|
|
729
763
|
return o.depth == e.depth && o.pos >= e.start(-1) && o.pos <= e.end(-1);
|
|
730
764
|
}
|
|
731
|
-
function
|
|
732
|
-
const n = o.start(-1),
|
|
733
|
-
return
|
|
765
|
+
function et(o, e, t) {
|
|
766
|
+
const n = o.start(-1), l = g.get(o.node(-1)).nextCell(o.pos - n, e, t);
|
|
767
|
+
return l == null ? null : o.node(0).resolve(n + l);
|
|
734
768
|
}
|
|
735
769
|
function y(o, e, t) {
|
|
736
770
|
const n = {};
|
|
737
|
-
for (const
|
|
738
|
-
n[
|
|
771
|
+
for (const s in o)
|
|
772
|
+
n[s] = o[s];
|
|
739
773
|
return n[e] = t, n;
|
|
740
774
|
}
|
|
741
|
-
function
|
|
775
|
+
function F(o, e, t = 1) {
|
|
742
776
|
const n = y(o, "colspan", o.colspan - t);
|
|
743
777
|
if (n.colwidth) {
|
|
744
|
-
const
|
|
745
|
-
n.colwidth =
|
|
778
|
+
const s = n.colwidth;
|
|
779
|
+
n.colwidth = s.slice(), s.splice(e, t), s.some((l) => l > 0) || (n.colwidth = null);
|
|
746
780
|
}
|
|
747
781
|
return n;
|
|
748
782
|
}
|
|
@@ -753,11 +787,11 @@ function M(o) {
|
|
|
753
787
|
return !0;
|
|
754
788
|
return !1;
|
|
755
789
|
}
|
|
756
|
-
function
|
|
790
|
+
function se(o) {
|
|
757
791
|
const e = o.selection;
|
|
758
|
-
return e instanceof m ? e.$anchorCell.pos > e.$headCell.pos ? e.$anchorCell : e.$headCell : e.node && e.node.type.spec.tableRole == "cell" ? e.$anchor :
|
|
792
|
+
return e instanceof m ? e.$anchorCell.pos > e.$headCell.pos ? e.$anchorCell : e.$headCell : e.node && e.node.type.spec.tableRole == "cell" ? e.$anchor : V(e.$head) || qt(e.$head);
|
|
759
793
|
}
|
|
760
|
-
function
|
|
794
|
+
function qt(o) {
|
|
761
795
|
for (let e = o.nodeAfter, t = o.pos; e; e = e.firstChild, t++) {
|
|
762
796
|
const n = e.type.spec.tableRole;
|
|
763
797
|
if (n == "cell" || n == "header_cell")
|
|
@@ -769,234 +803,246 @@ function Ht(o) {
|
|
|
769
803
|
return o.doc.resolve(t - e.nodeSize);
|
|
770
804
|
}
|
|
771
805
|
}
|
|
772
|
-
function
|
|
806
|
+
function Xt(o, e, t = 1) {
|
|
773
807
|
const n = y(o, "colspan", o.colspan + t);
|
|
774
808
|
if (n.colwidth) {
|
|
775
|
-
const
|
|
776
|
-
n.colwidth =
|
|
777
|
-
for (let
|
|
778
|
-
|
|
809
|
+
const s = n.colwidth;
|
|
810
|
+
n.colwidth = s.slice();
|
|
811
|
+
for (let l = 0; l < t; l++)
|
|
812
|
+
s.splice(e, 0, 0);
|
|
779
813
|
}
|
|
780
814
|
return n;
|
|
781
815
|
}
|
|
782
|
-
function
|
|
816
|
+
function Ut(o, e, t) {
|
|
783
817
|
const n = A(e.type.schema).header_cell;
|
|
784
|
-
for (let
|
|
785
|
-
const
|
|
786
|
-
if (e.nodeAt(
|
|
818
|
+
for (let s = 0; s < o.height; s++) {
|
|
819
|
+
const l = o.map[t + s * o.width];
|
|
820
|
+
if (e.nodeAt(l).type != n)
|
|
787
821
|
return !1;
|
|
788
822
|
}
|
|
789
823
|
return !0;
|
|
790
824
|
}
|
|
791
|
-
const
|
|
825
|
+
const Vt = (o) => (e, t) => {
|
|
792
826
|
if (!M(e))
|
|
793
827
|
return !1;
|
|
794
|
-
const { $head: n } = e.selection,
|
|
795
|
-
return
|
|
828
|
+
const { $head: n } = e.selection, s = n.after(), l = e.tr.replaceWith(s, s, o.createAndFill());
|
|
829
|
+
return l.setSelection(S.near(l.doc.resolve(s), 1)), t == null || t(l.scrollIntoView()), !0;
|
|
796
830
|
};
|
|
797
831
|
function P(o) {
|
|
798
|
-
const e = o.selection, t =
|
|
832
|
+
const e = o.selection, t = se(o), n = t.node(-1), s = t.start(-1), l = g.get(n);
|
|
799
833
|
let r;
|
|
800
|
-
return e instanceof m ? r =
|
|
834
|
+
return e instanceof m ? r = l.rectBetween(e.$anchorCell.pos - s, e.$headCell.pos - s) : r = l.findCell(t.pos - s), r.tableStart = s, r.map = l, r.table = n, r;
|
|
801
835
|
}
|
|
802
|
-
function
|
|
836
|
+
function tt(o, { map: e, tableStart: t, table: n }, s) {
|
|
803
837
|
e = e, n = n, t = t;
|
|
804
|
-
let
|
|
805
|
-
|
|
838
|
+
let l = s > 0 ? -1 : 0;
|
|
839
|
+
Ut(e, n, s + l) && (l = s == 0 || s == e.width ? null : 0);
|
|
806
840
|
for (let r = 0; r < e.height; r++) {
|
|
807
|
-
const a = r * e.width +
|
|
808
|
-
if (
|
|
841
|
+
const a = r * e.width + s;
|
|
842
|
+
if (s > 0 && s < e.width && e.map[a - 1] == e.map[a]) {
|
|
809
843
|
const i = e.map[a], c = n.nodeAt(i);
|
|
810
|
-
o.setNodeMarkup(o.mapping.map(t + i), null,
|
|
844
|
+
o.setNodeMarkup(o.mapping.map(t + i), null, Xt(c.attrs, s - e.colCount(i))), r += c.attrs.rowspan - 1;
|
|
811
845
|
} else {
|
|
812
|
-
const i = e.map[a +
|
|
846
|
+
const i = e.map[a + l], c = l == null ? A(n.type.schema).cell : n.nodeAt(i).type, d = e.positionAt(r, s, n);
|
|
813
847
|
o.insert(o.mapping.map(t + d), c.createAndFill());
|
|
814
848
|
}
|
|
815
849
|
}
|
|
816
850
|
return o;
|
|
817
851
|
}
|
|
818
|
-
const
|
|
852
|
+
const Gt = (o, e) => {
|
|
819
853
|
if (!M(o))
|
|
820
854
|
return !1;
|
|
821
855
|
if (e) {
|
|
822
856
|
const t = P(o);
|
|
823
|
-
e(
|
|
857
|
+
e(tt(o.tr, t, t.left));
|
|
824
858
|
}
|
|
825
859
|
return !0;
|
|
826
|
-
},
|
|
860
|
+
}, Jt = (o, e) => {
|
|
827
861
|
if (!M(o))
|
|
828
862
|
return !1;
|
|
829
863
|
if (e) {
|
|
830
864
|
const t = P(o);
|
|
831
|
-
e(
|
|
865
|
+
e(tt(o.tr, t, t.right));
|
|
832
866
|
}
|
|
833
867
|
return !0;
|
|
834
868
|
};
|
|
835
|
-
function
|
|
869
|
+
function Yt(o, { map: e, table: t, tableStart: n }, s) {
|
|
836
870
|
e = e, t = t, n = n;
|
|
837
|
-
const
|
|
871
|
+
const l = o.mapping.maps.length;
|
|
838
872
|
for (let r = 0; r < e.height; ) {
|
|
839
|
-
const a = r * e.width +
|
|
840
|
-
if (
|
|
841
|
-
o.setNodeMarkup(
|
|
873
|
+
const a = r * e.width + s, i = e.map[a], c = t.nodeAt(i);
|
|
874
|
+
if (s > 0 && e.map[a - 1] == i || s < e.width - 1 && e.map[a + 1] == i)
|
|
875
|
+
o.setNodeMarkup(
|
|
876
|
+
o.mapping.slice(l).map(n + i),
|
|
877
|
+
null,
|
|
878
|
+
F(c.attrs, s - e.colCount(i))
|
|
879
|
+
);
|
|
842
880
|
else {
|
|
843
|
-
const d = o.mapping.slice(
|
|
881
|
+
const d = o.mapping.slice(l).map(n + i);
|
|
844
882
|
o.delete(d, d + c.nodeSize);
|
|
845
883
|
}
|
|
846
884
|
r += c.attrs.rowspan;
|
|
847
885
|
}
|
|
848
886
|
}
|
|
849
|
-
const
|
|
887
|
+
const Zt = (o, e) => {
|
|
850
888
|
if (!M(o))
|
|
851
889
|
return !1;
|
|
852
890
|
if (e) {
|
|
853
891
|
const t = P(o), n = o.tr;
|
|
854
892
|
if (t.left == 0 && t.right == t.map.width)
|
|
855
893
|
return !1;
|
|
856
|
-
for (let
|
|
894
|
+
for (let s = t.right - 1; Yt(n, t, s), s != t.left; s--)
|
|
857
895
|
t.table = t.tableStart ? n.doc.nodeAt(t.tableStart - 1) : n.doc, t.map = g.get(t.table);
|
|
858
896
|
e(n);
|
|
859
897
|
}
|
|
860
898
|
return !0;
|
|
861
899
|
};
|
|
862
|
-
function
|
|
900
|
+
function Qt(o, { map: e, tableStart: t, table: n }, s) {
|
|
863
901
|
e = e, n = n, t = t;
|
|
864
|
-
let
|
|
865
|
-
for (let i = 0; i <
|
|
866
|
-
|
|
867
|
-
const r =
|
|
868
|
-
o.delete(
|
|
869
|
-
for (let i = 0, c =
|
|
902
|
+
let l = 0;
|
|
903
|
+
for (let i = 0; i < s; i++)
|
|
904
|
+
l += n.child(i).nodeSize;
|
|
905
|
+
const r = l + n.child(s).nodeSize, a = o.mapping.maps.length;
|
|
906
|
+
o.delete(l + t, r + t);
|
|
907
|
+
for (let i = 0, c = s * e.width; i < e.width; i++, c++) {
|
|
870
908
|
const d = e.map[c];
|
|
871
|
-
if (
|
|
909
|
+
if (s > 0 && d == e.map[c - e.width]) {
|
|
872
910
|
const f = n.nodeAt(d).attrs;
|
|
873
|
-
o.setNodeMarkup(
|
|
874
|
-
|
|
875
|
-
|
|
911
|
+
o.setNodeMarkup(
|
|
912
|
+
o.mapping.slice(a).map(d + t),
|
|
913
|
+
null,
|
|
914
|
+
y(f, "rowspan", f.rowspan - 1)
|
|
915
|
+
), i += f.colspan - 1;
|
|
916
|
+
} else if (s < e.width && d == e.map[c + e.width]) {
|
|
917
|
+
const f = n.nodeAt(d), u = f.type.create(y(f.attrs, "rowspan", f.attrs.rowspan - 1), f.content), p = e.positionAt(s + 1, i, n);
|
|
876
918
|
o.insert(o.mapping.slice(a).map(t + p), u), i += f.attrs.colspan - 1;
|
|
877
919
|
}
|
|
878
920
|
}
|
|
879
921
|
}
|
|
880
|
-
const
|
|
922
|
+
const en = (o, e) => {
|
|
881
923
|
if (!M(o))
|
|
882
924
|
return !1;
|
|
883
925
|
if (e) {
|
|
884
926
|
const t = P(o), n = o.tr;
|
|
885
927
|
if (t.top == 0 && t.bottom == t.map.height)
|
|
886
928
|
return !1;
|
|
887
|
-
for (let
|
|
929
|
+
for (let s = t.bottom - 1; Qt(n, t, s), s != t.top; s--)
|
|
888
930
|
t.table = t.tableStart ? n.doc.nodeAt(t.tableStart - 1) : n.doc, t.map = g.get(t.table);
|
|
889
931
|
e(n);
|
|
890
932
|
}
|
|
891
933
|
return !0;
|
|
892
934
|
};
|
|
893
|
-
function
|
|
935
|
+
function ce(o, e) {
|
|
894
936
|
return (t, n) => {
|
|
895
937
|
if (!M(t))
|
|
896
938
|
return !1;
|
|
897
|
-
const
|
|
898
|
-
if (
|
|
939
|
+
const s = se(t);
|
|
940
|
+
if (s.nodeAfter.attrs[o] === e)
|
|
899
941
|
return !1;
|
|
900
942
|
if (n) {
|
|
901
|
-
const
|
|
943
|
+
const l = t.tr;
|
|
902
944
|
t.selection instanceof m ? t.selection.forEachCell((r, a) => {
|
|
903
|
-
r.attrs[o] !== e &&
|
|
904
|
-
}) :
|
|
945
|
+
r.attrs[o] !== e && l.setNodeMarkup(a, null, y(r.attrs, o, e));
|
|
946
|
+
}) : l.setNodeMarkup(s.pos, null, y(s.nodeAfter.attrs, o, e)), n(l);
|
|
905
947
|
}
|
|
906
948
|
return !0;
|
|
907
949
|
};
|
|
908
950
|
}
|
|
909
|
-
function
|
|
951
|
+
function tn(o, e) {
|
|
910
952
|
if (e < 0) {
|
|
911
953
|
const t = o.nodeBefore;
|
|
912
954
|
if (t)
|
|
913
955
|
return o.pos - t.nodeSize;
|
|
914
|
-
for (let n = o.index(-1) - 1,
|
|
915
|
-
const
|
|
916
|
-
if (
|
|
917
|
-
return
|
|
918
|
-
|
|
956
|
+
for (let n = o.index(-1) - 1, s = o.before(); n >= 0; n--) {
|
|
957
|
+
const l = o.node(-1).child(n);
|
|
958
|
+
if (l.childCount)
|
|
959
|
+
return s - 1 - l.lastChild.nodeSize;
|
|
960
|
+
s -= l.nodeSize;
|
|
919
961
|
}
|
|
920
962
|
} else {
|
|
921
963
|
if (o.index() < o.parent.childCount - 1)
|
|
922
964
|
return o.pos + o.nodeAfter.nodeSize;
|
|
923
965
|
const t = o.node(-1);
|
|
924
|
-
for (let n = o.indexAfter(-1),
|
|
925
|
-
const
|
|
926
|
-
if (
|
|
927
|
-
return
|
|
928
|
-
|
|
966
|
+
for (let n = o.indexAfter(-1), s = o.after(); n < t.childCount; n++) {
|
|
967
|
+
const l = t.child(n);
|
|
968
|
+
if (l.childCount)
|
|
969
|
+
return s + 1;
|
|
970
|
+
s += l.nodeSize;
|
|
929
971
|
}
|
|
930
972
|
}
|
|
931
973
|
}
|
|
932
|
-
function
|
|
974
|
+
function Oe(o) {
|
|
933
975
|
return (e, t) => {
|
|
934
976
|
if (!M(e))
|
|
935
977
|
return !1;
|
|
936
|
-
const n =
|
|
978
|
+
const n = tn(se(e), o);
|
|
937
979
|
if (n == null)
|
|
938
980
|
return !1;
|
|
939
981
|
if (t) {
|
|
940
|
-
const
|
|
941
|
-
t(e.tr.setSelection(E.between(
|
|
982
|
+
const s = e.doc.resolve(n);
|
|
983
|
+
t(e.tr.setSelection(E.between(s, Kt(s))).scrollIntoView());
|
|
942
984
|
}
|
|
943
985
|
return !0;
|
|
944
986
|
};
|
|
945
987
|
}
|
|
946
|
-
const
|
|
988
|
+
const nn = (o, e) => {
|
|
947
989
|
const t = o.selection.$anchor;
|
|
948
990
|
for (let n = t.depth; n > 0; n--)
|
|
949
991
|
if (t.node(n).type.spec.tableRole == "table")
|
|
950
992
|
return e && e(o.tr.delete(t.before(n), t.after(n)).scrollIntoView()), !0;
|
|
951
993
|
return !1;
|
|
952
|
-
}, le = (o) =>
|
|
994
|
+
}, le = (o) => Ct((e) => e.type.spec.tableRole === "table")(o), on = (o) => (e) => {
|
|
953
995
|
const t = le(e);
|
|
954
996
|
if (!t)
|
|
955
997
|
return;
|
|
956
998
|
const n = g.get(t.node);
|
|
957
999
|
if (!(o < 0 || o >= n.width))
|
|
958
|
-
return n.cellsInRect({ left: o, right: o + 1, top: 0, bottom: n.height }).map((
|
|
959
|
-
const
|
|
960
|
-
if (!
|
|
1000
|
+
return n.cellsInRect({ left: o, right: o + 1, top: 0, bottom: n.height }).map((s) => {
|
|
1001
|
+
const l = t.node.nodeAt(s);
|
|
1002
|
+
if (!l)
|
|
961
1003
|
return;
|
|
962
|
-
const r =
|
|
1004
|
+
const r = s + t.start;
|
|
963
1005
|
return {
|
|
964
1006
|
pos: r,
|
|
965
1007
|
start: r + 1,
|
|
966
|
-
node:
|
|
1008
|
+
node: l
|
|
967
1009
|
};
|
|
968
|
-
}).filter((
|
|
969
|
-
},
|
|
1010
|
+
}).filter((s) => s != null);
|
|
1011
|
+
}, sn = (o) => (e) => {
|
|
970
1012
|
const t = le(e);
|
|
971
1013
|
if (!t)
|
|
972
1014
|
return;
|
|
973
1015
|
const n = g.get(t.node);
|
|
974
1016
|
if (!(o < 0 || o >= n.height))
|
|
975
|
-
return n.cellsInRect({ left: 0, right: n.width, top: o, bottom: o + 1 }).map((
|
|
976
|
-
const
|
|
977
|
-
if (!
|
|
1017
|
+
return n.cellsInRect({ left: 0, right: n.width, top: o, bottom: o + 1 }).map((s) => {
|
|
1018
|
+
const l = t.node.nodeAt(s);
|
|
1019
|
+
if (!l)
|
|
978
1020
|
return;
|
|
979
|
-
const r =
|
|
1021
|
+
const r = s + t.start;
|
|
980
1022
|
return {
|
|
981
1023
|
pos: r,
|
|
982
1024
|
start: r + 1,
|
|
983
|
-
node:
|
|
1025
|
+
node: l
|
|
984
1026
|
};
|
|
985
|
-
}).filter((
|
|
986
|
-
},
|
|
987
|
-
const { cell: n, header_cell:
|
|
1027
|
+
}).filter((s) => s != null);
|
|
1028
|
+
}, ae = (o, e = 3, t = 3) => {
|
|
1029
|
+
const { cell: n, header_cell: s, row: l, table: r } = A(o), a = Array(t).fill(0).map(() => n.createAndFill(null)), i = Array(t).fill(0).map(() => s.createAndFill(null)), c = Array(e).fill(0).map((d, f) => l.create(null, f === 0 ? i : a));
|
|
988
1030
|
return r.create(null, c);
|
|
989
|
-
},
|
|
990
|
-
const n = le(t.selection),
|
|
1031
|
+
}, _e = (o) => (e) => (t) => {
|
|
1032
|
+
const n = le(t.selection), s = o === "row";
|
|
991
1033
|
if (n) {
|
|
992
|
-
const
|
|
993
|
-
if (e >= 0 && e < (
|
|
994
|
-
const r =
|
|
995
|
-
|
|
1034
|
+
const l = g.get(n.node);
|
|
1035
|
+
if (e >= 0 && e < (s ? l.height : l.width)) {
|
|
1036
|
+
const r = l.positionAt(
|
|
1037
|
+
s ? e : l.height - 1,
|
|
1038
|
+
s ? l.width - 1 : e,
|
|
1039
|
+
n.node
|
|
1040
|
+
), a = t.doc.resolve(n.start + r), i = s ? m.rowSelection : m.colSelection, c = l.positionAt(s ? e : 0, s ? 0 : e, n.node), d = t.doc.resolve(n.start + c);
|
|
1041
|
+
return Ge(t.setSelection(i(a, d)));
|
|
996
1042
|
}
|
|
997
1043
|
}
|
|
998
1044
|
return t;
|
|
999
|
-
},
|
|
1045
|
+
}, ln = (o) => {
|
|
1000
1046
|
const e = le(o);
|
|
1001
1047
|
if (!e)
|
|
1002
1048
|
return;
|
|
@@ -1006,59 +1052,61 @@ const Qt = (o, e) => {
|
|
|
1006
1052
|
right: t.width,
|
|
1007
1053
|
top: 0,
|
|
1008
1054
|
bottom: t.height
|
|
1009
|
-
}).map((
|
|
1010
|
-
const
|
|
1011
|
-
return { pos: r, start: r + 1, node:
|
|
1055
|
+
}).map((s) => {
|
|
1056
|
+
const l = e.node.nodeAt(s), r = s + e.start;
|
|
1057
|
+
return { pos: r, start: r + 1, node: l };
|
|
1012
1058
|
});
|
|
1013
|
-
},
|
|
1014
|
-
const e =
|
|
1059
|
+
}, rn = (o) => {
|
|
1060
|
+
const e = ln(o.selection);
|
|
1015
1061
|
if (e && e[0]) {
|
|
1016
1062
|
const t = o.doc.resolve(e[0].pos), n = e[e.length - 1];
|
|
1017
1063
|
if (n) {
|
|
1018
|
-
const
|
|
1019
|
-
return
|
|
1064
|
+
const s = o.doc.resolve(n.pos);
|
|
1065
|
+
return Ge(o.setSelection(new m(s, t)));
|
|
1020
1066
|
}
|
|
1021
1067
|
}
|
|
1022
1068
|
return o;
|
|
1023
1069
|
};
|
|
1024
|
-
function
|
|
1025
|
-
const
|
|
1070
|
+
function ze(o, { map: e, tableStart: t, table: n }, s) {
|
|
1071
|
+
const l = Array(s).fill(0).reduce((c, d, f) => c + n.child(f).nodeSize, t), { cell: r, row: a } = A(n.type.schema), i = Array(e.width).fill(0).map((c, d) => {
|
|
1026
1072
|
const f = n.nodeAt(e.map[d]);
|
|
1027
1073
|
return r.createAndFill({ alignment: f == null ? void 0 : f.attrs.alignment });
|
|
1028
1074
|
});
|
|
1029
|
-
return o.insert(
|
|
1075
|
+
return o.insert(l, a.create(null, i)), o;
|
|
1030
1076
|
}
|
|
1031
|
-
const T = (o) => o.state.selection,
|
|
1077
|
+
const T = (o) => o.state.selection, cn = (o) => {
|
|
1032
1078
|
const e = g.get(o.$anchorCell.node(-1)), t = o.$anchorCell.start(-1), n = e.cellsInRect({
|
|
1033
1079
|
left: 0,
|
|
1034
1080
|
right: e.width,
|
|
1035
1081
|
top: 0,
|
|
1036
1082
|
bottom: 1
|
|
1037
|
-
}),
|
|
1038
|
-
|
|
1039
|
-
|
|
1083
|
+
}), s = e.cellsInRect(
|
|
1084
|
+
e.rectBetween(o.$anchorCell.pos - t, o.$headCell.pos - t)
|
|
1085
|
+
);
|
|
1086
|
+
for (let l = 0, r = n.length; l < r; l++)
|
|
1087
|
+
if (!s.includes(n[l]))
|
|
1040
1088
|
return !1;
|
|
1041
1089
|
return !0;
|
|
1042
|
-
},
|
|
1090
|
+
}, an = (o, e) => {
|
|
1043
1091
|
Object.values(o).forEach((t) => {
|
|
1044
|
-
var
|
|
1045
|
-
if ((
|
|
1092
|
+
var s;
|
|
1093
|
+
if ((s = t.disable) == null ? void 0 : s.call(t, e)) {
|
|
1046
1094
|
t.$.classList.add("hide");
|
|
1047
1095
|
return;
|
|
1048
1096
|
}
|
|
1049
1097
|
t.$.classList.remove("hide");
|
|
1050
1098
|
});
|
|
1051
|
-
},
|
|
1052
|
-
var e, t, n,
|
|
1099
|
+
}, dn = (o) => {
|
|
1100
|
+
var e, t, n, s, l, r, a, i;
|
|
1053
1101
|
return {
|
|
1054
1102
|
[0]: {
|
|
1055
1103
|
$: (e = o.get(L).get(v, "leftArrow")) == null ? void 0 : e.dom,
|
|
1056
|
-
command: () =>
|
|
1104
|
+
command: () => Gt,
|
|
1057
1105
|
disable: (c) => !T(c).isColSelection()
|
|
1058
1106
|
},
|
|
1059
1107
|
[1]: {
|
|
1060
1108
|
$: (t = o.get(L).get(v, "rightArrow")) == null ? void 0 : t.dom,
|
|
1061
|
-
command: () =>
|
|
1109
|
+
command: () => Jt,
|
|
1062
1110
|
disable: (c) => !T(c).isColSelection()
|
|
1063
1111
|
},
|
|
1064
1112
|
[2]: {
|
|
@@ -1068,66 +1116,67 @@ const T = (o) => o.state.selection, ln = (o) => {
|
|
|
1068
1116
|
return !1;
|
|
1069
1117
|
if (d) {
|
|
1070
1118
|
const f = P(c);
|
|
1071
|
-
d(
|
|
1119
|
+
d(ze(c.tr, f, f.top));
|
|
1072
1120
|
}
|
|
1073
1121
|
return !0;
|
|
1074
1122
|
},
|
|
1075
1123
|
disable: (c) => !T(c).isRowSelection() || T(c).$head.parent.type.name === "table_header"
|
|
1076
1124
|
},
|
|
1077
1125
|
[3]: {
|
|
1078
|
-
$: (
|
|
1126
|
+
$: (s = o.get(L).get(v, "downArrow")) == null ? void 0 : s.dom,
|
|
1079
1127
|
command: () => (c, d) => {
|
|
1080
1128
|
if (!M(c))
|
|
1081
1129
|
return !1;
|
|
1082
1130
|
if (d) {
|
|
1083
1131
|
const f = P(c);
|
|
1084
|
-
d(
|
|
1132
|
+
d(ze(c.tr, f, f.bottom));
|
|
1085
1133
|
}
|
|
1086
1134
|
return !0;
|
|
1087
1135
|
},
|
|
1088
1136
|
disable: (c) => !T(c).isRowSelection()
|
|
1089
1137
|
},
|
|
1090
1138
|
[4]: {
|
|
1091
|
-
$: (
|
|
1092
|
-
command: () =>
|
|
1139
|
+
$: (l = o.get(L).get(v, "alignLeft")) == null ? void 0 : l.dom,
|
|
1140
|
+
command: () => ce("alignment", "left"),
|
|
1093
1141
|
disable: (c) => !T(c).isColSelection()
|
|
1094
1142
|
},
|
|
1095
1143
|
[5]: {
|
|
1096
1144
|
$: (r = o.get(L).get(v, "alignCenter")) == null ? void 0 : r.dom,
|
|
1097
|
-
command: () =>
|
|
1145
|
+
command: () => ce("alignment", "center"),
|
|
1098
1146
|
disable: (c) => !T(c).isColSelection()
|
|
1099
1147
|
},
|
|
1100
1148
|
[6]: {
|
|
1101
1149
|
$: (a = o.get(L).get(v, "alignRight")) == null ? void 0 : a.dom,
|
|
1102
|
-
command: () =>
|
|
1150
|
+
command: () => ce("alignment", "right"),
|
|
1103
1151
|
disable: (c) => !T(c).isColSelection()
|
|
1104
1152
|
},
|
|
1105
1153
|
[7]: {
|
|
1106
1154
|
$: (i = o.get(L).get(v, "delete")) == null ? void 0 : i.dom,
|
|
1107
1155
|
command: (c, d) => {
|
|
1108
1156
|
const f = T(d), u = f.isColSelection(), p = f.isRowSelection();
|
|
1109
|
-
return u && p ?
|
|
1157
|
+
return u && p ? nn : u ? Zt : en;
|
|
1110
1158
|
},
|
|
1111
1159
|
disable: (c) => {
|
|
1112
1160
|
const d = T(c);
|
|
1113
|
-
return d.isRowSelection() ? d.isColSelection() ? !1 :
|
|
1161
|
+
return d.isRowSelection() ? d.isColSelection() ? !1 : cn(d) : !1;
|
|
1114
1162
|
}
|
|
1115
1163
|
}
|
|
1116
1164
|
};
|
|
1117
|
-
},
|
|
1118
|
-
const { selection: t } = o.state, n = t.isColSelection(),
|
|
1119
|
-
|
|
1165
|
+
}, fn = (o, e) => {
|
|
1166
|
+
const { selection: t } = o.state, n = t.isColSelection(), s = t.isRowSelection();
|
|
1167
|
+
yt(o, e, (l, r, a) => {
|
|
1120
1168
|
const i = e.parentElement;
|
|
1121
1169
|
if (!i)
|
|
1122
|
-
throw
|
|
1123
|
-
let c =
|
|
1124
|
-
|
|
1125
|
-
|
|
1170
|
+
throw bt();
|
|
1171
|
+
let c = s ? l.left - a.left - r.width / 2 - 8 : l.left - a.left + (l.width - r.width) / 2, d = l.top - a.top - r.height - (n ? 14 : 0) - 14 + i.scrollTop;
|
|
1172
|
+
c < 0 && (c = 0);
|
|
1173
|
+
const f = i.clientWidth - (r.width + 4);
|
|
1174
|
+
return c > f && (c = f), d < i.scrollTop && (d = l.top - a.top + 14 + i.scrollTop), [d, c];
|
|
1126
1175
|
});
|
|
1127
1176
|
};
|
|
1128
1177
|
var x = /* @__PURE__ */ ((o) => (o.Left = "Left", o.Top = "Top", o.Point = "Point", o))(x || {});
|
|
1129
|
-
const
|
|
1130
|
-
const n =
|
|
1178
|
+
const un = (o, { css: e, injectGlobal: t }) => {
|
|
1179
|
+
const n = mt(o), s = o.get(Te, "radius"), l = o.get(Te, "lineWidth");
|
|
1131
1180
|
return t`
|
|
1132
1181
|
.milkdown {
|
|
1133
1182
|
.tableWrapper {
|
|
@@ -1198,10 +1247,10 @@ const an = (o, { css: e, injectGlobal: t }) => {
|
|
|
1198
1247
|
|
|
1199
1248
|
position: absolute;
|
|
1200
1249
|
|
|
1201
|
-
border-radius: ${
|
|
1250
|
+
border-radius: ${s};
|
|
1202
1251
|
|
|
1203
|
-
${o.get(
|
|
1204
|
-
${o.get(
|
|
1252
|
+
${o.get(gt, void 0)};
|
|
1253
|
+
${o.get(wt, void 0)};
|
|
1205
1254
|
|
|
1206
1255
|
overflow: hidden;
|
|
1207
1256
|
background: ${n("surface")};
|
|
@@ -1228,7 +1277,7 @@ const an = (o, { css: e, injectGlobal: t }) => {
|
|
|
1228
1277
|
position: absolute;
|
|
1229
1278
|
right: 0;
|
|
1230
1279
|
top: 0;
|
|
1231
|
-
width: ${
|
|
1280
|
+
width: ${l};
|
|
1232
1281
|
bottom: 0;
|
|
1233
1282
|
background: ${n("line")};
|
|
1234
1283
|
}
|
|
@@ -1239,7 +1288,7 @@ const an = (o, { css: e, injectGlobal: t }) => {
|
|
|
1239
1288
|
display: none;
|
|
1240
1289
|
}
|
|
1241
1290
|
`;
|
|
1242
|
-
},
|
|
1291
|
+
}, pn = (o) => {
|
|
1243
1292
|
switch (o) {
|
|
1244
1293
|
case x.Left:
|
|
1245
1294
|
return "milkdown-cell-left";
|
|
@@ -1250,62 +1299,62 @@ const an = (o, { css: e, injectGlobal: t }) => {
|
|
|
1250
1299
|
return "milkdown-cell-point";
|
|
1251
1300
|
}
|
|
1252
1301
|
};
|
|
1253
|
-
function
|
|
1254
|
-
return
|
|
1302
|
+
function de(o, e, t, n = 0) {
|
|
1303
|
+
return Me.widget(e.pos + 1, (s) => {
|
|
1255
1304
|
var r;
|
|
1256
|
-
const
|
|
1257
|
-
return
|
|
1258
|
-
if (!!
|
|
1305
|
+
const l = document.createElement("div");
|
|
1306
|
+
return l.classList.add(pn(t)), t === x.Point && l.appendChild((r = o.get(L).get(v, "select")) == null ? void 0 : r.dom), l.addEventListener("mousedown", (a) => {
|
|
1307
|
+
if (!!s)
|
|
1259
1308
|
switch (a.preventDefault(), t) {
|
|
1260
1309
|
case x.Point: {
|
|
1261
|
-
|
|
1310
|
+
s.dispatch(rn(s.state.tr));
|
|
1262
1311
|
return;
|
|
1263
1312
|
}
|
|
1264
1313
|
case x.Left: {
|
|
1265
|
-
|
|
1266
|
-
return;
|
|
1267
|
-
}
|
|
1268
|
-
case x.Top: {
|
|
1269
|
-
l.dispatch(Oe("col")(n)(l.state.tr));
|
|
1314
|
+
s.dispatch(_e("row")(n)(s.state.tr));
|
|
1270
1315
|
return;
|
|
1271
1316
|
}
|
|
1317
|
+
case x.Top:
|
|
1318
|
+
s.dispatch(_e("col")(n)(s.state.tr));
|
|
1272
1319
|
}
|
|
1273
|
-
}),
|
|
1320
|
+
}), l;
|
|
1274
1321
|
});
|
|
1275
1322
|
}
|
|
1276
|
-
const
|
|
1277
|
-
key: new
|
|
1323
|
+
const hn = (o, e) => new H({
|
|
1324
|
+
key: new B("MILKDOWN_TABLE_OP"),
|
|
1278
1325
|
props: {
|
|
1279
1326
|
decorations: (t) => {
|
|
1280
|
-
|
|
1327
|
+
if (!o.get(U).editable)
|
|
1328
|
+
return null;
|
|
1329
|
+
const s = [], l = on(0)(t.selection);
|
|
1281
1330
|
if (!l)
|
|
1282
1331
|
return null;
|
|
1283
|
-
const
|
|
1284
|
-
if (!
|
|
1332
|
+
const r = sn(0)(t.selection);
|
|
1333
|
+
if (!r)
|
|
1285
1334
|
return null;
|
|
1286
|
-
const [
|
|
1287
|
-
return
|
|
1288
|
-
|
|
1289
|
-
}),
|
|
1290
|
-
|
|
1291
|
-
}),
|
|
1335
|
+
const [a] = l;
|
|
1336
|
+
return s.push(de(o, a, x.Point)), l.forEach((i, c) => {
|
|
1337
|
+
s.push(de(o, i, x.Left, c));
|
|
1338
|
+
}), r.forEach((i, c) => {
|
|
1339
|
+
s.push(de(o, i, x.Top, c));
|
|
1340
|
+
}), Se.create(t.doc, s);
|
|
1292
1341
|
}
|
|
1293
1342
|
},
|
|
1294
1343
|
view: (t) => {
|
|
1295
1344
|
var a;
|
|
1296
|
-
const n = Object.fromEntries(Object.entries(
|
|
1345
|
+
const n = Object.fromEntries(Object.entries(dn(o)).filter(([, i]) => i.$ != null)), s = document.createElement("div");
|
|
1297
1346
|
e.themeManager.onFlush(() => {
|
|
1298
|
-
const i = e.getStyle((c) =>
|
|
1299
|
-
i &&
|
|
1300
|
-
}),
|
|
1301
|
-
const
|
|
1347
|
+
const i = e.getStyle((c) => un(e.themeManager, c));
|
|
1348
|
+
i && s.classList.add(i);
|
|
1349
|
+
}), s.classList.add("table-tooltip", "hide"), Object.values(n).forEach(({ $: i }) => s.appendChild(i)), (a = t.dom.parentNode) == null || a.appendChild(s);
|
|
1350
|
+
const l = (i) => {
|
|
1302
1351
|
!t || (i.stopPropagation(), i.preventDefault(), Object.values(n).forEach(({ $: c, command: d }) => {
|
|
1303
1352
|
c.contains(i.target) && d(i, t)(t.state, t.dispatch, t);
|
|
1304
1353
|
}));
|
|
1305
1354
|
}, r = () => {
|
|
1306
|
-
|
|
1355
|
+
s.classList.add("hide");
|
|
1307
1356
|
};
|
|
1308
|
-
return
|
|
1357
|
+
return s.addEventListener("mousedown", l), {
|
|
1309
1358
|
update: (i, c) => {
|
|
1310
1359
|
const d = i.state;
|
|
1311
1360
|
if ((c == null ? void 0 : c.doc.eq(d.doc)) && c.selection.eq(d.selection))
|
|
@@ -1314,51 +1363,55 @@ const fn = (o, e) => new W({
|
|
|
1314
1363
|
r();
|
|
1315
1364
|
return;
|
|
1316
1365
|
}
|
|
1317
|
-
if (
|
|
1366
|
+
if (an(n, i), Object.values(n).every(({ $: u }) => u.classList.contains("hide"))) {
|
|
1318
1367
|
r();
|
|
1319
1368
|
return;
|
|
1320
1369
|
}
|
|
1321
|
-
|
|
1370
|
+
s.classList.remove("hide"), fn(i, s);
|
|
1322
1371
|
},
|
|
1323
1372
|
destroy: () => {
|
|
1324
|
-
|
|
1373
|
+
s.removeEventListener("mousedown", l), s.remove();
|
|
1325
1374
|
}
|
|
1326
1375
|
};
|
|
1327
1376
|
}
|
|
1328
|
-
}),
|
|
1329
|
-
key:
|
|
1377
|
+
}), mn = (o) => o.type.name === "paragraph" && o.nodeSize === 2, gn = (o) => o.type.name === "paragraph", wn = new B("plugin_autoInsertZeroSpace"), bn = () => new H({
|
|
1378
|
+
key: wn,
|
|
1330
1379
|
props: {
|
|
1331
1380
|
handleDOMEvents: {
|
|
1332
1381
|
compositionstart(o) {
|
|
1333
|
-
const { state: e, dispatch: t } = o, { tr: n, selection:
|
|
1334
|
-
return
|
|
1382
|
+
const { state: e, dispatch: t } = o, { tr: n, selection: s } = e, { $from: l } = s;
|
|
1383
|
+
return Le.safari && M(e) && s.empty && mn(l.parent) && t(n.insertText("\u2060", l.start())), !1;
|
|
1335
1384
|
},
|
|
1336
1385
|
compositionend(o) {
|
|
1337
|
-
const { state: e, dispatch: t } = o, { tr: n, selection:
|
|
1338
|
-
return
|
|
1386
|
+
const { state: e, dispatch: t } = o, { tr: n, selection: s } = e, { $from: l } = s;
|
|
1387
|
+
return Le.safari && M(e) && s.empty && gn(l.parent) && l.parent.textContent.startsWith("\u2060") && t(n.delete(l.start(), l.start() + 1)), !1;
|
|
1339
1388
|
}
|
|
1340
1389
|
}
|
|
1341
1390
|
}
|
|
1342
1391
|
});
|
|
1343
|
-
class
|
|
1392
|
+
class Cn {
|
|
1344
1393
|
constructor(e, t) {
|
|
1345
|
-
this
|
|
1394
|
+
I(this, "dom");
|
|
1395
|
+
I(this, "contentDOM");
|
|
1396
|
+
I(this, "table");
|
|
1397
|
+
I(this, "colgroup");
|
|
1398
|
+
this.node = e, this.cellMinWidth = t, this.node = e, this.cellMinWidth = t, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")), he(e, this.colgroup, this.table, t), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
1346
1399
|
}
|
|
1347
1400
|
update(e) {
|
|
1348
|
-
return e.type != this.node.type ? !1 : (this.node = e,
|
|
1401
|
+
return e.type != this.node.type ? !1 : (this.node = e, he(e, this.colgroup, this.table, this.cellMinWidth), !0);
|
|
1349
1402
|
}
|
|
1350
1403
|
ignoreMutation(e) {
|
|
1351
1404
|
return e.type == "attributes" && (e.target == this.table || this.colgroup.contains(e.target));
|
|
1352
1405
|
}
|
|
1353
1406
|
}
|
|
1354
|
-
function
|
|
1407
|
+
function he(o, e, t, n, s, l) {
|
|
1355
1408
|
var d;
|
|
1356
1409
|
let r = 0, a = !0, i = e.firstChild;
|
|
1357
1410
|
const c = o.firstChild;
|
|
1358
1411
|
for (let f = 0, u = 0; f < c.childCount; f++) {
|
|
1359
1412
|
const { colspan: p, colwidth: h } = c.child(f).attrs;
|
|
1360
1413
|
for (let b = 0; b < p; b++, u++) {
|
|
1361
|
-
const w =
|
|
1414
|
+
const w = s == u ? l : h && h[b], C = w ? `${w}px` : "";
|
|
1362
1415
|
r += w || n, w || (a = !1), i ? (i.style.width != C && (i.style.width = C), i = i.nextSibling) : e.appendChild(document.createElement("col")).style.width = C;
|
|
1363
1416
|
}
|
|
1364
1417
|
}
|
|
@@ -1366,49 +1419,49 @@ function pe(o, e, t, n, l, s) {
|
|
|
1366
1419
|
const f = i.nextSibling;
|
|
1367
1420
|
(d = i.parentNode) == null || d.removeChild(i), i = f;
|
|
1368
1421
|
}
|
|
1369
|
-
a ? (t.style.width = r
|
|
1422
|
+
a ? (t.style.width = `${r}px`, t.style.minWidth = "") : (t.style.width = "", t.style.minWidth = `${r}px`);
|
|
1370
1423
|
}
|
|
1371
|
-
const k = new
|
|
1372
|
-
function
|
|
1424
|
+
const k = new B("tableColumnResizing");
|
|
1425
|
+
function yn({
|
|
1373
1426
|
handleWidth: o = 5,
|
|
1374
1427
|
cellMinWidth: e = 25,
|
|
1375
|
-
View: t =
|
|
1428
|
+
View: t = Cn,
|
|
1376
1429
|
lastColumnResizable: n = !0
|
|
1377
1430
|
} = {}) {
|
|
1378
|
-
return new
|
|
1431
|
+
return new H({
|
|
1379
1432
|
key: k,
|
|
1380
1433
|
state: {
|
|
1381
|
-
init(
|
|
1382
|
-
return this.spec.props.nodeViews[A(r.schema).table.name] = (a) => new t(a, e), new
|
|
1434
|
+
init(l, r) {
|
|
1435
|
+
return this.spec.props.nodeViews[A(r.schema).table.name] = (a) => new t(a, e), new X(-1, !1);
|
|
1383
1436
|
},
|
|
1384
|
-
apply(
|
|
1385
|
-
return r.apply(
|
|
1437
|
+
apply(l, r) {
|
|
1438
|
+
return r.apply(l);
|
|
1386
1439
|
}
|
|
1387
1440
|
},
|
|
1388
1441
|
props: {
|
|
1389
|
-
attributes(
|
|
1390
|
-
return k.getState(
|
|
1442
|
+
attributes(l) {
|
|
1443
|
+
return k.getState(l).activeHandle > -1 ? { class: "resize-cursor" } : void 0;
|
|
1391
1444
|
},
|
|
1392
1445
|
handleDOMEvents: {
|
|
1393
|
-
mousemove(
|
|
1394
|
-
|
|
1446
|
+
mousemove(l, r) {
|
|
1447
|
+
!l.editable || kn(l, r, o, n);
|
|
1395
1448
|
},
|
|
1396
|
-
mouseleave(
|
|
1397
|
-
|
|
1449
|
+
mouseleave(l) {
|
|
1450
|
+
!l.editable || An(l);
|
|
1398
1451
|
},
|
|
1399
|
-
mousedown(
|
|
1400
|
-
|
|
1452
|
+
mousedown(l, r) {
|
|
1453
|
+
!l.editable || Mn(l, r, e);
|
|
1401
1454
|
}
|
|
1402
1455
|
},
|
|
1403
|
-
decorations(
|
|
1404
|
-
const r = k.getState(
|
|
1405
|
-
return r.activeHandle > -1 ?
|
|
1456
|
+
decorations(l) {
|
|
1457
|
+
const r = k.getState(l);
|
|
1458
|
+
return r.activeHandle > -1 ? Ln(l, r.activeHandle) : null;
|
|
1406
1459
|
},
|
|
1407
1460
|
nodeViews: {}
|
|
1408
1461
|
}
|
|
1409
1462
|
});
|
|
1410
1463
|
}
|
|
1411
|
-
class
|
|
1464
|
+
class X {
|
|
1412
1465
|
constructor(e, t) {
|
|
1413
1466
|
this.activeHandle = e, this.dragging = t, this.activeHandle = e, this.dragging = t;
|
|
1414
1467
|
}
|
|
@@ -1416,327 +1469,374 @@ class q {
|
|
|
1416
1469
|
let t = this;
|
|
1417
1470
|
const n = e.getMeta(k);
|
|
1418
1471
|
if (n && n.setHandle != null)
|
|
1419
|
-
return new
|
|
1472
|
+
return new X(n.setHandle, null);
|
|
1420
1473
|
if (n && n.setDragging !== void 0)
|
|
1421
|
-
return new
|
|
1474
|
+
return new X(t.activeHandle, n.setDragging);
|
|
1422
1475
|
if (t.activeHandle > -1 && e.docChanged) {
|
|
1423
|
-
let
|
|
1424
|
-
|
|
1476
|
+
let s = e.mapping.map(t.activeHandle, -1);
|
|
1477
|
+
pe(e.doc.resolve(s)) || (s = 0), t = new X(s, t.dragging);
|
|
1425
1478
|
}
|
|
1426
1479
|
return t;
|
|
1427
1480
|
}
|
|
1428
1481
|
}
|
|
1429
|
-
function
|
|
1430
|
-
const
|
|
1431
|
-
if (!
|
|
1432
|
-
const
|
|
1482
|
+
function kn(o, e, t, n) {
|
|
1483
|
+
const s = k.getState(o.state);
|
|
1484
|
+
if (!s.dragging) {
|
|
1485
|
+
const l = Nn(e.target);
|
|
1433
1486
|
let r = -1;
|
|
1434
|
-
if (
|
|
1435
|
-
const { left: a, right: i } =
|
|
1436
|
-
e.clientX
|
|
1487
|
+
if (l) {
|
|
1488
|
+
const { left: a, right: i } = l.getBoundingClientRect();
|
|
1489
|
+
i - e.clientX <= t || e.clientX === Math.floor(a) ? r = Fe(o, e, "right") : e.clientX - a <= t && (r = Fe(o, e, "left"));
|
|
1437
1490
|
}
|
|
1438
|
-
if (r !=
|
|
1491
|
+
if (r != s.activeHandle) {
|
|
1439
1492
|
if (!n && r !== -1) {
|
|
1440
1493
|
const a = o.state.doc.resolve(r), i = a.node(-1), c = g.get(i), d = a.start(-1);
|
|
1441
1494
|
if (c.colCount(a.pos - d) + a.nodeAfter.attrs.colspan - 1 == c.width - 1)
|
|
1442
1495
|
return;
|
|
1443
1496
|
}
|
|
1444
|
-
|
|
1497
|
+
nt(o, r);
|
|
1445
1498
|
}
|
|
1446
1499
|
}
|
|
1447
1500
|
}
|
|
1448
|
-
function
|
|
1501
|
+
function An(o) {
|
|
1449
1502
|
const e = k.getState(o.state);
|
|
1450
|
-
e.activeHandle > -1 && !e.dragging &&
|
|
1503
|
+
e.activeHandle > -1 && !e.dragging && nt(o, -1);
|
|
1451
1504
|
}
|
|
1452
|
-
function
|
|
1505
|
+
function Mn(o, e, t) {
|
|
1453
1506
|
const n = k.getState(o.state);
|
|
1454
1507
|
if (n.activeHandle == -1 || n.dragging)
|
|
1455
1508
|
return !1;
|
|
1456
|
-
const
|
|
1457
|
-
o.dispatch(
|
|
1458
|
-
|
|
1459
|
-
|
|
1509
|
+
const s = o.state.doc.nodeAt(n.activeHandle), l = Sn(o, n.activeHandle, s.attrs);
|
|
1510
|
+
o.dispatch(
|
|
1511
|
+
o.state.tr.setMeta(k, {
|
|
1512
|
+
setDragging: { startX: e.clientX, startWidth: l }
|
|
1513
|
+
})
|
|
1514
|
+
);
|
|
1460
1515
|
function r(i) {
|
|
1461
1516
|
window.removeEventListener("mouseup", r), window.removeEventListener("mousemove", a);
|
|
1462
1517
|
const c = k.getState(o.state);
|
|
1463
|
-
c.dragging && (
|
|
1518
|
+
c.dragging && (xn(o, c.activeHandle, Be(c.dragging, i, t)), o.dispatch(o.state.tr.setMeta(k, { setDragging: null })));
|
|
1464
1519
|
}
|
|
1465
1520
|
function a(i) {
|
|
1466
1521
|
if (!i.which)
|
|
1467
1522
|
return r(i);
|
|
1468
|
-
const c = k.getState(o.state), d =
|
|
1469
|
-
|
|
1523
|
+
const c = k.getState(o.state), d = Be(c.dragging, i, t);
|
|
1524
|
+
Rn(o, c.activeHandle, d, t);
|
|
1470
1525
|
}
|
|
1471
1526
|
return window.addEventListener("mouseup", r), window.addEventListener("mousemove", a), e.preventDefault(), !0;
|
|
1472
1527
|
}
|
|
1473
|
-
function
|
|
1474
|
-
const
|
|
1475
|
-
if (
|
|
1476
|
-
return
|
|
1477
|
-
const
|
|
1478
|
-
let a =
|
|
1528
|
+
function Sn(o, e, { colspan: t, colwidth: n }) {
|
|
1529
|
+
const s = n && n[n.length - 1];
|
|
1530
|
+
if (s)
|
|
1531
|
+
return s;
|
|
1532
|
+
const l = o.domAtPos(e);
|
|
1533
|
+
let a = l.node.childNodes[l.offset].offsetWidth, i = t;
|
|
1479
1534
|
if (n)
|
|
1480
1535
|
for (let c = 0; c < t; c++)
|
|
1481
1536
|
n[c] && (a -= n[c], i--);
|
|
1482
1537
|
return a / i;
|
|
1483
1538
|
}
|
|
1484
|
-
function
|
|
1539
|
+
function Nn(o) {
|
|
1485
1540
|
for (; o && o.nodeName != "TD" && o.nodeName != "TH"; )
|
|
1486
1541
|
o = o.classList.contains("ProseMirror") ? null : o.parentNode;
|
|
1487
1542
|
return o;
|
|
1488
1543
|
}
|
|
1489
|
-
function
|
|
1544
|
+
function Fe(o, e, t) {
|
|
1490
1545
|
const n = o.posAtCoords({ left: e.clientX, top: e.clientY });
|
|
1491
1546
|
if (!n)
|
|
1492
1547
|
return -1;
|
|
1493
|
-
const { pos:
|
|
1494
|
-
if (!
|
|
1548
|
+
const { pos: s } = n, l = V(o.state.doc.resolve(s));
|
|
1549
|
+
if (!l)
|
|
1495
1550
|
return -1;
|
|
1496
1551
|
if (t == "right")
|
|
1497
|
-
return
|
|
1498
|
-
const r = g.get(
|
|
1552
|
+
return l.pos;
|
|
1553
|
+
const r = g.get(l.node(-1)), a = l.start(-1), i = r.map.indexOf(l.pos - a);
|
|
1499
1554
|
return i % r.width == 0 ? -1 : a + r.map[i - 1];
|
|
1500
1555
|
}
|
|
1501
|
-
function
|
|
1556
|
+
function Be(o, e, t) {
|
|
1502
1557
|
const n = e.clientX - o.startX;
|
|
1503
1558
|
return Math.max(t, o.startWidth + n);
|
|
1504
1559
|
}
|
|
1505
|
-
function
|
|
1560
|
+
function nt(o, e) {
|
|
1506
1561
|
o.dispatch(o.state.tr.setMeta(k, { setHandle: e }));
|
|
1507
1562
|
}
|
|
1508
|
-
function
|
|
1509
|
-
const n = o.state.doc.resolve(e),
|
|
1510
|
-
for (let c = 0; c <
|
|
1511
|
-
const d = c *
|
|
1512
|
-
if (c &&
|
|
1563
|
+
function xn(o, e, t) {
|
|
1564
|
+
const n = o.state.doc.resolve(e), s = n.node(-1), l = g.get(s), r = n.start(-1), a = l.colCount(n.pos - r) + n.nodeAfter.attrs.colspan - 1, i = o.state.tr;
|
|
1565
|
+
for (let c = 0; c < l.height; c++) {
|
|
1566
|
+
const d = c * l.width + a;
|
|
1567
|
+
if (c && l.map[d] == l.map[d - l.width])
|
|
1513
1568
|
continue;
|
|
1514
|
-
const f =
|
|
1569
|
+
const f = l.map[d], { attrs: u } = s.nodeAt(f), p = u.colspan == 1 ? 0 : a - l.colCount(f);
|
|
1515
1570
|
if (u.colwidth && u.colwidth[p] == t)
|
|
1516
1571
|
continue;
|
|
1517
|
-
const h = u.colwidth ? u.colwidth.slice() :
|
|
1572
|
+
const h = u.colwidth ? u.colwidth.slice() : Tn(u.colspan);
|
|
1518
1573
|
h[p] = t, i.setNodeMarkup(r + f, null, y(u, "colwidth", h));
|
|
1519
1574
|
}
|
|
1520
1575
|
i.docChanged && o.dispatch(i);
|
|
1521
1576
|
}
|
|
1522
|
-
function
|
|
1523
|
-
const
|
|
1524
|
-
let i = o.domAtPos(
|
|
1577
|
+
function Rn(o, e, t, n) {
|
|
1578
|
+
const s = o.state.doc.resolve(e), l = s.node(-1), r = s.start(-1), a = g.get(l).colCount(s.pos - r) + s.nodeAfter.attrs.colspan - 1;
|
|
1579
|
+
let i = o.domAtPos(s.start(-1)).node;
|
|
1525
1580
|
for (; i.nodeName != "TABLE"; )
|
|
1526
1581
|
i = i.parentNode;
|
|
1527
|
-
|
|
1582
|
+
he(l, i.firstChild, i, n, a, t);
|
|
1528
1583
|
}
|
|
1529
|
-
function
|
|
1584
|
+
function Tn(o) {
|
|
1530
1585
|
const e = [];
|
|
1531
1586
|
for (let t = 0; t < o; t++)
|
|
1532
1587
|
e.push(0);
|
|
1533
1588
|
return e;
|
|
1534
1589
|
}
|
|
1535
|
-
function
|
|
1536
|
-
const t = [], n = o.doc.resolve(e),
|
|
1537
|
-
for (let i = 0; i <
|
|
1538
|
-
const c = a + i *
|
|
1539
|
-
if ((a ==
|
|
1540
|
-
const d =
|
|
1541
|
-
u.className = "column-resize-handle", t.push(
|
|
1590
|
+
function Ln(o, e) {
|
|
1591
|
+
const t = [], n = o.doc.resolve(e), s = n.node(-1), l = g.get(s), r = n.start(-1), a = l.colCount(n.pos - r) + n.nodeAfter.attrs.colspan;
|
|
1592
|
+
for (let i = 0; i < l.height; i++) {
|
|
1593
|
+
const c = a + i * l.width - 1;
|
|
1594
|
+
if ((a == l.width || l.map[c] != l.map[c + 1]) && (i == 0 || l.map[c - 1] != l.map[c - 1 - l.width])) {
|
|
1595
|
+
const d = l.map[c], f = r + d + s.nodeAt(d).nodeSize - 1, u = document.createElement("div");
|
|
1596
|
+
u.className = "column-resize-handle", t.push(Me.widget(f, u));
|
|
1542
1597
|
}
|
|
1543
1598
|
}
|
|
1544
|
-
return
|
|
1599
|
+
return Se.create(o.doc, t);
|
|
1545
1600
|
}
|
|
1546
|
-
function
|
|
1601
|
+
function vn(o) {
|
|
1547
1602
|
if (!o.size)
|
|
1548
1603
|
return null;
|
|
1549
1604
|
let { content: e, openStart: t, openEnd: n } = o;
|
|
1550
1605
|
for (; e.childCount == 1 && (t > 0 && n > 0 || e.firstChild.type.spec.tableRole == "table"); )
|
|
1551
1606
|
t--, n--, e = e.firstChild.content;
|
|
1552
|
-
const
|
|
1553
|
-
if (
|
|
1607
|
+
const s = e.firstChild, l = s.type.spec.tableRole, r = s.type.schema, a = [];
|
|
1608
|
+
if (l == "row")
|
|
1554
1609
|
for (let i = 0; i < e.childCount; i++) {
|
|
1555
1610
|
let c = e.child(i).content;
|
|
1556
1611
|
const d = i ? 0 : Math.max(0, t - 1), f = i < e.childCount - 1 ? 0 : Math.max(0, n - 1);
|
|
1557
|
-
(d || f) && (c =
|
|
1612
|
+
(d || f) && (c = me(A(r).row, new _(c, d, f)).content), a.push(c);
|
|
1558
1613
|
}
|
|
1559
|
-
else if (
|
|
1560
|
-
a.push(
|
|
1614
|
+
else if (l == "cell" || l == "header_cell")
|
|
1615
|
+
a.push(
|
|
1616
|
+
t || n ? me(A(r).row, new _(e, t, n)).content : e
|
|
1617
|
+
);
|
|
1561
1618
|
else
|
|
1562
1619
|
return null;
|
|
1563
|
-
return
|
|
1620
|
+
return En(r, a);
|
|
1564
1621
|
}
|
|
1565
|
-
function
|
|
1622
|
+
function En(o, e) {
|
|
1566
1623
|
const t = [];
|
|
1567
|
-
for (let
|
|
1568
|
-
const
|
|
1569
|
-
for (let r =
|
|
1570
|
-
const { rowspan: a, colspan: i } =
|
|
1571
|
-
for (let c =
|
|
1624
|
+
for (let s = 0; s < e.length; s++) {
|
|
1625
|
+
const l = e[s];
|
|
1626
|
+
for (let r = l.childCount - 1; r >= 0; r--) {
|
|
1627
|
+
const { rowspan: a, colspan: i } = l.child(r).attrs;
|
|
1628
|
+
for (let c = s; c < s + a; c++)
|
|
1572
1629
|
t[c] = (t[c] || 0) + i;
|
|
1573
1630
|
}
|
|
1574
1631
|
}
|
|
1575
1632
|
let n = 0;
|
|
1576
|
-
for (let
|
|
1577
|
-
n = Math.max(n, t[
|
|
1578
|
-
for (let
|
|
1579
|
-
if (
|
|
1580
|
-
const
|
|
1581
|
-
for (let a = t[
|
|
1582
|
-
r.push(
|
|
1583
|
-
e[
|
|
1633
|
+
for (let s = 0; s < t.length; s++)
|
|
1634
|
+
n = Math.max(n, t[s]);
|
|
1635
|
+
for (let s = 0; s < t.length; s++)
|
|
1636
|
+
if (s >= e.length && e.push($.empty), t[s] < n) {
|
|
1637
|
+
const l = A(o).cell.createAndFill(), r = [];
|
|
1638
|
+
for (let a = t[s]; a < n; a++)
|
|
1639
|
+
r.push(l);
|
|
1640
|
+
e[s] = e[s].append($.from(r));
|
|
1584
1641
|
}
|
|
1585
1642
|
return { height: e.length, width: n, rows: e };
|
|
1586
1643
|
}
|
|
1587
|
-
function
|
|
1644
|
+
function me(o, e) {
|
|
1588
1645
|
const t = o.createAndFill();
|
|
1589
|
-
return new
|
|
1646
|
+
return new Nt(t).replace(0, t.content.size, e).doc;
|
|
1590
1647
|
}
|
|
1591
|
-
function
|
|
1648
|
+
function $n({ width: o, height: e, rows: t }, n, s) {
|
|
1592
1649
|
if (o != n) {
|
|
1593
|
-
const
|
|
1650
|
+
const l = [], r = [];
|
|
1594
1651
|
for (let a = 0; a < t.length; a++) {
|
|
1595
1652
|
const i = t[a], c = [];
|
|
1596
|
-
for (let d =
|
|
1653
|
+
for (let d = l[a] || 0, f = 0; d < n; f++) {
|
|
1597
1654
|
let u = i.child(f % i.childCount);
|
|
1598
|
-
d + u.attrs.colspan > n && (u = u.type.create(
|
|
1655
|
+
d + u.attrs.colspan > n && (u = u.type.create(
|
|
1656
|
+
F(u.attrs, u.attrs.colspan, d + u.attrs.colspan - n),
|
|
1657
|
+
u.content
|
|
1658
|
+
)), c.push(u), d += u.attrs.colspan;
|
|
1599
1659
|
for (let p = 1; p < u.attrs.rowspan; p++)
|
|
1600
|
-
|
|
1660
|
+
l[a + p] = (l[a + p] || 0) + u.attrs.colspan;
|
|
1601
1661
|
}
|
|
1602
|
-
r.push(
|
|
1662
|
+
r.push($.from(c));
|
|
1603
1663
|
}
|
|
1604
1664
|
t = r, o = n;
|
|
1605
1665
|
}
|
|
1606
|
-
if (e !=
|
|
1607
|
-
const
|
|
1608
|
-
for (let r = 0, a = 0; r <
|
|
1666
|
+
if (e != s) {
|
|
1667
|
+
const l = [];
|
|
1668
|
+
for (let r = 0, a = 0; r < s; r++, a++) {
|
|
1609
1669
|
const i = [], c = t[a % e];
|
|
1610
1670
|
for (let d = 0; d < c.childCount; d++) {
|
|
1611
1671
|
let f = c.child(d);
|
|
1612
|
-
r + f.attrs.rowspan >
|
|
1672
|
+
r + f.attrs.rowspan > s && (f = f.type.create(
|
|
1673
|
+
y(f.attrs, "rowspan", Math.max(1, s - f.attrs.rowspan)),
|
|
1674
|
+
f.content
|
|
1675
|
+
)), i.push(f);
|
|
1613
1676
|
}
|
|
1614
|
-
|
|
1677
|
+
l.push($.from(i));
|
|
1615
1678
|
}
|
|
1616
|
-
t =
|
|
1679
|
+
t = l, e = s;
|
|
1617
1680
|
}
|
|
1618
1681
|
return { width: o, height: e, rows: t };
|
|
1619
1682
|
}
|
|
1620
|
-
function
|
|
1683
|
+
function In(o, e, t, n, s, l, r) {
|
|
1621
1684
|
const a = o.doc.type.schema, i = A(a);
|
|
1622
1685
|
let c, d;
|
|
1623
|
-
if (
|
|
1686
|
+
if (s > e.width)
|
|
1624
1687
|
for (let f = 0, u = 0; f < e.height; f++) {
|
|
1625
1688
|
const p = t.child(f);
|
|
1626
1689
|
u += p.nodeSize;
|
|
1627
1690
|
const h = [];
|
|
1628
1691
|
let b;
|
|
1629
1692
|
p.lastChild == null || p.lastChild.type == i.cell ? b = c || (c = i.cell.createAndFill()) : b = d || (d = i.header_cell.createAndFill());
|
|
1630
|
-
for (let w = e.width; w <
|
|
1693
|
+
for (let w = e.width; w < s; w++)
|
|
1631
1694
|
h.push(b);
|
|
1632
1695
|
o.insert(o.mapping.slice(r).map(u - 1 + n), h);
|
|
1633
1696
|
}
|
|
1634
|
-
if (
|
|
1697
|
+
if (l > e.height) {
|
|
1635
1698
|
const f = [];
|
|
1636
|
-
for (let h = 0, b = (e.height - 1) * e.width; h < Math.max(e.width,
|
|
1699
|
+
for (let h = 0, b = (e.height - 1) * e.width; h < Math.max(e.width, s); h++) {
|
|
1637
1700
|
const w = h >= e.width ? !1 : t.nodeAt(e.map[b + h]).type == i.header_cell;
|
|
1638
|
-
f.push(
|
|
1701
|
+
f.push(
|
|
1702
|
+
w ? d || (d = i.header_cell.createAndFill()) : c || (c = i.cell.createAndFill())
|
|
1703
|
+
);
|
|
1639
1704
|
}
|
|
1640
|
-
const u = i.row.create(null,
|
|
1641
|
-
for (let h = e.height; h <
|
|
1705
|
+
const u = i.row.create(null, $.from(f)), p = [];
|
|
1706
|
+
for (let h = e.height; h < l; h++)
|
|
1642
1707
|
p.push(u);
|
|
1643
1708
|
o.insert(o.mapping.slice(r).map(n + t.nodeSize - 2), p);
|
|
1644
1709
|
}
|
|
1645
1710
|
return !!(c || d);
|
|
1646
1711
|
}
|
|
1647
|
-
function
|
|
1712
|
+
function We(o, e, t, n, s, l, r, a) {
|
|
1648
1713
|
if (r == 0 || r == e.height)
|
|
1649
1714
|
return !1;
|
|
1650
1715
|
let i = !1;
|
|
1651
|
-
for (let c =
|
|
1716
|
+
for (let c = s; c < l; c++) {
|
|
1652
1717
|
const d = r * e.width + c, f = e.map[d];
|
|
1653
1718
|
if (e.map[d - e.width] == f) {
|
|
1654
1719
|
i = !0;
|
|
1655
1720
|
const u = t.nodeAt(f), { top: p, left: h } = e.findCell(f);
|
|
1656
|
-
o.setNodeMarkup(
|
|
1721
|
+
o.setNodeMarkup(
|
|
1722
|
+
o.mapping.slice(a).map(f + n),
|
|
1723
|
+
null,
|
|
1724
|
+
y(u.attrs, "rowspan", r - p)
|
|
1725
|
+
), o.insert(
|
|
1726
|
+
o.mapping.slice(a).map(e.positionAt(r, h, t)),
|
|
1727
|
+
u.type.createAndFill(y(u.attrs, "rowspan", p + u.attrs.rowspan - r))
|
|
1728
|
+
), c += u.attrs.colspan - 1;
|
|
1657
1729
|
}
|
|
1658
1730
|
}
|
|
1659
1731
|
return i;
|
|
1660
1732
|
}
|
|
1661
|
-
function Pe(o, e, t, n,
|
|
1733
|
+
function Pe(o, e, t, n, s, l, r, a) {
|
|
1662
1734
|
if (r == 0 || r == e.width)
|
|
1663
1735
|
return !1;
|
|
1664
1736
|
let i = !1;
|
|
1665
|
-
for (let c =
|
|
1737
|
+
for (let c = s; c < l; c++) {
|
|
1666
1738
|
const d = c * e.width + r, f = e.map[d];
|
|
1667
1739
|
if (e.map[d - 1] == f) {
|
|
1668
1740
|
i = !0;
|
|
1669
1741
|
const u = t.nodeAt(f), p = e.colCount(f), h = o.mapping.slice(a).map(f + n);
|
|
1670
|
-
o.setNodeMarkup(
|
|
1742
|
+
o.setNodeMarkup(
|
|
1743
|
+
h,
|
|
1744
|
+
null,
|
|
1745
|
+
F(u.attrs, r - p, u.attrs.colspan - (r - p))
|
|
1746
|
+
), o.insert(
|
|
1747
|
+
h + u.nodeSize,
|
|
1748
|
+
u.type.createAndFill(F(u.attrs, 0, r - p))
|
|
1749
|
+
), c += u.attrs.rowspan - 1;
|
|
1671
1750
|
}
|
|
1672
1751
|
}
|
|
1673
1752
|
return i;
|
|
1674
1753
|
}
|
|
1675
|
-
function
|
|
1676
|
-
let
|
|
1677
|
-
const { top: a, left: i } = n, c = i +
|
|
1754
|
+
function He(o, e, t, n, s) {
|
|
1755
|
+
let l = t ? o.doc.nodeAt(t - 1) : o.doc, r = g.get(l);
|
|
1756
|
+
const { top: a, left: i } = n, c = i + s.width, d = a + s.height, f = o.tr;
|
|
1678
1757
|
let u = 0;
|
|
1679
1758
|
function p() {
|
|
1680
|
-
|
|
1759
|
+
l = t ? f.doc.nodeAt(t - 1) : f.doc, r = g.get(l), u = f.mapping.maps.length;
|
|
1681
1760
|
}
|
|
1682
|
-
|
|
1761
|
+
In(f, r, l, t, c, d, u) && p(), We(f, r, l, t, i, c, a, u) && p(), We(f, r, l, t, i, c, d, u) && p(), Pe(f, r, l, t, a, d, i, u) && p(), Pe(f, r, l, t, a, d, c, u) && p();
|
|
1683
1762
|
for (let h = a; h < d; h++) {
|
|
1684
|
-
const b = r.positionAt(h, i,
|
|
1685
|
-
f.replace(
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1763
|
+
const b = r.positionAt(h, i, l), w = r.positionAt(h, c, l);
|
|
1764
|
+
f.replace(
|
|
1765
|
+
f.mapping.slice(u).map(b + t),
|
|
1766
|
+
f.mapping.slice(u).map(w + t),
|
|
1767
|
+
new _(s.rows[h - a], 0, 0)
|
|
1768
|
+
);
|
|
1769
|
+
}
|
|
1770
|
+
p(), f.setSelection(
|
|
1771
|
+
new m(
|
|
1772
|
+
f.doc.resolve(t + r.positionAt(a, i, l)),
|
|
1773
|
+
f.doc.resolve(t + r.positionAt(d - 1, c - 1, l))
|
|
1774
|
+
)
|
|
1775
|
+
), e(f);
|
|
1776
|
+
}
|
|
1777
|
+
const Dn = new B("fix-tables");
|
|
1778
|
+
function ot(o, e, t, n) {
|
|
1779
|
+
const s = o.childCount, l = e.childCount;
|
|
1692
1780
|
e:
|
|
1693
|
-
for (let r = 0, a = 0; r <
|
|
1781
|
+
for (let r = 0, a = 0; r < l; r++) {
|
|
1694
1782
|
const i = e.child(r);
|
|
1695
|
-
for (let c = a, d = Math.min(
|
|
1783
|
+
for (let c = a, d = Math.min(s, r + 3); c < d; c++)
|
|
1696
1784
|
if (o.child(c) == i) {
|
|
1697
1785
|
a = c + 1, t += i.nodeSize;
|
|
1698
1786
|
continue e;
|
|
1699
1787
|
}
|
|
1700
|
-
n(i, t), a <
|
|
1788
|
+
n(i, t), a < s && o.child(a).sameMarkup(i) ? ot(o.child(a), i, t + 1, n) : i.nodesBetween(0, i.content.size, n, t + 1), t += i.nodeSize;
|
|
1701
1789
|
}
|
|
1702
1790
|
}
|
|
1703
|
-
function
|
|
1791
|
+
function On(o, e) {
|
|
1704
1792
|
let t;
|
|
1705
|
-
const n = (
|
|
1706
|
-
|
|
1793
|
+
const n = (s, l) => {
|
|
1794
|
+
s.type.spec.tableRole == "table" && (t = _n(o, s, l, t));
|
|
1707
1795
|
};
|
|
1708
|
-
return e ? e.doc != o.doc &&
|
|
1796
|
+
return e ? e.doc != o.doc && ot(e.doc, o.doc, 0, n) : o.doc.descendants(n), t;
|
|
1709
1797
|
}
|
|
1710
|
-
function
|
|
1711
|
-
const
|
|
1712
|
-
if (!
|
|
1798
|
+
function _n(o, e, t, n) {
|
|
1799
|
+
const s = g.get(e);
|
|
1800
|
+
if (!s.problems)
|
|
1713
1801
|
return n;
|
|
1714
1802
|
n || (n = o.tr);
|
|
1715
|
-
const
|
|
1716
|
-
for (let i = 0; i <
|
|
1717
|
-
|
|
1718
|
-
for (let i = 0; i <
|
|
1719
|
-
const c =
|
|
1803
|
+
const l = [];
|
|
1804
|
+
for (let i = 0; i < s.height; i++)
|
|
1805
|
+
l.push(0);
|
|
1806
|
+
for (let i = 0; i < s.problems.length; i++) {
|
|
1807
|
+
const c = s.problems[i];
|
|
1720
1808
|
if (c.type == "collision") {
|
|
1721
1809
|
const d = e.nodeAt(c.pos);
|
|
1722
1810
|
for (let f = 0; f < d.attrs.rowspan; f++)
|
|
1723
|
-
|
|
1724
|
-
n.setNodeMarkup(
|
|
1811
|
+
l[c.row + f] += c.n;
|
|
1812
|
+
n.setNodeMarkup(
|
|
1813
|
+
n.mapping.map(t + 1 + c.pos),
|
|
1814
|
+
null,
|
|
1815
|
+
F(d.attrs, d.attrs.colspan - c.n, c.n)
|
|
1816
|
+
);
|
|
1725
1817
|
} else if (c.type == "missing")
|
|
1726
|
-
|
|
1818
|
+
l[c.row] += c.n;
|
|
1727
1819
|
else if (c.type == "overlong_rowspan") {
|
|
1728
1820
|
const d = e.nodeAt(c.pos);
|
|
1729
|
-
n.setNodeMarkup(
|
|
1821
|
+
n.setNodeMarkup(
|
|
1822
|
+
n.mapping.map(t + 1 + c.pos),
|
|
1823
|
+
null,
|
|
1824
|
+
y(d.attrs, "rowspan", d.attrs.rowspan - c.n)
|
|
1825
|
+
);
|
|
1730
1826
|
} else if (c.type == "colwidth mismatch") {
|
|
1731
1827
|
const d = e.nodeAt(c.pos);
|
|
1732
|
-
n.setNodeMarkup(
|
|
1828
|
+
n.setNodeMarkup(
|
|
1829
|
+
n.mapping.map(t + 1 + c.pos),
|
|
1830
|
+
null,
|
|
1831
|
+
y(d.attrs, "colwidth", c.colwidth)
|
|
1832
|
+
);
|
|
1733
1833
|
}
|
|
1734
1834
|
}
|
|
1735
1835
|
let r, a;
|
|
1736
|
-
for (let i = 0; i <
|
|
1737
|
-
|
|
1738
|
-
for (let i = 0, c = t + 1; i <
|
|
1739
|
-
const d = e.child(i), f = c + d.nodeSize, u =
|
|
1836
|
+
for (let i = 0; i < l.length; i++)
|
|
1837
|
+
l[i] && (r == null && (r = i), a = i);
|
|
1838
|
+
for (let i = 0, c = t + 1; i < s.height; i++) {
|
|
1839
|
+
const d = e.child(i), f = c + d.nodeSize, u = l[i];
|
|
1740
1840
|
if (u > 0) {
|
|
1741
1841
|
let p = "cell";
|
|
1742
1842
|
d.firstChild && (p = d.firstChild.type.spec.tableRole);
|
|
@@ -1748,34 +1848,37 @@ function $n(o, e, t, n) {
|
|
|
1748
1848
|
}
|
|
1749
1849
|
c = f;
|
|
1750
1850
|
}
|
|
1751
|
-
return n.setMeta(
|
|
1851
|
+
return n.setMeta(Dn, { fixTables: !0 });
|
|
1752
1852
|
}
|
|
1753
|
-
const
|
|
1754
|
-
function
|
|
1853
|
+
const D = new B("selectingCells");
|
|
1854
|
+
function je(o, e) {
|
|
1755
1855
|
for (; e && e != o.dom; e = e.parentNode)
|
|
1756
1856
|
if (e.nodeName == "TD" || e.nodeName == "TH")
|
|
1757
1857
|
return e;
|
|
1758
1858
|
}
|
|
1759
|
-
function
|
|
1760
|
-
const t = o.posAtCoords({
|
|
1761
|
-
|
|
1859
|
+
function fe(o, e) {
|
|
1860
|
+
const t = o.posAtCoords({
|
|
1861
|
+
left: e.clientX,
|
|
1862
|
+
top: e.clientY
|
|
1863
|
+
});
|
|
1864
|
+
return t && t ? V(o.state.doc.resolve(t.pos)) : null;
|
|
1762
1865
|
}
|
|
1763
|
-
function
|
|
1866
|
+
function zn(o, e) {
|
|
1764
1867
|
const t = e;
|
|
1765
1868
|
if (t.ctrlKey || t.metaKey)
|
|
1766
1869
|
return;
|
|
1767
|
-
const n =
|
|
1768
|
-
let
|
|
1870
|
+
const n = je(o, t.target);
|
|
1871
|
+
let s;
|
|
1769
1872
|
if (t.shiftKey && o.state.selection instanceof m)
|
|
1770
|
-
|
|
1771
|
-
else if (t.shiftKey && n && (
|
|
1772
|
-
s
|
|
1873
|
+
l(o.state.selection.$anchorCell, t), t.preventDefault();
|
|
1874
|
+
else if (t.shiftKey && n && (s = V(o.state.selection.$anchor)) != null && fe(o, t).pos != s.pos)
|
|
1875
|
+
l(s, t), t.preventDefault();
|
|
1773
1876
|
else if (!n)
|
|
1774
1877
|
return;
|
|
1775
|
-
function
|
|
1776
|
-
let d =
|
|
1777
|
-
const f =
|
|
1778
|
-
if (!d || !
|
|
1878
|
+
function l(i, c) {
|
|
1879
|
+
let d = fe(o, c);
|
|
1880
|
+
const f = D.getState(o.state) == null;
|
|
1881
|
+
if (!d || !xe(i, d))
|
|
1779
1882
|
if (f)
|
|
1780
1883
|
d = i;
|
|
1781
1884
|
else
|
|
@@ -1783,201 +1886,234 @@ function Dn(o, e) {
|
|
|
1783
1886
|
const u = new m(i, d);
|
|
1784
1887
|
if (f || !o.state.selection.eq(u)) {
|
|
1785
1888
|
const p = o.state.tr.setSelection(u);
|
|
1786
|
-
f && p.setMeta(
|
|
1889
|
+
f && p.setMeta(D, i.pos), o.dispatch(p);
|
|
1787
1890
|
}
|
|
1788
1891
|
}
|
|
1789
1892
|
function r() {
|
|
1790
|
-
o.root.removeEventListener("mouseup", r), o.root.removeEventListener("dragstart", r), o.root.removeEventListener("mousemove", a),
|
|
1893
|
+
o.root.removeEventListener("mouseup", r), o.root.removeEventListener("dragstart", r), o.root.removeEventListener("mousemove", a), D.getState(o.state) != null && o.dispatch(o.state.tr.setMeta(D, -1));
|
|
1791
1894
|
}
|
|
1792
1895
|
function a(i) {
|
|
1793
|
-
const c =
|
|
1896
|
+
const c = D.getState(o.state);
|
|
1794
1897
|
let d;
|
|
1795
1898
|
if (c != null)
|
|
1796
1899
|
d = o.state.doc.resolve(c);
|
|
1797
|
-
else if (
|
|
1900
|
+
else if (je(o, i.target) != n && (d = fe(o, t), !d))
|
|
1798
1901
|
return r();
|
|
1799
|
-
d &&
|
|
1902
|
+
d && l(d, i);
|
|
1800
1903
|
}
|
|
1801
1904
|
o.root.addEventListener("mouseup", r), o.root.addEventListener("dragstart", r), o.root.addEventListener("mousemove", a);
|
|
1802
1905
|
}
|
|
1803
|
-
function
|
|
1804
|
-
const t = o.state.doc, n =
|
|
1906
|
+
function Fn(o, e) {
|
|
1907
|
+
const t = o.state.doc, n = V(t.resolve(e));
|
|
1805
1908
|
return n ? (o.dispatch(o.state.tr.setSelection(new m(n))), !0) : !1;
|
|
1806
1909
|
}
|
|
1807
|
-
function
|
|
1910
|
+
function te(o, e, t) {
|
|
1808
1911
|
return t.eq(o.selection) ? !1 : (e && e(o.tr.setSelection(t).scrollIntoView()), !0);
|
|
1809
1912
|
}
|
|
1810
|
-
function
|
|
1913
|
+
function st(o, e, t) {
|
|
1811
1914
|
if (!(o.state.selection instanceof E))
|
|
1812
1915
|
return null;
|
|
1813
1916
|
const { $head: n } = o.state.selection;
|
|
1814
|
-
for (let
|
|
1815
|
-
const
|
|
1816
|
-
if ((t < 0 ? n.index(
|
|
1917
|
+
for (let s = n.depth - 1; s >= 0; s--) {
|
|
1918
|
+
const l = n.node(s);
|
|
1919
|
+
if ((t < 0 ? n.index(s) : n.indexAfter(s)) != (t < 0 ? 0 : l.childCount))
|
|
1817
1920
|
return null;
|
|
1818
|
-
if (
|
|
1819
|
-
const a = n.before(
|
|
1921
|
+
if (l.type.spec.tableRole == "cell" || l.type.spec.tableRole == "header_cell") {
|
|
1922
|
+
const a = n.before(s), i = e == "vert" ? t > 0 ? "down" : "up" : t > 0 ? "right" : "left";
|
|
1820
1923
|
return o.endOfTextblock(i) ? a : null;
|
|
1821
1924
|
}
|
|
1822
1925
|
}
|
|
1823
1926
|
return null;
|
|
1824
1927
|
}
|
|
1825
|
-
function
|
|
1826
|
-
return (t, n,
|
|
1827
|
-
const
|
|
1828
|
-
if (
|
|
1829
|
-
return
|
|
1830
|
-
|
|
1928
|
+
function Z(o, e) {
|
|
1929
|
+
return (t, n, s) => {
|
|
1930
|
+
const l = t.selection;
|
|
1931
|
+
if (l instanceof m)
|
|
1932
|
+
return te(
|
|
1933
|
+
t,
|
|
1934
|
+
n,
|
|
1935
|
+
S.near(l.$headCell, e)
|
|
1936
|
+
);
|
|
1937
|
+
if (o != "horiz" && !l.empty)
|
|
1831
1938
|
return !1;
|
|
1832
|
-
const r =
|
|
1939
|
+
const r = st(s, o, e);
|
|
1833
1940
|
if (r == null)
|
|
1834
1941
|
return !1;
|
|
1835
1942
|
if (o == "horiz")
|
|
1836
|
-
return
|
|
1943
|
+
return te(
|
|
1944
|
+
t,
|
|
1945
|
+
n,
|
|
1946
|
+
S.near(t.doc.resolve(l.head + e), e)
|
|
1947
|
+
);
|
|
1837
1948
|
{
|
|
1838
|
-
const a = t.doc.resolve(r), i =
|
|
1949
|
+
const a = t.doc.resolve(r), i = et(a, o, e);
|
|
1839
1950
|
let c;
|
|
1840
|
-
return i ? c =
|
|
1951
|
+
return i ? c = S.near(i, 1) : e < 0 ? c = S.near(t.doc.resolve(a.before(-1)), -1) : c = S.near(t.doc.resolve(a.after(-1)), 1), te(t, n, c);
|
|
1841
1952
|
}
|
|
1842
1953
|
};
|
|
1843
1954
|
}
|
|
1844
|
-
function
|
|
1845
|
-
return (t, n,
|
|
1846
|
-
let
|
|
1847
|
-
if (!(
|
|
1848
|
-
const a =
|
|
1955
|
+
function Q(o, e) {
|
|
1956
|
+
return (t, n, s) => {
|
|
1957
|
+
let l = t.selection;
|
|
1958
|
+
if (!(l instanceof m)) {
|
|
1959
|
+
const a = st(s, o, e);
|
|
1849
1960
|
if (a == null)
|
|
1850
1961
|
return !1;
|
|
1851
|
-
|
|
1962
|
+
l = new m(t.doc.resolve(a));
|
|
1852
1963
|
}
|
|
1853
|
-
const r =
|
|
1854
|
-
return r ?
|
|
1964
|
+
const r = et(l.$headCell, o, e);
|
|
1965
|
+
return r ? te(
|
|
1966
|
+
t,
|
|
1967
|
+
n,
|
|
1968
|
+
new m(l.$anchorCell, r)
|
|
1969
|
+
) : !1;
|
|
1855
1970
|
};
|
|
1856
1971
|
}
|
|
1857
|
-
function
|
|
1972
|
+
function ee(o, e) {
|
|
1858
1973
|
const t = o.selection;
|
|
1859
1974
|
if (!(t instanceof m))
|
|
1860
1975
|
return !1;
|
|
1861
1976
|
if (e) {
|
|
1862
|
-
const n = o.tr,
|
|
1863
|
-
t.forEachCell((
|
|
1864
|
-
|
|
1977
|
+
const n = o.tr, s = A(o.schema).cell.createAndFill().content;
|
|
1978
|
+
t.forEachCell((l, r) => {
|
|
1979
|
+
l.content.eq(s) || n.replace(
|
|
1980
|
+
n.mapping.map(r + 1),
|
|
1981
|
+
n.mapping.map(r + l.nodeSize - 1),
|
|
1982
|
+
new _(s, 0, 0)
|
|
1983
|
+
);
|
|
1865
1984
|
}), n.docChanged && e(n);
|
|
1866
1985
|
}
|
|
1867
1986
|
return !0;
|
|
1868
1987
|
}
|
|
1869
|
-
const
|
|
1870
|
-
ArrowLeft:
|
|
1871
|
-
ArrowRight:
|
|
1872
|
-
ArrowUp:
|
|
1873
|
-
ArrowDown:
|
|
1874
|
-
"Shift-ArrowLeft":
|
|
1875
|
-
"Shift-ArrowRight":
|
|
1876
|
-
"Shift-ArrowUp":
|
|
1877
|
-
"Shift-ArrowDown":
|
|
1878
|
-
Backspace:
|
|
1879
|
-
"Mod-Backspace":
|
|
1880
|
-
Delete:
|
|
1881
|
-
"Mod-Delete":
|
|
1988
|
+
const Bn = St({
|
|
1989
|
+
ArrowLeft: Z("horiz", -1),
|
|
1990
|
+
ArrowRight: Z("horiz", 1),
|
|
1991
|
+
ArrowUp: Z("vert", -1),
|
|
1992
|
+
ArrowDown: Z("vert", 1),
|
|
1993
|
+
"Shift-ArrowLeft": Q("horiz", -1),
|
|
1994
|
+
"Shift-ArrowRight": Q("horiz", 1),
|
|
1995
|
+
"Shift-ArrowUp": Q("vert", -1),
|
|
1996
|
+
"Shift-ArrowDown": Q("vert", 1),
|
|
1997
|
+
Backspace: ee,
|
|
1998
|
+
"Mod-Backspace": ee,
|
|
1999
|
+
Delete: ee,
|
|
2000
|
+
"Mod-Delete": ee
|
|
1882
2001
|
});
|
|
1883
|
-
function
|
|
2002
|
+
function Wn(o, e, t) {
|
|
1884
2003
|
if (!M(o.state))
|
|
1885
2004
|
return !1;
|
|
1886
|
-
let n =
|
|
1887
|
-
const
|
|
1888
|
-
if (
|
|
2005
|
+
let n = vn(t);
|
|
2006
|
+
const s = o.state.selection;
|
|
2007
|
+
if (s instanceof m) {
|
|
1889
2008
|
n || (n = {
|
|
1890
2009
|
width: 1,
|
|
1891
2010
|
height: 1,
|
|
1892
|
-
rows: [
|
|
2011
|
+
rows: [
|
|
2012
|
+
$.from(
|
|
2013
|
+
me(A(o.state.schema).cell, t)
|
|
2014
|
+
)
|
|
2015
|
+
]
|
|
1893
2016
|
});
|
|
1894
|
-
const
|
|
1895
|
-
|
|
2017
|
+
const l = s.$anchorCell.node(-1), r = s.$anchorCell.start(-1), a = g.get(l).rectBetween(
|
|
2018
|
+
s.$anchorCell.pos - r,
|
|
2019
|
+
s.$headCell.pos - r
|
|
2020
|
+
);
|
|
2021
|
+
return n = $n(n, a.right - a.left, a.bottom - a.top), He(o.state, o.dispatch, r, a, n), !0;
|
|
1896
2022
|
} else if (n) {
|
|
1897
|
-
const
|
|
1898
|
-
return
|
|
2023
|
+
const l = se(o.state), r = l.start(-1);
|
|
2024
|
+
return He(
|
|
2025
|
+
o.state,
|
|
2026
|
+
o.dispatch,
|
|
2027
|
+
r,
|
|
2028
|
+
g.get(l.node(-1)).findCell(l.pos - r),
|
|
2029
|
+
n
|
|
2030
|
+
), !0;
|
|
1899
2031
|
} else
|
|
1900
2032
|
return !1;
|
|
1901
2033
|
}
|
|
1902
|
-
function
|
|
1903
|
-
return new
|
|
1904
|
-
key:
|
|
2034
|
+
function Pn({ allowTableNodeSelection: o = !1 } = {}) {
|
|
2035
|
+
return new H({
|
|
2036
|
+
key: D,
|
|
1905
2037
|
state: {
|
|
1906
2038
|
init() {
|
|
1907
2039
|
return null;
|
|
1908
2040
|
},
|
|
1909
2041
|
apply(e, t) {
|
|
1910
|
-
const n = e.getMeta(
|
|
2042
|
+
const n = e.getMeta(D);
|
|
1911
2043
|
if (n != null)
|
|
1912
2044
|
return n == -1 ? null : n;
|
|
1913
2045
|
if (t == null || !e.docChanged)
|
|
1914
2046
|
return t;
|
|
1915
|
-
const { deleted:
|
|
1916
|
-
return
|
|
2047
|
+
const { deleted: s, pos: l } = e.mapping.mapResult(t);
|
|
2048
|
+
return s ? null : l;
|
|
1917
2049
|
}
|
|
1918
2050
|
},
|
|
1919
2051
|
props: {
|
|
1920
|
-
decorations:
|
|
2052
|
+
decorations: Bt,
|
|
1921
2053
|
handleDOMEvents: {
|
|
1922
|
-
mousedown:
|
|
2054
|
+
mousedown: zn
|
|
1923
2055
|
},
|
|
1924
2056
|
createSelectionBetween(e) {
|
|
1925
|
-
return
|
|
2057
|
+
return D.getState(e.state) != null ? e.state.selection : null;
|
|
1926
2058
|
},
|
|
1927
|
-
handleTripleClick:
|
|
1928
|
-
handleKeyDown:
|
|
1929
|
-
handlePaste:
|
|
2059
|
+
handleTripleClick: Fn,
|
|
2060
|
+
handleKeyDown: Bn,
|
|
2061
|
+
handlePaste: Wn
|
|
1930
2062
|
},
|
|
1931
2063
|
appendTransaction(e, t, n) {
|
|
1932
|
-
return
|
|
2064
|
+
return Ht(
|
|
2065
|
+
n,
|
|
2066
|
+
On(n, t),
|
|
2067
|
+
o
|
|
2068
|
+
);
|
|
1933
2069
|
}
|
|
1934
2070
|
});
|
|
1935
2071
|
}
|
|
1936
|
-
const
|
|
2072
|
+
const ne = {
|
|
1937
2073
|
NextCell: "NextCell",
|
|
1938
2074
|
PrevCell: "PrevCell",
|
|
1939
2075
|
ExitTable: "ExitTable"
|
|
1940
|
-
},
|
|
2076
|
+
}, Ke = R("PrevCell"), qe = R("NextCell"), Xe = R("BreakTable"), Hn = R("InsertTable"), jn = dt((o) => ({
|
|
1941
2077
|
schema: () => ({
|
|
1942
2078
|
node: {
|
|
1943
2079
|
table: {
|
|
1944
|
-
...
|
|
2080
|
+
...Y.table,
|
|
1945
2081
|
parseMarkdown: {
|
|
1946
2082
|
match: (e) => e.type === "table",
|
|
1947
2083
|
runner: (e, t, n) => {
|
|
1948
|
-
const
|
|
2084
|
+
const s = t.align, l = t.children.map((r, a) => ({
|
|
1949
2085
|
...r,
|
|
1950
|
-
align:
|
|
2086
|
+
align: s,
|
|
1951
2087
|
isHeader: a === 0
|
|
1952
2088
|
}));
|
|
1953
|
-
e.openNode(n), e.next(
|
|
2089
|
+
e.openNode(n), e.next(l), e.closeNode();
|
|
1954
2090
|
}
|
|
1955
2091
|
},
|
|
1956
2092
|
toMarkdown: {
|
|
1957
2093
|
match: (e) => e.type.name === "table",
|
|
1958
2094
|
runner: (e, t) => {
|
|
1959
|
-
var
|
|
1960
|
-
const n = (
|
|
2095
|
+
var l;
|
|
2096
|
+
const n = (l = t.content.firstChild) == null ? void 0 : l.content;
|
|
1961
2097
|
if (!n)
|
|
1962
2098
|
return;
|
|
1963
|
-
const
|
|
2099
|
+
const s = [];
|
|
1964
2100
|
n.forEach((r) => {
|
|
1965
|
-
|
|
1966
|
-
}), e.openNode("table", void 0, { align:
|
|
2101
|
+
s.push(r.attrs.alignment);
|
|
2102
|
+
}), e.openNode("table", void 0, { align: s }), e.next(t.content), e.closeNode();
|
|
1967
2103
|
}
|
|
1968
2104
|
}
|
|
1969
2105
|
},
|
|
1970
2106
|
table_row: {
|
|
1971
|
-
...
|
|
2107
|
+
...Y.table_row,
|
|
1972
2108
|
parseMarkdown: {
|
|
1973
2109
|
match: (e) => e.type === "tableRow",
|
|
1974
2110
|
runner: (e, t, n) => {
|
|
1975
|
-
const
|
|
2111
|
+
const s = t.align, l = t.children.map((r, a) => ({
|
|
1976
2112
|
...r,
|
|
1977
|
-
align:
|
|
2113
|
+
align: s[a],
|
|
1978
2114
|
isHeader: t.isHeader
|
|
1979
2115
|
}));
|
|
1980
|
-
e.openNode(n), e.next(
|
|
2116
|
+
e.openNode(n), e.next(l), e.closeNode();
|
|
1981
2117
|
}
|
|
1982
2118
|
},
|
|
1983
2119
|
toMarkdown: {
|
|
@@ -1988,12 +2124,12 @@ const ee = {
|
|
|
1988
2124
|
}
|
|
1989
2125
|
},
|
|
1990
2126
|
table_cell: {
|
|
1991
|
-
...
|
|
2127
|
+
...Y.table_cell,
|
|
1992
2128
|
parseMarkdown: {
|
|
1993
2129
|
match: (e) => e.type === "tableCell" && !e.isHeader,
|
|
1994
2130
|
runner: (e, t, n) => {
|
|
1995
|
-
const
|
|
1996
|
-
e.openNode(n, { alignment:
|
|
2131
|
+
const s = t.align;
|
|
2132
|
+
e.openNode(n, { alignment: s }).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode();
|
|
1997
2133
|
}
|
|
1998
2134
|
},
|
|
1999
2135
|
toMarkdown: {
|
|
@@ -2004,12 +2140,12 @@ const ee = {
|
|
|
2004
2140
|
}
|
|
2005
2141
|
},
|
|
2006
2142
|
table_header: {
|
|
2007
|
-
...
|
|
2143
|
+
...Y.table_header,
|
|
2008
2144
|
parseMarkdown: {
|
|
2009
2145
|
match: (e) => e.type === "tableCell" && !!e.isHeader,
|
|
2010
2146
|
runner: (e, t, n) => {
|
|
2011
|
-
const
|
|
2012
|
-
e.openNode(n, { alignment:
|
|
2147
|
+
const s = t.align;
|
|
2148
|
+
e.openNode(n, { alignment: s }), e.openNode(e.schema.nodes.paragraph), e.next(t.children), e.closeNode(), e.closeNode();
|
|
2013
2149
|
}
|
|
2014
2150
|
},
|
|
2015
2151
|
toMarkdown: {
|
|
@@ -2022,44 +2158,48 @@ const ee = {
|
|
|
2022
2158
|
}
|
|
2023
2159
|
}),
|
|
2024
2160
|
inputRules: (e, t) => [
|
|
2025
|
-
new
|
|
2026
|
-
const a = n.doc.resolve(
|
|
2161
|
+
new ue(/^\|\|\s$/, (n, s, l, r) => {
|
|
2162
|
+
const a = n.doc.resolve(l);
|
|
2027
2163
|
if (!a.node(-1).canReplaceWith(a.index(-1), a.indexAfter(-1), e.table))
|
|
2028
2164
|
return null;
|
|
2029
|
-
const i =
|
|
2030
|
-
return c.setSelection(E.create(c.doc,
|
|
2165
|
+
const i = ae(t.get(J)), c = n.tr.replaceRangeWith(l, r, i).scrollIntoView();
|
|
2166
|
+
return c.setSelection(E.create(c.doc, l + 3));
|
|
2031
2167
|
}),
|
|
2032
|
-
new
|
|
2168
|
+
new ue(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/, (n, s, l, r) => {
|
|
2033
2169
|
var d, f;
|
|
2034
|
-
const a = n.doc.resolve(
|
|
2170
|
+
const a = n.doc.resolve(l);
|
|
2035
2171
|
if (!a.node(-1).canReplaceWith(a.index(-1), a.indexAfter(-1), e.table))
|
|
2036
2172
|
return null;
|
|
2037
|
-
const i =
|
|
2038
|
-
|
|
2173
|
+
const i = ae(
|
|
2174
|
+
t.get(J),
|
|
2175
|
+
Number((d = s.groups) == null ? void 0 : d.row),
|
|
2176
|
+
Number((f = s.groups) == null ? void 0 : f.col)
|
|
2177
|
+
), c = n.tr.replaceRangeWith(l, r, i).scrollIntoView();
|
|
2178
|
+
return c.setSelection(E.create(c.doc, l + 3));
|
|
2039
2179
|
})
|
|
2040
2180
|
],
|
|
2041
2181
|
commands: (e, t) => [
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
const { selection:
|
|
2047
|
-
return d && (
|
|
2182
|
+
N(Ke, () => Oe(-1)),
|
|
2183
|
+
N(qe, () => Oe(1)),
|
|
2184
|
+
N(Xe, () => Vt(t.get(J).nodes.paragraph)),
|
|
2185
|
+
N(Hn, () => (n, s) => {
|
|
2186
|
+
const { selection: l, tr: r } = n, { from: a } = l, i = ae(t.get(J)), c = r.replaceSelectionWith(i), d = S.findFrom(c.doc.resolve(a), 1, !0);
|
|
2187
|
+
return d && (s == null || s(c.setSelection(d))), !0;
|
|
2048
2188
|
})
|
|
2049
2189
|
],
|
|
2050
2190
|
shortcuts: {
|
|
2051
|
-
[
|
|
2052
|
-
[
|
|
2053
|
-
[
|
|
2191
|
+
[ne.NextCell]: O(qe, "Mod-]"),
|
|
2192
|
+
[ne.PrevCell]: O(Ke, "Mod-["),
|
|
2193
|
+
[ne.ExitTable]: O(Xe, "Mod-Enter")
|
|
2054
2194
|
},
|
|
2055
|
-
prosePlugins: (e, t) => [
|
|
2056
|
-
})),
|
|
2057
|
-
...
|
|
2058
|
-
...
|
|
2195
|
+
prosePlugins: (e, t) => [hn(t, o), bn(), yn(), Pn()]
|
|
2196
|
+
})), q = {
|
|
2197
|
+
...it,
|
|
2198
|
+
...ne,
|
|
2059
2199
|
StrikeThrough: "StrikeThrough",
|
|
2060
2200
|
TaskList: "TaskList"
|
|
2061
|
-
},
|
|
2062
|
-
id:
|
|
2201
|
+
}, ge = R("ToggleStrikeThrough"), Ue = "strike_through", Kn = ft((o) => ({
|
|
2202
|
+
id: Ue,
|
|
2063
2203
|
schema: () => ({
|
|
2064
2204
|
inclusive: !1,
|
|
2065
2205
|
parseDOM: [
|
|
@@ -2074,17 +2214,17 @@ const ee = {
|
|
|
2074
2214
|
}
|
|
2075
2215
|
},
|
|
2076
2216
|
toMarkdown: {
|
|
2077
|
-
match: (e) => e.type.name ===
|
|
2217
|
+
match: (e) => e.type.name === Ue,
|
|
2078
2218
|
runner: (e, t) => {
|
|
2079
2219
|
e.withMark(t, "delete");
|
|
2080
2220
|
}
|
|
2081
2221
|
}
|
|
2082
2222
|
}),
|
|
2083
|
-
commands: (e) => [
|
|
2223
|
+
commands: (e) => [N(ge, () => At(e))],
|
|
2084
2224
|
shortcuts: {
|
|
2085
|
-
[
|
|
2225
|
+
[q.StrikeThrough]: O(ge, "Mod-Alt-x")
|
|
2086
2226
|
}
|
|
2087
|
-
})),
|
|
2227
|
+
})), we = R("SplitTaskListItem"), be = R("SinkTaskListItem"), Ce = R("LiftTaskListItem"), ye = R("TurnIntoTaskList"), qn = ke((o) => {
|
|
2088
2228
|
const e = "task_list_item";
|
|
2089
2229
|
return {
|
|
2090
2230
|
id: e,
|
|
@@ -2103,29 +2243,31 @@ const ee = {
|
|
|
2103
2243
|
tag: 'li[data-type="task-item"]',
|
|
2104
2244
|
getAttrs: (n) => {
|
|
2105
2245
|
if (!(n instanceof HTMLElement))
|
|
2106
|
-
throw
|
|
2246
|
+
throw Ae(n);
|
|
2107
2247
|
return { checked: n.dataset.checked === "true" };
|
|
2108
2248
|
}
|
|
2109
2249
|
}
|
|
2110
2250
|
],
|
|
2111
2251
|
toDOM: (n) => {
|
|
2112
|
-
const
|
|
2113
|
-
return
|
|
2114
|
-
const r =
|
|
2252
|
+
const s = document.createElement("input");
|
|
2253
|
+
return s.type = "checkbox", s.checked = n.attrs.checked, s.className = o.getClassName(n.attrs, "task-list-item_checkbox"), s.onchange = (l) => {
|
|
2254
|
+
const r = l.target;
|
|
2115
2255
|
if (!(r instanceof HTMLInputElement))
|
|
2116
2256
|
return;
|
|
2117
|
-
const a = t.get(
|
|
2257
|
+
const a = t.get(U);
|
|
2118
2258
|
if (!a.editable) {
|
|
2119
|
-
|
|
2259
|
+
s.checked = !s.checked;
|
|
2120
2260
|
return;
|
|
2121
2261
|
}
|
|
2122
2262
|
const { top: i, left: c } = r.getBoundingClientRect(), d = a.posAtCoords({ top: i, left: c });
|
|
2123
2263
|
if (!d)
|
|
2124
2264
|
return;
|
|
2125
2265
|
const { tr: f } = a.state;
|
|
2126
|
-
a.dispatch(
|
|
2127
|
-
|
|
2128
|
-
|
|
2266
|
+
a.dispatch(
|
|
2267
|
+
f.setNodeMarkup(d.inside, void 0, {
|
|
2268
|
+
checked: r.checked
|
|
2269
|
+
})
|
|
2270
|
+
);
|
|
2129
2271
|
}, [
|
|
2130
2272
|
"li",
|
|
2131
2273
|
{
|
|
@@ -2133,134 +2275,136 @@ const ee = {
|
|
|
2133
2275
|
"data-checked": n.attrs.checked ? "true" : "false",
|
|
2134
2276
|
class: o.getClassName(n.attrs, "task-list-item")
|
|
2135
2277
|
},
|
|
2136
|
-
|
|
2278
|
+
s,
|
|
2137
2279
|
["span", { class: o.getClassName(n.attrs, "task-list-item_body") }, 0]
|
|
2138
2280
|
];
|
|
2139
2281
|
},
|
|
2140
2282
|
parseMarkdown: {
|
|
2141
|
-
match: ({ type: n, checked:
|
|
2142
|
-
runner: (n,
|
|
2143
|
-
n.openNode(
|
|
2283
|
+
match: ({ type: n, checked: s }) => n === "listItem" && s !== null,
|
|
2284
|
+
runner: (n, s, l) => {
|
|
2285
|
+
n.openNode(l, { checked: s.checked }), n.next(s.children), n.closeNode();
|
|
2144
2286
|
}
|
|
2145
2287
|
},
|
|
2146
2288
|
toMarkdown: {
|
|
2147
2289
|
match: (n) => n.type.name === e,
|
|
2148
|
-
runner: (n,
|
|
2149
|
-
n.openNode("listItem", void 0, { checked:
|
|
2290
|
+
runner: (n, s) => {
|
|
2291
|
+
n.openNode("listItem", void 0, { checked: s.attrs.checked }), n.next(s.content), n.closeNode();
|
|
2150
2292
|
}
|
|
2151
2293
|
}
|
|
2152
2294
|
}),
|
|
2153
2295
|
inputRules: (t) => [
|
|
2154
|
-
|
|
2296
|
+
Je(/^\s*(\[([ |x])\])\s$/, t, (n) => ({
|
|
2155
2297
|
checked: n[n.length - 1] === "x"
|
|
2156
2298
|
}))
|
|
2157
2299
|
],
|
|
2158
2300
|
commands: (t) => [
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2301
|
+
N(we, () => xt(t)),
|
|
2302
|
+
N(be, () => Rt(t)),
|
|
2303
|
+
N(Ce, () => Tt(t)),
|
|
2304
|
+
N(ye, () => Mt(t))
|
|
2163
2305
|
],
|
|
2164
2306
|
shortcuts: {
|
|
2165
|
-
[
|
|
2166
|
-
[
|
|
2167
|
-
[
|
|
2168
|
-
[
|
|
2307
|
+
[q.NextListItem]: O(we, "Enter"),
|
|
2308
|
+
[q.SinkListItem]: O(be, "Mod-]"),
|
|
2309
|
+
[q.LiftListItem]: O(Ce, "Mod-["),
|
|
2310
|
+
[q.TaskList]: O(ye, "Mod-Alt-9")
|
|
2169
2311
|
},
|
|
2170
|
-
view: () => (t, n,
|
|
2171
|
-
let
|
|
2312
|
+
view: () => (t, n, s) => {
|
|
2313
|
+
let l = t;
|
|
2172
2314
|
const r = o.themeManager.get("task-list-item", {
|
|
2173
2315
|
editable: () => n.editable,
|
|
2174
2316
|
onChange: (d) => {
|
|
2175
2317
|
const { tr: f } = n.state;
|
|
2176
|
-
n.dispatch(
|
|
2177
|
-
|
|
2178
|
-
|
|
2318
|
+
n.dispatch(
|
|
2319
|
+
f.setNodeMarkup(s(), void 0, {
|
|
2320
|
+
checked: d
|
|
2321
|
+
})
|
|
2322
|
+
);
|
|
2179
2323
|
}
|
|
2180
2324
|
});
|
|
2181
2325
|
if (!r)
|
|
2182
2326
|
return {};
|
|
2183
2327
|
const { dom: a, contentDOM: i, onUpdate: c } = r;
|
|
2184
|
-
return c(
|
|
2328
|
+
return c(l), {
|
|
2185
2329
|
dom: a,
|
|
2186
2330
|
contentDOM: i,
|
|
2187
|
-
update: (d) => d.type.name !== e ? !1 : (
|
|
2331
|
+
update: (d) => d.type.name !== e ? !1 : (l = d, c(l), !0)
|
|
2188
2332
|
};
|
|
2189
2333
|
}
|
|
2190
2334
|
};
|
|
2191
|
-
}),
|
|
2192
|
-
...
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
]),
|
|
2200
|
-
...
|
|
2201
|
-
ToggleStrikeThrough:
|
|
2202
|
-
TurnIntoTaskList:
|
|
2203
|
-
SinkTaskListItem:
|
|
2204
|
-
LiftTaskListItem:
|
|
2205
|
-
SplitTaskListItem:
|
|
2335
|
+
}), io = ut.create([
|
|
2336
|
+
...ct,
|
|
2337
|
+
pt(() => ht),
|
|
2338
|
+
jn(),
|
|
2339
|
+
Kn(),
|
|
2340
|
+
qn(),
|
|
2341
|
+
$t(),
|
|
2342
|
+
vt()
|
|
2343
|
+
]), co = {
|
|
2344
|
+
...at,
|
|
2345
|
+
ToggleStrikeThrough: ge,
|
|
2346
|
+
TurnIntoTaskList: ye,
|
|
2347
|
+
SinkTaskListItem: be,
|
|
2348
|
+
LiftTaskListItem: Ce,
|
|
2349
|
+
SplitTaskListItem: we
|
|
2206
2350
|
};
|
|
2207
2351
|
export {
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2352
|
+
Xe as BreakTable,
|
|
2353
|
+
uo as InsertHardbreak,
|
|
2354
|
+
po as InsertHr,
|
|
2355
|
+
ho as InsertImage,
|
|
2356
|
+
Hn as InsertTable,
|
|
2357
|
+
mo as LiftListItem,
|
|
2358
|
+
Ce as LiftTaskListItem,
|
|
2359
|
+
ve as ModifyFootnoteDef,
|
|
2360
|
+
Ee as ModifyFootnoteRef,
|
|
2361
|
+
go as ModifyImage,
|
|
2362
|
+
wo as ModifyLink,
|
|
2363
|
+
qe as NextCell,
|
|
2364
|
+
Ke as PrevCell,
|
|
2365
|
+
bo as SinkListItem,
|
|
2366
|
+
be as SinkTaskListItem,
|
|
2367
|
+
Co as SplitListItem,
|
|
2368
|
+
we as SplitTaskListItem,
|
|
2369
|
+
q as SupportedKeys,
|
|
2370
|
+
yo as ToggleBold,
|
|
2371
|
+
ko as ToggleInlineCode,
|
|
2372
|
+
Ao as ToggleItalic,
|
|
2373
|
+
Mo as ToggleLink,
|
|
2374
|
+
ge as ToggleStrikeThrough,
|
|
2375
|
+
So as TurnIntoCodeFence,
|
|
2376
|
+
No as TurnIntoHeading,
|
|
2377
|
+
ye as TurnIntoTaskList,
|
|
2378
|
+
xo as TurnIntoText,
|
|
2379
|
+
Ro as WrapInBlockquote,
|
|
2380
|
+
To as WrapInBulletList,
|
|
2381
|
+
Lo as WrapInOrderedList,
|
|
2382
|
+
vo as blockquote,
|
|
2383
|
+
Eo as bulletList,
|
|
2384
|
+
$o as codeFence,
|
|
2385
|
+
Io as codeInline,
|
|
2386
|
+
co as commands,
|
|
2387
|
+
Do as commonmark,
|
|
2388
|
+
Oo as commonmarkNodes,
|
|
2389
|
+
_o as commonmarkPlugins,
|
|
2390
|
+
ae as createTable,
|
|
2391
|
+
zo as doc,
|
|
2392
|
+
Fo as em,
|
|
2393
|
+
vt as footnoteDefinition,
|
|
2394
|
+
$t as footnoteReference,
|
|
2395
|
+
io as gfm,
|
|
2396
|
+
Bo as hardbreak,
|
|
2397
|
+
Wo as heading,
|
|
2398
|
+
Po as hr,
|
|
2399
|
+
Ho as image,
|
|
2400
|
+
jo as link,
|
|
2401
|
+
Ko as listItem,
|
|
2402
|
+
qo as orderedList,
|
|
2403
|
+
Xo as paragraph,
|
|
2404
|
+
Kn as strikeThrough,
|
|
2405
|
+
Uo as strong,
|
|
2406
|
+
jn as table,
|
|
2407
|
+
qn as taskListItem,
|
|
2408
|
+
Vo as text
|
|
2265
2409
|
};
|
|
2266
2410
|
//# sourceMappingURL=index.es.js.map
|