reactjs-tiptap-editor 1.0.24 → 1.0.26
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-HYlhmRvw.js → ActionMenuButton-B4KDkZ0z.js} +1 -1
- package/lib/{ActionMenuButton-B8NhVw5m.cjs → ActionMenuButton-C3Cfeza9.cjs} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +25 -25
- package/lib/Blockquote.cjs +5 -5
- package/lib/Blockquote.js +1490 -53
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +3 -3
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +2 -2
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +222 -8
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +2 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +56 -39
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +8 -4
- 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 +2 -2
- package/lib/{Drawer-Was4hxYH.cjs → Drawer-D7E9kTca.cjs} +1 -1
- package/lib/{Drawer-CaXVhxo4.js → Drawer-DA0FLHs9.js} +20 -20
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +1644 -148
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +10 -10
- 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 +5 -5
- package/lib/FormatPainter.cjs +1 -0
- package/lib/FormatPainter.js +133 -0
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +15 -11
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +38 -32
- package/lib/History.cjs +7 -1
- package/lib/History.js +519 -478
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +2 -2
- package/lib/{Iframe-Bp986fj0.js → Iframe-DZ3r3QzK.js} +7 -7
- package/lib/{Iframe-BI0sq6pd.cjs → Iframe-OMVd0xa_.cjs} +1 -1
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +3 -3
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +6 -6
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +35 -35
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +15 -15
- package/lib/{Indent-FvM52kjA.cjs → Indent-QgCoonRk.cjs} +1 -1
- package/lib/{Indent-E6B8DkyN.js → Indent-kI4G-clX.js} +2 -2
- 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-pzwyyiFJ.js → Katex-BPbXjcZQ.js} +6 -7
- package/lib/Katex-CUofhjB5.cjs +4 -0
- 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-OjN4F2rM.js → LinkEditBlock-BYWwH2_x.js} +59 -32
- package/lib/{LinkEditBlock-Cmkmp2fW.cjs → LinkEditBlock-Z7RRurvx.cjs} +2 -2
- package/lib/MarkdownPaste.cjs +1 -1
- package/lib/MarkdownPaste.js +1 -1
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +9 -5
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +61 -62
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +5 -5
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +2 -2
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +14 -14
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +7 -7
- package/lib/{SlashCommandNodeView-o323V8li.js → SlashCommandNodeView-C0l3Fb_3.js} +10 -10
- package/lib/{SlashCommandNodeView-DarAytvt.cjs → SlashCommandNodeView-DPPmYEjC.cjs} +1 -1
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +2 -2
- package/lib/{Table-Clnz-i4l.cjs → Table-D5G3rfwb.cjs} +5 -5
- package/lib/{Table-CC9uNHPL.js → Table-DwseaFSD.js} +115 -97
- 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 +11 -11
- 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-BVnXL8we.js → Twitter-DP26Lkn8.js} +195 -195
- package/lib/Twitter-q4ZGZL0i.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +5 -5
- package/lib/bubble.cjs +6 -6
- package/lib/bubble.js +2783 -2137
- package/lib/{clsx-D6gYQn3o.cjs → clsx-DRbkQ4T7.cjs} +1 -1
- package/lib/{clsx-0OU6n9va.js → clsx-_bq4MQQ7.js} +14 -4
- package/lib/components/Bubble/RichTextBubbleCallout.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleCodeBlock.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleColumns.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleDrawer.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleExcalidraw.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleIframe.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleKatex.d.ts +2 -1
- package/lib/components/Bubble/RichTextBubbleLink.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleMedia.d.ts +3 -3
- package/lib/components/Bubble/RichTextBubbleMenuDragHandle.d.ts +2 -1
- package/lib/components/Bubble/RichTextBubbleMermaid.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleTable.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleText.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleTwitter.d.ts +1 -1
- package/lib/components/ColorPicker.d.ts +1 -1
- package/lib/components/ReactBus.d.ts +1 -1
- package/lib/components/RichTextProvider.d.ts +1 -1
- package/lib/components/SlashDialogTrigger/RenderDialogUploadImage.d.ts +1 -1
- package/lib/components/SlashDialogTrigger/RenderDialogUploadVideo.d.ts +1 -1
- package/lib/components/SlashDialogTrigger/SlashDialogTrigger.d.ts +2 -1
- package/lib/components/icons/Activity.d.ts +2 -1
- package/lib/components/icons/Animas.d.ts +2 -1
- package/lib/components/icons/AspectRatio.d.ts +1 -1
- package/lib/components/icons/Blockquote.d.ts +1 -1
- package/lib/components/icons/CodeView.d.ts +1 -1
- package/lib/components/icons/ColumnAddLeft.d.ts +1 -1
- package/lib/components/icons/ColumnAddRight.d.ts +1 -1
- package/lib/components/icons/DeleteColumn.d.ts +1 -1
- package/lib/components/icons/DeleteRow.d.ts +1 -1
- package/lib/components/icons/Direction.d.ts +1 -1
- package/lib/components/icons/Excalidraw.d.ts +1 -1
- package/lib/components/icons/ExportPdf.d.ts +1 -1
- package/lib/components/icons/ExportWord.d.ts +2 -1
- package/lib/components/icons/FileWordOutline.d.ts +1 -1
- package/lib/components/icons/Flag.d.ts +2 -1
- package/lib/components/icons/Food.d.ts +2 -1
- package/lib/components/icons/GIfIcon.d.ts +1 -1
- package/lib/components/icons/Html.d.ts +1 -1
- package/lib/components/icons/Icon.d.ts +1 -1
- package/lib/components/icons/IconColorFill.d.ts +1 -1
- package/lib/components/icons/IconHighlightFill.d.ts +1 -1
- package/lib/components/icons/ImportWord.d.ts +2 -1
- package/lib/components/icons/LeftToRight.d.ts +1 -1
- package/lib/components/icons/LineHeight.d.ts +1 -1
- package/lib/components/icons/MenuDown.d.ts +1 -1
- package/lib/components/icons/Mermaid.d.ts +1 -1
- package/lib/components/icons/NoFill.d.ts +1 -1
- package/lib/components/icons/Object.d.ts +2 -1
- package/lib/components/icons/RightToLeft.d.ts +1 -1
- package/lib/components/icons/SizeL.d.ts +1 -1
- package/lib/components/icons/SizeM.d.ts +1 -1
- package/lib/components/icons/SizeS.d.ts +1 -1
- package/lib/components/icons/Symbol.d.ts +2 -1
- package/lib/components/icons/Travel.d.ts +2 -1
- package/lib/components/icons/Twitter.d.ts +1 -1
- package/lib/components/ui/dialog.d.ts +2 -2
- package/lib/components/ui/dropdown-menu.d.ts +1 -1
- package/lib/components/ui/emoji-picker.d.ts +4 -4
- package/lib/components/ui/toaster.d.ts +1 -1
- package/lib/{dropdown-menu-BW2M6saA.js → dropdown-menu-BKSX4gvT.js} +1 -1
- package/lib/{dropdown-menu-BIGvxqiu.cjs → dropdown-menu-CURWpB9o.cjs} +1 -1
- package/lib/extensions/Attachment/components/NodeViewAttachment/FileIcon.d.ts +1 -1
- package/lib/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.d.ts +1 -1
- package/lib/extensions/Attachment/components/RichTextAttachment.d.ts +1 -1
- package/lib/extensions/Blockquote/components/RichTextBlockquote.d.ts +1 -1
- package/lib/extensions/Bold/components/RichTextBold.d.ts +1 -1
- package/lib/extensions/BulletList/components/RichTextBulletList.d.ts +1 -1
- package/lib/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +1 -1
- package/lib/extensions/Callout/components/RichTextCallout.d.ts +1 -1
- package/lib/extensions/Clear/components/RichTextClear.d.ts +1 -1
- package/lib/extensions/Code/components/RichTextCode.d.ts +1 -1
- package/lib/extensions/CodeBlock/components/RichTextCodeBlock.d.ts +2 -1
- package/lib/extensions/CodeView/components/RichTextCodeView.d.ts +1 -1
- package/lib/extensions/Color/components/RichTextColor.d.ts +1 -1
- package/lib/extensions/Column/components/RichTextColumn.d.ts +1 -1
- package/lib/extensions/Drawer/components/ControlDrawer/ControlDrawer.d.ts +2 -1
- package/lib/extensions/Drawer/components/ControlDrawer/icon.d.ts +27 -27
- package/lib/extensions/Drawer/components/EditDrawerBlock.d.ts +1 -1
- package/lib/extensions/Drawer/components/NodeViewDrawer/NodeViewDrawer.d.ts +2 -1
- package/lib/extensions/Drawer/components/RichTextDrawer.d.ts +1 -1
- package/lib/extensions/Emoji/components/RichTextEmoji.d.ts +2 -1
- package/lib/extensions/Excalidraw/components/NodeViewExcalidraw/NodeViewExcalidraw.d.ts +2 -1
- package/lib/extensions/Excalidraw/components/RichTextExcalidraw.d.ts +1 -1
- package/lib/extensions/ExportPdf/components/RichTextExportPdf.d.ts +1 -1
- package/lib/extensions/ExportWord/components/RichTextExportWord.d.ts +1 -1
- package/lib/extensions/FontFamily/components/RichTextFontFamily.d.ts +1 -1
- package/lib/extensions/FontSize/components/RichTextFontSize.d.ts +1 -1
- package/lib/extensions/FormatPainter/FormatPainter.d.ts +17 -0
- package/lib/extensions/FormatPainter/components/RichTextFormatPainter.d.ts +1 -0
- package/lib/extensions/FormatPainter/index.d.ts +1 -0
- package/lib/extensions/Heading/components/RichTextHeading.d.ts +1 -1
- package/lib/extensions/Highlight/components/RichTextHighlight.d.ts +2 -1
- package/lib/extensions/History/components/RichTextHistory.d.ts +3 -2
- package/lib/extensions/HorizontalRule/components/RichTextHorizontalRule.d.ts +1 -1
- package/lib/extensions/Iframe/components/IframeNodeView.d.ts +1 -1
- package/lib/extensions/Iframe/components/RichTextIframe.d.ts +1 -1
- package/lib/extensions/Image/components/ImageCropper.d.ts +2 -1
- package/lib/extensions/Image/components/ImageView.d.ts +2 -1
- package/lib/extensions/Image/components/RichTextImage.d.ts +1 -1
- package/lib/extensions/ImageGif/components/ImageGifView.d.ts +2 -1
- package/lib/extensions/ImageGif/components/RichTextImageGif.d.ts +2 -1
- package/lib/extensions/ImportWord/components/RichTextImportWord.d.ts +1 -1
- package/lib/extensions/Indent/components/RichTextIndent.d.ts +1 -1
- package/lib/extensions/Italic/components/RichTextItalic.d.ts +1 -1
- package/lib/extensions/Katex/components/KatexWrapper.d.ts +1 -1
- package/lib/extensions/Katex/components/RichTextKatex.d.ts +1 -1
- package/lib/extensions/LineHeight/components/RichTextLightHeight.d.ts +1 -1
- package/lib/extensions/Link/components/LinkEditBlock.d.ts +1 -1
- package/lib/extensions/Link/components/LinkViewBlock.d.ts +2 -1
- package/lib/extensions/Link/components/RichTextLink.d.ts +1 -1
- package/lib/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid.d.ts +2 -1
- package/lib/extensions/Mermaid/components/RichTextMermaid.d.ts +1 -1
- package/lib/extensions/MoreMark/components/RichTextMoreMark.d.ts +1 -1
- package/lib/extensions/OrderedList/components/RichTextOrderedList.d.ts +1 -1
- package/lib/extensions/SearchAndReplace/components/RichTextSearchAndReplace.d.ts +1 -1
- package/lib/extensions/SlashCommand/components/SlashCommandList.d.ts +1 -1
- package/lib/extensions/Strike/components/RichTextStrike.d.ts +1 -1
- package/lib/extensions/Table/components/CreateTablePopover.d.ts +2 -1
- package/lib/extensions/Table/components/RichTextTable.d.ts +2 -1
- package/lib/extensions/TaskList/components/RichTextTaskList.d.ts +1 -1
- package/lib/extensions/TextAlign/components/RichTextAlign.d.ts +1 -1
- package/lib/extensions/TextDirection/components/RichTextTextDirection.d.ts +1 -1
- package/lib/extensions/TextUnderline/components/RichTextUnderline.d.ts +1 -1
- package/lib/extensions/Twitter/components/FormEditLinkTwitter.d.ts +1 -1
- package/lib/extensions/Twitter/components/NodeViewTweet.d.ts +1 -1
- package/lib/extensions/Twitter/components/RichTextTwitter.d.ts +1 -1
- package/lib/extensions/Video/components/RichTextVideo.d.ts +1 -1
- package/lib/index-BGfIcDCQ.cjs +26 -0
- package/lib/index-BaR0Brts.js +1115 -0
- package/lib/index-BgNKVyMW.cjs +2 -0
- package/lib/index-BpLw6ebr.cjs +1 -0
- package/lib/{index-BrsJsbds.js → index-C52cuQ_Y.js} +1503 -1352
- package/lib/index-CDw4Eszh.cjs +12 -0
- package/lib/{index-CUvjYuRp.cjs → index-CHVV5iY-.cjs} +1 -1
- package/lib/{index-zw-Kd38i.js → index-CJMI7Fjf.js} +1 -1
- package/lib/{index-D-Ouz0vF.js → index-DQy9iBzV.js} +1 -1
- package/lib/index-Dbm_Mans.js +1756 -0
- package/lib/{index-oj858lQO.js → index-DtyAGMbq.js} +208 -208
- package/lib/{index-BblvcbTH.js → index-Dx-Dh7KS.js} +1464 -1348
- package/lib/{index-BAb_UADw.cjs → index-SEMQrdk2.cjs} +1 -1
- package/lib/index-aujjnfSJ.cjs +1 -0
- package/lib/index.cjs +1 -1
- package/lib/index.js +12 -12
- package/lib/{jsx-runtime-CT7Pcg-t.js → jsx-runtime-DE8oVoME.js} +3 -1
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +1 -1
- package/lib/locales/index.d.ts +1 -1
- package/lib/{popover-BIVHT1W9.js → popover-BB-ZDnqk.js} +1 -1
- package/lib/{popover-DoSfJsFS.cjs → popover-CrywEkBR.cjs} +1 -1
- package/lib/{renderNodeView-D--fDFov.cjs → renderNodeView-5h3-p80E.cjs} +1 -1
- package/lib/{renderNodeView-CfWJK4rG.js → renderNodeView-DoKZ4GYy.js} +2 -2
- package/lib/{separator-SRbPfmGa.cjs → separator-BGO9AZp4.cjs} +1 -1
- package/lib/{separator-b-qOPJmp.js → separator-DuuOJRQd.js} +21 -21
- package/lib/store/EditorEditableReactive.d.ts +1 -1
- package/lib/store/ThemeColorReactive.d.ts +1 -1
- package/lib/style.css +1 -1
- package/lib/types.d.ts +2 -2
- package/lib/{updatePosition-DGPtRfWN.cjs → updatePosition-B1oRJE1x.cjs} +1 -1
- package/lib/{updatePosition-BwzAsiY0.js → updatePosition-CFTYKYNJ.js} +2 -2
- package/package.json +79 -66
- package/lib/Callout-B-S2f0Qo.cjs +0 -1
- package/lib/Callout-CF7Y9yJ7.js +0 -340
- package/lib/Katex-DP6EjdKz.cjs +0 -4
- package/lib/Twitter-0kmrijjL.cjs +0 -1
- package/lib/index-BF3EVCB1.cjs +0 -2
- package/lib/index-Bcj8cyOO.cjs +0 -24
- package/lib/index-CGjT-a9h.js +0 -1377
- package/lib/index-CPTpXLfX.cjs +0 -11
- package/lib/index-CWw4s87s.cjs +0 -1
- package/lib/index-Cal5SPfB.js +0 -779
- package/lib/index-deubsx3z.cjs +0 -1
- package/lib/textarea-CpxXPky_.js +0 -20
- package/lib/textarea-DbGw9oCU.cjs +0 -1
|
@@ -0,0 +1,1115 @@
|
|
|
1
|
+
import { N as b, w as g, m as v, r as z, E as _, a as Q, p as O, i as w, b as tt, c as et, d as nt, e as V } from "./index-Dx-Dh7KS.js";
|
|
2
|
+
import { Fragment as st } from "@tiptap/pm/model";
|
|
3
|
+
import { Plugin as rt } from "@tiptap/pm/state";
|
|
4
|
+
var it = Object.defineProperty, at = (t, e) => {
|
|
5
|
+
for (var n in e)
|
|
6
|
+
it(t, n, { get: e[n], enumerable: !0 });
|
|
7
|
+
}, ot = "listItem", P = "textStyle", H = /^\s*([-+*])\s$/, ct = b.create({
|
|
8
|
+
name: "bulletList",
|
|
9
|
+
addOptions() {
|
|
10
|
+
return {
|
|
11
|
+
itemTypeName: "listItem",
|
|
12
|
+
HTMLAttributes: {},
|
|
13
|
+
keepMarks: !1,
|
|
14
|
+
keepAttributes: !1
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
group: "block list",
|
|
18
|
+
content() {
|
|
19
|
+
return `${this.options.itemTypeName}+`;
|
|
20
|
+
},
|
|
21
|
+
parseHTML() {
|
|
22
|
+
return [{ tag: "ul" }];
|
|
23
|
+
},
|
|
24
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
25
|
+
return ["ul", v(this.options.HTMLAttributes, t), 0];
|
|
26
|
+
},
|
|
27
|
+
markdownTokenName: "list",
|
|
28
|
+
parseMarkdown: (t, e) => t.type !== "list" || t.ordered ? [] : {
|
|
29
|
+
type: "bulletList",
|
|
30
|
+
content: t.items ? e.parseChildren(t.items) : []
|
|
31
|
+
},
|
|
32
|
+
renderMarkdown: (t, e) => t.content ? e.renderChildren(t.content, `
|
|
33
|
+
`) : "",
|
|
34
|
+
markdownOptions: {
|
|
35
|
+
indentsContent: !0
|
|
36
|
+
},
|
|
37
|
+
addCommands() {
|
|
38
|
+
return {
|
|
39
|
+
toggleBulletList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ot, this.editor.getAttributes(P)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
addKeyboardShortcuts() {
|
|
43
|
+
return {
|
|
44
|
+
"Mod-Shift-8": () => this.editor.commands.toggleBulletList()
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
addInputRules() {
|
|
48
|
+
let t = g({
|
|
49
|
+
find: H,
|
|
50
|
+
type: this.type
|
|
51
|
+
});
|
|
52
|
+
return (this.options.keepMarks || this.options.keepAttributes) && (t = g({
|
|
53
|
+
find: H,
|
|
54
|
+
type: this.type,
|
|
55
|
+
keepMarks: this.options.keepMarks,
|
|
56
|
+
keepAttributes: this.options.keepAttributes,
|
|
57
|
+
getAttributes: () => this.editor.getAttributes(P),
|
|
58
|
+
editor: this.editor
|
|
59
|
+
})), [t];
|
|
60
|
+
}
|
|
61
|
+
}), ut = (t, e, n) => {
|
|
62
|
+
const { selection: s } = t;
|
|
63
|
+
if (!s.empty)
|
|
64
|
+
return null;
|
|
65
|
+
const { $from: r } = s;
|
|
66
|
+
if (!r.parent.isTextblock || r.parentOffset !== r.parent.content.size)
|
|
67
|
+
return null;
|
|
68
|
+
let i = -1;
|
|
69
|
+
for (let d = r.depth; d > 0; d -= 1)
|
|
70
|
+
if (r.node(d).type.name === e) {
|
|
71
|
+
i = d;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
if (i < 0)
|
|
75
|
+
return null;
|
|
76
|
+
const o = r.node(i), a = r.index(i);
|
|
77
|
+
if (a + 1 >= o.childCount)
|
|
78
|
+
return null;
|
|
79
|
+
const u = o.child(a + 1);
|
|
80
|
+
if (!n.includes(u.type.name))
|
|
81
|
+
return null;
|
|
82
|
+
const h = t.schema.nodes[e];
|
|
83
|
+
let p = !1;
|
|
84
|
+
if (u.forEach((d) => {
|
|
85
|
+
d.type === h && d.childCount > 1 && (p = !0);
|
|
86
|
+
}), !p)
|
|
87
|
+
return null;
|
|
88
|
+
const c = t.doc.resolve(r.after()).nodeAfter;
|
|
89
|
+
if (!c || !n.includes(c.type.name))
|
|
90
|
+
return null;
|
|
91
|
+
const l = [];
|
|
92
|
+
return c.forEach((d) => {
|
|
93
|
+
l.push(d);
|
|
94
|
+
}), l.length === 0 ? null : {
|
|
95
|
+
listItemDepth: i,
|
|
96
|
+
nestedList: c,
|
|
97
|
+
nestedListPos: r.after(),
|
|
98
|
+
insertPos: r.after(i),
|
|
99
|
+
items: l
|
|
100
|
+
};
|
|
101
|
+
}, lt = (t, e, n, s) => {
|
|
102
|
+
const r = ut(t, n, s);
|
|
103
|
+
if (!r)
|
|
104
|
+
return !1;
|
|
105
|
+
const { selection: i } = t, { nestedList: o, nestedListPos: a, insertPos: u, items: h } = r, p = t.tr;
|
|
106
|
+
p.delete(a, a + o.nodeSize);
|
|
107
|
+
const c = p.mapping.map(u);
|
|
108
|
+
return p.insert(c, st.from(h)), p.setSelection(i.map(p.doc, p.mapping)), e && e(p), !0;
|
|
109
|
+
}, dt = (t, e, n) => lt(t.state, t.view.dispatch, e, n), X = (t, e) => _.create({
|
|
110
|
+
name: `${t}BranchingDeleteKeymap`,
|
|
111
|
+
priority: 101,
|
|
112
|
+
addKeyboardShortcuts() {
|
|
113
|
+
const n = () => dt(this.editor, t, e);
|
|
114
|
+
return {
|
|
115
|
+
Delete: n,
|
|
116
|
+
"Mod-Delete": n
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}), F = [
|
|
120
|
+
[1e3, "m"],
|
|
121
|
+
[900, "cm"],
|
|
122
|
+
[500, "d"],
|
|
123
|
+
[400, "cd"],
|
|
124
|
+
[100, "c"],
|
|
125
|
+
[90, "xc"],
|
|
126
|
+
[50, "l"],
|
|
127
|
+
[40, "xl"],
|
|
128
|
+
[10, "x"],
|
|
129
|
+
[9, "ix"],
|
|
130
|
+
[5, "v"],
|
|
131
|
+
[4, "iv"],
|
|
132
|
+
[1, "i"]
|
|
133
|
+
], T = "abcdefghijklmnopqrstuvwxyz", pt = "[a-zA-Z]{1,2}", S = String.raw`\d+|[ivxlcdmIVXLCDM]+|${pt}`;
|
|
134
|
+
function A(t) {
|
|
135
|
+
let e = t, n = "";
|
|
136
|
+
for (const [s, r] of F)
|
|
137
|
+
for (; e >= s; )
|
|
138
|
+
n += r, e -= s;
|
|
139
|
+
return n;
|
|
140
|
+
}
|
|
141
|
+
function $(t) {
|
|
142
|
+
return A(t).toUpperCase();
|
|
143
|
+
}
|
|
144
|
+
function U(t) {
|
|
145
|
+
const e = t.toLowerCase();
|
|
146
|
+
let n = 0, s = 0;
|
|
147
|
+
for (; n < e.length; ) {
|
|
148
|
+
let r = !1;
|
|
149
|
+
for (const [i, o] of F)
|
|
150
|
+
if (e.startsWith(o, n)) {
|
|
151
|
+
s += i, n += o.length, r = !0;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
if (!r)
|
|
155
|
+
return 0;
|
|
156
|
+
}
|
|
157
|
+
return s;
|
|
158
|
+
}
|
|
159
|
+
function ht(t) {
|
|
160
|
+
if (!/^[ivxlcdmIVXLCDM]+$/.test(t))
|
|
161
|
+
return !1;
|
|
162
|
+
const e = U(t);
|
|
163
|
+
return e <= 0 ? !1 : (t === t.toLowerCase() ? A(e) : $(e)) === t;
|
|
164
|
+
}
|
|
165
|
+
function ft(t) {
|
|
166
|
+
const e = t.toLowerCase();
|
|
167
|
+
if (e.length === 1)
|
|
168
|
+
return e.charCodeAt(0) - 97 + 1;
|
|
169
|
+
if (e.length === 2) {
|
|
170
|
+
const n = e.charCodeAt(0) - 97, s = e.charCodeAt(1) - 97;
|
|
171
|
+
return (n + 1) * 26 + s + 1;
|
|
172
|
+
}
|
|
173
|
+
return 0;
|
|
174
|
+
}
|
|
175
|
+
function I(t) {
|
|
176
|
+
if (t <= 26)
|
|
177
|
+
return T[t - 1];
|
|
178
|
+
const e = Math.floor((t - 1) / 26) - 1, n = (t - 1) % 26;
|
|
179
|
+
return e < 0 ? T[n] : T[e] + T[n];
|
|
180
|
+
}
|
|
181
|
+
function x(t) {
|
|
182
|
+
if (!(!t || /^\d+$/.test(t))) {
|
|
183
|
+
if (ht(t))
|
|
184
|
+
return t === t.toLowerCase() ? "i" : "I";
|
|
185
|
+
if (/^[a-z]{1,2}$/.test(t))
|
|
186
|
+
return "a";
|
|
187
|
+
if (/^[A-Z]{1,2}$/.test(t))
|
|
188
|
+
return "A";
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function R(t) {
|
|
192
|
+
if (/^\d+$/.test(t))
|
|
193
|
+
return parseInt(t, 10);
|
|
194
|
+
const e = x(t);
|
|
195
|
+
if (e === "i" || e === "I")
|
|
196
|
+
return U(t);
|
|
197
|
+
if (e === "a" || e === "A") {
|
|
198
|
+
const s = ft(t);
|
|
199
|
+
return s > 0 ? s : 1;
|
|
200
|
+
}
|
|
201
|
+
const n = parseInt(t, 10);
|
|
202
|
+
return Number.isNaN(n) ? 1 : n;
|
|
203
|
+
}
|
|
204
|
+
function mt(t, e) {
|
|
205
|
+
if (t === "numeric")
|
|
206
|
+
return String(e);
|
|
207
|
+
switch (t) {
|
|
208
|
+
case "a":
|
|
209
|
+
return I(e);
|
|
210
|
+
case "A":
|
|
211
|
+
return I(e).toUpperCase();
|
|
212
|
+
case "i":
|
|
213
|
+
return A(e);
|
|
214
|
+
case "I":
|
|
215
|
+
return $(e);
|
|
216
|
+
default:
|
|
217
|
+
return String(e);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function Lt(t) {
|
|
221
|
+
var e;
|
|
222
|
+
if (t.length === 0)
|
|
223
|
+
return !1;
|
|
224
|
+
const n = (e = x(t[0])) != null ? e : "numeric", s = R(t[0]);
|
|
225
|
+
if (s < 1)
|
|
226
|
+
return !1;
|
|
227
|
+
for (let r = 0; r < t.length; r++) {
|
|
228
|
+
const i = mt(n, s + r);
|
|
229
|
+
if (t[r] !== i)
|
|
230
|
+
return !1;
|
|
231
|
+
}
|
|
232
|
+
return !0;
|
|
233
|
+
}
|
|
234
|
+
function kt(t) {
|
|
235
|
+
return {
|
|
236
|
+
type: x(t),
|
|
237
|
+
start: R(t)
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function yt(t) {
|
|
241
|
+
const { type: e, start: n } = kt(t), s = {};
|
|
242
|
+
return e && (s.type = e), n !== 1 && (s.start = n), s;
|
|
243
|
+
}
|
|
244
|
+
function gt(t, e, n = ". ") {
|
|
245
|
+
const s = e + 1;
|
|
246
|
+
if (!t || t === "1")
|
|
247
|
+
return `${s}${n}`;
|
|
248
|
+
switch (t) {
|
|
249
|
+
case "a":
|
|
250
|
+
return `${I(s)}${n}`;
|
|
251
|
+
case "A":
|
|
252
|
+
return `${I(s).toUpperCase()}${n}`;
|
|
253
|
+
case "i":
|
|
254
|
+
return `${A(s)}${n}`;
|
|
255
|
+
case "I":
|
|
256
|
+
return `${$(s)}${n}`;
|
|
257
|
+
default:
|
|
258
|
+
return `${s}${n}`;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function bt(t) {
|
|
262
|
+
var e, n;
|
|
263
|
+
const s = (e = t.tokens) == null ? void 0 : e[0];
|
|
264
|
+
return !!(t.text && ((n = t.tokens) == null ? void 0 : n.length) === 1 && (s == null ? void 0 : s.type) === "list" && s.ordered && s.raw === t.text);
|
|
265
|
+
}
|
|
266
|
+
function vt(t, e) {
|
|
267
|
+
return e.tokenizeInline ? e.parseInline(e.tokenizeInline(t)) : e.parseInline([
|
|
268
|
+
{
|
|
269
|
+
type: "text",
|
|
270
|
+
raw: t,
|
|
271
|
+
text: t
|
|
272
|
+
}
|
|
273
|
+
]);
|
|
274
|
+
}
|
|
275
|
+
var Tt = b.create({
|
|
276
|
+
name: "listItem",
|
|
277
|
+
addOptions() {
|
|
278
|
+
return {
|
|
279
|
+
HTMLAttributes: {},
|
|
280
|
+
bulletListTypeName: "bulletList",
|
|
281
|
+
orderedListTypeName: "orderedList"
|
|
282
|
+
};
|
|
283
|
+
},
|
|
284
|
+
content: "paragraph block*",
|
|
285
|
+
defining: !0,
|
|
286
|
+
parseHTML() {
|
|
287
|
+
return [
|
|
288
|
+
{
|
|
289
|
+
tag: "li"
|
|
290
|
+
}
|
|
291
|
+
];
|
|
292
|
+
},
|
|
293
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
294
|
+
return ["li", v(this.options.HTMLAttributes, t), 0];
|
|
295
|
+
},
|
|
296
|
+
markdownTokenName: "list_item",
|
|
297
|
+
parseMarkdown: (t, e) => {
|
|
298
|
+
var n;
|
|
299
|
+
if (t.type !== "list_item")
|
|
300
|
+
return [];
|
|
301
|
+
const s = (n = e.parseBlockChildren) != null ? n : e.parseChildren;
|
|
302
|
+
let r = [];
|
|
303
|
+
if (t.tokens && t.tokens.length > 0) {
|
|
304
|
+
if (bt(t))
|
|
305
|
+
return {
|
|
306
|
+
type: "listItem",
|
|
307
|
+
content: [
|
|
308
|
+
{
|
|
309
|
+
type: "paragraph",
|
|
310
|
+
content: vt(t.text || "", e)
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
};
|
|
314
|
+
if (t.tokens.some((o) => o.type === "paragraph"))
|
|
315
|
+
r = s(t.tokens);
|
|
316
|
+
else {
|
|
317
|
+
const o = t.tokens[0];
|
|
318
|
+
if (o && o.type === "text" && o.tokens && o.tokens.length > 0) {
|
|
319
|
+
if (r = [
|
|
320
|
+
{
|
|
321
|
+
type: "paragraph",
|
|
322
|
+
content: e.parseInline(o.tokens)
|
|
323
|
+
}
|
|
324
|
+
], t.tokens.length > 1) {
|
|
325
|
+
const u = t.tokens.slice(1), h = s(u);
|
|
326
|
+
r.push(...h);
|
|
327
|
+
}
|
|
328
|
+
} else
|
|
329
|
+
r = s(t.tokens);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return r.length === 0 && (r = [
|
|
333
|
+
{
|
|
334
|
+
type: "paragraph",
|
|
335
|
+
content: []
|
|
336
|
+
}
|
|
337
|
+
]), {
|
|
338
|
+
type: "listItem",
|
|
339
|
+
content: r
|
|
340
|
+
};
|
|
341
|
+
},
|
|
342
|
+
renderMarkdown: (t, e, n) => z(
|
|
343
|
+
t,
|
|
344
|
+
e,
|
|
345
|
+
(s) => {
|
|
346
|
+
var r, i, o, a;
|
|
347
|
+
if (s.parentType === "bulletList")
|
|
348
|
+
return "- ";
|
|
349
|
+
if (s.parentType === "orderedList") {
|
|
350
|
+
const u = ((i = (r = s.meta) == null ? void 0 : r.parentAttrs) == null ? void 0 : i.start) || 1, h = (a = (o = s.meta) == null ? void 0 : o.parentAttrs) == null ? void 0 : a.type, p = u - 1 + (s.index || 0);
|
|
351
|
+
return gt(h, p, ". ");
|
|
352
|
+
}
|
|
353
|
+
return "- ";
|
|
354
|
+
},
|
|
355
|
+
n
|
|
356
|
+
),
|
|
357
|
+
addExtensions() {
|
|
358
|
+
return [
|
|
359
|
+
X(this.name, [
|
|
360
|
+
this.options.bulletListTypeName,
|
|
361
|
+
this.options.orderedListTypeName
|
|
362
|
+
])
|
|
363
|
+
];
|
|
364
|
+
},
|
|
365
|
+
addKeyboardShortcuts() {
|
|
366
|
+
return {
|
|
367
|
+
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
368
|
+
Tab: () => this.editor.commands.sinkListItem(this.name),
|
|
369
|
+
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
}), It = {};
|
|
373
|
+
at(It, {
|
|
374
|
+
findListItemPos: () => M,
|
|
375
|
+
getNextListDepth: () => D,
|
|
376
|
+
handleBackspace: () => C,
|
|
377
|
+
handleDelete: () => E,
|
|
378
|
+
hasListBefore: () => W,
|
|
379
|
+
hasListItemAfter: () => At,
|
|
380
|
+
hasListItemBefore: () => xt,
|
|
381
|
+
listItemHasSubList: () => Mt,
|
|
382
|
+
nextListIsDeeper: () => q,
|
|
383
|
+
nextListIsHigher: () => G
|
|
384
|
+
});
|
|
385
|
+
var M = (t, e) => {
|
|
386
|
+
const { $from: n } = e.selection, s = V(t, e.schema);
|
|
387
|
+
let r = null, i = n.depth, o = n.pos, a = null;
|
|
388
|
+
for (; i > 0 && a === null; )
|
|
389
|
+
r = n.node(i), r.type === s ? a = i : (i -= 1, o -= 1);
|
|
390
|
+
return a === null ? null : { $pos: e.doc.resolve(o), depth: a };
|
|
391
|
+
}, D = (t, e) => {
|
|
392
|
+
const n = M(t, e);
|
|
393
|
+
if (!n)
|
|
394
|
+
return !1;
|
|
395
|
+
const [, s] = nt(e, t, n.$pos.pos + 4);
|
|
396
|
+
return s;
|
|
397
|
+
}, W = (t, e, n) => {
|
|
398
|
+
const { $anchor: s } = t.selection, r = Math.max(0, s.pos - 2), i = t.doc.resolve(r).node();
|
|
399
|
+
return !(!i || !n.includes(i.type.name));
|
|
400
|
+
}, C = (t, e, n) => {
|
|
401
|
+
if (t.commands.undoInputRule())
|
|
402
|
+
return !0;
|
|
403
|
+
if (t.state.selection.from !== t.state.selection.to)
|
|
404
|
+
return !1;
|
|
405
|
+
if (!w(t.state, e) && W(t.state, e, n)) {
|
|
406
|
+
const { $anchor: s } = t.state.selection, r = t.state.doc.resolve(s.before() - 1), i = [];
|
|
407
|
+
r.node().descendants((u, h) => {
|
|
408
|
+
u.type.name === e && i.push({ node: u, pos: h });
|
|
409
|
+
});
|
|
410
|
+
const o = i.at(-1);
|
|
411
|
+
if (!o)
|
|
412
|
+
return !1;
|
|
413
|
+
const a = t.state.doc.resolve(r.start() + o.pos + 1);
|
|
414
|
+
return t.chain().cut({ from: s.start() - 1, to: s.end() + 1 }, a.end()).joinForward().run();
|
|
415
|
+
}
|
|
416
|
+
return !w(t.state, e) || !tt(t.state) ? !1 : t.chain().liftListItem(e).run();
|
|
417
|
+
}, q = (t, e) => {
|
|
418
|
+
const n = D(t, e), s = M(t, e);
|
|
419
|
+
return !s || !n ? !1 : n > s.depth;
|
|
420
|
+
}, G = (t, e) => {
|
|
421
|
+
const n = D(t, e), s = M(t, e);
|
|
422
|
+
return !s || !n ? !1 : n < s.depth;
|
|
423
|
+
}, E = (t, e) => {
|
|
424
|
+
if (!w(t.state, e) || !et(t.state, e))
|
|
425
|
+
return !1;
|
|
426
|
+
const { selection: n } = t.state, { $from: s, $to: r } = n;
|
|
427
|
+
return !n.empty && s.sameParent(r) ? !1 : q(e, t.state) ? t.chain().focus(t.state.selection.from + 4).lift(e).joinBackward().run() : G(e, t.state) ? t.chain().joinForward().joinBackward().run() : t.commands.joinItemForward();
|
|
428
|
+
}, At = (t, e) => {
|
|
429
|
+
var n;
|
|
430
|
+
const { $anchor: s } = e.selection, r = e.doc.resolve(s.pos - s.parentOffset - 2);
|
|
431
|
+
return !(r.index() === r.parent.childCount - 1 || ((n = r.nodeAfter) == null ? void 0 : n.type.name) !== t);
|
|
432
|
+
}, xt = (t, e) => {
|
|
433
|
+
var n;
|
|
434
|
+
const { $anchor: s } = e.selection, r = e.doc.resolve(s.pos - 2);
|
|
435
|
+
return !(r.index() === 0 || ((n = r.nodeBefore) == null ? void 0 : n.type.name) !== t);
|
|
436
|
+
}, Mt = (t, e, n) => {
|
|
437
|
+
if (!n)
|
|
438
|
+
return !1;
|
|
439
|
+
const s = V(t, e.schema);
|
|
440
|
+
let r = !1;
|
|
441
|
+
return n.descendants((i) => {
|
|
442
|
+
i.type === s && (r = !0);
|
|
443
|
+
}), r;
|
|
444
|
+
}, wt = _.create({
|
|
445
|
+
name: "listKeymap",
|
|
446
|
+
addOptions() {
|
|
447
|
+
return {
|
|
448
|
+
listTypes: [
|
|
449
|
+
{
|
|
450
|
+
itemName: "listItem",
|
|
451
|
+
wrapperNames: ["bulletList", "orderedList"]
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
itemName: "taskItem",
|
|
455
|
+
wrapperNames: ["taskList"]
|
|
456
|
+
}
|
|
457
|
+
]
|
|
458
|
+
};
|
|
459
|
+
},
|
|
460
|
+
addKeyboardShortcuts() {
|
|
461
|
+
return {
|
|
462
|
+
Delete: ({ editor: t }) => {
|
|
463
|
+
let e = !1;
|
|
464
|
+
return this.options.listTypes.forEach(({ itemName: n }) => {
|
|
465
|
+
t.state.schema.nodes[n] !== void 0 && E(t, n) && (e = !0);
|
|
466
|
+
}), e;
|
|
467
|
+
},
|
|
468
|
+
"Mod-Delete": ({ editor: t }) => {
|
|
469
|
+
let e = !1;
|
|
470
|
+
return this.options.listTypes.forEach(({ itemName: n }) => {
|
|
471
|
+
t.state.schema.nodes[n] !== void 0 && E(t, n) && (e = !0);
|
|
472
|
+
}), e;
|
|
473
|
+
},
|
|
474
|
+
Backspace: ({ editor: t }) => {
|
|
475
|
+
let e = !1;
|
|
476
|
+
return this.options.listTypes.forEach(({ itemName: n, wrapperNames: s }) => {
|
|
477
|
+
t.state.schema.nodes[n] !== void 0 && C(t, n, s) && (e = !0);
|
|
478
|
+
}), e;
|
|
479
|
+
},
|
|
480
|
+
"Mod-Backspace": ({ editor: t }) => {
|
|
481
|
+
let e = !1;
|
|
482
|
+
return this.options.listTypes.forEach(({ itemName: n, wrapperNames: s }) => {
|
|
483
|
+
t.state.schema.nodes[n] !== void 0 && C(t, n, s) && (e = !0);
|
|
484
|
+
}), e;
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
}), N = new RegExp(
|
|
489
|
+
`^(\\s*)(${S})([.)])\\s+(.*)$`
|
|
490
|
+
), Ct = new RegExp(
|
|
491
|
+
`^(\\s*)(${S})([.)])\\s+`
|
|
492
|
+
), Et = /^\s/;
|
|
493
|
+
function Nt(t) {
|
|
494
|
+
return N.test(t.trimStart());
|
|
495
|
+
}
|
|
496
|
+
function _t(t) {
|
|
497
|
+
const e = t.trimStart();
|
|
498
|
+
return (
|
|
499
|
+
// oxlint-disable-next-line prefer-string-starts-ends-with
|
|
500
|
+
/^[-+*]\s+/.test(e) || Nt(e) || // oxlint-disable-next-line prefer-string-starts-ends-with
|
|
501
|
+
/^>\s?/.test(e) || // oxlint-disable-next-line prefer-string-starts-ends-with
|
|
502
|
+
/^```/.test(e) || // oxlint-disable-next-line prefer-string-starts-ends-with
|
|
503
|
+
/^~~~/.test(e)
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
function St(t) {
|
|
507
|
+
const e = [], n = [];
|
|
508
|
+
let s = !1;
|
|
509
|
+
return t.forEach((r) => {
|
|
510
|
+
if (s) {
|
|
511
|
+
n.push(r);
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
if (r.trim() === "") {
|
|
515
|
+
s = !0, n.push(r);
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
if (e.length > 0 && _t(r)) {
|
|
519
|
+
s = !0, n.push(r);
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
e.push(r);
|
|
523
|
+
}), {
|
|
524
|
+
paragraphLines: e,
|
|
525
|
+
blockLines: n
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
function $t(t) {
|
|
529
|
+
const e = [];
|
|
530
|
+
let n = 0, s = 0;
|
|
531
|
+
for (; n < t.length; ) {
|
|
532
|
+
const r = t[n], i = r.match(N);
|
|
533
|
+
if (!i)
|
|
534
|
+
break;
|
|
535
|
+
const [, o, a, u, h] = i, p = o.length, c = parseInt(a, 10), l = isNaN(c) ? x(a) : void 0, d = isNaN(c) ? R(a) : c, L = [h];
|
|
536
|
+
let f = n + 1;
|
|
537
|
+
const m = [r];
|
|
538
|
+
let y = !1;
|
|
539
|
+
for (; f < t.length; ) {
|
|
540
|
+
const k = t[f];
|
|
541
|
+
if (k.match(N))
|
|
542
|
+
break;
|
|
543
|
+
if (k.trim() === "")
|
|
544
|
+
m.push(k), L.push(""), y = !0, f += 1;
|
|
545
|
+
else if (k.match(Et)) {
|
|
546
|
+
const J = k.length - k.trimStart().length, Y = p + a.length + 1;
|
|
547
|
+
m.push(k), L.push(k.slice(Math.min(J, Y))), f += 1;
|
|
548
|
+
} else {
|
|
549
|
+
if (y)
|
|
550
|
+
break;
|
|
551
|
+
m.push(k), L.push(k), f += 1;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
e.push({
|
|
555
|
+
indent: p,
|
|
556
|
+
number: d,
|
|
557
|
+
type: l,
|
|
558
|
+
content: L.join(`
|
|
559
|
+
`).trim(),
|
|
560
|
+
contentLines: L,
|
|
561
|
+
raw: m.join(`
|
|
562
|
+
`)
|
|
563
|
+
}), s = f, n = f;
|
|
564
|
+
}
|
|
565
|
+
return [e, s];
|
|
566
|
+
}
|
|
567
|
+
var Rt = new RegExp(
|
|
568
|
+
`^(${S})([.)])\\s+(.+)$`
|
|
569
|
+
);
|
|
570
|
+
function Dt(t) {
|
|
571
|
+
const e = t.split(`
|
|
572
|
+
`).filter((i) => i.trim().length > 0);
|
|
573
|
+
if (e.length === 0)
|
|
574
|
+
return null;
|
|
575
|
+
const n = [];
|
|
576
|
+
for (const i of e) {
|
|
577
|
+
const o = i.trim().match(Rt);
|
|
578
|
+
if (!o)
|
|
579
|
+
return null;
|
|
580
|
+
n.push({
|
|
581
|
+
marker: o[1],
|
|
582
|
+
content: o[3]
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
const s = n.map((i) => i.marker);
|
|
586
|
+
return Lt(s) ? {
|
|
587
|
+
type: "orderedList",
|
|
588
|
+
attrs: yt(n[0].marker),
|
|
589
|
+
content: n.map((i) => ({
|
|
590
|
+
type: "listItem",
|
|
591
|
+
content: [
|
|
592
|
+
{
|
|
593
|
+
type: "paragraph",
|
|
594
|
+
content: [{ type: "text", text: i.content }]
|
|
595
|
+
}
|
|
596
|
+
]
|
|
597
|
+
}))
|
|
598
|
+
} : null;
|
|
599
|
+
}
|
|
600
|
+
function Z(t, e, n) {
|
|
601
|
+
const s = [];
|
|
602
|
+
let r = 0;
|
|
603
|
+
for (; r < t.length; ) {
|
|
604
|
+
const i = t[r];
|
|
605
|
+
if (i.indent === e) {
|
|
606
|
+
const { paragraphLines: o, blockLines: a } = St(i.contentLines), u = o.join(`
|
|
607
|
+
`).trim(), h = [];
|
|
608
|
+
u && h.push({
|
|
609
|
+
type: "paragraph",
|
|
610
|
+
raw: u,
|
|
611
|
+
tokens: n.inlineTokens(u)
|
|
612
|
+
});
|
|
613
|
+
const p = a.join(`
|
|
614
|
+
`).trim();
|
|
615
|
+
if (p) {
|
|
616
|
+
const d = n.blockTokens(p);
|
|
617
|
+
h.push(...d);
|
|
618
|
+
}
|
|
619
|
+
let c = r + 1;
|
|
620
|
+
const l = [];
|
|
621
|
+
for (; c < t.length && t[c].indent > e; )
|
|
622
|
+
l.push(t[c]), c += 1;
|
|
623
|
+
if (l.length > 0) {
|
|
624
|
+
const d = Math.min(...l.map((f) => f.indent)), L = Z(l, d, n);
|
|
625
|
+
h.push({
|
|
626
|
+
type: "list",
|
|
627
|
+
ordered: !0,
|
|
628
|
+
start: l[0].number,
|
|
629
|
+
typeMarker: l[0].type,
|
|
630
|
+
items: L,
|
|
631
|
+
raw: l.map((f) => f.raw).join(`
|
|
632
|
+
`)
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
s.push({
|
|
636
|
+
type: "list_item",
|
|
637
|
+
raw: i.raw,
|
|
638
|
+
tokens: h
|
|
639
|
+
}), r = c;
|
|
640
|
+
} else
|
|
641
|
+
r += 1;
|
|
642
|
+
}
|
|
643
|
+
return s;
|
|
644
|
+
}
|
|
645
|
+
function Ot(t, e) {
|
|
646
|
+
return t.map((n) => {
|
|
647
|
+
if (n.type !== "list_item")
|
|
648
|
+
return e.parseChildren([n])[0];
|
|
649
|
+
const s = [];
|
|
650
|
+
return n.tokens && n.tokens.length > 0 && n.tokens.forEach((r) => {
|
|
651
|
+
if (r.type === "paragraph" || r.type === "list" || r.type === "blockquote" || r.type === "code")
|
|
652
|
+
s.push(...e.parseChildren([r]));
|
|
653
|
+
else if (r.type === "text" && r.tokens) {
|
|
654
|
+
const i = e.parseChildren([r]);
|
|
655
|
+
s.push({
|
|
656
|
+
type: "paragraph",
|
|
657
|
+
content: i
|
|
658
|
+
});
|
|
659
|
+
} else {
|
|
660
|
+
const i = e.parseChildren([r]);
|
|
661
|
+
i.length > 0 && s.push(...i);
|
|
662
|
+
}
|
|
663
|
+
}), {
|
|
664
|
+
type: "listItem",
|
|
665
|
+
content: s
|
|
666
|
+
};
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
var Pt = "listItem", B = "textStyle", j = /^(\d+)\.\s$/;
|
|
670
|
+
function K(t) {
|
|
671
|
+
const e = t.match(/list-style-type\s*:\s*([^;]+)/i);
|
|
672
|
+
if (!e)
|
|
673
|
+
return null;
|
|
674
|
+
switch (e[1].trim().toLowerCase()) {
|
|
675
|
+
case "upper-roman":
|
|
676
|
+
return "I";
|
|
677
|
+
case "lower-roman":
|
|
678
|
+
return "i";
|
|
679
|
+
case "upper-alpha":
|
|
680
|
+
case "upper-latin":
|
|
681
|
+
return "A";
|
|
682
|
+
case "lower-alpha":
|
|
683
|
+
case "lower-latin":
|
|
684
|
+
return "a";
|
|
685
|
+
default:
|
|
686
|
+
return null;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
var Ht = b.create({
|
|
690
|
+
name: "orderedList",
|
|
691
|
+
addOptions() {
|
|
692
|
+
return {
|
|
693
|
+
itemTypeName: "listItem",
|
|
694
|
+
HTMLAttributes: {},
|
|
695
|
+
keepMarks: !1,
|
|
696
|
+
keepAttributes: !1
|
|
697
|
+
};
|
|
698
|
+
},
|
|
699
|
+
group: "block list",
|
|
700
|
+
content() {
|
|
701
|
+
return `${this.options.itemTypeName}+`;
|
|
702
|
+
},
|
|
703
|
+
addAttributes() {
|
|
704
|
+
return {
|
|
705
|
+
start: {
|
|
706
|
+
default: 1,
|
|
707
|
+
parseHTML: (t) => t.hasAttribute("start") ? parseInt(t.getAttribute("start") || "", 10) : 1
|
|
708
|
+
},
|
|
709
|
+
type: {
|
|
710
|
+
default: null,
|
|
711
|
+
parseHTML: (t) => {
|
|
712
|
+
const e = t.getAttribute("type");
|
|
713
|
+
if (e)
|
|
714
|
+
return e;
|
|
715
|
+
const n = t.getAttribute("style");
|
|
716
|
+
if (n) {
|
|
717
|
+
const r = K(n);
|
|
718
|
+
if (r)
|
|
719
|
+
return r;
|
|
720
|
+
}
|
|
721
|
+
const s = t.querySelector("li");
|
|
722
|
+
if (s) {
|
|
723
|
+
const r = s.getAttribute("style");
|
|
724
|
+
if (r) {
|
|
725
|
+
const i = K(r);
|
|
726
|
+
if (i)
|
|
727
|
+
return i;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
return null;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
},
|
|
735
|
+
parseHTML() {
|
|
736
|
+
return [
|
|
737
|
+
{
|
|
738
|
+
tag: "ol"
|
|
739
|
+
}
|
|
740
|
+
];
|
|
741
|
+
},
|
|
742
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
743
|
+
const { start: e, type: n, ...s } = t, r = v(this.options.HTMLAttributes, s);
|
|
744
|
+
return e !== 1 && (r.start = e), n && n !== "1" && (r.type = n), ["ol", r, 0];
|
|
745
|
+
},
|
|
746
|
+
markdownTokenName: "list",
|
|
747
|
+
parseMarkdown: (t, e) => {
|
|
748
|
+
if (t.type !== "list" || !t.ordered)
|
|
749
|
+
return [];
|
|
750
|
+
const n = t.start || 1, s = t.typeMarker, r = t.items ? Ot(t.items, e) : [], i = {};
|
|
751
|
+
return n !== 1 && (i.start = n), s && (i.type = s), Object.keys(i).length > 0 ? {
|
|
752
|
+
type: "orderedList",
|
|
753
|
+
attrs: i,
|
|
754
|
+
content: r
|
|
755
|
+
} : {
|
|
756
|
+
type: "orderedList",
|
|
757
|
+
content: r
|
|
758
|
+
};
|
|
759
|
+
},
|
|
760
|
+
renderMarkdown: (t, e) => t.content ? e.renderChildren(t.content, `
|
|
761
|
+
`) : "",
|
|
762
|
+
markdownTokenizer: {
|
|
763
|
+
name: "orderedList",
|
|
764
|
+
level: "block",
|
|
765
|
+
start: (t) => {
|
|
766
|
+
const e = t.match(Ct), n = e == null ? void 0 : e.index;
|
|
767
|
+
return n !== void 0 ? n : -1;
|
|
768
|
+
},
|
|
769
|
+
tokenize: (t, e, n) => {
|
|
770
|
+
var s, r;
|
|
771
|
+
const i = t.split(`
|
|
772
|
+
`), [o, a] = $t(i);
|
|
773
|
+
if (o.length === 0)
|
|
774
|
+
return;
|
|
775
|
+
const u = Z(o, 0, n);
|
|
776
|
+
if (u.length === 0)
|
|
777
|
+
return;
|
|
778
|
+
const h = ((s = o[0]) == null ? void 0 : s.number) || 1, p = (r = o[0]) == null ? void 0 : r.type;
|
|
779
|
+
return {
|
|
780
|
+
type: "list",
|
|
781
|
+
ordered: !0,
|
|
782
|
+
start: h,
|
|
783
|
+
typeMarker: p,
|
|
784
|
+
items: u,
|
|
785
|
+
raw: i.slice(0, a).join(`
|
|
786
|
+
`)
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
markdownOptions: {
|
|
791
|
+
indentsContent: !0
|
|
792
|
+
},
|
|
793
|
+
addCommands() {
|
|
794
|
+
return {
|
|
795
|
+
toggleOrderedList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Pt, this.editor.getAttributes(B)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
796
|
+
};
|
|
797
|
+
},
|
|
798
|
+
addKeyboardShortcuts() {
|
|
799
|
+
return {
|
|
800
|
+
"Mod-Shift-7": () => this.editor.commands.toggleOrderedList()
|
|
801
|
+
};
|
|
802
|
+
},
|
|
803
|
+
addProseMirrorPlugins() {
|
|
804
|
+
return [
|
|
805
|
+
new rt({
|
|
806
|
+
props: {
|
|
807
|
+
handlePaste: (t, e) => {
|
|
808
|
+
var n, s;
|
|
809
|
+
const r = (n = e.clipboardData) == null ? void 0 : n.getData("text/html");
|
|
810
|
+
if (r != null && r.trim())
|
|
811
|
+
return !1;
|
|
812
|
+
const i = (s = e.clipboardData) == null ? void 0 : s.getData("text/plain");
|
|
813
|
+
if (!i)
|
|
814
|
+
return !1;
|
|
815
|
+
const o = Dt(i);
|
|
816
|
+
if (!o)
|
|
817
|
+
return !1;
|
|
818
|
+
try {
|
|
819
|
+
const a = t.state.schema.nodeFromJSON(o), u = t.state.tr.replaceSelectionWith(a);
|
|
820
|
+
return t.dispatch(u), !0;
|
|
821
|
+
} catch {
|
|
822
|
+
return !1;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
})
|
|
827
|
+
];
|
|
828
|
+
},
|
|
829
|
+
addInputRules() {
|
|
830
|
+
const t = (n, s) => (!s.attrs.type || s.attrs.type === "1") && s.childCount + s.attrs.start === +n[1];
|
|
831
|
+
let e = g({
|
|
832
|
+
find: j,
|
|
833
|
+
type: this.type,
|
|
834
|
+
getAttributes: (n) => ({ start: +n[1] }),
|
|
835
|
+
joinPredicate: t
|
|
836
|
+
});
|
|
837
|
+
return (this.options.keepMarks || this.options.keepAttributes) && (e = g({
|
|
838
|
+
find: j,
|
|
839
|
+
type: this.type,
|
|
840
|
+
keepMarks: this.options.keepMarks,
|
|
841
|
+
keepAttributes: this.options.keepAttributes,
|
|
842
|
+
getAttributes: (n) => ({ start: +n[1], ...this.editor.getAttributes(B) }),
|
|
843
|
+
joinPredicate: t,
|
|
844
|
+
editor: this.editor
|
|
845
|
+
})), [e];
|
|
846
|
+
}
|
|
847
|
+
}), Bt = /^\s*(\[([( |x])?\])\s$/, jt = b.create({
|
|
848
|
+
name: "taskItem",
|
|
849
|
+
addOptions() {
|
|
850
|
+
return {
|
|
851
|
+
nested: !1,
|
|
852
|
+
HTMLAttributes: {},
|
|
853
|
+
taskListTypeName: "taskList",
|
|
854
|
+
a11y: void 0
|
|
855
|
+
};
|
|
856
|
+
},
|
|
857
|
+
content() {
|
|
858
|
+
return this.options.nested ? "paragraph block*" : "paragraph+";
|
|
859
|
+
},
|
|
860
|
+
defining: !0,
|
|
861
|
+
addAttributes() {
|
|
862
|
+
return {
|
|
863
|
+
checked: {
|
|
864
|
+
default: !1,
|
|
865
|
+
keepOnSplit: !1,
|
|
866
|
+
parseHTML: (t) => {
|
|
867
|
+
const e = t.getAttribute("data-checked");
|
|
868
|
+
return e === "" || e === "true";
|
|
869
|
+
},
|
|
870
|
+
renderHTML: (t) => ({
|
|
871
|
+
"data-checked": t.checked
|
|
872
|
+
})
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
|
+
},
|
|
876
|
+
parseHTML() {
|
|
877
|
+
return [
|
|
878
|
+
{
|
|
879
|
+
tag: `li[data-type="${this.name}"]`,
|
|
880
|
+
priority: 51
|
|
881
|
+
}
|
|
882
|
+
];
|
|
883
|
+
},
|
|
884
|
+
renderHTML({ node: t, HTMLAttributes: e }) {
|
|
885
|
+
return [
|
|
886
|
+
"li",
|
|
887
|
+
v(this.options.HTMLAttributes, e, {
|
|
888
|
+
"data-type": this.name
|
|
889
|
+
}),
|
|
890
|
+
[
|
|
891
|
+
"label",
|
|
892
|
+
[
|
|
893
|
+
"input",
|
|
894
|
+
{
|
|
895
|
+
type: "checkbox",
|
|
896
|
+
checked: t.attrs.checked ? "checked" : null
|
|
897
|
+
}
|
|
898
|
+
],
|
|
899
|
+
["span"]
|
|
900
|
+
],
|
|
901
|
+
["div", 0]
|
|
902
|
+
];
|
|
903
|
+
},
|
|
904
|
+
parseMarkdown: (t, e) => {
|
|
905
|
+
const n = [];
|
|
906
|
+
if (t.tokens && t.tokens.length > 0 ? n.push(e.createNode("paragraph", {}, e.parseInline(t.tokens))) : t.text ? n.push(e.createNode("paragraph", {}, [e.createNode("text", { text: t.text })])) : n.push(e.createNode("paragraph", {}, [])), t.nestedTokens && t.nestedTokens.length > 0) {
|
|
907
|
+
const s = e.parseChildren(t.nestedTokens);
|
|
908
|
+
n.push(...s);
|
|
909
|
+
}
|
|
910
|
+
return e.createNode("taskItem", { checked: t.checked || !1 }, n);
|
|
911
|
+
},
|
|
912
|
+
renderMarkdown: (t, e) => {
|
|
913
|
+
var n;
|
|
914
|
+
const r = `- [${(n = t.attrs) != null && n.checked ? "x" : " "}] `;
|
|
915
|
+
return z(t, e, r);
|
|
916
|
+
},
|
|
917
|
+
addExtensions() {
|
|
918
|
+
return this.options.nested ? [X(this.name, [this.options.taskListTypeName])] : [];
|
|
919
|
+
},
|
|
920
|
+
addKeyboardShortcuts() {
|
|
921
|
+
const t = {
|
|
922
|
+
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
923
|
+
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
924
|
+
};
|
|
925
|
+
return this.options.nested ? {
|
|
926
|
+
...t,
|
|
927
|
+
Tab: () => this.editor.commands.sinkListItem(this.name)
|
|
928
|
+
} : t;
|
|
929
|
+
},
|
|
930
|
+
addNodeView() {
|
|
931
|
+
return ({ node: t, HTMLAttributes: e, getPos: n, editor: s }) => {
|
|
932
|
+
const r = document.createElement("li"), i = document.createElement("label"), o = document.createElement("span"), a = document.createElement("input"), u = document.createElement("div"), h = (c) => {
|
|
933
|
+
var l, d;
|
|
934
|
+
a.ariaLabel = ((d = (l = this.options.a11y) == null ? void 0 : l.checkboxLabel) == null ? void 0 : d.call(l, c, a.checked)) || `Task item checkbox for ${c.textContent || "empty task item"}`;
|
|
935
|
+
};
|
|
936
|
+
h(t), i.contentEditable = "false", a.type = "checkbox", a.addEventListener("mousedown", (c) => c.preventDefault()), a.addEventListener("change", (c) => {
|
|
937
|
+
if (!s.isEditable && !this.options.onReadOnlyChecked) {
|
|
938
|
+
a.checked = !a.checked;
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
const { checked: l } = c.target;
|
|
942
|
+
s.isEditable && typeof n == "function" && s.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: d }) => {
|
|
943
|
+
const L = n();
|
|
944
|
+
if (typeof L != "number")
|
|
945
|
+
return !1;
|
|
946
|
+
const f = d.doc.nodeAt(L);
|
|
947
|
+
return d.setNodeMarkup(L, void 0, {
|
|
948
|
+
...f == null ? void 0 : f.attrs,
|
|
949
|
+
checked: l
|
|
950
|
+
}), !0;
|
|
951
|
+
}).run(), !s.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(t, l) || (a.checked = !a.checked));
|
|
952
|
+
}), Object.entries(this.options.HTMLAttributes).forEach(([c, l]) => {
|
|
953
|
+
r.setAttribute(c, l);
|
|
954
|
+
}), r.dataset.checked = t.attrs.checked, a.checked = t.attrs.checked, i.append(a, o), r.append(i, u), Object.entries(e).forEach(([c, l]) => {
|
|
955
|
+
r.setAttribute(c, l);
|
|
956
|
+
});
|
|
957
|
+
let p = new Set(Object.keys(e));
|
|
958
|
+
return {
|
|
959
|
+
dom: r,
|
|
960
|
+
contentDOM: u,
|
|
961
|
+
update: (c) => {
|
|
962
|
+
if (c.type !== this.type)
|
|
963
|
+
return !1;
|
|
964
|
+
r.dataset.checked = c.attrs.checked, a.checked = c.attrs.checked, h(c);
|
|
965
|
+
const l = s.extensionManager.attributes, d = Q(c, l), L = new Set(Object.keys(d)), f = this.options.HTMLAttributes;
|
|
966
|
+
return p.forEach((m) => {
|
|
967
|
+
L.has(m) || (m in f ? r.setAttribute(m, f[m]) : r.removeAttribute(m));
|
|
968
|
+
}), Object.entries(d).forEach(([m, y]) => {
|
|
969
|
+
y == null ? m in f ? r.setAttribute(m, f[m]) : r.removeAttribute(m) : r.setAttribute(m, y);
|
|
970
|
+
}), p = L, !0;
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
};
|
|
974
|
+
},
|
|
975
|
+
addInputRules() {
|
|
976
|
+
return [
|
|
977
|
+
g({
|
|
978
|
+
find: Bt,
|
|
979
|
+
type: this.type,
|
|
980
|
+
getAttributes: (t) => ({
|
|
981
|
+
checked: t[t.length - 1] === "x"
|
|
982
|
+
})
|
|
983
|
+
})
|
|
984
|
+
];
|
|
985
|
+
}
|
|
986
|
+
}), Kt = b.create({
|
|
987
|
+
name: "taskList",
|
|
988
|
+
addOptions() {
|
|
989
|
+
return {
|
|
990
|
+
itemTypeName: "taskItem",
|
|
991
|
+
HTMLAttributes: {}
|
|
992
|
+
};
|
|
993
|
+
},
|
|
994
|
+
group: "block list",
|
|
995
|
+
content() {
|
|
996
|
+
return `${this.options.itemTypeName}+`;
|
|
997
|
+
},
|
|
998
|
+
parseHTML() {
|
|
999
|
+
return [
|
|
1000
|
+
{
|
|
1001
|
+
tag: `ul[data-type="${this.name}"]`,
|
|
1002
|
+
priority: 51
|
|
1003
|
+
}
|
|
1004
|
+
];
|
|
1005
|
+
},
|
|
1006
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
1007
|
+
return [
|
|
1008
|
+
"ul",
|
|
1009
|
+
v(this.options.HTMLAttributes, t, { "data-type": this.name }),
|
|
1010
|
+
0
|
|
1011
|
+
];
|
|
1012
|
+
},
|
|
1013
|
+
parseMarkdown: (t, e) => e.createNode("taskList", {}, e.parseChildren(t.items || [])),
|
|
1014
|
+
renderMarkdown: (t, e) => t.content ? e.renderChildren(t.content, `
|
|
1015
|
+
`) : "",
|
|
1016
|
+
markdownTokenizer: {
|
|
1017
|
+
name: "taskList",
|
|
1018
|
+
level: "block",
|
|
1019
|
+
start(t) {
|
|
1020
|
+
var e;
|
|
1021
|
+
const n = (e = t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)) == null ? void 0 : e.index;
|
|
1022
|
+
return n !== void 0 ? n : -1;
|
|
1023
|
+
},
|
|
1024
|
+
tokenize(t, e, n) {
|
|
1025
|
+
const s = (i) => {
|
|
1026
|
+
const o = O(
|
|
1027
|
+
i,
|
|
1028
|
+
{
|
|
1029
|
+
itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
|
|
1030
|
+
extractItemData: (a) => ({
|
|
1031
|
+
indentLevel: a[1].length,
|
|
1032
|
+
mainContent: a[4],
|
|
1033
|
+
checked: a[3].toLowerCase() === "x"
|
|
1034
|
+
}),
|
|
1035
|
+
createToken: (a, u) => ({
|
|
1036
|
+
type: "taskItem",
|
|
1037
|
+
raw: "",
|
|
1038
|
+
mainContent: a.mainContent,
|
|
1039
|
+
indentLevel: a.indentLevel,
|
|
1040
|
+
checked: a.checked,
|
|
1041
|
+
text: a.mainContent,
|
|
1042
|
+
tokens: n.inlineTokens(a.mainContent),
|
|
1043
|
+
nestedTokens: u
|
|
1044
|
+
}),
|
|
1045
|
+
// Allow recursive nesting
|
|
1046
|
+
customNestedParser: s
|
|
1047
|
+
},
|
|
1048
|
+
n
|
|
1049
|
+
);
|
|
1050
|
+
return o ? [
|
|
1051
|
+
{
|
|
1052
|
+
type: "taskList",
|
|
1053
|
+
raw: o.raw,
|
|
1054
|
+
items: o.items
|
|
1055
|
+
}
|
|
1056
|
+
] : n.blockTokens(i);
|
|
1057
|
+
}, r = O(
|
|
1058
|
+
t,
|
|
1059
|
+
{
|
|
1060
|
+
itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
|
|
1061
|
+
extractItemData: (i) => ({
|
|
1062
|
+
indentLevel: i[1].length,
|
|
1063
|
+
mainContent: i[4],
|
|
1064
|
+
checked: i[3].toLowerCase() === "x"
|
|
1065
|
+
}),
|
|
1066
|
+
createToken: (i, o) => ({
|
|
1067
|
+
type: "taskItem",
|
|
1068
|
+
raw: "",
|
|
1069
|
+
mainContent: i.mainContent,
|
|
1070
|
+
indentLevel: i.indentLevel,
|
|
1071
|
+
checked: i.checked,
|
|
1072
|
+
text: i.mainContent,
|
|
1073
|
+
tokens: n.inlineTokens(i.mainContent),
|
|
1074
|
+
nestedTokens: o
|
|
1075
|
+
}),
|
|
1076
|
+
// Use the recursive parser for nested content
|
|
1077
|
+
customNestedParser: s
|
|
1078
|
+
},
|
|
1079
|
+
n
|
|
1080
|
+
);
|
|
1081
|
+
if (r)
|
|
1082
|
+
return {
|
|
1083
|
+
type: "taskList",
|
|
1084
|
+
raw: r.raw,
|
|
1085
|
+
items: r.items
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1088
|
+
},
|
|
1089
|
+
markdownOptions: {
|
|
1090
|
+
indentsContent: !0
|
|
1091
|
+
},
|
|
1092
|
+
addCommands() {
|
|
1093
|
+
return {
|
|
1094
|
+
toggleTaskList: () => ({ commands: t }) => t.toggleList(this.name, this.options.itemTypeName)
|
|
1095
|
+
};
|
|
1096
|
+
},
|
|
1097
|
+
addKeyboardShortcuts() {
|
|
1098
|
+
return {
|
|
1099
|
+
"Mod-Shift-9": () => this.editor.commands.toggleTaskList()
|
|
1100
|
+
};
|
|
1101
|
+
}
|
|
1102
|
+
});
|
|
1103
|
+
_.create({
|
|
1104
|
+
name: "listKit",
|
|
1105
|
+
addExtensions() {
|
|
1106
|
+
const t = [];
|
|
1107
|
+
return this.options.bulletList !== !1 && t.push(ct.configure(this.options.bulletList)), this.options.listItem !== !1 && t.push(Tt.configure(this.options.listItem)), this.options.listKeymap !== !1 && t.push(wt.configure(this.options.listKeymap)), this.options.orderedList !== !1 && t.push(Ht.configure(this.options.orderedList)), this.options.taskItem !== !1 && t.push(jt.configure(this.options.taskItem)), this.options.taskList !== !1 && t.push(Kt.configure(this.options.taskList)), t;
|
|
1108
|
+
}
|
|
1109
|
+
});
|
|
1110
|
+
export {
|
|
1111
|
+
ct as B,
|
|
1112
|
+
Ht as O,
|
|
1113
|
+
Kt as T,
|
|
1114
|
+
jt as a
|
|
1115
|
+
};
|