@meowdown/core 0.78.4 → 0.80.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/dist/index.d.ts +27 -29
- package/dist/index.js +190 -125
- package/package.json +7 -6
package/dist/index.d.ts
CHANGED
|
@@ -7,9 +7,10 @@ import { Command, EditorState, PluginKey } from "@prosekit/pm/state";
|
|
|
7
7
|
import { EditorView } from "@prosekit/pm/view";
|
|
8
8
|
import { EditorNode, Mark, ProseMirrorNode } from "@prosekit/pm/model";
|
|
9
9
|
import { ListAttrs } from "@prosekit/extensions/list";
|
|
10
|
-
import {
|
|
10
|
+
import { HorizontalRuleCommandsExtension, HorizontalRuleSpecExtension } from "@prosekit/extensions/horizontal-rule";
|
|
11
11
|
import { Resolver, XPostMediaClickEvent } from "@meowdown/embed/x";
|
|
12
12
|
import { YouTubeVideoClickEvent } from "@meowdown/embed/youtube";
|
|
13
|
+
import "prosemirror-flat-list";
|
|
13
14
|
import { render } from "katex";
|
|
14
15
|
import { XPost, YouTubeVideo } from "@post-embed/types";
|
|
15
16
|
import { VirtualElement } from "@floating-ui/dom";
|
|
@@ -116,7 +117,7 @@ type HorizontalRuleMarkerExtension = Extension<{
|
|
|
116
117
|
horizontalRule: MeowdownHorizontalRuleAttrs;
|
|
117
118
|
};
|
|
118
119
|
}>;
|
|
119
|
-
type MeowdownHorizontalRuleExtension = Union<[
|
|
120
|
+
type MeowdownHorizontalRuleExtension = Union<[HorizontalRuleSpecExtension, HorizontalRuleCommandsExtension, HorizontalRuleMarkerExtension]>;
|
|
120
121
|
//#endregion
|
|
121
122
|
//#region src/extensions/html-comment.d.ts
|
|
122
123
|
interface MeowdownHTMLCommentAttrs {
|
|
@@ -1098,7 +1099,15 @@ interface EditorConfig extends InlineMarkOptions, FollowLinkHandlers, FilePasteO
|
|
|
1098
1099
|
embedPaste?: boolean;
|
|
1099
1100
|
linkPaste?: boolean;
|
|
1100
1101
|
bulletAfterHeading?: boolean;
|
|
1102
|
+
backspaceDeletesEmptyFirstBlock?: boolean;
|
|
1101
1103
|
substitution?: boolean;
|
|
1104
|
+
/**
|
|
1105
|
+
* Keep the document to one paragraph of inline Markdown: typed block
|
|
1106
|
+
* prefixes (`# `, `> `, `- `, ```` ``` ````) stay literal and pasted blocks
|
|
1107
|
+
* flatten into soft lines. Seed the editor with `paragraphMarkdownToDoc` and
|
|
1108
|
+
* read it with `docToParagraphMarkdown`.
|
|
1109
|
+
*/
|
|
1110
|
+
singleParagraph?: boolean;
|
|
1102
1111
|
wikilinkEnabled?: boolean;
|
|
1103
1112
|
placeholder?: PlaceholderOptions$1['placeholder'];
|
|
1104
1113
|
readOnly?: boolean;
|
|
@@ -1121,7 +1130,7 @@ declare function defineEditorExtensionImpl(options: EditorExtensionOptions): imp
|
|
|
1121
1130
|
frontmatter?: Frontmatter;
|
|
1122
1131
|
};
|
|
1123
1132
|
};
|
|
1124
|
-
}>, import("@prosekit/extensions/text").TextExtension, import("@prosekit/extensions/blockquote").
|
|
1133
|
+
}>, import("@prosekit/extensions/text").TextExtension, import("@prosekit/core").Union<readonly [import("@prosekit/extensions/blockquote").BlockquoteSpecExtension, import("@prosekit/extensions/blockquote").BlockquoteCommandsExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension]>, import("@prosekit/core").Union<readonly [import("@prosekit/extensions/list").ListSpecExtension, import("@prosekit/core").PlainExtension, import("@prosekit/extensions/list").ListCommandsExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").Extension<{
|
|
1125
1134
|
Nodes: {
|
|
1126
1135
|
list: {
|
|
1127
1136
|
marker?: ListMarker;
|
|
@@ -1146,6 +1155,9 @@ declare function defineEditorExtensionImpl(options: EditorExtensionOptions): imp
|
|
|
1146
1155
|
wrapInCircleTask: [];
|
|
1147
1156
|
wrapInSquareTask: [];
|
|
1148
1157
|
toggleListCollapsed: [];
|
|
1158
|
+
indentList: [options?: import("prosemirror-flat-list").IndentListOptions | undefined];
|
|
1159
|
+
dedentList: [options?: import("prosemirror-flat-list").DedentListOptions | undefined];
|
|
1160
|
+
splitList: [options?: import("prosemirror-flat-list").SplitListOptions | undefined];
|
|
1149
1161
|
};
|
|
1150
1162
|
}>]>, import("@prosekit/core").Union<readonly [import("@prosekit/extensions/heading").HeadingSpecExtension, import("@prosekit/core").Extension<{
|
|
1151
1163
|
Nodes: {
|
|
@@ -1171,7 +1183,7 @@ declare function defineEditorExtensionImpl(options: EditorExtensionOptions): imp
|
|
|
1171
1183
|
Nodes: {
|
|
1172
1184
|
tableHeaderCell: import("@prosekit/pm/model").Attrs;
|
|
1173
1185
|
};
|
|
1174
|
-
}>]>, TableColumnAlignExtension, import("@prosekit/core").PlainExtension, import("@prosekit/extensions/table").TableCommandsExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension]>, import("@prosekit/core").Union<readonly [import("@prosekit/extensions/code-block").
|
|
1186
|
+
}>]>, TableColumnAlignExtension, import("@prosekit/core").PlainExtension, import("@prosekit/extensions/table").TableCommandsExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension]>, import("@prosekit/core").Union<readonly [import("@prosekit/extensions/code-block").CodeBlockSpecExtension, import("@prosekit/core").PlainExtension, import("@prosekit/extensions/code-block").CodeBlockCommandsExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").Extension<{
|
|
1175
1187
|
Nodes: {
|
|
1176
1188
|
codeBlock: {
|
|
1177
1189
|
fenceStyle?: CodeBlockFenceStyle | null;
|
|
@@ -1247,11 +1259,11 @@ declare function defineEditorExtensionImpl(options: EditorExtensionOptions): imp
|
|
|
1247
1259
|
Marks: {
|
|
1248
1260
|
mdPack: MdPackAttrs;
|
|
1249
1261
|
};
|
|
1250
|
-
}>]>, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").Extension<import("@prosekit/core").ExtensionTyping<any, any, any>>, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").Union<readonly [import("@prosekit/core").Extension<{
|
|
1262
|
+
}>]>, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").Extension<import("@prosekit/core").ExtensionTyping<any, any, any>>, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").Union<readonly [import("@prosekit/core").Extension<{
|
|
1251
1263
|
Commands: {
|
|
1252
1264
|
insertSoftBreak: [];
|
|
1253
1265
|
};
|
|
1254
|
-
}>, import("@prosekit/core").PlainExtension]>, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").Union<readonly [import("@prosekit/core").Extension<{
|
|
1266
|
+
}>, import("@prosekit/core").PlainExtension]>, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").Union<readonly [import("@prosekit/core").Extension<{
|
|
1255
1267
|
Commands: {
|
|
1256
1268
|
toggleEm: [];
|
|
1257
1269
|
toggleStrong: [];
|
|
@@ -1343,6 +1355,15 @@ interface DocToMarkdownOptions {
|
|
|
1343
1355
|
*/
|
|
1344
1356
|
export declare function docToMarkdown(node: ProseMirrorNode, options?: DocToMarkdownOptions): string;
|
|
1345
1357
|
//#endregion
|
|
1358
|
+
//#region src/extensions/backspace-empty-first-block.d.ts
|
|
1359
|
+
/**
|
|
1360
|
+
* Nothing sits before the document's first block, so Backspace in an empty
|
|
1361
|
+
* first paragraph has nothing to join and does nothing. When this extension is
|
|
1362
|
+
* applied, that Backspace deletes the empty paragraph instead, and the rest of
|
|
1363
|
+
* the document moves up one line.
|
|
1364
|
+
*/
|
|
1365
|
+
export declare function defineBackspaceEmptyFirstBlock(enabled?: (state: EditorState) => boolean): PlainExtension;
|
|
1366
|
+
//#endregion
|
|
1346
1367
|
//#region src/extensions/bullet-after-heading.d.ts
|
|
1347
1368
|
/**
|
|
1348
1369
|
* "Type a title, press Return, start bullets." When this extension is applied,
|
|
@@ -1667,27 +1688,4 @@ export declare function paragraphMarkdownToDoc(markdown: string, nodes?: TypedNo
|
|
|
1667
1688
|
*/
|
|
1668
1689
|
export declare function docToParagraphMarkdown(doc: ProseMirrorNode): string;
|
|
1669
1690
|
//#endregion
|
|
1670
|
-
//#region src/extensions/single-paragraph.d.ts
|
|
1671
|
-
/**
|
|
1672
|
-
* Keep editing and pasted content within one paragraph.
|
|
1673
|
-
* Opt into this extension for inline Markdown fields such as task paragraphs.
|
|
1674
|
-
* Register it alongside `defineMeowdown`, seed content with
|
|
1675
|
-
* `paragraphMarkdownToDoc`, and read edits with `docToParagraphMarkdown`.
|
|
1676
|
-
* Ordinary note editors should keep their full document behavior.
|
|
1677
|
-
*
|
|
1678
|
-
* Text input stays literal, before block input rules can consume prefixes.
|
|
1679
|
-
* Transactions and pasted blocks flatten to paragraph text separated by soft
|
|
1680
|
-
* lines. Reference definitions come from `referenceDefinitions` in the editor
|
|
1681
|
-
* config; definition-looking content in the field remains visible literal text.
|
|
1682
|
-
* Enter/submit, focus, and persistence remain the caller's responsibility.
|
|
1683
|
-
*
|
|
1684
|
-
* @example
|
|
1685
|
-
* const editor = createEditor({
|
|
1686
|
-
* extension: union(defineMeowdown({ referenceDefinitions }), defineSingleParagraph()),
|
|
1687
|
-
* defaultContent: paragraphMarkdownToDoc('Buy **milk**'),
|
|
1688
|
-
* })
|
|
1689
|
-
* const markdown = docToParagraphMarkdown(editor.state.doc)
|
|
1690
|
-
*/
|
|
1691
|
-
export declare function defineSingleParagraph(): PlainExtension;
|
|
1692
|
-
//#endregion
|
|
1693
1691
|
export { type AcceptPendingReplacementOptions, type CheckRoundTripOptions, type CodeBlockAttrs, type CodeBlockFenceStyle, type CodeToken, type DocToMarkdownOptions, type EditorConfig, type EditorExtension, type EditorExtensionOptions, type ExitBoundaryHandler, type ExitBoundaryOptions, type FileClickHandler, type FileClickPayload, type FileInfo, type FileInfoResolver, type FileLinkOptions, type FileLinkPayload, type FileLinkResolver, type FilePasteHandler, type FilePasteOptions, type FileSaveErrorHandler, type FileViewOptions, type FollowLinkHandlers, type ImageClickHandler, type ImageClickPayload, type ImageOptions, type ImageUrlResolver, type InlineMarkContext, type InlineMarkOptions, type KaTeXRender, type LanguageItem, type LinkAttrs, type LinkClickHandler, type LinkClickPayload, type LinkCopyHandler, type LinkCopyPayload, type LinkEditHandler, type LinkEditOptions, type LinkHoverHandler, type LinkHoverOptions, type LinkPreview, type LinkPreviewResolver, type LinkUnit, type ListMarker, type MarkChunk, type MarkMode, type MarkName, type MarkdownToDocOptions, type MdFileAttrs, type MdImageAttrs, type MdLinkTextAttrs, type MdMathAttrs, type MdWikilinkAttrs, type MeowdownCodeBlockAttrs, type MeowdownHTMLCommentAttrs, type MeowdownListAttrs, type MeowdownTableCellAttrs, type NodeName, type ParsedWikiEmbed, type PendingReplacement, type PendingReplacementEvent, type PendingReplacementHandler, type PendingReplacementMode, type PendingReplacementOutcome, type PlaceholderOptions, type PositionRange, type PostEmbedSnapshot, Priority, type ReferenceDefinition, type ReferenceDefinitionIndex, type ReferenceDefinitions, type RoundTripFidelity, type SearchStatus, type SearchStatusHandler, type StartPendingReplacementOptions, type TableColumnAlign, type TagClickHandler, type TagClickPayload, type TypedEditor, type TypedMarkBuilders, type VirtualElement, type WikiEmbedOptions, type WikiEmbedResolution, type WikiEmbedResolver, type WikilinkClickHandler, type WikilinkClickPayload, type WikilinkHoverHandler, type WikilinkHoverHit, type WikilinkOptions, type WikilinkPayload, type WikilinkResolution, type WikilinkResolver, type XPostMediaClickHandler, type XPostResolver, type YouTubeVideoClickHandler, type YouTubeVideoResolver, checkRoundTrip, defineCodeBlockPreviewPlugin, definePlaceholder, defineSearchStatusHandler, getSearchStatus, isCodeBlockPreviewHiddenDecoration, withPriority };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { LEZER_NODE_IDS, checkRoundTrip, collectInlineElements, getAutolinkHref, gfmParser, isSpaceChar, matchEmbed, parseInline, parseMarkdownAst, parseXPostId, serializeMarkdownAst } from "@meowdown/markdown";
|
|
2
2
|
import { Priority, Priority as Priority$1, createMarkBuilders, createNodeBuilders, defaultBlockAt, defineBaseCommands, defineBaseKeymap, defineClipboardSerializer, defineCommands, defineHistory, defineKeymap, defineMarkSpec, defineMarkView, defineNodeAttr, defineNodeSpec, definePlugin, findMarkRange, getMarkRange, getMarkType, getNodeType, isAllSelection, isApple, isAtBlockStart, isNodeSelection, isTextSelection, setBlockType, toggleNode, union, unsetBlockType, withPriority, withPriority as withPriority$1, withSkipCodeBlock } from "@prosekit/core";
|
|
3
|
-
import {
|
|
3
|
+
import { codeBlockEnterRule, codeBlockInputRule, defineCodeBlockCommands, defineCodeBlockHighlight, defineCodeBlockKeymap, defineCodeBlockPreviewPlugin, defineCodeBlockSpec, isCodeBlockPreviewHiddenDecoration } from "@prosekit/extensions/code-block";
|
|
4
4
|
import { definePlaceholder, definePlaceholder as definePlaceholder$1 } from "@prosekit/extensions/placeholder";
|
|
5
5
|
import { defineSearchCommands, defineSearchQuery, defineSearchStatusHandler, getSearchStatus, getSearchStatus as getSearchStatus$1 } from "@prosekit/extensions/search";
|
|
6
6
|
import { isElementLike, isHTMLElement, isObject, once } from "@ocavue/utils";
|
|
7
|
-
import { defineBlockquote } from "@prosekit/extensions/blockquote";
|
|
8
7
|
import { defineDoc } from "@prosekit/extensions/doc";
|
|
9
8
|
import { defineGapCursor } from "@prosekit/extensions/gap-cursor";
|
|
10
9
|
import { defineModClickPrevention } from "@prosekit/extensions/mod-click-prevention";
|
|
@@ -12,6 +11,11 @@ import { defineText } from "@prosekit/extensions/text";
|
|
|
12
11
|
import { defineVirtualSelection } from "@prosekit/extensions/virtual-selection";
|
|
13
12
|
import { NodeSelection, Plugin, PluginKey, Selection, TextSelection } from "@prosekit/pm/state";
|
|
14
13
|
import { Decoration, DecorationSet } from "@prosekit/pm/view";
|
|
14
|
+
import { blockquoteInputRule, defineBlockquoteCommands, defineBlockquoteKeymap, defineBlockquoteSpec } from "@prosekit/extensions/blockquote";
|
|
15
|
+
import { createTextBlockInputRuleHandler, createWrappingInputRuleHandler, defineInputRule } from "@prosekit/extensions/input-rule";
|
|
16
|
+
import { defineEnterRule } from "@prosekit/extensions/enter-rule";
|
|
17
|
+
import { InputRule } from "@prosekit/pm/inputrules";
|
|
18
|
+
import { createTextBlockEnterRule } from "prosemirror-enter-rules";
|
|
15
19
|
import { NO_BREAK_SPACE } from "unicode-by-name";
|
|
16
20
|
import { defaultHandlers } from "hast-util-to-mdast";
|
|
17
21
|
import { defaultHandlers as defaultHandlers$1 } from "mdast-util-to-markdown";
|
|
@@ -21,19 +25,17 @@ import remarkGfm from "remark-gfm";
|
|
|
21
25
|
import remarkStringify from "remark-stringify";
|
|
22
26
|
import { unified } from "unified";
|
|
23
27
|
import { DOMParser, DOMSerializer, Fragment, Mark, Slice } from "@prosekit/pm/model";
|
|
24
|
-
import { defineHeadingCommands,
|
|
28
|
+
import { defineHeadingCommands, defineHeadingSpec, headingInputRule } from "@prosekit/extensions/heading";
|
|
25
29
|
import { defineParagraphCommands, defineParagraphKeymap } from "@prosekit/extensions/paragraph";
|
|
26
30
|
import { LanguageDescription } from "@codemirror/language";
|
|
27
31
|
import { languages } from "@codemirror/language-data";
|
|
28
32
|
import { classHighlighter, highlightTree } from "@lezer/highlight";
|
|
29
33
|
import { createParser } from "prosemirror-highlight/lezer";
|
|
30
|
-
import { defineEnterRule, defineTextBlockEnterRule } from "@prosekit/extensions/enter-rule";
|
|
31
|
-
import { defineInputRule, defineTextBlockInputRule } from "@prosekit/extensions/input-rule";
|
|
32
34
|
import { triggerAutocomplete } from "@prosekit/extensions/autocomplete";
|
|
33
|
-
import { defineListCommands, defineListDropIndicator,
|
|
34
|
-
import { chainCommands, lift, newlineInCode, splitBlock } from "@prosekit/pm/commands";
|
|
35
|
+
import { defineListCommands, defineListDropIndicator, defineListSpec, moveList, toggleList, unwrapList, wrapInList } from "@prosekit/extensions/list";
|
|
36
|
+
import { chainCommands, deleteSelection, lift, newlineInCode, splitBlock } from "@prosekit/pm/commands";
|
|
35
37
|
import { closeHistory } from "@prosekit/pm/history";
|
|
36
|
-
import {
|
|
38
|
+
import { defineHorizontalRuleCommands, defineHorizontalRuleSpec, horizontalRuleInputRule } from "@prosekit/extensions/horizontal-rule";
|
|
37
39
|
import { X_POST_MEDIA_CLICK, registerXPost } from "@meowdown/embed/x";
|
|
38
40
|
import { YOUTUBE_VIDEO_CLICK, registerYouTubeVideo } from "@meowdown/embed/youtube";
|
|
39
41
|
import { registerResizableHandleElement, registerResizableRootElement } from "@prosekit/web/resizable";
|
|
@@ -44,9 +46,8 @@ import * as v from "valibot";
|
|
|
44
46
|
import { AttrStep, ReplaceStep, Step, StepResult, Transform } from "@prosekit/pm/transform";
|
|
45
47
|
import { decodeString } from "micromark-util-decode-string";
|
|
46
48
|
import { normalizeIdentifier } from "micromark-util-normalize-identifier";
|
|
47
|
-
import { createListRenderingPlugin, createSafariInputMethodWorkaroundPlugin, createToggleCollapsedCommand, defaultAttributesGetter, enterCommand, findCheckboxInListItem, handleListMarkerMouseDown, joinListElements, listToDOM,
|
|
49
|
+
import { bulletListInputRule, createDedentListCommand, createIndentListCommand, createListInputRuleHandler, createListRenderingPlugin, createSafariInputMethodWorkaroundPlugin, createSplitListCommand, createToggleCollapsedCommand, defaultAttributesGetter, deleteCommand, enterCommand, findCheckboxInListItem, handleListMarkerMouseDown, joinCollapsedListBackward, joinListElements, joinListUp, listToDOM, orderedListInputRule, protectCollapsed, taskListInputRule, unwrapListSlice } from "prosemirror-flat-list";
|
|
48
50
|
import { defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableEditingPlugin, defineTableHeaderCellSpec, defineTableRowSpec, defineTableSpec, deleteTable, isCellSelection } from "@prosekit/extensions/table";
|
|
49
|
-
import { InputRule } from "@prosekit/pm/inputrules";
|
|
50
51
|
|
|
51
52
|
//#region src/utils/composition.ts
|
|
52
53
|
const COMPOSITION_TAIL_MS = 50;
|
|
@@ -629,6 +630,129 @@ function isNodeOfType(node, name) {
|
|
|
629
630
|
return node.type.name === name;
|
|
630
631
|
}
|
|
631
632
|
|
|
633
|
+
//#endregion
|
|
634
|
+
//#region src/extensions/backspace-empty-first-block.ts
|
|
635
|
+
/**
|
|
636
|
+
* Claim Backspace only when the selection is an empty caret in an empty
|
|
637
|
+
* paragraph that is the document's first block and has a block after it.
|
|
638
|
+
* Delete that paragraph and leave the following block as it is.
|
|
639
|
+
*/
|
|
640
|
+
const deleteEmptyFirstBlock = (state, dispatch) => {
|
|
641
|
+
const { $from, empty } = state.selection;
|
|
642
|
+
if (!empty || $from.depth !== 1 || $from.index(0) !== 0) return false;
|
|
643
|
+
const block = $from.parent;
|
|
644
|
+
if (!isNodeOfType(block, "paragraph") || block.content.size > 0) return false;
|
|
645
|
+
if (state.doc.childCount < 2) return false;
|
|
646
|
+
if (dispatch) {
|
|
647
|
+
const tr = state.tr.delete(0, block.nodeSize);
|
|
648
|
+
tr.setSelection(Selection.atStart(tr.doc));
|
|
649
|
+
dispatch(tr.scrollIntoView());
|
|
650
|
+
}
|
|
651
|
+
return true;
|
|
652
|
+
};
|
|
653
|
+
/**
|
|
654
|
+
* Nothing sits before the document's first block, so Backspace in an empty
|
|
655
|
+
* first paragraph has nothing to join and does nothing. When this extension is
|
|
656
|
+
* applied, that Backspace deletes the empty paragraph instead, and the rest of
|
|
657
|
+
* the document moves up one line.
|
|
658
|
+
*/
|
|
659
|
+
function defineBackspaceEmptyFirstBlock(enabled) {
|
|
660
|
+
return withPriority$1(defineKeymap({ Backspace: (state, dispatch) => {
|
|
661
|
+
return (!enabled || enabled(state)) && deleteEmptyFirstBlock(state, dispatch);
|
|
662
|
+
} }), Priority$1.lowest);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
//#endregion
|
|
666
|
+
//#region src/converters/paragraph.ts
|
|
667
|
+
/**
|
|
668
|
+
* Build one paragraph without interpreting block-opening Markdown.
|
|
669
|
+
*/
|
|
670
|
+
function paragraphMarkdownToDoc(markdown, nodes = getNodeBuilders()) {
|
|
671
|
+
return astToDoc({
|
|
672
|
+
type: "document",
|
|
673
|
+
children: [{
|
|
674
|
+
type: "paragraph",
|
|
675
|
+
value: markdown.replaceAll(/\r\n?/g, "\n").replaceAll(/\n[ \t]*\n+/g, "\n")
|
|
676
|
+
}]
|
|
677
|
+
}, nodes);
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Flatten textblocks into one paragraph's source content.
|
|
681
|
+
*/
|
|
682
|
+
function docToParagraphMarkdown(doc) {
|
|
683
|
+
const paragraphs = [];
|
|
684
|
+
doc.descendants((node) => {
|
|
685
|
+
if (!node.isTextblock) return true;
|
|
686
|
+
paragraphs.push(node.textContent);
|
|
687
|
+
return false;
|
|
688
|
+
});
|
|
689
|
+
return paragraphs.join("\n").replaceAll(/\n[ \t]*\n+/g, "\n");
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
//#endregion
|
|
693
|
+
//#region src/extensions/single-paragraph.ts
|
|
694
|
+
const singleParagraphPluginKey = new PluginKey("single-paragraph");
|
|
695
|
+
/**
|
|
696
|
+
* Whether the editor holds one paragraph of inline Markdown (the
|
|
697
|
+
* `singleParagraph` editor config option).
|
|
698
|
+
*/
|
|
699
|
+
function isSingleParagraph(state) {
|
|
700
|
+
return !!getEditorConfig(state).singleParagraph;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Keep the document to one paragraph while `singleParagraph` is set. Input
|
|
704
|
+
* rules and enter rules that open a block stay inert on their own (see
|
|
705
|
+
* `block-rule.ts`); this flattens what still arrives as blocks, such as a
|
|
706
|
+
* paste or a command, into paragraph text separated by soft lines.
|
|
707
|
+
*/
|
|
708
|
+
function defineSingleParagraph() {
|
|
709
|
+
return withPriority$1(definePlugin(new Plugin({
|
|
710
|
+
key: singleParagraphPluginKey,
|
|
711
|
+
appendTransaction(transactions, _oldState, state) {
|
|
712
|
+
if (!isSingleParagraph(state)) return;
|
|
713
|
+
if (!transactions.some((transaction) => transaction.docChanged)) return;
|
|
714
|
+
const markdown = docToParagraphMarkdown(state.doc);
|
|
715
|
+
if (state.doc.childCount === 1 && isNodeOfType(state.doc.child(0), "paragraph") && state.doc.child(0).textContent === markdown) return;
|
|
716
|
+
const doc = paragraphMarkdownToDoc(markdown, getNodeBuildersForSchema(state.schema));
|
|
717
|
+
const position = Math.min(state.selection.head, doc.content.size - 1);
|
|
718
|
+
const transaction = state.tr.replaceWith(0, state.doc.content.size, doc.content);
|
|
719
|
+
return transaction.setSelection(TextSelection.create(transaction.doc, Math.max(1, position)));
|
|
720
|
+
}
|
|
721
|
+
})), Priority$1.highest);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
//#endregion
|
|
725
|
+
//#region src/extensions/block-rule.ts
|
|
726
|
+
/**
|
|
727
|
+
* An input rule whose match turns the textblock into, or wraps it in, a block
|
|
728
|
+
* node. In a single paragraph the match is left as typed text: there is no
|
|
729
|
+
* block for it to open.
|
|
730
|
+
*/
|
|
731
|
+
function defineBlockInputRule(regex, handler) {
|
|
732
|
+
return defineInputRule(new InputRule(regex, (state, match, start, end) => {
|
|
733
|
+
return isSingleParagraph(state) ? null : handler(state, match, start, end);
|
|
734
|
+
}));
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* An enter rule whose match turns the textblock into a block node. In a single
|
|
738
|
+
* paragraph the match is left as typed text, like {@link defineBlockInputRule}.
|
|
739
|
+
*/
|
|
740
|
+
function defineBlockEnterRule(options) {
|
|
741
|
+
const rule = createTextBlockEnterRule(options);
|
|
742
|
+
return defineEnterRule({
|
|
743
|
+
...rule,
|
|
744
|
+
handler: (handlerOptions) => {
|
|
745
|
+
return isSingleParagraph(handlerOptions.state) ? null : rule.handler(handlerOptions);
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
//#endregion
|
|
751
|
+
//#region src/extensions/blockquote.ts
|
|
752
|
+
function defineMeowdownBlockquote() {
|
|
753
|
+
return union(defineBlockquoteSpec(), defineBlockquoteCommands(), defineBlockquoteKeymap(), defineBlockInputRule(blockquoteInputRule.regex, createWrappingInputRuleHandler(blockquoteInputRule)));
|
|
754
|
+
}
|
|
755
|
+
|
|
632
756
|
//#endregion
|
|
633
757
|
//#region src/extensions/bullet-after-heading.ts
|
|
634
758
|
/**
|
|
@@ -1092,7 +1216,7 @@ function defineHeadingKeymap() {
|
|
|
1092
1216
|
});
|
|
1093
1217
|
}
|
|
1094
1218
|
function defineHeading() {
|
|
1095
|
-
return union(defineHeadingSpec(), defineHeadingWhitespace(), defineSetextUnderlineAttr(), defineHeadingClosingHashesAttr(),
|
|
1219
|
+
return union(defineHeadingSpec(), defineHeadingWhitespace(), defineSetextUnderlineAttr(), defineHeadingClosingHashesAttr(), defineBlockInputRule(headingInputRule.regex, createTextBlockInputRuleHandler(headingInputRule)), defineHeadingCommands(), defineHeadingKeymap());
|
|
1096
1220
|
}
|
|
1097
1221
|
|
|
1098
1222
|
//#endregion
|
|
@@ -1813,22 +1937,20 @@ function getTildeFenceAttrs(match) {
|
|
|
1813
1937
|
fenceStyle: "tilde"
|
|
1814
1938
|
};
|
|
1815
1939
|
}
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
});
|
|
1822
|
-
}
|
|
1940
|
+
const tildeFenceInputRule = {
|
|
1941
|
+
regex: /^~~~(\S*)\s$/,
|
|
1942
|
+
type: "codeBlock",
|
|
1943
|
+
attrs: getTildeFenceAttrs
|
|
1944
|
+
};
|
|
1823
1945
|
function defineTildeFenceEnterRule() {
|
|
1824
|
-
return
|
|
1946
|
+
return defineBlockEnterRule({
|
|
1825
1947
|
regex: /^~~~(\S*)$/,
|
|
1826
1948
|
type: "codeBlock",
|
|
1827
1949
|
attrs: getTildeFenceAttrs
|
|
1828
1950
|
});
|
|
1829
1951
|
}
|
|
1830
1952
|
function defineDollarFenceEnterRule() {
|
|
1831
|
-
return
|
|
1953
|
+
return defineBlockEnterRule({
|
|
1832
1954
|
regex: /^\$\$$/,
|
|
1833
1955
|
type: "codeBlock",
|
|
1834
1956
|
attrs: () => ({
|
|
@@ -1837,8 +1959,8 @@ function defineDollarFenceEnterRule() {
|
|
|
1837
1959
|
})
|
|
1838
1960
|
});
|
|
1839
1961
|
}
|
|
1840
|
-
function defineCodeBlock
|
|
1841
|
-
return union(
|
|
1962
|
+
function defineCodeBlock() {
|
|
1963
|
+
return union(defineCodeBlockSpec(), defineCodeBlockKeymap(), defineCodeBlockCommands(), defineBlockInputRule(codeBlockInputRule.regex, createTextBlockInputRuleHandler(codeBlockInputRule)), defineBlockEnterRule(codeBlockEnterRule), defineFenceStyleAttr(), defineFenceLengthAttr(), defineBlockInputRule(tildeFenceInputRule.regex, createTextBlockInputRuleHandler(tildeFenceInputRule)), defineTildeFenceEnterRule(), defineDollarFenceEnterRule(), defineCodeBlockExitKeymap());
|
|
1842
1964
|
}
|
|
1843
1965
|
|
|
1844
1966
|
//#endregion
|
|
@@ -3035,7 +3157,7 @@ function defineHorizontalRuleMarkerAttr() {
|
|
|
3035
3157
|
});
|
|
3036
3158
|
}
|
|
3037
3159
|
function defineMeowdownHorizontalRule() {
|
|
3038
|
-
return union(
|
|
3160
|
+
return union(defineHorizontalRuleSpec(), defineHorizontalRuleCommands(), defineHorizontalRuleMarkerAttr(), defineBlockInputRule(horizontalRuleInputRule.regex, horizontalRuleInputRule.handler));
|
|
3039
3161
|
}
|
|
3040
3162
|
|
|
3041
3163
|
//#endregion
|
|
@@ -4518,75 +4640,6 @@ function emit(out, from, to, marks) {
|
|
|
4518
4640
|
]);
|
|
4519
4641
|
}
|
|
4520
4642
|
|
|
4521
|
-
//#endregion
|
|
4522
|
-
//#region src/converters/paragraph.ts
|
|
4523
|
-
/**
|
|
4524
|
-
* Build one paragraph without interpreting block-opening Markdown.
|
|
4525
|
-
*/
|
|
4526
|
-
function paragraphMarkdownToDoc(markdown, nodes = getNodeBuilders()) {
|
|
4527
|
-
return astToDoc({
|
|
4528
|
-
type: "document",
|
|
4529
|
-
children: [{
|
|
4530
|
-
type: "paragraph",
|
|
4531
|
-
value: markdown.replaceAll(/\r\n?/g, "\n").replaceAll(/\n[ \t]*\n+/g, "\n")
|
|
4532
|
-
}]
|
|
4533
|
-
}, nodes);
|
|
4534
|
-
}
|
|
4535
|
-
/**
|
|
4536
|
-
* Flatten textblocks into one paragraph's source content.
|
|
4537
|
-
*/
|
|
4538
|
-
function docToParagraphMarkdown(doc) {
|
|
4539
|
-
const paragraphs = [];
|
|
4540
|
-
doc.descendants((node) => {
|
|
4541
|
-
if (!node.isTextblock) return true;
|
|
4542
|
-
paragraphs.push(node.textContent);
|
|
4543
|
-
return false;
|
|
4544
|
-
});
|
|
4545
|
-
return paragraphs.join("\n").replaceAll(/\n[ \t]*\n+/g, "\n");
|
|
4546
|
-
}
|
|
4547
|
-
|
|
4548
|
-
//#endregion
|
|
4549
|
-
//#region src/extensions/single-paragraph.ts
|
|
4550
|
-
const singleParagraphPluginKey = new PluginKey("single-paragraph");
|
|
4551
|
-
/**
|
|
4552
|
-
* Keep editing and pasted content within one paragraph.
|
|
4553
|
-
* Opt into this extension for inline Markdown fields such as task paragraphs.
|
|
4554
|
-
* Register it alongside `defineMeowdown`, seed content with
|
|
4555
|
-
* `paragraphMarkdownToDoc`, and read edits with `docToParagraphMarkdown`.
|
|
4556
|
-
* Ordinary note editors should keep their full document behavior.
|
|
4557
|
-
*
|
|
4558
|
-
* Text input stays literal, before block input rules can consume prefixes.
|
|
4559
|
-
* Transactions and pasted blocks flatten to paragraph text separated by soft
|
|
4560
|
-
* lines. Reference definitions come from `referenceDefinitions` in the editor
|
|
4561
|
-
* config; definition-looking content in the field remains visible literal text.
|
|
4562
|
-
* Enter/submit, focus, and persistence remain the caller's responsibility.
|
|
4563
|
-
*
|
|
4564
|
-
* @example
|
|
4565
|
-
* const editor = createEditor({
|
|
4566
|
-
* extension: union(defineMeowdown({ referenceDefinitions }), defineSingleParagraph()),
|
|
4567
|
-
* defaultContent: paragraphMarkdownToDoc('Buy **milk**'),
|
|
4568
|
-
* })
|
|
4569
|
-
* const markdown = docToParagraphMarkdown(editor.state.doc)
|
|
4570
|
-
*/
|
|
4571
|
-
function defineSingleParagraph() {
|
|
4572
|
-
return withPriority$1(definePlugin(new Plugin({
|
|
4573
|
-
key: singleParagraphPluginKey,
|
|
4574
|
-
props: { handleTextInput(view, from, to, text) {
|
|
4575
|
-
view.dispatch(view.state.tr.insertText(text, from, to));
|
|
4576
|
-
return true;
|
|
4577
|
-
} },
|
|
4578
|
-
appendTransaction(transactions, _oldState, state) {
|
|
4579
|
-
if (!transactions.some((transaction) => transaction.docChanged)) return;
|
|
4580
|
-
const markdown = docToParagraphMarkdown(state.doc);
|
|
4581
|
-
if (state.doc.childCount === 1 && isNodeOfType(state.doc.child(0), "paragraph") && state.doc.child(0).textContent === markdown) return;
|
|
4582
|
-
const doc = paragraphMarkdownToDoc(markdown, getNodeBuildersForSchema(state.schema));
|
|
4583
|
-
const position = Math.min(state.selection.head, doc.content.size - 1);
|
|
4584
|
-
const transaction = state.tr.replaceWith(0, state.doc.content.size, doc.content);
|
|
4585
|
-
return transaction.setSelection(TextSelection.create(transaction.doc, Math.max(1, position)));
|
|
4586
|
-
}
|
|
4587
|
-
})), Priority$1.highest);
|
|
4588
|
-
}
|
|
4589
|
-
|
|
4590
4643
|
//#endregion
|
|
4591
4644
|
//#region src/extensions/inline-mark-plugin.ts
|
|
4592
4645
|
const META_KEY = "inline-marks-applied";
|
|
@@ -4683,7 +4736,7 @@ function createInlineMarkPlugin(getOptions) {
|
|
|
4683
4736
|
const touchesRange = pos <= range.to && pos + node.nodeSize >= range.from;
|
|
4684
4737
|
const dependsOnChange = cached == null || setsIntersect(cached.referencedKeys, changedKeys);
|
|
4685
4738
|
if (!touchesRange && !dependsOnChange) return false;
|
|
4686
|
-
const nodeChunks = chunksForTextblock(node, pos + 1, state.schema, options, references, changedKeys, !
|
|
4739
|
+
const nodeChunks = chunksForTextblock(node, pos + 1, state.schema, options, references, changedKeys, !isSingleParagraph(state) && isReferenceDefinitionNode(node, parent, index));
|
|
4687
4740
|
if (nodeChunks.length > 0) chunks.push(...nodeChunks);
|
|
4688
4741
|
const updated = chunkCache.get(node);
|
|
4689
4742
|
if (updated != null) processed.push({
|
|
@@ -4706,7 +4759,7 @@ function createInlineMarkPlugin(getOptions) {
|
|
|
4706
4759
|
}
|
|
4707
4760
|
}
|
|
4708
4761
|
function collectReferences(doc, external, state) {
|
|
4709
|
-
const local =
|
|
4762
|
+
const local = isSingleParagraph(state) ? {
|
|
4710
4763
|
nodes: /* @__PURE__ */ new Set(),
|
|
4711
4764
|
definitions: /* @__PURE__ */ new Map()
|
|
4712
4765
|
} : collectReferenceDefinitions(doc);
|
|
@@ -4732,7 +4785,7 @@ function createInlineMarkPlugin(getOptions) {
|
|
|
4732
4785
|
};
|
|
4733
4786
|
if (transaction.getMeta(META_KEY)) return value;
|
|
4734
4787
|
const externalDefinitions = getOptions?.(oldState)?.referenceDefinitions;
|
|
4735
|
-
const references =
|
|
4788
|
+
const references = isSingleParagraph(oldState) || externalDefinitions !== value.externalDefinitions || externalDefinitions && transaction.docChanged ? collectReferences(newState.doc, externalDefinitions, newState) : updateReferenceDefinitions(value.references, transaction, newState.doc);
|
|
4736
4789
|
if (references === value.references) return value;
|
|
4737
4790
|
const changedKeys = getChangedReferenceKeys(value.references.definitions, references.definitions);
|
|
4738
4791
|
if (changedKeys.size === 0) return {
|
|
@@ -5786,36 +5839,20 @@ function normalizeTaskList(node) {
|
|
|
5786
5839
|
node.replaceChildren(...content.children);
|
|
5787
5840
|
textBlock.prepend(checkbox);
|
|
5788
5841
|
}
|
|
5789
|
-
const
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
collapsed: false
|
|
5793
|
-
}),
|
|
5794
|
-
wrappingListInputRule(/^\s?(\d+)\.\s$/, ({ match }) => {
|
|
5795
|
-
const text = match[1];
|
|
5796
|
-
const num = text ? parseInt(text, 10) : void 0;
|
|
5797
|
-
return {
|
|
5798
|
-
kind: "ordered",
|
|
5799
|
-
collapsed: false,
|
|
5800
|
-
order: num && num >= 2 && Number.isSafeInteger(num) ? num : null
|
|
5801
|
-
};
|
|
5802
|
-
}),
|
|
5803
|
-
wrappingListInputRule(/^\s?\[([\sX]?)\]\s$/i, ({ match }) => {
|
|
5804
|
-
return {
|
|
5805
|
-
kind: "task",
|
|
5806
|
-
checked: ["x", "X"].includes(match[1]),
|
|
5807
|
-
collapsed: false
|
|
5808
|
-
};
|
|
5809
|
-
}),
|
|
5810
|
-
wrappingListInputRule(/^\s?\+\s$/, {
|
|
5842
|
+
const circleTaskListInputRule = {
|
|
5843
|
+
regexp: /^\s?\+\s$/,
|
|
5844
|
+
getAttrs: {
|
|
5811
5845
|
kind: "task",
|
|
5812
5846
|
marker: "+",
|
|
5813
5847
|
checked: false,
|
|
5814
5848
|
collapsed: false
|
|
5815
|
-
}
|
|
5816
|
-
|
|
5849
|
+
}
|
|
5850
|
+
};
|
|
5851
|
+
function defineListInputRule({ regexp, getAttrs }) {
|
|
5852
|
+
return defineBlockInputRule(regexp, createListInputRuleHandler(getAttrs));
|
|
5853
|
+
}
|
|
5817
5854
|
function defineMeowdownListInputRules() {
|
|
5818
|
-
return union(
|
|
5855
|
+
return union(defineListInputRule(bulletListInputRule), defineListInputRule(orderedListInputRule), defineListInputRule(taskListInputRule), defineListInputRule(circleTaskListInputRule));
|
|
5819
5856
|
}
|
|
5820
5857
|
/**
|
|
5821
5858
|
* Circle checkbox task: a `task` list item with a `+` marker.
|
|
@@ -5896,13 +5933,34 @@ function cycleBulletOrderedList() {
|
|
|
5896
5933
|
function toggleListCollapsed() {
|
|
5897
5934
|
return createToggleCollapsedCommand({ isToggleable: isCollapsibleBullet });
|
|
5898
5935
|
}
|
|
5936
|
+
function indentList(options) {
|
|
5937
|
+
return createIndentListCommand({
|
|
5938
|
+
strict: true,
|
|
5939
|
+
...options
|
|
5940
|
+
});
|
|
5941
|
+
}
|
|
5942
|
+
function dedentList(options) {
|
|
5943
|
+
return createDedentListCommand({
|
|
5944
|
+
strict: true,
|
|
5945
|
+
...options
|
|
5946
|
+
});
|
|
5947
|
+
}
|
|
5948
|
+
function splitList(options) {
|
|
5949
|
+
return createSplitListCommand({
|
|
5950
|
+
strict: true,
|
|
5951
|
+
...options
|
|
5952
|
+
});
|
|
5953
|
+
}
|
|
5899
5954
|
function defineMeowdownListCommands() {
|
|
5900
5955
|
return defineCommands({
|
|
5901
5956
|
cycleCheckableList,
|
|
5902
5957
|
cycleBulletOrderedList,
|
|
5903
5958
|
wrapInCircleTask,
|
|
5904
5959
|
wrapInSquareTask,
|
|
5905
|
-
toggleListCollapsed
|
|
5960
|
+
toggleListCollapsed,
|
|
5961
|
+
indentList,
|
|
5962
|
+
dedentList,
|
|
5963
|
+
splitList
|
|
5906
5964
|
});
|
|
5907
5965
|
}
|
|
5908
5966
|
/**
|
|
@@ -6002,6 +6060,13 @@ function defineMeowdownListPlugins() {
|
|
|
6002
6060
|
}
|
|
6003
6061
|
function defineMeowdownListKeymap() {
|
|
6004
6062
|
return defineKeymap({
|
|
6063
|
+
Enter: chainCommands(protectCollapsed, splitList()),
|
|
6064
|
+
Backspace: chainCommands(protectCollapsed, deleteSelection, joinListUp, joinCollapsedListBackward),
|
|
6065
|
+
Delete: deleteCommand,
|
|
6066
|
+
Tab: indentList(),
|
|
6067
|
+
"Shift-Tab": dedentList(),
|
|
6068
|
+
"Mod-]": indentList(),
|
|
6069
|
+
"Mod-[": dedentList(),
|
|
6005
6070
|
"Mod-Enter": rotateSquareTask(),
|
|
6006
6071
|
"Mod-Shift-Enter": rotateCircleTask(),
|
|
6007
6072
|
"Mod-.": createToggleCollapsedCommand({ isToggleable: isCollapsibleBullet }),
|
|
@@ -6021,7 +6086,7 @@ function defineMeowdownListKeymap() {
|
|
|
6021
6086
|
});
|
|
6022
6087
|
}
|
|
6023
6088
|
function defineMeowdownList() {
|
|
6024
|
-
return union(defineListSpec(), defineMeowdownListPlugins(),
|
|
6089
|
+
return union(defineListSpec(), defineMeowdownListPlugins(), defineListCommands(), defineMeowdownListSerializer(), defineListDropIndicator(), defineMeowdownListInputRules(), defineMeowdownListKeymap(), defineListMarkerAttr(), defineListTaskMarkerAttr(), defineListMarkerGapAttr(), defineMeowdownListCommands());
|
|
6025
6090
|
}
|
|
6026
6091
|
|
|
6027
6092
|
//#endregion
|
|
@@ -7283,7 +7348,7 @@ function defineYouTubeVideoClickHandler(getOnClick) {
|
|
|
7283
7348
|
//#endregion
|
|
7284
7349
|
//#region src/extensions/extension.ts
|
|
7285
7350
|
function defineEditorExtensionImpl(options) {
|
|
7286
|
-
return union(defineMeowdownParagraph(), defineDoc(), defineDocFrontmatterAttr(), defineText(),
|
|
7351
|
+
return union(defineMeowdownParagraph(), defineDoc(), defineDocFrontmatterAttr(), defineText(), defineMeowdownBlockquote(), defineMeowdownList(), defineHeading(), defineTable(), defineCodeBlock(), defineMeowdownHorizontalRule(), defineHTMLComment(), defineInlineMarks(), defineEditorConfig(options), defineImage(getEditorConfig), defineFileView(getEditorConfig), defineModClickPrevention(), defineFileClickHandler((state) => getEditorConfig(state).onFileClick), defineImageClickHandler((state) => getEditorConfig(state).onImageClick), defineXPostMediaClickHandler((state) => getEditorConfig(state).onXPostMediaClick), defineYouTubeVideoClickHandler((state) => getEditorConfig(state).onYouTubeVideoClick), defineWikilinkClickHandler((state) => getEditorConfig(state).onWikilinkClick), defineTagClickHandler((state) => getEditorConfig(state).onTagClick), defineLinkClickHandler((state) => getEditorConfig(state).onLinkClick), defineFollowLinkHandler(getEditorConfig), defineExitBoundaryHandler((state) => getEditorConfig(state).onExitBoundary), defineFilePaste(getEditorConfig), defineEmbedPaste((state) => !!getEditorConfig(state).embedPaste), defineLinkPaste((state) => !!getEditorConfig(state).linkPaste), defineBulletAfterHeading((state) => !!getEditorConfig(state).bulletAfterHeading), defineBackspaceEmptyFirstBlock((state) => !!getEditorConfig(state).backspaceDeletesEmptyFirstBlock), defineSubstitution((state) => !!getEditorConfig(state).substitution), defineWikilinkTrigger((state) => !!getEditorConfig(state).wikilinkEnabled), definePlaceholder$1({
|
|
7287
7352
|
placeholder: (state) => {
|
|
7288
7353
|
const placeholder = getEditorConfig(state).placeholder;
|
|
7289
7354
|
return typeof placeholder === "function" ? placeholder(state) : placeholder ?? "";
|
|
@@ -7295,7 +7360,7 @@ function defineEditorExtensionImpl(options) {
|
|
|
7295
7360
|
if (editorClassName) attributes.class += ` ${editorClassName}`;
|
|
7296
7361
|
if (spellCheck != null) attributes.spellcheck = String(spellCheck);
|
|
7297
7362
|
return attributes;
|
|
7298
|
-
}), defineCodeBlockSyntaxHighlight(), defineCrossEditorDrag(), defineClickBelow(), defineEscapeCollapse(), defineSoftBreak(), defineMoveBlock(), defineSelectDocBoundary(), defineInlineMarkPlugin(getEditorConfig), defineInlineToggle(), defineLinkCommands(), defineWikilink(), defineMath(), defineMarkMode(getMarkMode), defineClipboard(), defineScrollToSelection(), defineHiddenRunCaret(), defineSystemSubstitutionGuard(), defineAtomMarkNavigation({ marks: ATOM_SOURCE_MARK_NAMES.map((name) => ({
|
|
7363
|
+
}), defineCodeBlockSyntaxHighlight(), defineCrossEditorDrag(), defineClickBelow(), defineEscapeCollapse(), defineSoftBreak(), defineMoveBlock(), defineSelectDocBoundary(), defineSingleParagraph(), defineInlineMarkPlugin(getEditorConfig), defineInlineToggle(), defineLinkCommands(), defineWikilink(), defineMath(), defineMarkMode(getMarkMode), defineClipboard(), defineScrollToSelection(), defineHiddenRunCaret(), defineSystemSubstitutionGuard(), defineAtomMarkNavigation({ marks: ATOM_SOURCE_MARK_NAMES.map((name) => ({
|
|
7299
7364
|
name,
|
|
7300
7365
|
modes: [
|
|
7301
7366
|
"hide",
|
|
@@ -8074,4 +8139,4 @@ function getVirtualElementFromRange(view, range) {
|
|
|
8074
8139
|
}
|
|
8075
8140
|
|
|
8076
8141
|
//#endregion
|
|
8077
|
-
export { EDITOR_KEY_BINDINGS, Priority, buildFileMarkdown, checkRoundTrip, codeBlockLanguages, collectReferenceDefinitions, defaultResolveImageUrl, defaultResolveXPost, defaultResolveYouTubeVideo, defineBulletAfterHeading, defineCodeBlockPreviewPlugin, defineCodeBlockSyntaxHighlight, defineEditorExtension, defineEmbedPaste, defineExitBoundaryHandler, defineFileClickHandler, defineFilePaste, defineFileView, defineFollowLinkHandler, defineHTMLComment, defineImage, defineImageClickHandler, defineLinkClickHandler, defineLinkCommands, defineLinkEditKeymap, defineLinkHoverHandler, defineLinkPaste, defineMath, definePendingReplacementHandler, definePlaceholder, defineReadonly, defineSearchStatusHandler,
|
|
8142
|
+
export { EDITOR_KEY_BINDINGS, Priority, buildFileMarkdown, checkRoundTrip, codeBlockLanguages, collectReferenceDefinitions, defaultResolveImageUrl, defaultResolveXPost, defaultResolveYouTubeVideo, defineBackspaceEmptyFirstBlock, defineBulletAfterHeading, defineCodeBlockPreviewPlugin, defineCodeBlockSyntaxHighlight, defineEditorExtension, defineEmbedPaste, defineExitBoundaryHandler, defineFileClickHandler, defineFilePaste, defineFileView, defineFollowLinkHandler, defineHTMLComment, defineImage, defineImageClickHandler, defineLinkClickHandler, defineLinkCommands, defineLinkEditKeymap, defineLinkHoverHandler, defineLinkPaste, defineMath, definePendingReplacementHandler, definePlaceholder, defineReadonly, defineSearchStatusHandler, defineSubstitution, defineTagClickHandler, defineViewAttributes, defineVirtualCaret, defineWikilinkClickHandler, defineWikilinkHoverHandler, defineWikilinkTrigger, defineXPostMediaClickHandler, defineYouTubeVideoClickHandler, dismissLinkHover, docToMarkdown, docToParagraphMarkdown, formatFileSize, formatSizedWikiEmbed, getCodeTokens, getEditorConfig, getFileKind, getIsComposing, getLinkText, getLinkUnitAt, getMarkBuilders, getPendingReplacement, getSearchStatus, getSelectedText, getTableColumnAlign, getTextblockDisplayText, getVirtualElementFromRange, inlineTextToMarkChunks, inlineTextToMarkChunksWithContext, insertLink, isCodeBlockPreviewHiddenDecoration, isLinkTextForHref, isMarkOfType, isModEvent, isNodeOfType, isReferenceDefinitionNode, isSelectionInTableCell, loadKaTeX, markdownToDoc, normalizeHref, paragraphMarkdownToDoc, parsePostEmbedSnapshot, parseWikiEmbed, removeLink, renderMathInto, updateEditorConfig, updateLink, wikiEmbedBasename, withPriority };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meowdown/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.80.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"./dist/**/*.css"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@codemirror/language": "^6.
|
|
24
|
+
"@codemirror/language": "^6.13.1",
|
|
25
25
|
"@codemirror/language-data": "^6.5.2",
|
|
26
26
|
"@floating-ui/dom": "^1.8.0",
|
|
27
|
-
"@lezer/highlight": "^1.2.
|
|
27
|
+
"@lezer/highlight": "^1.2.5",
|
|
28
28
|
"@meowdown/embed": "0.3.1",
|
|
29
29
|
"@meowdown/markdown": "0.76.0",
|
|
30
30
|
"@ocavue/utils": "^1.8.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@post-embed/schema": "^0.5.2",
|
|
33
33
|
"@post-embed/types": "^0.5.0",
|
|
34
34
|
"@prosekit/core": "^0.13.3",
|
|
35
|
-
"@prosekit/extensions": "^0.18.
|
|
35
|
+
"@prosekit/extensions": "^0.18.4",
|
|
36
36
|
"@prosekit/pm": "^0.1.20",
|
|
37
37
|
"@prosekit/web": "^0.9.3",
|
|
38
38
|
"hast-util-to-mdast": "^10.1.2",
|
|
@@ -41,9 +41,10 @@
|
|
|
41
41
|
"mdast-util-to-markdown": "^2.2.0",
|
|
42
42
|
"micromark-util-decode-string": "^2.0.1",
|
|
43
43
|
"micromark-util-normalize-identifier": "^2.0.1",
|
|
44
|
-
"prosemirror-
|
|
44
|
+
"prosemirror-enter-rules": "^0.1.6",
|
|
45
|
+
"prosemirror-flat-list": "^0.7.3",
|
|
45
46
|
"prosemirror-highlight": "^0.16.0",
|
|
46
|
-
"rehype-parse": "^9.0.
|
|
47
|
+
"rehype-parse": "^9.0.0",
|
|
47
48
|
"rehype-remark": "^10.0.1",
|
|
48
49
|
"remark-gfm": "^4.0.1",
|
|
49
50
|
"remark-stringify": "^11.0.0",
|