reactjs-tiptap-editor 1.0.22 → 1.0.24
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/{ActionMenuButton-BBDqKvKg.cjs → ActionMenuButton-B8NhVw5m.cjs} +1 -1
- package/lib/{ActionMenuButton-B1067mIC.js → ActionMenuButton-HYlhmRvw.js} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +4 -4
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.js +2 -2
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +2 -2
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +2 -2
- package/lib/{Callout-lBlBlK_w.cjs → Callout-B-S2f0Qo.cjs} +1 -1
- package/lib/{Callout-V2mO6s2Y.js → Callout-CF7Y9yJ7.js} +4 -4
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +4 -4
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +2 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +6 -6
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +27 -27
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +2 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +3 -3
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +7 -7
- package/lib/{Drawer-Cyv27orn.js → Drawer-CaXVhxo4.js} +21 -21
- package/lib/{Drawer-BeYo9jAG.cjs → Drawer-Was4hxYH.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +4312 -1860
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +3 -3
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +2 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +2 -2
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +5 -5
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +9 -9
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +5 -5
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +69 -46
- package/lib/History.cjs +1 -1
- package/lib/History.js +556 -418
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +2 -2
- package/lib/{Iframe-Bx-VDxSB.cjs → Iframe-BI0sq6pd.cjs} +1 -1
- package/lib/{Iframe-D9JVKzO0.js → Iframe-Bp986fj0.js} +3 -3
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +3 -3
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +3 -3
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +47 -47
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +3 -3
- package/lib/{Indent-B5tQ5Wfg.js → Indent-E6B8DkyN.js} +4 -4
- package/lib/{Indent-CCLO0KpG.cjs → Indent-FvM52kjA.cjs} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +2 -2
- package/lib/{Katex-rtfVV2pl.cjs → Katex-DP6EjdKz.cjs} +1 -1
- package/lib/{Katex-w_c6vAMd.js → Katex-pzwyyiFJ.js} +5 -5
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +3 -3
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +4 -4
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/LinkEditBlock-Cmkmp2fW.cjs +5 -0
- package/lib/{LinkEditBlock-CTlU8YnO.js → LinkEditBlock-OjN4F2rM.js} +222 -224
- package/lib/MarkdownPaste.cjs +1 -1
- package/lib/MarkdownPaste.js +1 -1
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +8 -8
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +34 -34
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +3 -3
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +2 -2
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +4 -4
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +7 -7
- package/lib/{SlashCommandNodeView-CVKjpS6r.cjs → SlashCommandNodeView-DarAytvt.cjs} +1 -1
- package/lib/{SlashCommandNodeView-DNkpJuM3.js → SlashCommandNodeView-o323V8li.js} +2 -2
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +2 -2
- package/lib/Table-CC9uNHPL.js +1984 -0
- package/lib/Table-Clnz-i4l.cjs +9 -0
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +2 -2
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +3 -3
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +3 -3
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +2 -2
- package/lib/{Twitter-BJjt8vv_.cjs → Twitter-0kmrijjL.cjs} +1 -1
- package/lib/{Twitter-CKm0M53B.js → Twitter-BVnXL8we.js} +5 -5
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +3 -3
- package/lib/bubble.cjs +6 -6
- package/lib/bubble.js +1573 -1561
- package/lib/{clsx-Bg-2aTKh.js → clsx-0OU6n9va.js} +379 -353
- package/lib/clsx-D6gYQn3o.cjs +33 -0
- package/lib/{dropdown-menu-Dre693DD.cjs → dropdown-menu-BIGvxqiu.cjs} +1 -1
- package/lib/{dropdown-menu-AhMKS9PQ.js → dropdown-menu-BW2M6saA.js} +1 -1
- package/lib/index-BAb_UADw.cjs +1 -0
- package/lib/index-BF3EVCB1.cjs +2 -0
- package/lib/{index-D0EmqTpe.js → index-BblvcbTH.js} +1130 -1064
- package/lib/index-Bcj8cyOO.cjs +24 -0
- package/lib/{index-BfHAqkoX.js → index-BrsJsbds.js} +3 -3
- package/lib/index-CGjT-a9h.js +1377 -0
- package/lib/index-CPTpXLfX.cjs +11 -0
- package/lib/{index-C3dgmjIF.cjs → index-CUvjYuRp.cjs} +1 -1
- package/lib/{index-C4aGVY2E.cjs → index-CWw4s87s.cjs} +1 -1
- package/lib/{index-DXtVL0al.js → index-Cal5SPfB.js} +189 -134
- package/lib/{index-CjLxMm5d.js → index-D-Ouz0vF.js} +1 -1
- package/lib/{index-83hp1lZH.cjs → index-deubsx3z.cjs} +1 -1
- package/lib/{index-DtVRewGA.js → index-oj858lQO.js} +229 -31
- package/lib/{index-CbkpBnTX.js → index-zw-Kd38i.js} +47 -50
- package/lib/index.cjs +1 -1
- package/lib/index.js +2 -2
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +7 -6
- package/lib/locales/index.d.ts +199 -1
- package/lib/locales/ja.d.ts +198 -0
- package/lib/{popover-B1ptDngu.js → popover-BIVHT1W9.js} +1 -1
- package/lib/{popover-D7w_FVSV.cjs → popover-DoSfJsFS.cjs} +1 -1
- package/lib/{renderNodeView-CbxCTni3.js → renderNodeView-CfWJK4rG.js} +2 -2
- package/lib/{renderNodeView-DFVrJy0l.cjs → renderNodeView-D--fDFov.cjs} +1 -1
- package/lib/{separator-C_7KkuoG.cjs → separator-SRbPfmGa.cjs} +1 -1
- package/lib/{separator-CDoF4Z4Z.js → separator-b-qOPJmp.js} +3 -3
- package/lib/{textarea-CNzZnjjW.js → textarea-CpxXPky_.js} +1 -1
- package/lib/{textarea-CEtXap1b.cjs → textarea-DbGw9oCU.cjs} +1 -1
- package/lib/updatePosition-BwzAsiY0.js +16 -0
- package/lib/{updatePosition-CQE1ct18.cjs → updatePosition-DGPtRfWN.cjs} +1 -1
- package/package.json +60 -60
- package/lib/LinkEditBlock-_41zgSyl.cjs +0 -5
- package/lib/Table-BFiU40iW.cjs +0 -9
- package/lib/Table-yZtD5Qo1.js +0 -1945
- package/lib/clsx-DSAWW32g.cjs +0 -33
- package/lib/index-C4WLt4NA.cjs +0 -24
- package/lib/index-DlxZt4_j.cjs +0 -1
- package/lib/index-P5_MyY0i.js +0 -1362
- package/lib/index-TcJ2UKnv.cjs +0 -1
- package/lib/index-fbGGohBT.cjs +0 -12
- package/lib/updatePosition-BGD41Hbg.js +0 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as g, w as b, m as L, r as $, E as
|
|
1
|
+
import { N as g, w as b, m as L, r as $, E as S, a as K, p as x, i as I, b as z, c as V, d as O, e as X } from "./index-BblvcbTH.js";
|
|
2
2
|
var F = Object.defineProperty, G = (t, e) => {
|
|
3
3
|
for (var s in e)
|
|
4
4
|
F(t, s, { get: e[s], enumerable: !0 });
|
|
@@ -56,7 +56,22 @@ var F = Object.defineProperty, G = (t, e) => {
|
|
|
56
56
|
editor: this.editor
|
|
57
57
|
})), [t];
|
|
58
58
|
}
|
|
59
|
-
})
|
|
59
|
+
});
|
|
60
|
+
function Y(t) {
|
|
61
|
+
var e, s;
|
|
62
|
+
const n = (e = t.tokens) == null ? void 0 : e[0];
|
|
63
|
+
return !!(t.text && ((s = t.tokens) == null ? void 0 : s.length) === 1 && (n == null ? void 0 : n.type) === "list" && n.ordered && n.raw === t.text);
|
|
64
|
+
}
|
|
65
|
+
function J(t, e) {
|
|
66
|
+
return e.tokenizeInline ? e.parseInline(e.tokenizeInline(t)) : e.parseInline([
|
|
67
|
+
{
|
|
68
|
+
type: "text",
|
|
69
|
+
raw: t,
|
|
70
|
+
text: t
|
|
71
|
+
}
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
var Q = g.create({
|
|
60
75
|
name: "listItem",
|
|
61
76
|
addOptions() {
|
|
62
77
|
return {
|
|
@@ -84,24 +99,35 @@ var F = Object.defineProperty, G = (t, e) => {
|
|
|
84
99
|
return [];
|
|
85
100
|
const n = (s = e.parseBlockChildren) != null ? s : e.parseChildren;
|
|
86
101
|
let r = [];
|
|
87
|
-
if (t.tokens && t.tokens.length > 0)
|
|
88
|
-
if (t
|
|
102
|
+
if (t.tokens && t.tokens.length > 0) {
|
|
103
|
+
if (Y(t))
|
|
104
|
+
return {
|
|
105
|
+
type: "listItem",
|
|
106
|
+
content: [
|
|
107
|
+
{
|
|
108
|
+
type: "paragraph",
|
|
109
|
+
content: J(t.text || "", e)
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
};
|
|
113
|
+
if (t.tokens.some((u) => u.type === "paragraph"))
|
|
89
114
|
r = n(t.tokens);
|
|
90
115
|
else {
|
|
91
|
-
const
|
|
92
|
-
if (
|
|
116
|
+
const u = t.tokens[0];
|
|
117
|
+
if (u && u.type === "text" && u.tokens && u.tokens.length > 0) {
|
|
93
118
|
if (r = [
|
|
94
119
|
{
|
|
95
120
|
type: "paragraph",
|
|
96
|
-
content: e.parseInline(
|
|
121
|
+
content: e.parseInline(u.tokens)
|
|
97
122
|
}
|
|
98
123
|
], t.tokens.length > 1) {
|
|
99
|
-
const
|
|
100
|
-
r.push(...
|
|
124
|
+
const p = t.tokens.slice(1), h = n(p);
|
|
125
|
+
r.push(...h);
|
|
101
126
|
}
|
|
102
127
|
} else
|
|
103
128
|
r = n(t.tokens);
|
|
104
129
|
}
|
|
130
|
+
}
|
|
105
131
|
return r.length === 0 && (r = [
|
|
106
132
|
{
|
|
107
133
|
type: "paragraph",
|
|
@@ -128,42 +154,42 @@ var F = Object.defineProperty, G = (t, e) => {
|
|
|
128
154
|
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
129
155
|
};
|
|
130
156
|
}
|
|
131
|
-
}),
|
|
132
|
-
G(
|
|
157
|
+
}), U = {};
|
|
158
|
+
G(U, {
|
|
133
159
|
findListItemPos: () => y,
|
|
134
160
|
getNextListDepth: () => A,
|
|
135
161
|
handleBackspace: () => T,
|
|
136
162
|
handleDelete: () => M,
|
|
137
163
|
hasListBefore: () => _,
|
|
138
|
-
hasListItemAfter: () =>
|
|
139
|
-
hasListItemBefore: () =>
|
|
140
|
-
listItemHasSubList: () =>
|
|
141
|
-
nextListIsDeeper: () =>
|
|
142
|
-
nextListIsHigher: () =>
|
|
164
|
+
hasListItemAfter: () => Z,
|
|
165
|
+
hasListItemBefore: () => B,
|
|
166
|
+
listItemHasSubList: () => P,
|
|
167
|
+
nextListIsDeeper: () => D,
|
|
168
|
+
nextListIsHigher: () => j
|
|
143
169
|
});
|
|
144
170
|
var y = (t, e) => {
|
|
145
|
-
const { $from: s } = e.selection, n =
|
|
146
|
-
let r = null, i = s.depth,
|
|
171
|
+
const { $from: s } = e.selection, n = O(t, e.schema);
|
|
172
|
+
let r = null, i = s.depth, u = s.pos, a = null;
|
|
147
173
|
for (; i > 0 && a === null; )
|
|
148
|
-
r = s.node(i), r.type === n ? a = i : (i -= 1,
|
|
149
|
-
return a === null ? null : { $pos: e.doc.resolve(
|
|
174
|
+
r = s.node(i), r.type === n ? a = i : (i -= 1, u -= 1);
|
|
175
|
+
return a === null ? null : { $pos: e.doc.resolve(u), depth: a };
|
|
150
176
|
}, A = (t, e) => {
|
|
151
177
|
const s = y(t, e);
|
|
152
178
|
if (!s)
|
|
153
179
|
return !1;
|
|
154
|
-
const [, n] =
|
|
180
|
+
const [, n] = X(e, t, s.$pos.pos + 4);
|
|
155
181
|
return n;
|
|
156
182
|
}, _ = (t, e, s) => {
|
|
157
183
|
const { $anchor: n } = t.selection, r = Math.max(0, n.pos - 2), i = t.doc.resolve(r).node();
|
|
158
184
|
return !(!i || !s.includes(i.type.name));
|
|
159
|
-
},
|
|
185
|
+
}, B = (t, e) => {
|
|
160
186
|
var s;
|
|
161
187
|
const { $anchor: n } = e.selection, r = e.doc.resolve(n.pos - 2);
|
|
162
188
|
return !(r.index() === 0 || ((s = r.nodeBefore) == null ? void 0 : s.type.name) !== t);
|
|
163
|
-
},
|
|
189
|
+
}, P = (t, e, s) => {
|
|
164
190
|
if (!s)
|
|
165
191
|
return !1;
|
|
166
|
-
const n =
|
|
192
|
+
const n = O(t, e.schema);
|
|
167
193
|
let r = !1;
|
|
168
194
|
return s.descendants((i) => {
|
|
169
195
|
i.type === n && (r = !0);
|
|
@@ -174,39 +200,39 @@ var y = (t, e) => {
|
|
|
174
200
|
if (t.state.selection.from !== t.state.selection.to)
|
|
175
201
|
return !1;
|
|
176
202
|
if (!I(t.state, e) && _(t.state, e, s)) {
|
|
177
|
-
const { $anchor: a } = t.state.selection,
|
|
178
|
-
|
|
179
|
-
|
|
203
|
+
const { $anchor: a } = t.state.selection, p = t.state.doc.resolve(a.before() - 1), h = [];
|
|
204
|
+
p.node().descendants((c, l) => {
|
|
205
|
+
c.type.name === e && h.push({ node: c, pos: l });
|
|
180
206
|
});
|
|
181
|
-
const
|
|
182
|
-
if (!
|
|
207
|
+
const m = h.at(-1);
|
|
208
|
+
if (!m)
|
|
183
209
|
return !1;
|
|
184
|
-
const o = t.state.doc.resolve(
|
|
210
|
+
const o = t.state.doc.resolve(p.start() + m.pos + 1);
|
|
185
211
|
return t.chain().cut({ from: a.start() - 1, to: a.end() + 1 }, o.end()).joinForward().run();
|
|
186
212
|
}
|
|
187
|
-
if (!I(t.state, e) || !
|
|
213
|
+
if (!I(t.state, e) || !z(t.state))
|
|
188
214
|
return !1;
|
|
189
215
|
const n = y(e, t.state);
|
|
190
216
|
if (!n)
|
|
191
217
|
return !1;
|
|
192
|
-
const i = t.state.doc.resolve(n.$pos.pos - 2).node(n.depth),
|
|
193
|
-
return
|
|
194
|
-
},
|
|
218
|
+
const i = t.state.doc.resolve(n.$pos.pos - 2).node(n.depth), u = P(e, t.state, i);
|
|
219
|
+
return B(e, t.state) && !u ? t.commands.joinItemBackward() : t.chain().liftListItem(e).run();
|
|
220
|
+
}, D = (t, e) => {
|
|
195
221
|
const s = A(t, e), n = y(t, e);
|
|
196
222
|
return !n || !s ? !1 : s > n.depth;
|
|
197
|
-
},
|
|
223
|
+
}, j = (t, e) => {
|
|
198
224
|
const s = A(t, e), n = y(t, e);
|
|
199
225
|
return !n || !s ? !1 : s < n.depth;
|
|
200
226
|
}, M = (t, e) => {
|
|
201
|
-
if (!I(t.state, e) || !
|
|
227
|
+
if (!I(t.state, e) || !V(t.state, e))
|
|
202
228
|
return !1;
|
|
203
229
|
const { selection: s } = t.state, { $from: n, $to: r } = s;
|
|
204
|
-
return !s.empty && n.sameParent(r) ? !1 :
|
|
205
|
-
},
|
|
230
|
+
return !s.empty && n.sameParent(r) ? !1 : D(e, t.state) ? t.chain().focus(t.state.selection.from + 4).lift(e).joinBackward().run() : j(e, t.state) ? t.chain().joinForward().joinBackward().run() : t.commands.joinItemForward();
|
|
231
|
+
}, Z = (t, e) => {
|
|
206
232
|
var s;
|
|
207
233
|
const { $anchor: n } = e.selection, r = e.doc.resolve(n.pos - n.parentOffset - 2);
|
|
208
234
|
return !(r.index() === r.parent.childCount - 1 || ((s = r.nodeAfter) == null ? void 0 : s.type.name) !== t);
|
|
209
|
-
},
|
|
235
|
+
}, tt = S.create({
|
|
210
236
|
name: "listKeymap",
|
|
211
237
|
addOptions() {
|
|
212
238
|
return {
|
|
@@ -250,86 +276,115 @@ var y = (t, e) => {
|
|
|
250
276
|
}
|
|
251
277
|
};
|
|
252
278
|
}
|
|
253
|
-
}), N = /^(\s*)(\d+)\.\s+(.*)$/,
|
|
254
|
-
function
|
|
279
|
+
}), N = /^(\s*)(\d+)\.\s+(.*)$/, et = /^\s/;
|
|
280
|
+
function st(t) {
|
|
281
|
+
const e = t.trimStart();
|
|
282
|
+
return /^[-+*]\s+/.test(e) || /^\d+\.\s+/.test(e) || /^>\s?/.test(e) || /^```/.test(e) || /^~~~/.test(e);
|
|
283
|
+
}
|
|
284
|
+
function nt(t) {
|
|
285
|
+
const e = [], s = [];
|
|
286
|
+
let n = !1;
|
|
287
|
+
return t.forEach((r) => {
|
|
288
|
+
if (n) {
|
|
289
|
+
s.push(r);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (r.trim() === "") {
|
|
293
|
+
n = !0, s.push(r);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
if (e.length > 0 && st(r)) {
|
|
297
|
+
n = !0, s.push(r);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
e.push(r);
|
|
301
|
+
}), {
|
|
302
|
+
paragraphLines: e,
|
|
303
|
+
blockLines: s
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
function rt(t) {
|
|
255
307
|
const e = [];
|
|
256
308
|
let s = 0, n = 0;
|
|
257
309
|
for (; s < t.length; ) {
|
|
258
310
|
const r = t[s], i = r.match(N);
|
|
259
311
|
if (!i)
|
|
260
312
|
break;
|
|
261
|
-
const [,
|
|
262
|
-
let
|
|
263
|
-
const
|
|
313
|
+
const [, u, a, p] = i, h = u.length, m = [p];
|
|
314
|
+
let o = s + 1;
|
|
315
|
+
const c = [r];
|
|
316
|
+
let l = !1;
|
|
264
317
|
for (; o < t.length; ) {
|
|
265
318
|
const d = t[o];
|
|
266
319
|
if (d.match(N))
|
|
267
320
|
break;
|
|
268
321
|
if (d.trim() === "")
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
322
|
+
c.push(d), m.push(""), l = !0, o += 1;
|
|
323
|
+
else if (d.match(et))
|
|
324
|
+
c.push(d), m.push(d.slice(h + 2)), o += 1;
|
|
325
|
+
else {
|
|
326
|
+
if (l)
|
|
327
|
+
break;
|
|
328
|
+
c.push(d), m.push(d), o += 1;
|
|
329
|
+
}
|
|
276
330
|
}
|
|
277
331
|
e.push({
|
|
278
|
-
indent:
|
|
332
|
+
indent: h,
|
|
279
333
|
number: parseInt(a, 10),
|
|
280
|
-
content:
|
|
281
|
-
|
|
334
|
+
content: m.join(`
|
|
335
|
+
`).trim(),
|
|
336
|
+
contentLines: m,
|
|
337
|
+
raw: c.join(`
|
|
282
338
|
`)
|
|
283
339
|
}), n = o, s = o;
|
|
284
340
|
}
|
|
285
341
|
return [e, n];
|
|
286
342
|
}
|
|
287
|
-
function
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
u && p.push({
|
|
343
|
+
function R(t, e, s) {
|
|
344
|
+
const n = [];
|
|
345
|
+
let r = 0;
|
|
346
|
+
for (; r < t.length; ) {
|
|
347
|
+
const i = t[r];
|
|
348
|
+
if (i.indent === e) {
|
|
349
|
+
const { paragraphLines: u, blockLines: a } = nt(i.contentLines), p = u.join(`
|
|
350
|
+
`).trim(), h = [];
|
|
351
|
+
p && h.push({
|
|
297
352
|
type: "paragraph",
|
|
298
|
-
raw:
|
|
299
|
-
tokens: s.inlineTokens(
|
|
353
|
+
raw: p,
|
|
354
|
+
tokens: s.inlineTokens(p)
|
|
300
355
|
});
|
|
301
|
-
const
|
|
356
|
+
const m = a.join(`
|
|
302
357
|
`).trim();
|
|
303
|
-
if (
|
|
304
|
-
const
|
|
305
|
-
|
|
358
|
+
if (m) {
|
|
359
|
+
const l = s.blockTokens(m);
|
|
360
|
+
h.push(...l);
|
|
306
361
|
}
|
|
307
|
-
let o =
|
|
308
|
-
const
|
|
362
|
+
let o = r + 1;
|
|
363
|
+
const c = [];
|
|
309
364
|
for (; o < t.length && t[o].indent > e; )
|
|
310
|
-
|
|
311
|
-
if (
|
|
312
|
-
const
|
|
313
|
-
|
|
365
|
+
c.push(t[o]), o += 1;
|
|
366
|
+
if (c.length > 0) {
|
|
367
|
+
const l = Math.min(...c.map((f) => f.indent)), d = R(c, l, s);
|
|
368
|
+
h.push({
|
|
314
369
|
type: "list",
|
|
315
370
|
ordered: !0,
|
|
316
|
-
start:
|
|
317
|
-
items:
|
|
318
|
-
raw:
|
|
371
|
+
start: c[0].number,
|
|
372
|
+
items: d,
|
|
373
|
+
raw: c.map((f) => f.raw).join(`
|
|
319
374
|
`)
|
|
320
375
|
});
|
|
321
376
|
}
|
|
322
|
-
|
|
377
|
+
n.push({
|
|
323
378
|
type: "list_item",
|
|
324
|
-
raw:
|
|
325
|
-
tokens:
|
|
326
|
-
}),
|
|
379
|
+
raw: i.raw,
|
|
380
|
+
tokens: h
|
|
381
|
+
}), r = o;
|
|
327
382
|
} else
|
|
328
|
-
|
|
383
|
+
r += 1;
|
|
329
384
|
}
|
|
330
|
-
return
|
|
385
|
+
return n;
|
|
331
386
|
}
|
|
332
|
-
function
|
|
387
|
+
function it(t, e) {
|
|
333
388
|
return t.map((s) => {
|
|
334
389
|
if (s.type !== "list_item")
|
|
335
390
|
return e.parseChildren([s])[0];
|
|
@@ -353,7 +408,7 @@ function et(t, e) {
|
|
|
353
408
|
};
|
|
354
409
|
});
|
|
355
410
|
}
|
|
356
|
-
var
|
|
411
|
+
var at = "listItem", E = "textStyle", H = /^(\d+)\.\s$/, ot = g.create({
|
|
357
412
|
name: "orderedList",
|
|
358
413
|
addOptions() {
|
|
359
414
|
return {
|
|
@@ -394,7 +449,7 @@ var st = "listItem", E = "textStyle", H = /^(\d+)\.\s$/, nt = g.create({
|
|
|
394
449
|
parseMarkdown: (t, e) => {
|
|
395
450
|
if (t.type !== "list" || !t.ordered)
|
|
396
451
|
return [];
|
|
397
|
-
const s = t.start || 1, n = t.items ?
|
|
452
|
+
const s = t.start || 1, n = t.items ? it(t.items, e) : [];
|
|
398
453
|
return s !== 1 ? {
|
|
399
454
|
type: "orderedList",
|
|
400
455
|
attrs: { start: s },
|
|
@@ -416,16 +471,16 @@ var st = "listItem", E = "textStyle", H = /^(\d+)\.\s$/, nt = g.create({
|
|
|
416
471
|
tokenize: (t, e, s) => {
|
|
417
472
|
var n;
|
|
418
473
|
const r = t.split(`
|
|
419
|
-
`), [i,
|
|
474
|
+
`), [i, u] = rt(r);
|
|
420
475
|
if (i.length === 0)
|
|
421
476
|
return;
|
|
422
|
-
const a =
|
|
477
|
+
const a = R(i, 0, s);
|
|
423
478
|
return a.length === 0 ? void 0 : {
|
|
424
479
|
type: "list",
|
|
425
480
|
ordered: !0,
|
|
426
481
|
start: ((n = i[0]) == null ? void 0 : n.number) || 1,
|
|
427
482
|
items: a,
|
|
428
|
-
raw: r.slice(0,
|
|
483
|
+
raw: r.slice(0, u).join(`
|
|
429
484
|
`)
|
|
430
485
|
};
|
|
431
486
|
}
|
|
@@ -435,7 +490,7 @@ var st = "listItem", E = "textStyle", H = /^(\d+)\.\s$/, nt = g.create({
|
|
|
435
490
|
},
|
|
436
491
|
addCommands() {
|
|
437
492
|
return {
|
|
438
|
-
toggleOrderedList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
493
|
+
toggleOrderedList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(at, this.editor.getAttributes(E)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
439
494
|
};
|
|
440
495
|
},
|
|
441
496
|
addKeyboardShortcuts() {
|
|
@@ -460,7 +515,7 @@ var st = "listItem", E = "textStyle", H = /^(\d+)\.\s$/, nt = g.create({
|
|
|
460
515
|
editor: this.editor
|
|
461
516
|
})), [t];
|
|
462
517
|
}
|
|
463
|
-
}),
|
|
518
|
+
}), ut = /^\s*(\[([( |x])?\])\s$/, ct = g.create({
|
|
464
519
|
name: "taskItem",
|
|
465
520
|
addOptions() {
|
|
466
521
|
return {
|
|
@@ -542,45 +597,45 @@ var st = "listItem", E = "textStyle", H = /^(\d+)\.\s$/, nt = g.create({
|
|
|
542
597
|
},
|
|
543
598
|
addNodeView() {
|
|
544
599
|
return ({ node: t, HTMLAttributes: e, getPos: s, editor: n }) => {
|
|
545
|
-
const r = document.createElement("li"), i = document.createElement("label"),
|
|
546
|
-
var
|
|
547
|
-
a.ariaLabel = ((
|
|
600
|
+
const r = document.createElement("li"), i = document.createElement("label"), u = document.createElement("span"), a = document.createElement("input"), p = document.createElement("div"), h = (o) => {
|
|
601
|
+
var c, l;
|
|
602
|
+
a.ariaLabel = ((l = (c = this.options.a11y) == null ? void 0 : c.checkboxLabel) == null ? void 0 : l.call(c, o, a.checked)) || `Task item checkbox for ${o.textContent || "empty task item"}`;
|
|
548
603
|
};
|
|
549
|
-
|
|
604
|
+
h(t), i.contentEditable = "false", a.type = "checkbox", a.addEventListener("mousedown", (o) => o.preventDefault()), a.addEventListener("change", (o) => {
|
|
550
605
|
if (!n.isEditable && !this.options.onReadOnlyChecked) {
|
|
551
606
|
a.checked = !a.checked;
|
|
552
607
|
return;
|
|
553
608
|
}
|
|
554
|
-
const { checked:
|
|
555
|
-
n.isEditable && typeof s == "function" && n.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr:
|
|
556
|
-
const
|
|
557
|
-
if (typeof
|
|
609
|
+
const { checked: c } = o.target;
|
|
610
|
+
n.isEditable && typeof s == "function" && n.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: l }) => {
|
|
611
|
+
const d = s();
|
|
612
|
+
if (typeof d != "number")
|
|
558
613
|
return !1;
|
|
559
|
-
const
|
|
560
|
-
return
|
|
561
|
-
...
|
|
562
|
-
checked:
|
|
614
|
+
const f = l.doc.nodeAt(d);
|
|
615
|
+
return l.setNodeMarkup(d, void 0, {
|
|
616
|
+
...f == null ? void 0 : f.attrs,
|
|
617
|
+
checked: c
|
|
563
618
|
}), !0;
|
|
564
|
-
}).run(), !n.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(t,
|
|
565
|
-
}), Object.entries(this.options.HTMLAttributes).forEach(([o,
|
|
566
|
-
r.setAttribute(o,
|
|
567
|
-
}), r.dataset.checked = t.attrs.checked, a.checked = t.attrs.checked, i.append(a,
|
|
568
|
-
r.setAttribute(o,
|
|
619
|
+
}).run(), !n.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(t, c) || (a.checked = !a.checked));
|
|
620
|
+
}), Object.entries(this.options.HTMLAttributes).forEach(([o, c]) => {
|
|
621
|
+
r.setAttribute(o, c);
|
|
622
|
+
}), r.dataset.checked = t.attrs.checked, a.checked = t.attrs.checked, i.append(a, u), r.append(i, p), Object.entries(e).forEach(([o, c]) => {
|
|
623
|
+
r.setAttribute(o, c);
|
|
569
624
|
});
|
|
570
|
-
let
|
|
625
|
+
let m = new Set(Object.keys(e));
|
|
571
626
|
return {
|
|
572
627
|
dom: r,
|
|
573
|
-
contentDOM:
|
|
628
|
+
contentDOM: p,
|
|
574
629
|
update: (o) => {
|
|
575
630
|
if (o.type !== this.type)
|
|
576
631
|
return !1;
|
|
577
|
-
r.dataset.checked = o.attrs.checked, a.checked = o.attrs.checked,
|
|
578
|
-
const
|
|
579
|
-
return
|
|
580
|
-
|
|
581
|
-
}), Object.entries(
|
|
582
|
-
v == null ?
|
|
583
|
-
}),
|
|
632
|
+
r.dataset.checked = o.attrs.checked, a.checked = o.attrs.checked, h(o);
|
|
633
|
+
const c = n.extensionManager.attributes, l = K(o, c), d = new Set(Object.keys(l)), f = this.options.HTMLAttributes;
|
|
634
|
+
return m.forEach((k) => {
|
|
635
|
+
d.has(k) || (k in f ? r.setAttribute(k, f[k]) : r.removeAttribute(k));
|
|
636
|
+
}), Object.entries(l).forEach(([k, v]) => {
|
|
637
|
+
v == null ? k in f ? r.setAttribute(k, f[k]) : r.removeAttribute(k) : r.setAttribute(k, v);
|
|
638
|
+
}), m = d, !0;
|
|
584
639
|
}
|
|
585
640
|
};
|
|
586
641
|
};
|
|
@@ -588,7 +643,7 @@ var st = "listItem", E = "textStyle", H = /^(\d+)\.\s$/, nt = g.create({
|
|
|
588
643
|
addInputRules() {
|
|
589
644
|
return [
|
|
590
645
|
b({
|
|
591
|
-
find:
|
|
646
|
+
find: ut,
|
|
592
647
|
type: this.type,
|
|
593
648
|
getAttributes: (t) => ({
|
|
594
649
|
checked: t[t.length - 1] === "x"
|
|
@@ -596,7 +651,7 @@ var st = "listItem", E = "textStyle", H = /^(\d+)\.\s$/, nt = g.create({
|
|
|
596
651
|
})
|
|
597
652
|
];
|
|
598
653
|
}
|
|
599
|
-
}),
|
|
654
|
+
}), lt = g.create({
|
|
600
655
|
name: "taskList",
|
|
601
656
|
addOptions() {
|
|
602
657
|
return {
|
|
@@ -632,7 +687,7 @@ var st = "listItem", E = "textStyle", H = /^(\d+)\.\s$/, nt = g.create({
|
|
|
632
687
|
},
|
|
633
688
|
tokenize(t, e, s) {
|
|
634
689
|
const n = (i) => {
|
|
635
|
-
const
|
|
690
|
+
const u = x(
|
|
636
691
|
i,
|
|
637
692
|
{
|
|
638
693
|
itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
|
|
@@ -641,7 +696,7 @@ var st = "listItem", E = "textStyle", H = /^(\d+)\.\s$/, nt = g.create({
|
|
|
641
696
|
mainContent: a[4],
|
|
642
697
|
checked: a[3].toLowerCase() === "x"
|
|
643
698
|
}),
|
|
644
|
-
createToken: (a,
|
|
699
|
+
createToken: (a, p) => ({
|
|
645
700
|
type: "taskItem",
|
|
646
701
|
raw: "",
|
|
647
702
|
mainContent: a.mainContent,
|
|
@@ -649,18 +704,18 @@ var st = "listItem", E = "textStyle", H = /^(\d+)\.\s$/, nt = g.create({
|
|
|
649
704
|
checked: a.checked,
|
|
650
705
|
text: a.mainContent,
|
|
651
706
|
tokens: s.inlineTokens(a.mainContent),
|
|
652
|
-
nestedTokens:
|
|
707
|
+
nestedTokens: p
|
|
653
708
|
}),
|
|
654
709
|
// Allow recursive nesting
|
|
655
710
|
customNestedParser: n
|
|
656
711
|
},
|
|
657
712
|
s
|
|
658
713
|
);
|
|
659
|
-
return
|
|
714
|
+
return u ? [
|
|
660
715
|
{
|
|
661
716
|
type: "taskList",
|
|
662
|
-
raw:
|
|
663
|
-
items:
|
|
717
|
+
raw: u.raw,
|
|
718
|
+
items: u.items
|
|
664
719
|
}
|
|
665
720
|
] : s.blockTokens(i);
|
|
666
721
|
}, r = x(
|
|
@@ -672,7 +727,7 @@ var st = "listItem", E = "textStyle", H = /^(\d+)\.\s$/, nt = g.create({
|
|
|
672
727
|
mainContent: i[4],
|
|
673
728
|
checked: i[3].toLowerCase() === "x"
|
|
674
729
|
}),
|
|
675
|
-
createToken: (i,
|
|
730
|
+
createToken: (i, u) => ({
|
|
676
731
|
type: "taskItem",
|
|
677
732
|
raw: "",
|
|
678
733
|
mainContent: i.mainContent,
|
|
@@ -680,7 +735,7 @@ var st = "listItem", E = "textStyle", H = /^(\d+)\.\s$/, nt = g.create({
|
|
|
680
735
|
checked: i.checked,
|
|
681
736
|
text: i.mainContent,
|
|
682
737
|
tokens: s.inlineTokens(i.mainContent),
|
|
683
|
-
nestedTokens:
|
|
738
|
+
nestedTokens: u
|
|
684
739
|
}),
|
|
685
740
|
// Use the recursive parser for nested content
|
|
686
741
|
customNestedParser: n
|
|
@@ -709,16 +764,16 @@ var st = "listItem", E = "textStyle", H = /^(\d+)\.\s$/, nt = g.create({
|
|
|
709
764
|
};
|
|
710
765
|
}
|
|
711
766
|
});
|
|
712
|
-
|
|
767
|
+
S.create({
|
|
713
768
|
name: "listKit",
|
|
714
769
|
addExtensions() {
|
|
715
770
|
const t = [];
|
|
716
|
-
return this.options.bulletList !== !1 && t.push(q.configure(this.options.bulletList)), this.options.listItem !== !1 && t.push(
|
|
771
|
+
return this.options.bulletList !== !1 && t.push(q.configure(this.options.bulletList)), this.options.listItem !== !1 && t.push(Q.configure(this.options.listItem)), this.options.listKeymap !== !1 && t.push(tt.configure(this.options.listKeymap)), this.options.orderedList !== !1 && t.push(ot.configure(this.options.orderedList)), this.options.taskItem !== !1 && t.push(ct.configure(this.options.taskItem)), this.options.taskList !== !1 && t.push(lt.configure(this.options.taskList)), t;
|
|
717
772
|
}
|
|
718
773
|
});
|
|
719
774
|
export {
|
|
720
775
|
q as B,
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
776
|
+
ot as O,
|
|
777
|
+
lt as T,
|
|
778
|
+
ct as a
|
|
724
779
|
};
|