reactjs-tiptap-editor 0.3.30 → 0.4.0
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/README.md +8 -2
- package/lib/{ActionMenuButton-wiDnIxE2.cjs → ActionMenuButton-CYdM1xx5.cjs} +1 -1
- package/lib/{ActionMenuButton-B6fitGKu.js → ActionMenuButton-DKRF6oa0.js} +5 -5
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.d.cts +47 -51
- package/lib/Attachment.d.ts +47 -51
- package/lib/Attachment.js +7 -6
- package/lib/BaseKit.cjs +3 -0
- package/lib/BaseKit.d.cts +481 -0
- package/lib/BaseKit.d.ts +481 -0
- package/lib/BaseKit.js +132 -0
- package/lib/Blockquote.cjs +5 -1
- package/lib/Blockquote.d.cts +47 -51
- package/lib/Blockquote.d.ts +47 -51
- package/lib/Blockquote.js +33 -17
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.d.cts +47 -51
- package/lib/Bold.d.ts +47 -51
- package/lib/Bold.js +23 -16
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.d.cts +48 -52
- package/lib/BulletList.d.ts +48 -52
- package/lib/BulletList.js +11 -57
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.d.cts +47 -51
- package/lib/Clear.d.ts +47 -51
- package/lib/Clear.js +4 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.d.cts +47 -51
- package/lib/Code.d.ts +47 -51
- package/lib/Code.js +29 -25
- package/lib/CodeBlock.cjs +2 -2
- package/lib/CodeBlock.d.cts +47 -51
- package/lib/CodeBlock.d.ts +47 -51
- package/lib/CodeBlock.js +5 -4
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.d.cts +47 -51
- package/lib/CodeView.d.ts +47 -51
- package/lib/CodeView.js +3 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.d.cts +48 -52
- package/lib/Color.d.ts +48 -52
- package/lib/Color.js +42 -74
- package/lib/Document.cjs +1 -1
- package/lib/Document.d.cts +47 -51
- package/lib/Document.d.ts +47 -51
- package/lib/Document.js +4 -8
- package/lib/{Drawer-BKTU9CpU.js → Drawer-CaAfmqNo.js} +268 -265
- package/lib/Drawer-CdvCMSzN.cjs +1 -0
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.d.cts +47 -51
- package/lib/Drawer.d.ts +47 -51
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.d.cts +50 -52
- package/lib/Emoji.d.ts +50 -52
- package/lib/Emoji.js +19790 -178
- package/lib/Excalidraw-BbMQhNvs.cjs +1 -0
- package/lib/Excalidraw-CVWz2Vyn.js +290 -0
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.d.cts +47 -51
- package/lib/Excalidraw.d.ts +47 -51
- package/lib/Excalidraw.js +3 -3
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.d.cts +47 -51
- package/lib/ExportPdf.d.ts +47 -51
- package/lib/ExportPdf.js +4 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.d.cts +47 -51
- package/lib/ExportWord.d.ts +47 -51
- package/lib/ExportWord.js +22 -51
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.d.cts +48 -52
- package/lib/FontFamily.d.ts +48 -52
- package/lib/FontFamily.js +46 -74
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.d.cts +47 -51
- package/lib/FontSize.d.ts +47 -51
- package/lib/FontSize.js +11 -8
- package/lib/FormatPainter.cjs +1 -1
- package/lib/FormatPainter.d.cts +47 -51
- package/lib/FormatPainter.d.ts +47 -51
- package/lib/FormatPainter.js +4 -2
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.d.cts +47 -51
- package/lib/Heading.d.ts +47 -51
- package/lib/Heading.js +77 -65
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.d.cts +47 -51
- package/lib/Highlight.d.ts +47 -51
- package/lib/Highlight.js +5 -4
- package/lib/History.cjs +1 -1
- package/lib/History.d.cts +49 -53
- package/lib/History.d.ts +49 -53
- package/lib/History.js +39 -403
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.d.cts +47 -51
- package/lib/HorizontalRule.d.ts +47 -51
- package/lib/HorizontalRule.js +16 -65
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.d.cts +47 -51
- package/lib/Iframe.d.ts +47 -51
- package/lib/Iframe.js +4 -4
- package/lib/Image.cjs +1 -1
- package/lib/Image.d.cts +47 -51
- package/lib/Image.d.ts +47 -51
- package/lib/Image.js +3 -3
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.d.cts +47 -51
- package/lib/ImageGif.d.ts +47 -51
- package/lib/ImageGif.js +5 -5
- package/lib/ImportWord.cjs +72 -72
- package/lib/ImportWord.d.cts +47 -51
- package/lib/ImportWord.d.ts +47 -51
- package/lib/ImportWord.js +5654 -5616
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.d.cts +47 -51
- package/lib/Indent.d.ts +47 -51
- package/lib/Indent.js +4 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.d.cts +47 -51
- package/lib/Italic.d.ts +47 -51
- package/lib/Italic.js +20 -14
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.d.cts +47 -51
- package/lib/Katex.d.ts +47 -51
- package/lib/Katex.js +49 -48
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.d.cts +47 -51
- package/lib/LineHeight.d.ts +47 -51
- package/lib/LineHeight.js +21 -18
- package/lib/Link.cjs +1 -1
- package/lib/Link.d.cts +47 -51
- package/lib/Link.d.ts +47 -51
- package/lib/Link.js +4 -4
- package/lib/ListItem.cjs +1 -1
- package/lib/ListItem.d.cts +52 -52
- package/lib/ListItem.d.ts +52 -52
- package/lib/ListItem.js +4 -30
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.d.cts +47 -51
- package/lib/Mention.d.ts +47 -51
- package/lib/Mention.js +161 -132
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.d.cts +47 -51
- package/lib/Mermaid.d.ts +47 -51
- package/lib/Mermaid.js +150 -147
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.d.cts +47 -51
- package/lib/MoreMark.d.ts +47 -51
- package/lib/MoreMark.js +5 -3
- package/lib/MultiColumn.cjs +1 -1
- package/lib/MultiColumn.d.cts +47 -51
- package/lib/MultiColumn.d.ts +47 -51
- package/lib/MultiColumn.js +2 -2
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.d.cts +48 -52
- package/lib/OrderedList.d.ts +48 -52
- package/lib/OrderedList.js +11 -75
- package/lib/RichTextEditor-CxvwGvQG.cjs +142 -0
- package/lib/RichTextEditor-DGcKEUGr.js +22166 -0
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.d.cts +60 -134
- package/lib/SearchAndReplace.d.ts +60 -134
- package/lib/SearchAndReplace.js +207 -194
- package/lib/Selection.cjs +1 -1
- package/lib/Selection.d.cts +47 -51
- package/lib/Selection.d.ts +47 -51
- package/lib/Selection.js +1 -1
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.d.cts +47 -51
- package/lib/SlashCommand.d.ts +47 -51
- package/lib/SlashCommand.js +177 -222
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.d.cts +47 -51
- package/lib/Strike.d.ts +47 -51
- package/lib/Strike.js +20 -14
- package/lib/SubAndSuperScript.cjs +1 -1
- package/lib/SubAndSuperScript.d.cts +47 -51
- package/lib/SubAndSuperScript.d.ts +47 -51
- package/lib/SubAndSuperScript.js +5 -3
- package/lib/Table.cjs +8 -10
- package/lib/Table.d.cts +50 -54
- package/lib/Table.d.ts +50 -54
- package/lib/Table.js +382 -2021
- package/lib/TableOfContent.cjs +1 -1
- package/lib/TableOfContent.d.cts +47 -51
- package/lib/TableOfContent.d.ts +47 -51
- package/lib/TableOfContent.js +53 -52
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.d.cts +49 -53
- package/lib/TaskList.d.ts +49 -53
- package/lib/TaskList.js +12 -154
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.d.cts +47 -51
- package/lib/TextAlign.d.ts +47 -51
- package/lib/TextAlign.js +11 -8
- package/lib/TextBubble.cjs +1 -1
- package/lib/TextBubble.d.cts +47 -51
- package/lib/TextBubble.d.ts +47 -51
- package/lib/TextBubble.js +5 -3
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.d.cts +47 -51
- package/lib/TextDirection.d.ts +47 -51
- package/lib/TextDirection.js +15 -15
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.d.cts +47 -51
- package/lib/TextUnderline.d.ts +47 -51
- package/lib/TextUnderline.js +40 -12
- package/lib/TrailingNode.cjs +1 -1
- package/lib/TrailingNode.d.cts +47 -51
- package/lib/TrailingNode.d.ts +47 -51
- package/lib/TrailingNode.js +1 -1
- package/lib/Twitter-BFULyqdR.js +1628 -0
- package/lib/Twitter-Cutpkh3h.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.d.cts +47 -51
- package/lib/Twitter.d.ts +47 -51
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.d.cts +47 -51
- package/lib/Video.d.ts +47 -51
- package/lib/Video.js +3 -3
- package/lib/bubble-extra.cjs +2 -2
- package/lib/bubble-extra.d.cts +47 -51
- package/lib/bubble-extra.d.ts +47 -51
- package/lib/bubble-extra.js +200 -192
- package/lib/dom-dataset-_6-diIRQ.cjs +33 -0
- package/lib/dom-dataset-lYeH6gfI.js +2361 -0
- package/lib/index-5iBZLua9.cjs +12 -0
- package/lib/index-6D1J-A-o.cjs +1 -0
- package/lib/index-B96Cclrj.cjs +3 -0
- package/lib/index-BBz7Nmv9.js +55 -0
- package/lib/index-BeCTd5v2.cjs +1 -0
- package/lib/index-ByurDDMv.js +237 -0
- package/lib/index-CUogRI7j.cjs +1 -0
- package/lib/index-Ch6dBBad.js +709 -0
- package/lib/index-DF2Lp4HZ.cjs +100 -0
- package/lib/{index-LUL9mqY4.js → index-D_L6n8O8.js} +4 -4
- package/lib/index-Dbvi-Bvh.cjs +1 -0
- package/lib/index-DpCrt7xs.cjs +1 -0
- package/lib/index-DsAX1Vq8.cjs +1 -0
- package/lib/index-Dy4DlW9o.js +12 -0
- package/lib/index-J3jHHZ4d.js +200 -0
- package/lib/{index-CsK90iVd.js → index-LmrOdnen.js} +302 -389
- package/lib/index-VvXaaKe3.js +898 -0
- package/lib/index-kbO3iWqL.js +13432 -0
- package/lib/index.cjs +1 -2
- package/lib/index.d.cts +49 -251
- package/lib/index.d.ts +49 -251
- package/lib/index.js +2 -588
- package/lib/jsx-runtime-CT7Pcg-t.js +13 -0
- package/lib/jsx-runtime-C_NLcKys.cjs +1 -0
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +47 -51
- package/lib/locale-bundle.d.ts +47 -51
- package/lib/locale-bundle.js +1 -1
- package/lib/style.css +1 -1
- package/lib/{textarea-D5WVZMgt.cjs → textarea-DFo_aXnj.cjs} +1 -1
- package/lib/{textarea-BglwYF6b.js → textarea-aPtytkDx.js} +1 -1
- package/package.json +76 -70
- package/lib/Drawer-CmoEF-Zg.cjs +0 -1
- package/lib/Excalidraw-CM74U5tG.js +0 -289
- package/lib/Excalidraw-DAPP9qgY.cjs +0 -1
- package/lib/RichTextEditor-BQN2eLD_.js +0 -12775
- package/lib/RichTextEditor-C8Sm1E6J.cjs +0 -140
- package/lib/Twitter-CL2pu4QM.cjs +0 -17
- package/lib/Twitter-Dg6WWauX.js +0 -1743
- package/lib/dom-dataset-Byuf1YmW.cjs +0 -33
- package/lib/dom-dataset-Di3tIRrR.js +0 -1031
- package/lib/index-BI-IcZcN.cjs +0 -1
- package/lib/index-ByRfqzMr.cjs +0 -89
- package/lib/index-C1fzuXpN.js +0 -46
- package/lib/index-CbQQFj2T.js +0 -133
- package/lib/index-DI9T3iLd.js +0 -12354
- package/lib/index-D_A0TBRA.cjs +0 -1
- package/lib/index-DclQSrIx.cjs +0 -1
- package/lib/index-Z4b9rzn-.cjs +0 -1
|
@@ -0,0 +1,709 @@
|
|
|
1
|
+
import { N as L, w as k, m, r as E, E as H, p as M, d as g, e as B, f as j, g as $, h as K } from "./index-kbO3iWqL.js";
|
|
2
|
+
var V = Object.defineProperty, X = (t, e) => {
|
|
3
|
+
for (var s in e)
|
|
4
|
+
V(t, s, { get: e[s], enumerable: !0 });
|
|
5
|
+
}, z = "listItem", x = "textStyle", w = /^\s*([-+*])\s$/, F = L.create({
|
|
6
|
+
name: "bulletList",
|
|
7
|
+
addOptions() {
|
|
8
|
+
return {
|
|
9
|
+
itemTypeName: "listItem",
|
|
10
|
+
HTMLAttributes: {},
|
|
11
|
+
keepMarks: !1,
|
|
12
|
+
keepAttributes: !1
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
group: "block list",
|
|
16
|
+
content() {
|
|
17
|
+
return `${this.options.itemTypeName}+`;
|
|
18
|
+
},
|
|
19
|
+
parseHTML() {
|
|
20
|
+
return [{ tag: "ul" }];
|
|
21
|
+
},
|
|
22
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
23
|
+
return ["ul", m(this.options.HTMLAttributes, t), 0];
|
|
24
|
+
},
|
|
25
|
+
markdownTokenName: "list",
|
|
26
|
+
parseMarkdown: (t, e) => t.type !== "list" || t.ordered ? [] : {
|
|
27
|
+
type: "bulletList",
|
|
28
|
+
content: t.items ? e.parseChildren(t.items) : []
|
|
29
|
+
},
|
|
30
|
+
renderMarkdown: (t, e) => t.content ? e.renderChildren(t.content, `
|
|
31
|
+
`) : "",
|
|
32
|
+
markdownOptions: {
|
|
33
|
+
indentsContent: !0
|
|
34
|
+
},
|
|
35
|
+
addCommands() {
|
|
36
|
+
return {
|
|
37
|
+
toggleBulletList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(z, this.editor.getAttributes(x)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
addKeyboardShortcuts() {
|
|
41
|
+
return {
|
|
42
|
+
"Mod-Shift-8": () => this.editor.commands.toggleBulletList()
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
addInputRules() {
|
|
46
|
+
let t = k({
|
|
47
|
+
find: w,
|
|
48
|
+
type: this.type
|
|
49
|
+
});
|
|
50
|
+
return (this.options.keepMarks || this.options.keepAttributes) && (t = k({
|
|
51
|
+
find: w,
|
|
52
|
+
type: this.type,
|
|
53
|
+
keepMarks: this.options.keepMarks,
|
|
54
|
+
keepAttributes: this.options.keepAttributes,
|
|
55
|
+
getAttributes: () => this.editor.getAttributes(x),
|
|
56
|
+
editor: this.editor
|
|
57
|
+
})), [t];
|
|
58
|
+
}
|
|
59
|
+
}), G = L.create({
|
|
60
|
+
name: "listItem",
|
|
61
|
+
addOptions() {
|
|
62
|
+
return {
|
|
63
|
+
HTMLAttributes: {},
|
|
64
|
+
bulletListTypeName: "bulletList",
|
|
65
|
+
orderedListTypeName: "orderedList"
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
content: "paragraph block*",
|
|
69
|
+
defining: !0,
|
|
70
|
+
parseHTML() {
|
|
71
|
+
return [
|
|
72
|
+
{
|
|
73
|
+
tag: "li"
|
|
74
|
+
}
|
|
75
|
+
];
|
|
76
|
+
},
|
|
77
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
78
|
+
return ["li", m(this.options.HTMLAttributes, t), 0];
|
|
79
|
+
},
|
|
80
|
+
markdownTokenName: "list_item",
|
|
81
|
+
parseMarkdown: (t, e) => {
|
|
82
|
+
if (t.type !== "list_item")
|
|
83
|
+
return [];
|
|
84
|
+
let s = [];
|
|
85
|
+
if (t.tokens && t.tokens.length > 0)
|
|
86
|
+
if (t.tokens.some((r) => r.type === "paragraph"))
|
|
87
|
+
s = e.parseChildren(t.tokens);
|
|
88
|
+
else {
|
|
89
|
+
const r = t.tokens[0];
|
|
90
|
+
if (r && r.type === "text" && r.tokens && r.tokens.length > 0) {
|
|
91
|
+
if (s = [
|
|
92
|
+
{
|
|
93
|
+
type: "paragraph",
|
|
94
|
+
content: e.parseInline(r.tokens)
|
|
95
|
+
}
|
|
96
|
+
], t.tokens.length > 1) {
|
|
97
|
+
const l = t.tokens.slice(1), a = e.parseChildren(l);
|
|
98
|
+
s.push(...a);
|
|
99
|
+
}
|
|
100
|
+
} else
|
|
101
|
+
s = e.parseChildren(t.tokens);
|
|
102
|
+
}
|
|
103
|
+
return s.length === 0 && (s = [
|
|
104
|
+
{
|
|
105
|
+
type: "paragraph",
|
|
106
|
+
content: []
|
|
107
|
+
}
|
|
108
|
+
]), {
|
|
109
|
+
type: "listItem",
|
|
110
|
+
content: s
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
renderMarkdown: (t, e, s) => E(
|
|
114
|
+
t,
|
|
115
|
+
e,
|
|
116
|
+
(n) => n.parentType === "bulletList" ? "- " : n.parentType === "orderedList" ? `${n.index + 1}. ` : "- ",
|
|
117
|
+
s
|
|
118
|
+
),
|
|
119
|
+
addKeyboardShortcuts() {
|
|
120
|
+
return {
|
|
121
|
+
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
122
|
+
Tab: () => this.editor.commands.sinkListItem(this.name),
|
|
123
|
+
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}), W = {};
|
|
127
|
+
X(W, {
|
|
128
|
+
findListItemPos: () => b,
|
|
129
|
+
getNextListDepth: () => T,
|
|
130
|
+
handleBackspace: () => v,
|
|
131
|
+
handleDelete: () => I,
|
|
132
|
+
hasListBefore: () => S,
|
|
133
|
+
hasListItemAfter: () => q,
|
|
134
|
+
hasListItemBefore: () => O,
|
|
135
|
+
listItemHasSubList: () => P,
|
|
136
|
+
nextListIsDeeper: () => _,
|
|
137
|
+
nextListIsHigher: () => D
|
|
138
|
+
});
|
|
139
|
+
var b = (t, e) => {
|
|
140
|
+
const { $from: s } = e.selection, n = $(t, e.schema);
|
|
141
|
+
let r = null, i = s.depth, l = s.pos, a = null;
|
|
142
|
+
for (; i > 0 && a === null; )
|
|
143
|
+
r = s.node(i), r.type === n ? a = i : (i -= 1, l -= 1);
|
|
144
|
+
return a === null ? null : { $pos: e.doc.resolve(l), depth: a };
|
|
145
|
+
}, T = (t, e) => {
|
|
146
|
+
const s = b(t, e);
|
|
147
|
+
if (!s)
|
|
148
|
+
return !1;
|
|
149
|
+
const [, n] = K(e, t, s.$pos.pos + 4);
|
|
150
|
+
return n;
|
|
151
|
+
}, S = (t, e, s) => {
|
|
152
|
+
const { $anchor: n } = t.selection, r = Math.max(0, n.pos - 2), i = t.doc.resolve(r).node();
|
|
153
|
+
return !(!i || !s.includes(i.type.name));
|
|
154
|
+
}, O = (t, e) => {
|
|
155
|
+
var s;
|
|
156
|
+
const { $anchor: n } = e.selection, r = e.doc.resolve(n.pos - 2);
|
|
157
|
+
return !(r.index() === 0 || ((s = r.nodeBefore) == null ? void 0 : s.type.name) !== t);
|
|
158
|
+
}, P = (t, e, s) => {
|
|
159
|
+
if (!s)
|
|
160
|
+
return !1;
|
|
161
|
+
const n = $(t, e.schema);
|
|
162
|
+
let r = !1;
|
|
163
|
+
return s.descendants((i) => {
|
|
164
|
+
i.type === n && (r = !0);
|
|
165
|
+
}), r;
|
|
166
|
+
}, v = (t, e, s) => {
|
|
167
|
+
if (t.commands.undoInputRule())
|
|
168
|
+
return !0;
|
|
169
|
+
if (t.state.selection.from !== t.state.selection.to)
|
|
170
|
+
return !1;
|
|
171
|
+
if (!g(t.state, e) && S(t.state, e, s)) {
|
|
172
|
+
const { $anchor: a } = t.state.selection, p = t.state.doc.resolve(a.before() - 1), h = [];
|
|
173
|
+
p.node().descendants((c, u) => {
|
|
174
|
+
c.type.name === e && h.push({ node: c, pos: u });
|
|
175
|
+
});
|
|
176
|
+
const o = h.at(-1);
|
|
177
|
+
if (!o)
|
|
178
|
+
return !1;
|
|
179
|
+
const d = t.state.doc.resolve(p.start() + o.pos + 1);
|
|
180
|
+
return t.chain().cut({ from: a.start() - 1, to: a.end() + 1 }, d.end()).joinForward().run();
|
|
181
|
+
}
|
|
182
|
+
if (!g(t.state, e) || !B(t.state))
|
|
183
|
+
return !1;
|
|
184
|
+
const n = b(e, t.state);
|
|
185
|
+
if (!n)
|
|
186
|
+
return !1;
|
|
187
|
+
const i = t.state.doc.resolve(n.$pos.pos - 2).node(n.depth), l = P(e, t.state, i);
|
|
188
|
+
return O(e, t.state) && !l ? t.commands.joinItemBackward() : t.chain().liftListItem(e).run();
|
|
189
|
+
}, _ = (t, e) => {
|
|
190
|
+
const s = T(t, e), n = b(t, e);
|
|
191
|
+
return !n || !s ? !1 : s > n.depth;
|
|
192
|
+
}, D = (t, e) => {
|
|
193
|
+
const s = T(t, e), n = b(t, e);
|
|
194
|
+
return !n || !s ? !1 : s < n.depth;
|
|
195
|
+
}, I = (t, e) => {
|
|
196
|
+
if (!g(t.state, e) || !j(t.state, e))
|
|
197
|
+
return !1;
|
|
198
|
+
const { selection: s } = t.state, { $from: n, $to: r } = s;
|
|
199
|
+
return !s.empty && n.sameParent(r) ? !1 : _(e, t.state) ? t.chain().focus(t.state.selection.from + 4).lift(e).joinBackward().run() : D(e, t.state) ? t.chain().joinForward().joinBackward().run() : t.commands.joinItemForward();
|
|
200
|
+
}, q = (t, e) => {
|
|
201
|
+
var s;
|
|
202
|
+
const { $anchor: n } = e.selection, r = e.doc.resolve(n.pos - n.parentOffset - 2);
|
|
203
|
+
return !(r.index() === r.parent.childCount - 1 || ((s = r.nodeAfter) == null ? void 0 : s.type.name) !== t);
|
|
204
|
+
}, Y = H.create({
|
|
205
|
+
name: "listKeymap",
|
|
206
|
+
addOptions() {
|
|
207
|
+
return {
|
|
208
|
+
listTypes: [
|
|
209
|
+
{
|
|
210
|
+
itemName: "listItem",
|
|
211
|
+
wrapperNames: ["bulletList", "orderedList"]
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
itemName: "taskItem",
|
|
215
|
+
wrapperNames: ["taskList"]
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
};
|
|
219
|
+
},
|
|
220
|
+
addKeyboardShortcuts() {
|
|
221
|
+
return {
|
|
222
|
+
Delete: ({ editor: t }) => {
|
|
223
|
+
let e = !1;
|
|
224
|
+
return this.options.listTypes.forEach(({ itemName: s }) => {
|
|
225
|
+
t.state.schema.nodes[s] !== void 0 && I(t, s) && (e = !0);
|
|
226
|
+
}), e;
|
|
227
|
+
},
|
|
228
|
+
"Mod-Delete": ({ editor: t }) => {
|
|
229
|
+
let e = !1;
|
|
230
|
+
return this.options.listTypes.forEach(({ itemName: s }) => {
|
|
231
|
+
t.state.schema.nodes[s] !== void 0 && I(t, s) && (e = !0);
|
|
232
|
+
}), e;
|
|
233
|
+
},
|
|
234
|
+
Backspace: ({ editor: t }) => {
|
|
235
|
+
let e = !1;
|
|
236
|
+
return this.options.listTypes.forEach(({ itemName: s, wrapperNames: n }) => {
|
|
237
|
+
t.state.schema.nodes[s] !== void 0 && v(t, s, n) && (e = !0);
|
|
238
|
+
}), e;
|
|
239
|
+
},
|
|
240
|
+
"Mod-Backspace": ({ editor: t }) => {
|
|
241
|
+
let e = !1;
|
|
242
|
+
return this.options.listTypes.forEach(({ itemName: s, wrapperNames: n }) => {
|
|
243
|
+
t.state.schema.nodes[s] !== void 0 && v(t, s, n) && (e = !0);
|
|
244
|
+
}), e;
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
}), A = /^(\s*)(\d+)\.\s+(.*)$/, J = /^\s/;
|
|
249
|
+
function Q(t) {
|
|
250
|
+
const e = [];
|
|
251
|
+
let s = 0, n = 0;
|
|
252
|
+
for (; s < t.length; ) {
|
|
253
|
+
const r = t[s], i = r.match(A);
|
|
254
|
+
if (!i)
|
|
255
|
+
break;
|
|
256
|
+
const [, l, a, p] = i, h = l.length;
|
|
257
|
+
let o = p, d = s + 1;
|
|
258
|
+
const c = [r];
|
|
259
|
+
for (; d < t.length; ) {
|
|
260
|
+
const u = t[d];
|
|
261
|
+
if (u.match(A))
|
|
262
|
+
break;
|
|
263
|
+
if (u.trim() === "")
|
|
264
|
+
c.push(u), o += `
|
|
265
|
+
`, d += 1;
|
|
266
|
+
else if (u.match(J))
|
|
267
|
+
c.push(u), o += `
|
|
268
|
+
${u.slice(h + 2)}`, d += 1;
|
|
269
|
+
else
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
e.push({
|
|
273
|
+
indent: h,
|
|
274
|
+
number: parseInt(a, 10),
|
|
275
|
+
content: o.trim(),
|
|
276
|
+
raw: c.join(`
|
|
277
|
+
`)
|
|
278
|
+
}), n = d, s = d;
|
|
279
|
+
}
|
|
280
|
+
return [e, n];
|
|
281
|
+
}
|
|
282
|
+
function R(t, e, s) {
|
|
283
|
+
var n;
|
|
284
|
+
const r = [];
|
|
285
|
+
let i = 0;
|
|
286
|
+
for (; i < t.length; ) {
|
|
287
|
+
const l = t[i];
|
|
288
|
+
if (l.indent === e) {
|
|
289
|
+
const a = l.content.split(`
|
|
290
|
+
`), p = ((n = a[0]) == null ? void 0 : n.trim()) || "", h = [];
|
|
291
|
+
p && h.push({
|
|
292
|
+
type: "paragraph",
|
|
293
|
+
raw: p,
|
|
294
|
+
tokens: s.inlineTokens(p)
|
|
295
|
+
});
|
|
296
|
+
const o = a.slice(1).join(`
|
|
297
|
+
`).trim();
|
|
298
|
+
if (o) {
|
|
299
|
+
const u = s.blockTokens(o);
|
|
300
|
+
h.push(...u);
|
|
301
|
+
}
|
|
302
|
+
let d = i + 1;
|
|
303
|
+
const c = [];
|
|
304
|
+
for (; d < t.length && t[d].indent > e; )
|
|
305
|
+
c.push(t[d]), d += 1;
|
|
306
|
+
if (c.length > 0) {
|
|
307
|
+
const u = Math.min(...c.map((y) => y.indent)), f = R(c, u, s);
|
|
308
|
+
h.push({
|
|
309
|
+
type: "list",
|
|
310
|
+
ordered: !0,
|
|
311
|
+
start: c[0].number,
|
|
312
|
+
items: f,
|
|
313
|
+
raw: c.map((y) => y.raw).join(`
|
|
314
|
+
`)
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
r.push({
|
|
318
|
+
type: "list_item",
|
|
319
|
+
raw: l.raw,
|
|
320
|
+
tokens: h
|
|
321
|
+
}), i = d;
|
|
322
|
+
} else
|
|
323
|
+
i += 1;
|
|
324
|
+
}
|
|
325
|
+
return r;
|
|
326
|
+
}
|
|
327
|
+
function U(t, e) {
|
|
328
|
+
return t.map((s) => {
|
|
329
|
+
if (s.type !== "list_item")
|
|
330
|
+
return e.parseChildren([s])[0];
|
|
331
|
+
const n = [];
|
|
332
|
+
return s.tokens && s.tokens.length > 0 && s.tokens.forEach((r) => {
|
|
333
|
+
if (r.type === "paragraph" || r.type === "list" || r.type === "blockquote" || r.type === "code")
|
|
334
|
+
n.push(...e.parseChildren([r]));
|
|
335
|
+
else if (r.type === "text" && r.tokens) {
|
|
336
|
+
const i = e.parseChildren([r]);
|
|
337
|
+
n.push({
|
|
338
|
+
type: "paragraph",
|
|
339
|
+
content: i
|
|
340
|
+
});
|
|
341
|
+
} else {
|
|
342
|
+
const i = e.parseChildren([r]);
|
|
343
|
+
i.length > 0 && n.push(...i);
|
|
344
|
+
}
|
|
345
|
+
}), {
|
|
346
|
+
type: "listItem",
|
|
347
|
+
content: n
|
|
348
|
+
};
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
var Z = "listItem", C = "textStyle", N = /^(\d+)\.\s$/, tt = L.create({
|
|
352
|
+
name: "orderedList",
|
|
353
|
+
addOptions() {
|
|
354
|
+
return {
|
|
355
|
+
itemTypeName: "listItem",
|
|
356
|
+
HTMLAttributes: {},
|
|
357
|
+
keepMarks: !1,
|
|
358
|
+
keepAttributes: !1
|
|
359
|
+
};
|
|
360
|
+
},
|
|
361
|
+
group: "block list",
|
|
362
|
+
content() {
|
|
363
|
+
return `${this.options.itemTypeName}+`;
|
|
364
|
+
},
|
|
365
|
+
addAttributes() {
|
|
366
|
+
return {
|
|
367
|
+
start: {
|
|
368
|
+
default: 1,
|
|
369
|
+
parseHTML: (t) => t.hasAttribute("start") ? parseInt(t.getAttribute("start") || "", 10) : 1
|
|
370
|
+
},
|
|
371
|
+
type: {
|
|
372
|
+
default: null,
|
|
373
|
+
parseHTML: (t) => t.getAttribute("type")
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
},
|
|
377
|
+
parseHTML() {
|
|
378
|
+
return [
|
|
379
|
+
{
|
|
380
|
+
tag: "ol"
|
|
381
|
+
}
|
|
382
|
+
];
|
|
383
|
+
},
|
|
384
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
385
|
+
const { start: e, ...s } = t;
|
|
386
|
+
return e === 1 ? ["ol", m(this.options.HTMLAttributes, s), 0] : ["ol", m(this.options.HTMLAttributes, t), 0];
|
|
387
|
+
},
|
|
388
|
+
markdownTokenName: "list",
|
|
389
|
+
parseMarkdown: (t, e) => {
|
|
390
|
+
if (t.type !== "list" || !t.ordered)
|
|
391
|
+
return [];
|
|
392
|
+
const s = t.start || 1, n = t.items ? U(t.items, e) : [];
|
|
393
|
+
return s !== 1 ? {
|
|
394
|
+
type: "orderedList",
|
|
395
|
+
attrs: { start: s },
|
|
396
|
+
content: n
|
|
397
|
+
} : {
|
|
398
|
+
type: "orderedList",
|
|
399
|
+
content: n
|
|
400
|
+
};
|
|
401
|
+
},
|
|
402
|
+
renderMarkdown: (t, e) => t.content ? e.renderChildren(t.content, `
|
|
403
|
+
`) : "",
|
|
404
|
+
markdownTokenizer: {
|
|
405
|
+
name: "orderedList",
|
|
406
|
+
level: "block",
|
|
407
|
+
start: (t) => {
|
|
408
|
+
const e = t.match(/^(\s*)(\d+)\.\s+/), s = e == null ? void 0 : e.index;
|
|
409
|
+
return s !== void 0 ? s : -1;
|
|
410
|
+
},
|
|
411
|
+
tokenize: (t, e, s) => {
|
|
412
|
+
var n;
|
|
413
|
+
const r = t.split(`
|
|
414
|
+
`), [i, l] = Q(r);
|
|
415
|
+
if (i.length === 0)
|
|
416
|
+
return;
|
|
417
|
+
const a = R(i, 0, s);
|
|
418
|
+
return a.length === 0 ? void 0 : {
|
|
419
|
+
type: "list",
|
|
420
|
+
ordered: !0,
|
|
421
|
+
start: ((n = i[0]) == null ? void 0 : n.number) || 1,
|
|
422
|
+
items: a,
|
|
423
|
+
raw: r.slice(0, l).join(`
|
|
424
|
+
`)
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
markdownOptions: {
|
|
429
|
+
indentsContent: !0
|
|
430
|
+
},
|
|
431
|
+
addCommands() {
|
|
432
|
+
return {
|
|
433
|
+
toggleOrderedList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Z, this.editor.getAttributes(C)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
434
|
+
};
|
|
435
|
+
},
|
|
436
|
+
addKeyboardShortcuts() {
|
|
437
|
+
return {
|
|
438
|
+
"Mod-Shift-7": () => this.editor.commands.toggleOrderedList()
|
|
439
|
+
};
|
|
440
|
+
},
|
|
441
|
+
addInputRules() {
|
|
442
|
+
let t = k({
|
|
443
|
+
find: N,
|
|
444
|
+
type: this.type,
|
|
445
|
+
getAttributes: (e) => ({ start: +e[1] }),
|
|
446
|
+
joinPredicate: (e, s) => s.childCount + s.attrs.start === +e[1]
|
|
447
|
+
});
|
|
448
|
+
return (this.options.keepMarks || this.options.keepAttributes) && (t = k({
|
|
449
|
+
find: N,
|
|
450
|
+
type: this.type,
|
|
451
|
+
keepMarks: this.options.keepMarks,
|
|
452
|
+
keepAttributes: this.options.keepAttributes,
|
|
453
|
+
getAttributes: (e) => ({ start: +e[1], ...this.editor.getAttributes(C) }),
|
|
454
|
+
joinPredicate: (e, s) => s.childCount + s.attrs.start === +e[1],
|
|
455
|
+
editor: this.editor
|
|
456
|
+
})), [t];
|
|
457
|
+
}
|
|
458
|
+
}), et = /^\s*(\[([( |x])?\])\s$/, st = L.create({
|
|
459
|
+
name: "taskItem",
|
|
460
|
+
addOptions() {
|
|
461
|
+
return {
|
|
462
|
+
nested: !1,
|
|
463
|
+
HTMLAttributes: {},
|
|
464
|
+
taskListTypeName: "taskList",
|
|
465
|
+
a11y: void 0
|
|
466
|
+
};
|
|
467
|
+
},
|
|
468
|
+
content() {
|
|
469
|
+
return this.options.nested ? "paragraph block*" : "paragraph+";
|
|
470
|
+
},
|
|
471
|
+
defining: !0,
|
|
472
|
+
addAttributes() {
|
|
473
|
+
return {
|
|
474
|
+
checked: {
|
|
475
|
+
default: !1,
|
|
476
|
+
keepOnSplit: !1,
|
|
477
|
+
parseHTML: (t) => {
|
|
478
|
+
const e = t.getAttribute("data-checked");
|
|
479
|
+
return e === "" || e === "true";
|
|
480
|
+
},
|
|
481
|
+
renderHTML: (t) => ({
|
|
482
|
+
"data-checked": t.checked
|
|
483
|
+
})
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
},
|
|
487
|
+
parseHTML() {
|
|
488
|
+
return [
|
|
489
|
+
{
|
|
490
|
+
tag: `li[data-type="${this.name}"]`,
|
|
491
|
+
priority: 51
|
|
492
|
+
}
|
|
493
|
+
];
|
|
494
|
+
},
|
|
495
|
+
renderHTML({ node: t, HTMLAttributes: e }) {
|
|
496
|
+
return [
|
|
497
|
+
"li",
|
|
498
|
+
m(this.options.HTMLAttributes, e, {
|
|
499
|
+
"data-type": this.name
|
|
500
|
+
}),
|
|
501
|
+
[
|
|
502
|
+
"label",
|
|
503
|
+
[
|
|
504
|
+
"input",
|
|
505
|
+
{
|
|
506
|
+
type: "checkbox",
|
|
507
|
+
checked: t.attrs.checked ? "checked" : null
|
|
508
|
+
}
|
|
509
|
+
],
|
|
510
|
+
["span"]
|
|
511
|
+
],
|
|
512
|
+
["div", 0]
|
|
513
|
+
];
|
|
514
|
+
},
|
|
515
|
+
parseMarkdown: (t, e) => {
|
|
516
|
+
const s = [];
|
|
517
|
+
if (t.tokens && t.tokens.length > 0 ? s.push(e.createNode("paragraph", {}, e.parseInline(t.tokens))) : t.text ? s.push(e.createNode("paragraph", {}, [e.createNode("text", { text: t.text })])) : s.push(e.createNode("paragraph", {}, [])), t.nestedTokens && t.nestedTokens.length > 0) {
|
|
518
|
+
const n = e.parseChildren(t.nestedTokens);
|
|
519
|
+
s.push(...n);
|
|
520
|
+
}
|
|
521
|
+
return e.createNode("taskItem", { checked: t.checked || !1 }, s);
|
|
522
|
+
},
|
|
523
|
+
renderMarkdown: (t, e) => {
|
|
524
|
+
var s;
|
|
525
|
+
const r = `- [${(s = t.attrs) != null && s.checked ? "x" : " "}] `;
|
|
526
|
+
return E(t, e, r);
|
|
527
|
+
},
|
|
528
|
+
addKeyboardShortcuts() {
|
|
529
|
+
const t = {
|
|
530
|
+
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
531
|
+
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
532
|
+
};
|
|
533
|
+
return this.options.nested ? {
|
|
534
|
+
...t,
|
|
535
|
+
Tab: () => this.editor.commands.sinkListItem(this.name)
|
|
536
|
+
} : t;
|
|
537
|
+
},
|
|
538
|
+
addNodeView() {
|
|
539
|
+
return ({ node: t, HTMLAttributes: e, getPos: s, editor: n }) => {
|
|
540
|
+
const r = document.createElement("li"), i = document.createElement("label"), l = document.createElement("span"), a = document.createElement("input"), p = document.createElement("div"), h = (o) => {
|
|
541
|
+
var d, c;
|
|
542
|
+
a.ariaLabel = ((c = (d = this.options.a11y) == null ? void 0 : d.checkboxLabel) == null ? void 0 : c.call(d, o, a.checked)) || `Task item checkbox for ${o.textContent || "empty task item"}`;
|
|
543
|
+
};
|
|
544
|
+
return h(t), i.contentEditable = "false", a.type = "checkbox", a.addEventListener("mousedown", (o) => o.preventDefault()), a.addEventListener("change", (o) => {
|
|
545
|
+
if (!n.isEditable && !this.options.onReadOnlyChecked) {
|
|
546
|
+
a.checked = !a.checked;
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
const { checked: d } = o.target;
|
|
550
|
+
n.isEditable && typeof s == "function" && n.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: c }) => {
|
|
551
|
+
const u = s();
|
|
552
|
+
if (typeof u != "number")
|
|
553
|
+
return !1;
|
|
554
|
+
const f = c.doc.nodeAt(u);
|
|
555
|
+
return c.setNodeMarkup(u, void 0, {
|
|
556
|
+
...f == null ? void 0 : f.attrs,
|
|
557
|
+
checked: d
|
|
558
|
+
}), !0;
|
|
559
|
+
}).run(), !n.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(t, d) || (a.checked = !a.checked));
|
|
560
|
+
}), Object.entries(this.options.HTMLAttributes).forEach(([o, d]) => {
|
|
561
|
+
r.setAttribute(o, d);
|
|
562
|
+
}), r.dataset.checked = t.attrs.checked, a.checked = t.attrs.checked, i.append(a, l), r.append(i, p), Object.entries(e).forEach(([o, d]) => {
|
|
563
|
+
r.setAttribute(o, d);
|
|
564
|
+
}), {
|
|
565
|
+
dom: r,
|
|
566
|
+
contentDOM: p,
|
|
567
|
+
update: (o) => o.type !== this.type ? !1 : (r.dataset.checked = o.attrs.checked, a.checked = o.attrs.checked, h(o), !0)
|
|
568
|
+
};
|
|
569
|
+
};
|
|
570
|
+
},
|
|
571
|
+
addInputRules() {
|
|
572
|
+
return [
|
|
573
|
+
k({
|
|
574
|
+
find: et,
|
|
575
|
+
type: this.type,
|
|
576
|
+
getAttributes: (t) => ({
|
|
577
|
+
checked: t[t.length - 1] === "x"
|
|
578
|
+
})
|
|
579
|
+
})
|
|
580
|
+
];
|
|
581
|
+
}
|
|
582
|
+
}), nt = L.create({
|
|
583
|
+
name: "taskList",
|
|
584
|
+
addOptions() {
|
|
585
|
+
return {
|
|
586
|
+
itemTypeName: "taskItem",
|
|
587
|
+
HTMLAttributes: {}
|
|
588
|
+
};
|
|
589
|
+
},
|
|
590
|
+
group: "block list",
|
|
591
|
+
content() {
|
|
592
|
+
return `${this.options.itemTypeName}+`;
|
|
593
|
+
},
|
|
594
|
+
parseHTML() {
|
|
595
|
+
return [
|
|
596
|
+
{
|
|
597
|
+
tag: `ul[data-type="${this.name}"]`,
|
|
598
|
+
priority: 51
|
|
599
|
+
}
|
|
600
|
+
];
|
|
601
|
+
},
|
|
602
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
603
|
+
return ["ul", m(this.options.HTMLAttributes, t, { "data-type": this.name }), 0];
|
|
604
|
+
},
|
|
605
|
+
parseMarkdown: (t, e) => e.createNode("taskList", {}, e.parseChildren(t.items || [])),
|
|
606
|
+
renderMarkdown: (t, e) => t.content ? e.renderChildren(t.content, `
|
|
607
|
+
`) : "",
|
|
608
|
+
markdownTokenizer: {
|
|
609
|
+
name: "taskList",
|
|
610
|
+
level: "block",
|
|
611
|
+
start(t) {
|
|
612
|
+
var e;
|
|
613
|
+
const s = (e = t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)) == null ? void 0 : e.index;
|
|
614
|
+
return s !== void 0 ? s : -1;
|
|
615
|
+
},
|
|
616
|
+
tokenize(t, e, s) {
|
|
617
|
+
const n = (i) => {
|
|
618
|
+
const l = M(
|
|
619
|
+
i,
|
|
620
|
+
{
|
|
621
|
+
itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
|
|
622
|
+
extractItemData: (a) => ({
|
|
623
|
+
indentLevel: a[1].length,
|
|
624
|
+
mainContent: a[4],
|
|
625
|
+
checked: a[3].toLowerCase() === "x"
|
|
626
|
+
}),
|
|
627
|
+
createToken: (a, p) => ({
|
|
628
|
+
type: "taskItem",
|
|
629
|
+
raw: "",
|
|
630
|
+
mainContent: a.mainContent,
|
|
631
|
+
indentLevel: a.indentLevel,
|
|
632
|
+
checked: a.checked,
|
|
633
|
+
text: a.mainContent,
|
|
634
|
+
tokens: s.inlineTokens(a.mainContent),
|
|
635
|
+
nestedTokens: p
|
|
636
|
+
}),
|
|
637
|
+
// Allow recursive nesting
|
|
638
|
+
customNestedParser: n
|
|
639
|
+
},
|
|
640
|
+
s
|
|
641
|
+
);
|
|
642
|
+
return l ? [
|
|
643
|
+
{
|
|
644
|
+
type: "taskList",
|
|
645
|
+
raw: l.raw,
|
|
646
|
+
items: l.items
|
|
647
|
+
}
|
|
648
|
+
] : s.blockTokens(i);
|
|
649
|
+
}, r = M(
|
|
650
|
+
t,
|
|
651
|
+
{
|
|
652
|
+
itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
|
|
653
|
+
extractItemData: (i) => ({
|
|
654
|
+
indentLevel: i[1].length,
|
|
655
|
+
mainContent: i[4],
|
|
656
|
+
checked: i[3].toLowerCase() === "x"
|
|
657
|
+
}),
|
|
658
|
+
createToken: (i, l) => ({
|
|
659
|
+
type: "taskItem",
|
|
660
|
+
raw: "",
|
|
661
|
+
mainContent: i.mainContent,
|
|
662
|
+
indentLevel: i.indentLevel,
|
|
663
|
+
checked: i.checked,
|
|
664
|
+
text: i.mainContent,
|
|
665
|
+
tokens: s.inlineTokens(i.mainContent),
|
|
666
|
+
nestedTokens: l
|
|
667
|
+
}),
|
|
668
|
+
// Use the recursive parser for nested content
|
|
669
|
+
customNestedParser: n
|
|
670
|
+
},
|
|
671
|
+
s
|
|
672
|
+
);
|
|
673
|
+
if (r)
|
|
674
|
+
return {
|
|
675
|
+
type: "taskList",
|
|
676
|
+
raw: r.raw,
|
|
677
|
+
items: r.items
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
},
|
|
681
|
+
markdownOptions: {
|
|
682
|
+
indentsContent: !0
|
|
683
|
+
},
|
|
684
|
+
addCommands() {
|
|
685
|
+
return {
|
|
686
|
+
toggleTaskList: () => ({ commands: t }) => t.toggleList(this.name, this.options.itemTypeName)
|
|
687
|
+
};
|
|
688
|
+
},
|
|
689
|
+
addKeyboardShortcuts() {
|
|
690
|
+
return {
|
|
691
|
+
"Mod-Shift-9": () => this.editor.commands.toggleTaskList()
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
H.create({
|
|
696
|
+
name: "listKit",
|
|
697
|
+
addExtensions() {
|
|
698
|
+
const t = [];
|
|
699
|
+
return this.options.bulletList !== !1 && t.push(F.configure(this.options.bulletList)), this.options.listItem !== !1 && t.push(G.configure(this.options.listItem)), this.options.listKeymap !== !1 && t.push(Y.configure(this.options.listKeymap)), this.options.orderedList !== !1 && t.push(tt.configure(this.options.orderedList)), this.options.taskItem !== !1 && t.push(st.configure(this.options.taskItem)), this.options.taskList !== !1 && t.push(nt.configure(this.options.taskList)), t;
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
export {
|
|
703
|
+
F as B,
|
|
704
|
+
G as L,
|
|
705
|
+
tt as O,
|
|
706
|
+
nt as T,
|
|
707
|
+
st as a,
|
|
708
|
+
Y as b
|
|
709
|
+
};
|