@meowdown/core 0.81.3 → 0.83.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 +37 -133
- package/dist/index.js +169 -238
- package/dist/style.css +123 -21
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ import "prosemirror-flat-list";
|
|
|
13
13
|
import { render } from "katex";
|
|
14
14
|
import { XPost, YouTubeVideo } from "@post-embed/types";
|
|
15
15
|
import { VirtualElement } from "@floating-ui/dom";
|
|
16
|
-
//#region src/extensions/frontmatter.d.ts
|
|
17
16
|
/**
|
|
18
17
|
* The raw YAML frontmatter body, stored verbatim (the text between the opening
|
|
19
18
|
* and closing `---` fences, without a trailing newline).
|
|
@@ -23,8 +22,6 @@ import { VirtualElement } from "@floating-ui/dom";
|
|
|
23
22
|
* - any other string is the body, which may contain newlines.
|
|
24
23
|
*/
|
|
25
24
|
type Frontmatter = string | null;
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/extensions/list.d.ts
|
|
28
25
|
/**
|
|
29
26
|
* The marker for a list item.
|
|
30
27
|
*
|
|
@@ -47,8 +44,6 @@ interface MeowdownListAttrs extends ListAttrs {
|
|
|
47
44
|
taskMarker?: TaskMarker | undefined;
|
|
48
45
|
markerGap?: number | undefined;
|
|
49
46
|
}
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/extensions/table-column-align.d.ts
|
|
52
47
|
/**
|
|
53
48
|
* Column alignment of a GFM table, encoded by the delimiter row: `:--` for
|
|
54
49
|
* left, `:-:` for center, `--:` for right.
|
|
@@ -84,8 +79,6 @@ type TableColumnAlignCommandsExtension = Extension<{
|
|
|
84
79
|
};
|
|
85
80
|
}>;
|
|
86
81
|
type TableColumnAlignExtension = Union<[TableCellAlignExtension, TableHeaderCellAlignExtension, PlainExtension, TableColumnAlignCommandsExtension]>;
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region src/extensions/code-block.d.ts
|
|
89
82
|
type CodeBlockFenceStyle = 'tilde' | 'indented' | 'dollar';
|
|
90
83
|
interface MeowdownCodeBlockAttrs extends CodeBlockAttrs$1 {
|
|
91
84
|
/**
|
|
@@ -102,8 +95,6 @@ interface MeowdownCodeBlockAttrs extends CodeBlockAttrs$1 {
|
|
|
102
95
|
*/
|
|
103
96
|
fenceLength?: number | null | undefined;
|
|
104
97
|
}
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region src/extensions/horizontal-rule.d.ts
|
|
107
98
|
interface MeowdownHorizontalRuleAttrs {
|
|
108
99
|
/**
|
|
109
100
|
* The literal markdown marker of a thematic break, e.g. `***`, `___`, or
|
|
@@ -117,8 +108,6 @@ type HorizontalRuleMarkerExtension = Extension<{
|
|
|
117
108
|
};
|
|
118
109
|
}>;
|
|
119
110
|
type MeowdownHorizontalRuleExtension = Union<[HorizontalRuleSpecExtension, HorizontalRuleCommandsExtension, HorizontalRuleMarkerExtension]>;
|
|
120
|
-
//#endregion
|
|
121
|
-
//#region src/extensions/html-comment.d.ts
|
|
122
111
|
interface MeowdownHTMLCommentAttrs {
|
|
123
112
|
/**
|
|
124
113
|
* The literal markdown comment, including its delimiters, e.g.
|
|
@@ -152,8 +141,6 @@ type HTMLCommentExtension = Extension<{
|
|
|
152
141
|
* invisible marker the cursor steps over rather than a block the user edits.
|
|
153
142
|
*/
|
|
154
143
|
export declare function defineHTMLComment(): HTMLCommentExtension;
|
|
155
|
-
//#endregion
|
|
156
|
-
//#region src/extensions/inline-marks.d.ts
|
|
157
144
|
/**
|
|
158
145
|
* Attributes of the `mdImage` mark, derived from either ``
|
|
159
146
|
* (plus an optional trailing size comment) or a resolved wiki image embed.
|
|
@@ -298,14 +285,10 @@ type MdPackAttrs = {
|
|
|
298
285
|
revealInFocus?: null | undefined;
|
|
299
286
|
revealInHide?: null | undefined;
|
|
300
287
|
};
|
|
301
|
-
//#endregion
|
|
302
|
-
//#region src/utils/range.d.ts
|
|
303
288
|
interface PositionRange {
|
|
304
289
|
from: number;
|
|
305
290
|
to: number;
|
|
306
291
|
}
|
|
307
|
-
//#endregion
|
|
308
|
-
//#region src/extensions/get-link-unit-at.d.ts
|
|
309
292
|
interface LinkUnitBase {
|
|
310
293
|
state: EditorState;
|
|
311
294
|
/**
|
|
@@ -357,8 +340,6 @@ type LinkUnit = (LinkUnitBase & {
|
|
|
357
340
|
* the `mdLinkUri` run locates the `( )` body.
|
|
358
341
|
*/
|
|
359
342
|
export declare function getLinkUnitAt(state: EditorState, pos: number): LinkUnit | undefined;
|
|
360
|
-
//#endregion
|
|
361
|
-
//#region src/extensions/link-commands.d.ts
|
|
362
343
|
interface LinkAttrs {
|
|
363
344
|
href?: string | undefined;
|
|
364
345
|
title?: string | undefined;
|
|
@@ -407,8 +388,6 @@ interface LinkEditOptions {
|
|
|
407
388
|
}
|
|
408
389
|
type LinkEditHandler = (options: LinkEditOptions) => void;
|
|
409
390
|
export declare function defineLinkEditKeymap(onLinkEdit: LinkEditHandler): PlainExtension;
|
|
410
|
-
//#endregion
|
|
411
|
-
//#region src/extensions/pending-replacement.d.ts
|
|
412
391
|
/**
|
|
413
392
|
* Where an accepted replacement lands relative to the source range.
|
|
414
393
|
*/
|
|
@@ -476,8 +455,6 @@ type PendingReplacementHandler = (event: PendingReplacementEvent) => void;
|
|
|
476
455
|
* render the preview and know whether the stage was accepted or discarded.
|
|
477
456
|
*/
|
|
478
457
|
export declare function definePendingReplacementHandler(handler: PendingReplacementHandler): PlainExtension;
|
|
479
|
-
//#endregion
|
|
480
|
-
//#region src/extensions/exit-boundary.d.ts
|
|
481
458
|
/**
|
|
482
459
|
* Payload for {@link ExitBoundaryHandler}.
|
|
483
460
|
*/
|
|
@@ -501,8 +478,6 @@ type ExitBoundaryHandler = (options: ExitBoundaryOptions) => boolean | void;
|
|
|
501
478
|
* Call `onExitBoundary` when an arrow key press would leave the document boundary.
|
|
502
479
|
*/
|
|
503
480
|
export declare function defineExitBoundaryHandler(getExitBoundaryHandler?: (state: EditorState) => ExitBoundaryHandler | undefined): PlainExtension;
|
|
504
|
-
//#endregion
|
|
505
|
-
//#region src/extensions/file-paste.d.ts
|
|
506
481
|
type FilePasteHandler = (file: File) => string | undefined | Promise<string | undefined>;
|
|
507
482
|
type FileSaveErrorHandler = (error: unknown, file: File) => void;
|
|
508
483
|
/**
|
|
@@ -538,8 +513,6 @@ export declare function buildFileMarkdown(file: {
|
|
|
538
513
|
* other file. Multiple files insert one link per line, in DataTransfer order.
|
|
539
514
|
*/
|
|
540
515
|
export declare function defineFilePaste(getOptions?: (state: EditorState) => FilePasteOptions | undefined): PlainExtension;
|
|
541
|
-
//#endregion
|
|
542
|
-
//#region src/extensions/file-view.d.ts
|
|
543
516
|
/**
|
|
544
517
|
* Metadata a host resolves for one file link, shown on its pill.
|
|
545
518
|
*/
|
|
@@ -577,8 +550,6 @@ export declare function getFileKind(href: string): string;
|
|
|
577
550
|
* clicks are reported through `defineFileClickHandler`.
|
|
578
551
|
*/
|
|
579
552
|
export declare function defineFileView(getOptions?: (state: EditorState) => FileViewOptions): PlainExtension;
|
|
580
|
-
//#endregion
|
|
581
|
-
//#region src/extensions/file-click.d.ts
|
|
582
553
|
/**
|
|
583
554
|
* Payload for {@link FileClickHandler}.
|
|
584
555
|
*/
|
|
@@ -609,8 +580,6 @@ type FileClickHandler = (payload: FileClickPayload) => void;
|
|
|
609
580
|
* click does (e.g. open the file in the OS default app).
|
|
610
581
|
*/
|
|
611
582
|
export declare function defineFileClickHandler(getOnClick?: (state: EditorState) => FileClickHandler | undefined): PlainExtension;
|
|
612
|
-
//#endregion
|
|
613
|
-
//#region src/extensions/image-click.d.ts
|
|
614
583
|
/**
|
|
615
584
|
* Payload for {@link ImageClickHandler}.
|
|
616
585
|
*/
|
|
@@ -653,8 +622,6 @@ type ImageClickHandler = (payload: ImageClickPayload) => void;
|
|
|
653
622
|
* (such as a lightbox).
|
|
654
623
|
*/
|
|
655
624
|
export declare function defineImageClickHandler(getOnClick?: (state: EditorState) => ImageClickHandler | undefined): PlainExtension;
|
|
656
|
-
//#endregion
|
|
657
|
-
//#region src/extensions/link-click.d.ts
|
|
658
625
|
interface LinkClickPayload {
|
|
659
626
|
href: string;
|
|
660
627
|
/**
|
|
@@ -678,8 +645,6 @@ type LinkCopyHandler = (payload: LinkCopyPayload) => void;
|
|
|
678
645
|
* is the originating `MouseEvent` or `KeyboardEvent`.
|
|
679
646
|
*/
|
|
680
647
|
export declare function defineLinkClickHandler(getOnClick?: (state: EditorState) => LinkClickHandler | undefined): PlainExtension;
|
|
681
|
-
//#endregion
|
|
682
|
-
//#region src/extensions/tag-click.d.ts
|
|
683
648
|
interface TagClickPayload {
|
|
684
649
|
/**
|
|
685
650
|
* The tag name, without the leading `#`.
|
|
@@ -703,8 +668,6 @@ type TagClickHandler = (payload: TagClickPayload) => void;
|
|
|
703
668
|
* without the leading `#`.
|
|
704
669
|
*/
|
|
705
670
|
export declare function defineTagClickHandler(getOnClick?: (state: EditorState) => TagClickHandler | undefined): PlainExtension;
|
|
706
|
-
//#endregion
|
|
707
|
-
//#region src/extensions/wikilink-click.d.ts
|
|
708
671
|
interface WikilinkHit {
|
|
709
672
|
from: number;
|
|
710
673
|
to: number;
|
|
@@ -729,8 +692,6 @@ type WikilinkClickHandler = (payload: WikilinkClickPayload) => void;
|
|
|
729
692
|
* `MouseEvent` or `KeyboardEvent`.
|
|
730
693
|
*/
|
|
731
694
|
export declare function defineWikilinkClickHandler(getOnClick?: (state: EditorState) => WikilinkClickHandler | undefined): PlainExtension;
|
|
732
|
-
//#endregion
|
|
733
|
-
//#region src/extensions/follow-link.d.ts
|
|
734
695
|
interface FollowLinkHandlers {
|
|
735
696
|
onWikilinkClick?: WikilinkClickHandler | undefined;
|
|
736
697
|
onTagClick?: TagClickHandler | undefined;
|
|
@@ -754,8 +715,6 @@ interface FollowLinkHandlers {
|
|
|
754
715
|
* itself.
|
|
755
716
|
*/
|
|
756
717
|
export declare function defineFollowLinkHandler(getHandlers?: (state: EditorState) => FollowLinkHandlers): PlainExtension;
|
|
757
|
-
//#endregion
|
|
758
|
-
//#region src/extensions/post-embed.d.ts
|
|
759
718
|
type XPostResolver = Resolver<XPost>;
|
|
760
719
|
type YouTubeVideoResolver = Resolver<YouTubeVideo>;
|
|
761
720
|
export declare const defaultResolveXPost: XPostResolver;
|
|
@@ -778,8 +737,6 @@ type PostEmbedSnapshot = {
|
|
|
778
737
|
* snapshot is exactly what the card needs.
|
|
779
738
|
*/
|
|
780
739
|
export declare function parsePostEmbedSnapshot(value: unknown): PostEmbedSnapshot | undefined;
|
|
781
|
-
//#endregion
|
|
782
|
-
//#region src/extensions/image.d.ts
|
|
783
740
|
/**
|
|
784
741
|
* Maps a markdown `src` to a displayable URL, or `undefined` to skip rendering
|
|
785
742
|
* that image. May return a `Promise` when the answer needs data that is not
|
|
@@ -827,14 +784,10 @@ export declare function defaultResolveImageUrl(src: string): string | undefined;
|
|
|
827
784
|
* plain Markdown.
|
|
828
785
|
*/
|
|
829
786
|
export declare function defineImage(getOptions?: (state: EditorState) => ImageOptions | undefined): PlainExtension;
|
|
830
|
-
//#endregion
|
|
831
|
-
//#region src/extensions/mark-chunk.d.ts
|
|
832
787
|
/**
|
|
833
788
|
* Contiguous range with a uniform inline-mark set.
|
|
834
789
|
*/
|
|
835
790
|
type MarkChunk = readonly [from: number, to: number, marks: readonly Mark[]];
|
|
836
|
-
//#endregion
|
|
837
|
-
//#region src/extensions/reference-links.d.ts
|
|
838
791
|
interface ReferenceDefinition {
|
|
839
792
|
key: string;
|
|
840
793
|
href: string;
|
|
@@ -847,8 +800,6 @@ interface ReferenceDefinitionIndex {
|
|
|
847
800
|
}
|
|
848
801
|
export declare function isReferenceDefinitionNode(node: EditorNode, parent: EditorNode | null, index: number): boolean;
|
|
849
802
|
export declare function collectReferenceDefinitions(doc: EditorNode): ReferenceDefinitionIndex;
|
|
850
|
-
//#endregion
|
|
851
|
-
//#region src/extensions/wiki-embed.d.ts
|
|
852
803
|
/**
|
|
853
804
|
* The parsed source payload of an Obsidian-style `![[target]]` embed.
|
|
854
805
|
*/
|
|
@@ -932,8 +883,6 @@ export declare function formatSizedWikiEmbed(target: string, width: number, heig
|
|
|
932
883
|
* Last path component of a target, with a note heading/block fragment removed.
|
|
933
884
|
*/
|
|
934
885
|
export declare function wikiEmbedBasename(target: string): string;
|
|
935
|
-
//#endregion
|
|
936
|
-
//#region src/extensions/wikilink.d.ts
|
|
937
886
|
/**
|
|
938
887
|
* What {@link WikilinkResolver} sees for one `[[...]]` wikilink.
|
|
939
888
|
*/
|
|
@@ -971,8 +920,6 @@ type WikilinkResolver = (link: WikilinkPayload) => WikilinkResolution | undefine
|
|
|
971
920
|
interface WikilinkOptions {
|
|
972
921
|
resolveWikilink?: WikilinkResolver | undefined;
|
|
973
922
|
}
|
|
974
|
-
//#endregion
|
|
975
|
-
//#region src/extensions/inline-text-to-mark-chunks.d.ts
|
|
976
923
|
/**
|
|
977
924
|
* What {@link FileLinkResolver} sees for one `[label](url)` link.
|
|
978
925
|
*/
|
|
@@ -1050,8 +997,6 @@ text: string,
|
|
|
1050
997
|
*/
|
|
1051
998
|
options?: InlineMarkOptions): MarkChunk[];
|
|
1052
999
|
export declare function inlineTextToMarkChunksWithContext(marks: TypedMarkBuilders, text: string, options?: InlineMarkOptions, context?: InlineMarkContext): MarkChunk[];
|
|
1053
|
-
//#endregion
|
|
1054
|
-
//#region src/extensions/mark-mode.d.ts
|
|
1055
1000
|
/**
|
|
1056
1001
|
* Controls how markdown syntax characters are rendered and how the clipboard's
|
|
1057
1002
|
* `text/plain` treats the inline layer (see `definePlainTextSerializer`).
|
|
@@ -1061,8 +1006,6 @@ export declare function inlineTextToMarkChunksWithContext(marks: TypedMarkBuilde
|
|
|
1061
1006
|
* - 'show': syntax chars always visible (dim grey); copy keeps them.
|
|
1062
1007
|
*/
|
|
1063
1008
|
type MarkMode = 'hide' | 'focus' | 'show';
|
|
1064
|
-
//#endregion
|
|
1065
|
-
//#region src/extensions/x-post-media-click.d.ts
|
|
1066
1009
|
/**
|
|
1067
1010
|
* Receives the `meowdown-embed-media-click` event of an X post card. Its
|
|
1068
1011
|
* `detail` holds the activated photo or video, its sibling items, and the
|
|
@@ -1075,8 +1018,6 @@ type XPostMediaClickHandler = (event: XPostMediaClickEvent) => void;
|
|
|
1075
1018
|
* card.
|
|
1076
1019
|
*/
|
|
1077
1020
|
export declare function defineXPostMediaClickHandler(getOnClick?: (state: EditorState) => XPostMediaClickHandler | undefined): PlainExtension;
|
|
1078
|
-
//#endregion
|
|
1079
|
-
//#region src/extensions/youtube-video-click.d.ts
|
|
1080
1021
|
/**
|
|
1081
1022
|
* Receives the `meowdown-embed-youtube-click` event of a YouTube card. Its
|
|
1082
1023
|
* `detail` holds the video, the player URL, and the rendered thumbnail
|
|
@@ -1088,8 +1029,6 @@ type YouTubeVideoClickHandler = (event: YouTubeVideoClickEvent) => void;
|
|
|
1088
1029
|
* Call `onClick` when the user activates the poster of a YouTube card.
|
|
1089
1030
|
*/
|
|
1090
1031
|
export declare function defineYouTubeVideoClickHandler(getOnClick?: (state: EditorState) => YouTubeVideoClickHandler | undefined): PlainExtension;
|
|
1091
|
-
//#endregion
|
|
1092
|
-
//#region src/extensions/editor-config-types.d.ts
|
|
1093
1032
|
interface EditorConfig extends InlineMarkOptions, FollowLinkHandlers, FilePasteOptions, FileViewOptions, ImageOptions {
|
|
1094
1033
|
markMode?: MarkMode | undefined;
|
|
1095
1034
|
onExitBoundary?: ExitBoundaryHandler | undefined;
|
|
@@ -1110,11 +1049,40 @@ interface EditorConfig extends InlineMarkOptions, FollowLinkHandlers, FilePasteO
|
|
|
1110
1049
|
wikilinkEnabled?: boolean | undefined;
|
|
1111
1050
|
placeholder?: PlaceholderOptions$1['placeholder'] | undefined;
|
|
1112
1051
|
readOnly?: boolean | undefined;
|
|
1052
|
+
/**
|
|
1053
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/spellcheck
|
|
1054
|
+
*/
|
|
1113
1055
|
spellCheck?: boolean | undefined;
|
|
1056
|
+
/**
|
|
1057
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/writingsuggestions
|
|
1058
|
+
*/
|
|
1059
|
+
writingSuggestions?: boolean | undefined;
|
|
1060
|
+
/**
|
|
1061
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/autocorrect
|
|
1062
|
+
*/
|
|
1063
|
+
autoCorrect?: boolean | undefined;
|
|
1064
|
+
/**
|
|
1065
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/autocapitalize
|
|
1066
|
+
*/
|
|
1067
|
+
autoCapitalize?: 'off' | 'sentences' | 'words' | 'characters' | undefined;
|
|
1068
|
+
/**
|
|
1069
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/enterkeyhint
|
|
1070
|
+
*/
|
|
1071
|
+
enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send' | undefined;
|
|
1072
|
+
/**
|
|
1073
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/dir
|
|
1074
|
+
*/
|
|
1075
|
+
dir?: 'ltr' | 'rtl' | 'auto' | undefined;
|
|
1076
|
+
/**
|
|
1077
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/lang
|
|
1078
|
+
*/
|
|
1079
|
+
lang?: string | undefined;
|
|
1080
|
+
/**
|
|
1081
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-label
|
|
1082
|
+
*/
|
|
1083
|
+
ariaLabel?: string | undefined;
|
|
1114
1084
|
editorClassName?: string | undefined;
|
|
1115
1085
|
}
|
|
1116
|
-
//#endregion
|
|
1117
|
-
//#region src/extensions/extension.d.ts
|
|
1118
1086
|
declare function defineEditorExtensionImpl(options: EditorExtensionOptions): import("@prosekit/core").Union<readonly [import("@prosekit/core").Extension<{
|
|
1119
1087
|
Nodes: import("@prosekit/core").SimplifyDeeper<{
|
|
1120
1088
|
paragraph: import("@prosekit/pm/model").Attrs;
|
|
@@ -1127,6 +1095,7 @@ declare function defineEditorExtensionImpl(options: EditorExtensionOptions): imp
|
|
|
1127
1095
|
Nodes: {
|
|
1128
1096
|
doc: {
|
|
1129
1097
|
frontmatter?: Frontmatter | undefined;
|
|
1098
|
+
frontmatterTight?: boolean | undefined;
|
|
1130
1099
|
};
|
|
1131
1100
|
};
|
|
1132
1101
|
}>, 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<{
|
|
@@ -1182,7 +1151,11 @@ declare function defineEditorExtensionImpl(options: EditorExtensionOptions): imp
|
|
|
1182
1151
|
Nodes: {
|
|
1183
1152
|
tableHeaderCell: import("@prosekit/pm/model").Attrs;
|
|
1184
1153
|
};
|
|
1185
|
-
}>]>, 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").
|
|
1154
|
+
}>]>, 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").Extension<{
|
|
1155
|
+
Nodes: {
|
|
1156
|
+
codeBlock: import("@prosekit/extensions/code-block").CodeBlockAttrs;
|
|
1157
|
+
};
|
|
1158
|
+
}>, import("@prosekit/core").PlainExtension, import("@prosekit/extensions/code-block").CodeBlockCommandsExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").Extension<{
|
|
1186
1159
|
Nodes: {
|
|
1187
1160
|
codeBlock: {
|
|
1188
1161
|
fenceStyle?: CodeBlockFenceStyle | null | undefined;
|
|
@@ -1300,16 +1273,12 @@ type EditorExtension = ReturnType<typeof defineEditorExtensionImpl>;
|
|
|
1300
1273
|
type EditorExtensionOptions = EditorConfig;
|
|
1301
1274
|
export declare function defineEditorExtension(options?: EditorExtensionOptions): EditorExtension;
|
|
1302
1275
|
type TypedEditor = Editor<EditorExtension>;
|
|
1303
|
-
//#endregion
|
|
1304
|
-
//#region src/extensions/schema.d.ts
|
|
1305
1276
|
type TypedNodeBuilders = ExtractNodeBuilders<EditorExtension>;
|
|
1306
1277
|
type TypedMarkBuilders = ExtractMarkBuilders<EditorExtension>;
|
|
1307
1278
|
/**
|
|
1308
1279
|
* Typed mark builders bound to the shared schema.
|
|
1309
1280
|
*/
|
|
1310
1281
|
export declare const getMarkBuilders: () => TypedMarkBuilders;
|
|
1311
|
-
//#endregion
|
|
1312
|
-
//#region src/converters/md-to-pm.d.ts
|
|
1313
1282
|
/**
|
|
1314
1283
|
* Options for {@link markdownToDoc}.
|
|
1315
1284
|
*/
|
|
@@ -1338,8 +1307,6 @@ interface MarkdownToDocOptions {
|
|
|
1338
1307
|
* inline-code characters survive verbatim.
|
|
1339
1308
|
*/
|
|
1340
1309
|
export declare function markdownToDoc(markdown: string, options?: MarkdownToDocOptions): ProseMirrorNode;
|
|
1341
|
-
//#endregion
|
|
1342
|
-
//#region src/converters/pm-to-md.d.ts
|
|
1343
1310
|
/**
|
|
1344
1311
|
* Options for {@link docToMarkdown}.
|
|
1345
1312
|
*/
|
|
@@ -1353,8 +1320,6 @@ interface DocToMarkdownOptions {
|
|
|
1353
1320
|
* Convert persisted editor content to Markdown through the shared block serializer.
|
|
1354
1321
|
*/
|
|
1355
1322
|
export declare function docToMarkdown(node: ProseMirrorNode, options?: DocToMarkdownOptions): string;
|
|
1356
|
-
//#endregion
|
|
1357
|
-
//#region src/extensions/backspace-empty-first-block.d.ts
|
|
1358
1323
|
/**
|
|
1359
1324
|
* Nothing sits before the document's first block, so Backspace in an empty
|
|
1360
1325
|
* first paragraph has nothing to join and does nothing. When this extension is
|
|
@@ -1362,16 +1327,12 @@ export declare function docToMarkdown(node: ProseMirrorNode, options?: DocToMark
|
|
|
1362
1327
|
* the document moves up one line.
|
|
1363
1328
|
*/
|
|
1364
1329
|
export declare function defineBackspaceEmptyFirstBlock(enabled?: (state: EditorState) => boolean): PlainExtension;
|
|
1365
|
-
//#endregion
|
|
1366
|
-
//#region src/extensions/bullet-after-heading.d.ts
|
|
1367
1330
|
/**
|
|
1368
1331
|
* "Type a title, press Return, start bullets." When this extension is applied,
|
|
1369
1332
|
* pressing Enter at the end of the document's first heading (the title line)
|
|
1370
1333
|
* drops the caret into a fresh empty bullet instead of a plain paragraph.
|
|
1371
1334
|
*/
|
|
1372
1335
|
export declare function defineBulletAfterHeading(enabled?: (state: EditorState) => boolean): PlainExtension;
|
|
1373
|
-
//#endregion
|
|
1374
|
-
//#region src/extensions/code-block-highlight.d.ts
|
|
1375
1336
|
/**
|
|
1376
1337
|
* Adds syntax highlighting to `codeBlock` nodes, parsing each block with the
|
|
1377
1338
|
* matching CodeMirror/Lezer grammar (loaded on demand from
|
|
@@ -1390,8 +1351,6 @@ type CodeToken = readonly [from: number, to: number, classes: string];
|
|
|
1390
1351
|
* must load on demand. Returns `[]` for an empty or unsupported language.
|
|
1391
1352
|
*/
|
|
1392
1353
|
export declare function getCodeTokens(code: string, language: string): CodeToken[] | Promise<CodeToken[]>;
|
|
1393
|
-
//#endregion
|
|
1394
|
-
//#region src/extensions/code-block-languages.d.ts
|
|
1395
1354
|
type LanguageItem = {
|
|
1396
1355
|
label: string;
|
|
1397
1356
|
value: string;
|
|
@@ -1400,17 +1359,11 @@ type LanguageItem = {
|
|
|
1400
1359
|
* A list of languages for code block syntax-highlight.
|
|
1401
1360
|
*/
|
|
1402
1361
|
export declare const codeBlockLanguages: ReadonlyArray<LanguageItem>;
|
|
1403
|
-
//#endregion
|
|
1404
|
-
//#region src/extensions/editor-config-getter.d.ts
|
|
1405
1362
|
/**
|
|
1406
1363
|
* Read the current configuration. Callback values are live, not historical state snapshots.
|
|
1407
1364
|
*/
|
|
1408
1365
|
export declare function getEditorConfig(state: EditorState): Readonly<EditorConfig>;
|
|
1409
|
-
//#endregion
|
|
1410
|
-
//#region src/extensions/editor-config.d.ts
|
|
1411
1366
|
export declare function updateEditorConfig(editor: Pick<Editor, 'state' | 'view' | 'mounted' | 'updateState'>, patch: Partial<EditorConfig>): void;
|
|
1412
|
-
//#endregion
|
|
1413
|
-
//#region src/extensions/embed-paste.d.ts
|
|
1414
1367
|
/**
|
|
1415
1368
|
* Auto-embed a pasted tweet or YouTube link. When the clipboard holds exactly
|
|
1416
1369
|
* one such URL, the link is rewritten to ``, which the image pipeline
|
|
@@ -1418,8 +1371,6 @@ export declare function updateEditorConfig(editor: Pick<Editor, 'state' | 'view'
|
|
|
1418
1371
|
* or install this standalone extension.
|
|
1419
1372
|
*/
|
|
1420
1373
|
export declare function defineEmbedPaste(enabled?: (state: EditorState) => boolean): PlainExtension;
|
|
1421
|
-
//#endregion
|
|
1422
|
-
//#region src/extensions/key-bindings.d.ts
|
|
1423
1374
|
/**
|
|
1424
1375
|
* Human-readable descriptions of the editor's formatting and heading shortcuts.
|
|
1425
1376
|
*/
|
|
@@ -1452,14 +1403,10 @@ export declare const EDITOR_KEY_BINDINGS: {
|
|
|
1452
1403
|
readonly 'Mod-Shift-ArrowDown': "Select to the document end";
|
|
1453
1404
|
readonly Escape: "Collapse the selection";
|
|
1454
1405
|
};
|
|
1455
|
-
//#endregion
|
|
1456
|
-
//#region src/extensions/mark-hover.d.ts
|
|
1457
1406
|
interface MarkHoverHit<Payload> {
|
|
1458
1407
|
payload: Payload;
|
|
1459
1408
|
element: HTMLElement;
|
|
1460
1409
|
}
|
|
1461
|
-
//#endregion
|
|
1462
|
-
//#region src/extensions/link-hover.d.ts
|
|
1463
1410
|
type LinkHoverHandler = (hit: MarkHoverHit<LinkUnit> | undefined) => void;
|
|
1464
1411
|
interface LinkHoverOptions {
|
|
1465
1412
|
/**
|
|
@@ -1482,8 +1429,6 @@ export declare function defineLinkHoverHandler(onHoverChange: LinkHoverHandler,
|
|
|
1482
1429
|
* pending hover cannot reopen the UI.
|
|
1483
1430
|
*/
|
|
1484
1431
|
export declare function dismissLinkHover(state: EditorState): void;
|
|
1485
|
-
//#endregion
|
|
1486
|
-
//#region src/extensions/link-paste.d.ts
|
|
1487
1432
|
/**
|
|
1488
1433
|
* Paste a URL over selected text to wrap the selection as a Markdown link
|
|
1489
1434
|
* `[selected text](url)`. Only fires when the clipboard holds exactly one URL
|
|
@@ -1498,8 +1443,6 @@ export declare function dismissLinkHover(state: EditorState): void;
|
|
|
1498
1443
|
* standalone extension.
|
|
1499
1444
|
*/
|
|
1500
1445
|
export declare function defineLinkPaste(enabled?: (state: EditorState) => boolean): PlainExtension;
|
|
1501
|
-
//#endregion
|
|
1502
|
-
//#region src/extensions/link-preview.d.ts
|
|
1503
1446
|
/**
|
|
1504
1447
|
* Metadata a host application can supply for a web link.
|
|
1505
1448
|
*/
|
|
@@ -1514,43 +1457,29 @@ interface LinkPreview {
|
|
|
1514
1457
|
* instead of cancelling in-flight work.
|
|
1515
1458
|
*/
|
|
1516
1459
|
type LinkPreviewResolver = (href: string) => LinkPreview | undefined | Promise<LinkPreview | undefined>;
|
|
1517
|
-
//#endregion
|
|
1518
|
-
//#region src/extensions/mark-names.d.ts
|
|
1519
1460
|
declare const MARK_NAMES: readonly ["mdWikilink", "mdImage", "mdFile", "mdMath", "mdMark", "mdEm", "mdStrong", "mdCode", "mdLinkText", "mdLinkUri", "mdLinkTitle", "mdDel", "mdHighlight", "mdTag", "mdPack"];
|
|
1520
1461
|
type MarkName = (typeof MARK_NAMES)[number];
|
|
1521
1462
|
export declare function isMarkOfType(mark: Mark, name: MarkName): boolean;
|
|
1522
|
-
//#endregion
|
|
1523
|
-
//#region src/extensions/math.d.ts
|
|
1524
1463
|
/**
|
|
1525
1464
|
* Inline math rendering: a KaTeX preview on the `mdMath` mark.
|
|
1526
1465
|
*/
|
|
1527
1466
|
export declare function defineMath(): PlainExtension;
|
|
1528
|
-
//#endregion
|
|
1529
|
-
//#region src/extensions/node-names.d.ts
|
|
1530
1467
|
/**
|
|
1531
1468
|
* Every ProseMirror node name the editor schema knows about.
|
|
1532
1469
|
*/
|
|
1533
1470
|
declare const NODE_NAMES: readonly ["doc", "text", "paragraph", "heading", "blockquote", "list", "codeBlock", "horizontalRule", "htmlComment", "table", "tableRow", "tableCell", "tableHeaderCell"];
|
|
1534
1471
|
type NodeName = (typeof NODE_NAMES)[number];
|
|
1535
1472
|
export declare function isNodeOfType(node: ProseMirrorNode, name: NodeName): boolean;
|
|
1536
|
-
//#endregion
|
|
1537
|
-
//#region src/extensions/readonly.d.ts
|
|
1538
1473
|
export declare function defineReadonly(getReadonly?: (state: EditorState) => boolean): PlainExtension;
|
|
1539
|
-
//#endregion
|
|
1540
|
-
//#region src/extensions/substitution.d.ts
|
|
1541
1474
|
/**
|
|
1542
1475
|
* Apply the editor's automatic plain-text substitutions.
|
|
1543
1476
|
*/
|
|
1544
1477
|
export declare function defineSubstitution(enabled?: (state: EditorState) => boolean): PlainExtension;
|
|
1545
|
-
//#endregion
|
|
1546
|
-
//#region src/extensions/table.d.ts
|
|
1547
1478
|
/**
|
|
1548
1479
|
* Whether the selection sits inside a table cell (data or header). Useful for
|
|
1549
1480
|
* gating block-creating UI, since cells hold inline content only.
|
|
1550
1481
|
*/
|
|
1551
1482
|
export declare function isSelectionInTableCell(state: EditorState): boolean;
|
|
1552
|
-
//#endregion
|
|
1553
|
-
//#region src/extensions/view-attributes.d.ts
|
|
1554
1483
|
/**
|
|
1555
1484
|
* Add DOM attributes to the editable root. `class` and `style` values from
|
|
1556
1485
|
* every such extension are combined, so applying this more than once adds
|
|
@@ -1561,8 +1490,6 @@ export declare function defineViewAttributes(attributes: {
|
|
|
1561
1490
|
} | ((state: EditorState) => {
|
|
1562
1491
|
[name: string]: string;
|
|
1563
1492
|
})): PlainExtension;
|
|
1564
|
-
//#endregion
|
|
1565
|
-
//#region src/extensions/virtual-caret.d.ts
|
|
1566
1493
|
/**
|
|
1567
1494
|
* Draws the caret as an overlay element and hides the native caret via CSS
|
|
1568
1495
|
* (`caret-color: transparent`). The native DOM selection stays fully alive,
|
|
@@ -1580,8 +1507,6 @@ export declare function defineViewAttributes(attributes: {
|
|
|
1580
1507
|
* content.
|
|
1581
1508
|
*/
|
|
1582
1509
|
export declare function defineVirtualCaret(layer: HTMLElement): PlainExtension;
|
|
1583
|
-
//#endregion
|
|
1584
|
-
//#region src/extensions/wikilink-hover.d.ts
|
|
1585
1510
|
/**
|
|
1586
1511
|
* A wikilink currently under the pointer.
|
|
1587
1512
|
*/
|
|
@@ -1606,32 +1531,22 @@ type WikilinkHoverHandler = (hit: WikilinkHoverHit | undefined) => void;
|
|
|
1606
1531
|
* changes target. Moving among descendants of one label is de-duplicated.
|
|
1607
1532
|
*/
|
|
1608
1533
|
export declare function defineWikilinkHoverHandler(onHoverChange: WikilinkHoverHandler, openDelay?: number, closeDelay?: number): PlainExtension;
|
|
1609
|
-
//#endregion
|
|
1610
|
-
//#region src/extensions/wikilink-trigger.d.ts
|
|
1611
1534
|
/**
|
|
1612
1535
|
* Binds `Mod-Shift-k` to open the wikilink menu, and `[` to wrap a selected
|
|
1613
1536
|
* phrase into an open wikilink (`[[phrase`) with the menu searching it.
|
|
1614
1537
|
*/
|
|
1615
1538
|
export declare function defineWikilinkTrigger(enabled?: (state: EditorState) => boolean): PlainExtension;
|
|
1616
|
-
//#endregion
|
|
1617
|
-
//#region src/utils/composition.d.ts
|
|
1618
1539
|
export declare function getIsComposing(): boolean;
|
|
1619
|
-
//#endregion
|
|
1620
|
-
//#region src/utils/display-text.d.ts
|
|
1621
1540
|
/**
|
|
1622
1541
|
* The textblock as its live-preview marks display it: syntax runs are
|
|
1623
1542
|
* omitted and each atom unit is replaced by its display text.
|
|
1624
1543
|
*/
|
|
1625
1544
|
export declare function getTextblockDisplayText(textblock: ProseMirrorNode): string;
|
|
1626
|
-
//#endregion
|
|
1627
|
-
//#region src/utils/format-file-size.d.ts
|
|
1628
1545
|
/**
|
|
1629
1546
|
* Format a byte count for display on a file pill: decimal units (1 KB =
|
|
1630
1547
|
* 1000 B, matching macOS Finder), one decimal below 10, integers otherwise.
|
|
1631
1548
|
*/
|
|
1632
1549
|
export declare function formatFileSize(bytes: number): string;
|
|
1633
|
-
//#endregion
|
|
1634
|
-
//#region src/utils/is-mod-event.d.ts
|
|
1635
1550
|
/**
|
|
1636
1551
|
* Whether the platform's mod key is held on `event`: `Command` on Apple, `Ctrl` elsewhere.
|
|
1637
1552
|
*/
|
|
@@ -1639,11 +1554,7 @@ export declare function isModEvent(event: MouseEvent | KeyboardEvent | TouchEven
|
|
|
1639
1554
|
metaKey: boolean;
|
|
1640
1555
|
ctrlKey: boolean;
|
|
1641
1556
|
}): boolean;
|
|
1642
|
-
//#endregion
|
|
1643
|
-
//#region src/utils/katex-chunk.d.ts
|
|
1644
1557
|
type KaTeXRender = typeof render;
|
|
1645
|
-
//#endregion
|
|
1646
|
-
//#region src/utils/katex.d.ts
|
|
1647
1558
|
/**
|
|
1648
1559
|
* Load KaTeX's render function on first use and cache it. Most documents
|
|
1649
1560
|
* contain no math, so the library stays out of the initial bundle.
|
|
@@ -1656,8 +1567,6 @@ export declare function loadKaTeX(): Promise<KaTeXRender>;
|
|
|
1656
1567
|
* render.
|
|
1657
1568
|
*/
|
|
1658
1569
|
export declare function renderMathInto(katexRender: KaTeXRender, element: HTMLElement, formula: string, displayMode: boolean): void;
|
|
1659
|
-
//#endregion
|
|
1660
|
-
//#region src/utils/selected-text.d.ts
|
|
1661
1570
|
/**
|
|
1662
1571
|
* The current selection as Markdown: block structure (list markers, headings,
|
|
1663
1572
|
* blockquotes) is serialized, and inline Markdown syntax is already literal
|
|
@@ -1666,8 +1575,6 @@ export declare function renderMathInto(katexRender: KaTeXRender, element: HTMLEl
|
|
|
1666
1575
|
* consumers (e.g. an AI prompt) see the same Markdown the user would.
|
|
1667
1576
|
*/
|
|
1668
1577
|
export declare function getSelectedText(state: EditorState): string;
|
|
1669
|
-
//#endregion
|
|
1670
|
-
//#region src/utils/virtual-element.d.ts
|
|
1671
1578
|
/**
|
|
1672
1579
|
* Returns a Floating-UI virtual element tracking a document range.
|
|
1673
1580
|
*
|
|
@@ -1676,8 +1583,6 @@ export declare function getSelectedText(state: EditorState): string;
|
|
|
1676
1583
|
* no longer resolves; those return the last known rect instead of throwing.
|
|
1677
1584
|
*/
|
|
1678
1585
|
export declare function getVirtualElementFromRange(view: EditorView, range: PositionRange): VirtualElement;
|
|
1679
|
-
//#endregion
|
|
1680
|
-
//#region src/converters/paragraph.d.ts
|
|
1681
1586
|
/**
|
|
1682
1587
|
* Build one paragraph without interpreting block-opening Markdown.
|
|
1683
1588
|
*/
|
|
@@ -1686,5 +1591,4 @@ export declare function paragraphMarkdownToDoc(markdown: string, nodes?: TypedNo
|
|
|
1686
1591
|
* Flatten textblocks into one paragraph's source content.
|
|
1687
1592
|
*/
|
|
1688
1593
|
export declare function docToParagraphMarkdown(doc: ProseMirrorNode): string;
|
|
1689
|
-
//#endregion
|
|
1690
1594
|
export { type AcceptPendingReplacementOptions, 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 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, defineCodeBlockPreviewPlugin, definePlaceholder, defineSearchStatusHandler, getSearchStatus, isCodeBlockPreviewHiddenDecoration, withPriority };
|