@meowdown/core 0.80.0 → 0.81.1
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 +94 -95
- package/dist/index.js +8 -15
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CheckRoundTripOptions, RoundTripFidelity, checkRoundTrip } from "@meowdown/markdown";
|
|
2
1
|
import { Editor, Extension, ExtractMarkBuilders, ExtractNodeBuilders, PlainExtension, Priority, Union, withPriority } from "@prosekit/core";
|
|
3
2
|
import { CodeBlockAttrs, CodeBlockAttrs as CodeBlockAttrs$1, defineCodeBlockPreviewPlugin, isCodeBlockPreviewHiddenDecoration } from "@prosekit/extensions/code-block";
|
|
4
3
|
import { PlaceholderOptions, PlaceholderOptions as PlaceholderOptions$1, definePlaceholder } from "@prosekit/extensions/placeholder";
|
|
@@ -44,9 +43,9 @@ type ListMarker = '.' | ')' | '-' | '*' | '+' | null;
|
|
|
44
43
|
*/
|
|
45
44
|
type TaskMarker = 'x' | 'X' | null;
|
|
46
45
|
interface MeowdownListAttrs extends ListAttrs {
|
|
47
|
-
marker?: ListMarker;
|
|
48
|
-
taskMarker?: TaskMarker;
|
|
49
|
-
markerGap?: number;
|
|
46
|
+
marker?: ListMarker | undefined;
|
|
47
|
+
taskMarker?: TaskMarker | undefined;
|
|
48
|
+
markerGap?: number | undefined;
|
|
50
49
|
}
|
|
51
50
|
//#endregion
|
|
52
51
|
//#region src/extensions/table-column-align.d.ts
|
|
@@ -61,7 +60,7 @@ interface MeowdownTableCellAttrs {
|
|
|
61
60
|
* renders with the default left alignment and serializes the delimiter
|
|
62
61
|
* column as `---`.
|
|
63
62
|
*/
|
|
64
|
-
align?: TableColumnAlign | null;
|
|
63
|
+
align?: TableColumnAlign | null | undefined;
|
|
65
64
|
}
|
|
66
65
|
type TableCellAlignExtension = Extension<{
|
|
67
66
|
Nodes: {
|
|
@@ -95,13 +94,13 @@ interface MeowdownCodeBlockAttrs extends CodeBlockAttrs$1 {
|
|
|
95
94
|
* default) is a backtick fence, so a block created in the editor serializes
|
|
96
95
|
* to the canonical form.
|
|
97
96
|
*/
|
|
98
|
-
fenceStyle?: CodeBlockFenceStyle | null;
|
|
97
|
+
fenceStyle?: CodeBlockFenceStyle | null | undefined;
|
|
99
98
|
/**
|
|
100
99
|
* The number of characters in the opening fence, kept only when it exceeds
|
|
101
100
|
* CommonMark's three-character minimum. `null` (the default) lets the
|
|
102
101
|
* serializer pick the shortest fence the content allows.
|
|
103
102
|
*/
|
|
104
|
-
fenceLength?: number | null;
|
|
103
|
+
fenceLength?: number | null | undefined;
|
|
105
104
|
}
|
|
106
105
|
//#endregion
|
|
107
106
|
//#region src/extensions/horizontal-rule.d.ts
|
|
@@ -110,7 +109,7 @@ interface MeowdownHorizontalRuleAttrs {
|
|
|
110
109
|
* The literal markdown marker of a thematic break, e.g. `***`, `___`, or
|
|
111
110
|
* `- - -`. Defaults to null, which the serializer emits as the canonical `---`.
|
|
112
111
|
*/
|
|
113
|
-
marker?: string | null;
|
|
112
|
+
marker?: string | null | undefined;
|
|
114
113
|
}
|
|
115
114
|
type HorizontalRuleMarkerExtension = Extension<{
|
|
116
115
|
Nodes: {
|
|
@@ -251,53 +250,53 @@ interface MdMathAttrs {
|
|
|
251
250
|
*/
|
|
252
251
|
type MdPackAttrs = {
|
|
253
252
|
key: 'italic' | 'bold' | 'code' | 'del' | 'highlight';
|
|
254
|
-
data?: null;
|
|
255
|
-
slot?: 1 | null;
|
|
253
|
+
data?: null | undefined;
|
|
254
|
+
slot?: 1 | null | undefined;
|
|
256
255
|
revealInFocus: true;
|
|
257
|
-
revealInHide?: null;
|
|
256
|
+
revealInHide?: null | undefined;
|
|
258
257
|
} | {
|
|
259
258
|
key: 'link-inline' | 'link-reference';
|
|
260
259
|
data: {
|
|
261
260
|
href: string;
|
|
262
261
|
title: string;
|
|
263
262
|
};
|
|
264
|
-
slot?: 1 | null;
|
|
263
|
+
slot?: 1 | null | undefined;
|
|
265
264
|
revealInFocus: true;
|
|
266
|
-
revealInHide?: null;
|
|
265
|
+
revealInHide?: null | undefined;
|
|
267
266
|
} | {
|
|
268
267
|
key: 'link-angle';
|
|
269
268
|
data: {
|
|
270
269
|
href: string;
|
|
271
270
|
};
|
|
272
|
-
slot?: 1 | null;
|
|
271
|
+
slot?: 1 | null | undefined;
|
|
273
272
|
revealInFocus: true;
|
|
274
|
-
revealInHide?: null;
|
|
273
|
+
revealInHide?: null | undefined;
|
|
275
274
|
} | {
|
|
276
275
|
key: 'link-bare';
|
|
277
276
|
data: {
|
|
278
277
|
href: string;
|
|
279
278
|
};
|
|
280
|
-
slot?: 1 | null;
|
|
281
|
-
revealInFocus?: null;
|
|
282
|
-
revealInHide?: null;
|
|
279
|
+
slot?: 1 | null | undefined;
|
|
280
|
+
revealInFocus?: null | undefined;
|
|
281
|
+
revealInHide?: null | undefined;
|
|
283
282
|
} | {
|
|
284
283
|
key: 'noLink';
|
|
285
|
-
data?: null;
|
|
286
|
-
slot?: 1 | null;
|
|
284
|
+
data?: null | undefined;
|
|
285
|
+
slot?: 1 | null | undefined;
|
|
287
286
|
revealInFocus: true;
|
|
288
|
-
revealInHide?: null;
|
|
287
|
+
revealInHide?: null | undefined;
|
|
289
288
|
} | {
|
|
290
289
|
key: 'math';
|
|
291
|
-
data?: null;
|
|
292
|
-
slot?: 1 | null;
|
|
290
|
+
data?: null | undefined;
|
|
291
|
+
slot?: 1 | null | undefined;
|
|
293
292
|
revealInFocus: true;
|
|
294
293
|
revealInHide: true;
|
|
295
294
|
} | {
|
|
296
295
|
key: 'wikilink' | 'image' | 'file';
|
|
297
|
-
data?: null;
|
|
298
|
-
slot?: 1 | null;
|
|
299
|
-
revealInFocus?: null;
|
|
300
|
-
revealInHide?: null;
|
|
296
|
+
data?: null | undefined;
|
|
297
|
+
slot?: 1 | null | undefined;
|
|
298
|
+
revealInFocus?: null | undefined;
|
|
299
|
+
revealInHide?: null | undefined;
|
|
301
300
|
};
|
|
302
301
|
//#endregion
|
|
303
302
|
//#region src/utils/range.d.ts
|
|
@@ -361,9 +360,9 @@ export declare function getLinkUnitAt(state: EditorState, pos: number): LinkUnit
|
|
|
361
360
|
//#endregion
|
|
362
361
|
//#region src/extensions/link-commands.d.ts
|
|
363
362
|
interface LinkAttrs {
|
|
364
|
-
href?: string;
|
|
365
|
-
title?: string;
|
|
366
|
-
text?: string;
|
|
363
|
+
href?: string | undefined;
|
|
364
|
+
title?: string | undefined;
|
|
365
|
+
text?: string | undefined;
|
|
367
366
|
}
|
|
368
367
|
/**
|
|
369
368
|
* Normalize a typed URL with the existing autolink logic, else keep it verbatim.
|
|
@@ -378,10 +377,10 @@ export declare function getLinkText(link: LinkUnit): string;
|
|
|
378
377
|
*/
|
|
379
378
|
export declare function isLinkTextForHref(text: string, href: string): boolean;
|
|
380
379
|
interface InsertLinkOptions {
|
|
381
|
-
href?: string;
|
|
382
|
-
title?: string;
|
|
383
|
-
text?: string;
|
|
384
|
-
wrapText?: boolean;
|
|
380
|
+
href?: string | undefined;
|
|
381
|
+
title?: string | undefined;
|
|
382
|
+
text?: string | undefined;
|
|
383
|
+
wrapText?: boolean | undefined;
|
|
385
384
|
}
|
|
386
385
|
export declare function insertLink({ href, title, text, wrapText }?: InsertLinkOptions): Command;
|
|
387
386
|
/**
|
|
@@ -458,7 +457,7 @@ interface AcceptPendingReplacementOptions {
|
|
|
458
457
|
/**
|
|
459
458
|
* Overrides the staged mode for this accept (e.g. "Insert below" on a replace stage).
|
|
460
459
|
*/
|
|
461
|
-
mode?: PendingReplacementMode;
|
|
460
|
+
mode?: PendingReplacementMode | undefined;
|
|
462
461
|
}
|
|
463
462
|
/**
|
|
464
463
|
* A pending-replacement change: text/range updates, or how the stage ended.
|
|
@@ -516,11 +515,11 @@ interface FilePasteOptions {
|
|
|
516
515
|
* An image (`image/*` MIME type or a recognized image filename extension)
|
|
517
516
|
* inserts ``; any other file inserts a `[name](src)` link.
|
|
518
517
|
*/
|
|
519
|
-
onFilePaste?: FilePasteHandler;
|
|
518
|
+
onFilePaste?: FilePasteHandler | undefined;
|
|
520
519
|
/**
|
|
521
520
|
* Called when persisting a pasted/dropped file throws. Defaults to `console.error`.
|
|
522
521
|
*/
|
|
523
|
-
onFileSaveError?: FileSaveErrorHandler;
|
|
522
|
+
onFileSaveError?: FileSaveErrorHandler | undefined;
|
|
524
523
|
}
|
|
525
524
|
/**
|
|
526
525
|
* The markdown a saved file becomes: `` for an image (a
|
|
@@ -531,7 +530,7 @@ interface FilePasteOptions {
|
|
|
531
530
|
*/
|
|
532
531
|
export declare function buildFileMarkdown(file: {
|
|
533
532
|
name: string;
|
|
534
|
-
type?: string;
|
|
533
|
+
type?: string | undefined;
|
|
535
534
|
}, destination: string): string;
|
|
536
535
|
/**
|
|
537
536
|
* Persist pasted/dropped files via `onFilePaste` and insert the returned
|
|
@@ -548,7 +547,7 @@ interface FileInfo {
|
|
|
548
547
|
/**
|
|
549
548
|
* File size in bytes, shown as a human-readable suffix (e.g. `1.4 MB`).
|
|
550
549
|
*/
|
|
551
|
-
size?: number;
|
|
550
|
+
size?: number | undefined;
|
|
552
551
|
}
|
|
553
552
|
/**
|
|
554
553
|
* Resolve display metadata for a file `href`, directly or as a promise; the
|
|
@@ -565,7 +564,7 @@ interface FileViewOptions {
|
|
|
565
564
|
/**
|
|
566
565
|
* Resolve the metadata (file size) shown on a pill. Omit to show none.
|
|
567
566
|
*/
|
|
568
|
-
resolveFileInfo?: FileInfoResolver;
|
|
567
|
+
resolveFileInfo?: FileInfoResolver | undefined;
|
|
569
568
|
}
|
|
570
569
|
/**
|
|
571
570
|
* Classify a file destination for the pill's `data-file-kind` attribute.
|
|
@@ -733,11 +732,11 @@ export declare function defineWikilinkClickHandler(getOnClick?: (state: EditorSt
|
|
|
733
732
|
//#endregion
|
|
734
733
|
//#region src/extensions/follow-link.d.ts
|
|
735
734
|
interface FollowLinkHandlers {
|
|
736
|
-
onWikilinkClick?: WikilinkClickHandler;
|
|
737
|
-
onTagClick?: TagClickHandler;
|
|
738
|
-
onFileClick?: FileClickHandler;
|
|
739
|
-
onLinkClick?: LinkClickHandler;
|
|
740
|
-
onImageClick?: ImageClickHandler;
|
|
735
|
+
onWikilinkClick?: WikilinkClickHandler | undefined;
|
|
736
|
+
onTagClick?: TagClickHandler | undefined;
|
|
737
|
+
onFileClick?: FileClickHandler | undefined;
|
|
738
|
+
onLinkClick?: LinkClickHandler | undefined;
|
|
739
|
+
onImageClick?: ImageClickHandler | undefined;
|
|
741
740
|
}
|
|
742
741
|
/**
|
|
743
742
|
* Binds `Mod-Enter` to follow the wikilink, tag, file pill, or Markdown link
|
|
@@ -799,22 +798,22 @@ interface ImageOptions {
|
|
|
799
798
|
* resolved image does not shift the layout. Defaults to
|
|
800
799
|
* `defaultResolveImageUrl`.
|
|
801
800
|
*/
|
|
802
|
-
resolveImageUrl?: ImageUrlResolver;
|
|
801
|
+
resolveImageUrl?: ImageUrlResolver | undefined;
|
|
803
802
|
/**
|
|
804
803
|
* Resolve the data behind an X post URL.
|
|
805
804
|
* When omitted, public posts use `defaultResolveXPost`.
|
|
806
805
|
*/
|
|
807
|
-
resolveXPost?: XPostResolver;
|
|
806
|
+
resolveXPost?: XPostResolver | undefined;
|
|
808
807
|
/**
|
|
809
808
|
* Additional trusted protocols for X media URLs, such as `reflect-asset:`.
|
|
810
809
|
*/
|
|
811
|
-
mediaUrlProtocols?: string[];
|
|
810
|
+
mediaUrlProtocols?: string[] | undefined;
|
|
812
811
|
/**
|
|
813
812
|
* Resolve the data behind a YouTube video URL, rendered as a
|
|
814
813
|
* `meowdown-embed-youtube` card. Defaults to `defaultResolveYouTubeVideo`,
|
|
815
814
|
* which reads YouTube's oEmbed endpoint.
|
|
816
815
|
*/
|
|
817
|
-
resolveYouTubeVideo?: YouTubeVideoResolver;
|
|
816
|
+
resolveYouTubeVideo?: YouTubeVideoResolver | undefined;
|
|
818
817
|
}
|
|
819
818
|
/**
|
|
820
819
|
* Show an `src` as-is when it is an http(s) URL, otherwise skip rendering it.
|
|
@@ -879,35 +878,35 @@ type WikiEmbedResolution = {
|
|
|
879
878
|
/**
|
|
880
879
|
* Source passed to `resolveImageUrl` and image click handlers. Defaults to `target`.
|
|
881
880
|
*/
|
|
882
|
-
src?: string;
|
|
881
|
+
src?: string | undefined;
|
|
883
882
|
/**
|
|
884
883
|
* Image alt text. Defaults to the alias or target basename.
|
|
885
884
|
*/
|
|
886
|
-
alt?: string;
|
|
885
|
+
alt?: string | undefined;
|
|
887
886
|
} | {
|
|
888
887
|
kind: 'file';
|
|
889
888
|
/**
|
|
890
889
|
* Destination passed to file metadata and click handlers. Defaults to `target`.
|
|
891
890
|
*/
|
|
892
|
-
href?: string;
|
|
891
|
+
href?: string | undefined;
|
|
893
892
|
/**
|
|
894
893
|
* File pill label. Defaults to the alias or target basename.
|
|
895
894
|
*/
|
|
896
|
-
name?: string;
|
|
895
|
+
name?: string | undefined;
|
|
897
896
|
/**
|
|
898
897
|
* Optional file title.
|
|
899
898
|
*/
|
|
900
|
-
title?: string;
|
|
899
|
+
title?: string | undefined;
|
|
901
900
|
} | {
|
|
902
901
|
kind: 'note';
|
|
903
902
|
/**
|
|
904
903
|
* Target passed to wikilink click handlers. Defaults to the source target.
|
|
905
904
|
*/
|
|
906
|
-
target?: string;
|
|
905
|
+
target?: string | undefined;
|
|
907
906
|
/**
|
|
908
907
|
* Chip label. Defaults to the source alias or resolved target.
|
|
909
908
|
*/
|
|
910
|
-
display?: string;
|
|
909
|
+
display?: string | undefined;
|
|
911
910
|
};
|
|
912
911
|
/**
|
|
913
912
|
* Classifies one wiki embed for rendering. Return `undefined` to leave the
|
|
@@ -919,7 +918,7 @@ type WikiEmbedResolver = (embed: ParsedWikiEmbed) => WikiEmbedResolution | undef
|
|
|
919
918
|
* Host options for wiki-embed parsing.
|
|
920
919
|
*/
|
|
921
920
|
interface WikiEmbedOptions {
|
|
922
|
-
resolveWikiEmbed?: WikiEmbedResolver;
|
|
921
|
+
resolveWikiEmbed?: WikiEmbedResolver | undefined;
|
|
923
922
|
}
|
|
924
923
|
/**
|
|
925
924
|
* Parse `![[target]]`, `![[target|alias]]`, `![[target|width]]`, or `![[target|widthxheight]]`.
|
|
@@ -952,11 +951,11 @@ interface WikilinkResolution {
|
|
|
952
951
|
/**
|
|
953
952
|
* Target passed to click and hover handlers. Defaults to the bracketed text.
|
|
954
953
|
*/
|
|
955
|
-
target?: string;
|
|
954
|
+
target?: string | undefined;
|
|
956
955
|
/**
|
|
957
956
|
* Label shown in place of the source. Defaults to the target.
|
|
958
957
|
*/
|
|
959
|
-
display?: string;
|
|
958
|
+
display?: string | undefined;
|
|
960
959
|
}
|
|
961
960
|
/**
|
|
962
961
|
* Resolves one `[[...]]` wikilink into the target its handlers receive and
|
|
@@ -970,7 +969,7 @@ type WikilinkResolver = (link: WikilinkPayload) => WikilinkResolution | undefine
|
|
|
970
969
|
* Host options for wikilink parsing.
|
|
971
970
|
*/
|
|
972
971
|
interface WikilinkOptions {
|
|
973
|
-
resolveWikilink?: WikilinkResolver;
|
|
972
|
+
resolveWikilink?: WikilinkResolver | undefined;
|
|
974
973
|
}
|
|
975
974
|
//#endregion
|
|
976
975
|
//#region src/extensions/inline-text-to-mark-chunks.d.ts
|
|
@@ -1007,7 +1006,7 @@ interface FileLinkOptions {
|
|
|
1007
1006
|
* Claim `[label](url)` links as file attachments; see {@link FileLinkResolver}.
|
|
1008
1007
|
* Updates existing content when the configured resolver changes.
|
|
1009
1008
|
*/
|
|
1010
|
-
resolveFileLink?: FileLinkResolver;
|
|
1009
|
+
resolveFileLink?: FileLinkResolver | undefined;
|
|
1011
1010
|
}
|
|
1012
1011
|
/**
|
|
1013
1012
|
* Host options that influence source-backed inline atom parsing.
|
|
@@ -1016,21 +1015,21 @@ type InlineMarkOptions = FileLinkOptions & WikiEmbedOptions & WikilinkOptions &
|
|
|
1016
1015
|
/**
|
|
1017
1016
|
* Definitions supplied by the containing document.
|
|
1018
1017
|
*/
|
|
1019
|
-
referenceDefinitions?: ReferenceDefinitions;
|
|
1018
|
+
referenceDefinitions?: ReferenceDefinitions | undefined;
|
|
1020
1019
|
};
|
|
1021
1020
|
interface InlineMarkContext {
|
|
1022
1021
|
/**
|
|
1023
1022
|
* Effective document-wide definitions, keyed by normalized reference label.
|
|
1024
1023
|
*/
|
|
1025
|
-
referenceDefinitions?: ReferenceDefinitions;
|
|
1024
|
+
referenceDefinitions?: ReferenceDefinitions | undefined;
|
|
1026
1025
|
/**
|
|
1027
1026
|
* Prevent this definition block's own label from resolving as a shortcut reference.
|
|
1028
1027
|
*/
|
|
1029
|
-
isReferenceDefinition?: boolean;
|
|
1028
|
+
isReferenceDefinition?: boolean | undefined;
|
|
1030
1029
|
/**
|
|
1031
1030
|
* Receives every normalized key read by this block, including unresolved references.
|
|
1032
1031
|
*/
|
|
1033
|
-
referencedKeys?: Set<string
|
|
1032
|
+
referencedKeys?: Set<string> | undefined;
|
|
1034
1033
|
}
|
|
1035
1034
|
/**
|
|
1036
1035
|
* Walk a textblock's inline content and produce a list of mark chunks
|
|
@@ -1092,27 +1091,27 @@ export declare function defineYouTubeVideoClickHandler(getOnClick?: (state: Edit
|
|
|
1092
1091
|
//#endregion
|
|
1093
1092
|
//#region src/extensions/editor-config-types.d.ts
|
|
1094
1093
|
interface EditorConfig extends InlineMarkOptions, FollowLinkHandlers, FilePasteOptions, FileViewOptions, ImageOptions {
|
|
1095
|
-
markMode?: MarkMode;
|
|
1096
|
-
onExitBoundary?: ExitBoundaryHandler;
|
|
1097
|
-
onXPostMediaClick?: XPostMediaClickHandler;
|
|
1098
|
-
onYouTubeVideoClick?: YouTubeVideoClickHandler;
|
|
1099
|
-
embedPaste?: boolean;
|
|
1100
|
-
linkPaste?: boolean;
|
|
1101
|
-
bulletAfterHeading?: boolean;
|
|
1102
|
-
backspaceDeletesEmptyFirstBlock?: boolean;
|
|
1103
|
-
substitution?: boolean;
|
|
1094
|
+
markMode?: MarkMode | undefined;
|
|
1095
|
+
onExitBoundary?: ExitBoundaryHandler | undefined;
|
|
1096
|
+
onXPostMediaClick?: XPostMediaClickHandler | undefined;
|
|
1097
|
+
onYouTubeVideoClick?: YouTubeVideoClickHandler | undefined;
|
|
1098
|
+
embedPaste?: boolean | undefined;
|
|
1099
|
+
linkPaste?: boolean | undefined;
|
|
1100
|
+
bulletAfterHeading?: boolean | undefined;
|
|
1101
|
+
backspaceDeletesEmptyFirstBlock?: boolean | undefined;
|
|
1102
|
+
substitution?: boolean | undefined;
|
|
1104
1103
|
/**
|
|
1105
1104
|
* Keep the document to one paragraph of inline Markdown: typed block
|
|
1106
1105
|
* prefixes (`# `, `> `, `- `, ```` ``` ````) stay literal and pasted blocks
|
|
1107
1106
|
* flatten into soft lines. Seed the editor with `paragraphMarkdownToDoc` and
|
|
1108
1107
|
* read it with `docToParagraphMarkdown`.
|
|
1109
1108
|
*/
|
|
1110
|
-
singleParagraph?: boolean;
|
|
1111
|
-
wikilinkEnabled?: boolean;
|
|
1112
|
-
placeholder?: PlaceholderOptions$1['placeholder'];
|
|
1113
|
-
readOnly?: boolean;
|
|
1114
|
-
spellCheck?: boolean;
|
|
1115
|
-
editorClassName?: string;
|
|
1109
|
+
singleParagraph?: boolean | undefined;
|
|
1110
|
+
wikilinkEnabled?: boolean | undefined;
|
|
1111
|
+
placeholder?: PlaceholderOptions$1['placeholder'] | undefined;
|
|
1112
|
+
readOnly?: boolean | undefined;
|
|
1113
|
+
spellCheck?: boolean | undefined;
|
|
1114
|
+
editorClassName?: string | undefined;
|
|
1116
1115
|
}
|
|
1117
1116
|
//#endregion
|
|
1118
1117
|
//#region src/extensions/extension.d.ts
|
|
@@ -1127,25 +1126,25 @@ declare function defineEditorExtensionImpl(options: EditorExtensionOptions): imp
|
|
|
1127
1126
|
}>, import("@prosekit/extensions/doc").DocExtension, import("@prosekit/core").Extension<{
|
|
1128
1127
|
Nodes: {
|
|
1129
1128
|
doc: {
|
|
1130
|
-
frontmatter?: Frontmatter;
|
|
1129
|
+
frontmatter?: Frontmatter | undefined;
|
|
1131
1130
|
};
|
|
1132
1131
|
};
|
|
1133
1132
|
}>, 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<{
|
|
1134
1133
|
Nodes: {
|
|
1135
1134
|
list: {
|
|
1136
|
-
marker?: ListMarker;
|
|
1135
|
+
marker?: ListMarker | undefined;
|
|
1137
1136
|
};
|
|
1138
1137
|
};
|
|
1139
1138
|
}>, import("@prosekit/core").Extension<{
|
|
1140
1139
|
Nodes: {
|
|
1141
1140
|
list: {
|
|
1142
|
-
taskMarker?: "x" | "X" | null;
|
|
1141
|
+
taskMarker?: ("x" | "X" | null) | undefined;
|
|
1143
1142
|
};
|
|
1144
1143
|
};
|
|
1145
1144
|
}>, import("@prosekit/core").Extension<{
|
|
1146
1145
|
Nodes: {
|
|
1147
1146
|
list: {
|
|
1148
|
-
markerGap?: number;
|
|
1147
|
+
markerGap?: number | undefined;
|
|
1149
1148
|
};
|
|
1150
1149
|
};
|
|
1151
1150
|
}>, import("@prosekit/core").Extension<{
|
|
@@ -1166,13 +1165,13 @@ declare function defineEditorExtensionImpl(options: EditorExtensionOptions): imp
|
|
|
1166
1165
|
}>, import("@prosekit/core").Extension<{
|
|
1167
1166
|
Nodes: {
|
|
1168
1167
|
heading: {
|
|
1169
|
-
setextUnderline?: number | null;
|
|
1168
|
+
setextUnderline?: number | null | undefined;
|
|
1170
1169
|
};
|
|
1171
1170
|
};
|
|
1172
1171
|
}>, import("@prosekit/core").Extension<{
|
|
1173
1172
|
Nodes: {
|
|
1174
1173
|
heading: {
|
|
1175
|
-
closingHashes?: number | null;
|
|
1174
|
+
closingHashes?: number | null | undefined;
|
|
1176
1175
|
};
|
|
1177
1176
|
};
|
|
1178
1177
|
}>, import("@prosekit/core").PlainExtension, import("@prosekit/extensions/heading").HeadingCommandsExtension, import("@prosekit/core").PlainExtension]>, import("@prosekit/core").Union<readonly [import("@prosekit/extensions/table").TableSpecExtension, import("@prosekit/extensions/table").TableRowSpecExtension, import("@prosekit/extensions/table").TableCellSpecExtension, import("@prosekit/extensions/table").TableHeaderCellSpecExtension, import("@prosekit/core").Union<readonly [import("@prosekit/core").Extension<{
|
|
@@ -1186,13 +1185,13 @@ declare function defineEditorExtensionImpl(options: EditorExtensionOptions): imp
|
|
|
1186
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").PlainExtension, import("@prosekit/extensions/code-block").CodeBlockCommandsExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").Extension<{
|
|
1187
1186
|
Nodes: {
|
|
1188
1187
|
codeBlock: {
|
|
1189
|
-
fenceStyle?: CodeBlockFenceStyle | null;
|
|
1188
|
+
fenceStyle?: CodeBlockFenceStyle | null | undefined;
|
|
1190
1189
|
};
|
|
1191
1190
|
};
|
|
1192
1191
|
}>, import("@prosekit/core").Extension<{
|
|
1193
1192
|
Nodes: {
|
|
1194
1193
|
codeBlock: {
|
|
1195
|
-
fenceLength?: number | null;
|
|
1194
|
+
fenceLength?: number | null | undefined;
|
|
1196
1195
|
};
|
|
1197
1196
|
};
|
|
1198
1197
|
}>, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension, import("@prosekit/core").PlainExtension]>, MeowdownHorizontalRuleExtension, import("@prosekit/core").Extension<{
|
|
@@ -1318,11 +1317,11 @@ interface MarkdownToDocOptions {
|
|
|
1318
1317
|
/**
|
|
1319
1318
|
* Node builders to build the document with. Defaults to the shared schema's builders.
|
|
1320
1319
|
*/
|
|
1321
|
-
nodes?: TypedNodeBuilders;
|
|
1320
|
+
nodes?: TypedNodeBuilders | undefined;
|
|
1322
1321
|
/**
|
|
1323
1322
|
* Whether to peel a leading `---` frontmatter block onto the doc's `frontmatter` attribute. Off by default.
|
|
1324
1323
|
*/
|
|
1325
|
-
frontmatter?: boolean;
|
|
1324
|
+
frontmatter?: boolean | undefined;
|
|
1326
1325
|
}
|
|
1327
1326
|
/**
|
|
1328
1327
|
* Convert a markdown string into a ProseMirror document node.
|
|
@@ -1348,7 +1347,7 @@ interface DocToMarkdownOptions {
|
|
|
1348
1347
|
/**
|
|
1349
1348
|
* Whether to serialize the doc's `frontmatter` attribute as a leading `---` block. Off by default.
|
|
1350
1349
|
*/
|
|
1351
|
-
frontmatter?: boolean;
|
|
1350
|
+
frontmatter?: boolean | undefined;
|
|
1352
1351
|
}
|
|
1353
1352
|
/**
|
|
1354
1353
|
* Convert persisted editor content to Markdown through the shared block serializer.
|
|
@@ -1467,7 +1466,7 @@ interface LinkHoverOptions {
|
|
|
1467
1466
|
* Return `false` while the pointer is on the popup the link opened: a
|
|
1468
1467
|
* pending leave then re-checks later instead of firing.
|
|
1469
1468
|
*/
|
|
1470
|
-
canLeave?: () => boolean;
|
|
1469
|
+
canLeave?: (() => boolean) | undefined;
|
|
1471
1470
|
}
|
|
1472
1471
|
/**
|
|
1473
1472
|
* Track the link under the user's attention: a mouse hover after a short
|
|
@@ -1506,8 +1505,8 @@ export declare function defineLinkPaste(enabled?: (state: EditorState) => boolea
|
|
|
1506
1505
|
*/
|
|
1507
1506
|
interface LinkPreview {
|
|
1508
1507
|
readonly title: string;
|
|
1509
|
-
readonly description?: string;
|
|
1510
|
-
readonly iconSrc?: string;
|
|
1508
|
+
readonly description?: string | undefined;
|
|
1509
|
+
readonly iconSrc?: string | undefined;
|
|
1511
1510
|
}
|
|
1512
1511
|
/**
|
|
1513
1512
|
* Resolve display metadata for a link, or return `undefined` when unavailable.
|
|
@@ -1688,4 +1687,4 @@ export declare function paragraphMarkdownToDoc(markdown: string, nodes?: TypedNo
|
|
|
1688
1687
|
*/
|
|
1689
1688
|
export declare function docToParagraphMarkdown(doc: ProseMirrorNode): string;
|
|
1690
1689
|
//#endregion
|
|
1691
|
-
export { type AcceptPendingReplacementOptions, type
|
|
1690
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LEZER_NODE_IDS, checkRoundTrip, collectInlineElements, getAutolinkHref, gfmParser, isSpaceChar, matchEmbed, parseInline, parseMarkdownAst, parseXPostId, serializeMarkdownAst } from "@meowdown/markdown";
|
|
2
1
|
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
2
|
import { codeBlockEnterRule, codeBlockInputRule, defineCodeBlockCommands, defineCodeBlockHighlight, defineCodeBlockKeymap, defineCodeBlockPreviewPlugin, defineCodeBlockSpec, isCodeBlockPreviewHiddenDecoration } from "@prosekit/extensions/code-block";
|
|
4
3
|
import { definePlaceholder, definePlaceholder as definePlaceholder$1 } from "@prosekit/extensions/placeholder";
|
|
5
4
|
import { defineSearchCommands, defineSearchQuery, defineSearchStatusHandler, getSearchStatus, getSearchStatus as getSearchStatus$1 } from "@prosekit/extensions/search";
|
|
6
|
-
import {
|
|
5
|
+
import { LEZER_NODE_IDS, collectInlineElements, getAutolinkHref, gfmParser, isSpaceChar, matchEmbed, parseInline, parseMarkdownAst, parseXPostId, serializeMarkdownAst } from "@meowdown/markdown";
|
|
6
|
+
import { debounce, isElementLike, isHTMLElement, isObject, once } from "@ocavue/utils";
|
|
7
7
|
import { defineDoc } from "@prosekit/extensions/doc";
|
|
8
8
|
import { defineGapCursor } from "@prosekit/extensions/gap-cursor";
|
|
9
9
|
import { defineModClickPrevention } from "@prosekit/extensions/mod-click-prevention";
|
|
@@ -4824,28 +4824,21 @@ function createInlineMarkPlugin(getOptions) {
|
|
|
4824
4824
|
},
|
|
4825
4825
|
view(view) {
|
|
4826
4826
|
view.dispatch(triggerInlineMarks(view.state));
|
|
4827
|
-
|
|
4827
|
+
const controller = new AbortController();
|
|
4828
4828
|
const flush = (currentView) => {
|
|
4829
|
-
timer = void 0;
|
|
4830
4829
|
if (currentView.isDestroyed) return;
|
|
4831
4830
|
if ((pluginKey.getState(currentView.state)?.pendingReferenceKeys.size ?? 0) === 0) return;
|
|
4832
4831
|
currentView.dispatch(currentView.state.tr.setMeta(RESTYLE_KEY, true));
|
|
4833
4832
|
};
|
|
4833
|
+
const scheduleFlush = debounce(flush, RESTYLE_DEBOUNCE_MS, { signal: controller.signal });
|
|
4834
4834
|
return {
|
|
4835
4835
|
update(currentView, previousState) {
|
|
4836
4836
|
const current = pluginKey.getState(currentView.state);
|
|
4837
|
-
if ((current?.pendingReferenceKeys.size ?? 0) === 0)
|
|
4838
|
-
|
|
4839
|
-
timer = void 0;
|
|
4840
|
-
return;
|
|
4841
|
-
}
|
|
4842
|
-
if (timer == null || pluginKey.getState(previousState) !== current) {
|
|
4843
|
-
if (timer != null) clearTimeout(timer);
|
|
4844
|
-
timer = setTimeout(() => flush(currentView), RESTYLE_DEBOUNCE_MS);
|
|
4845
|
-
}
|
|
4837
|
+
if ((current?.pendingReferenceKeys.size ?? 0) === 0) return;
|
|
4838
|
+
if (pluginKey.getState(previousState) !== current) scheduleFlush(currentView);
|
|
4846
4839
|
},
|
|
4847
4840
|
destroy() {
|
|
4848
|
-
|
|
4841
|
+
controller.abort();
|
|
4849
4842
|
}
|
|
4850
4843
|
};
|
|
4851
4844
|
}
|
|
@@ -8139,4 +8132,4 @@ function getVirtualElementFromRange(view, range) {
|
|
|
8139
8132
|
}
|
|
8140
8133
|
|
|
8141
8134
|
//#endregion
|
|
8142
|
-
export { EDITOR_KEY_BINDINGS, Priority, buildFileMarkdown,
|
|
8135
|
+
export { EDITOR_KEY_BINDINGS, Priority, buildFileMarkdown, 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.81.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"@floating-ui/dom": "^1.8.0",
|
|
27
27
|
"@lezer/highlight": "^1.2.5",
|
|
28
28
|
"@meowdown/embed": "0.3.1",
|
|
29
|
-
"@meowdown/markdown": "0.
|
|
30
|
-
"@ocavue/utils": "^1.
|
|
29
|
+
"@meowdown/markdown": "0.77.0",
|
|
30
|
+
"@ocavue/utils": "^1.9.0",
|
|
31
31
|
"@post-embed/exporter": "^0.5.0",
|
|
32
32
|
"@post-embed/schema": "^0.5.2",
|
|
33
33
|
"@post-embed/types": "^0.5.0",
|
|
34
34
|
"@prosekit/core": "^0.13.3",
|
|
35
35
|
"@prosekit/extensions": "^0.18.4",
|
|
36
36
|
"@prosekit/pm": "^0.1.20",
|
|
37
|
-
"@prosekit/web": "^0.9.
|
|
37
|
+
"@prosekit/web": "^0.9.4",
|
|
38
38
|
"hast-util-to-mdast": "^10.1.2",
|
|
39
39
|
"katex": "^0.19.0",
|
|
40
40
|
"lru.min": "^1.1.5",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"prosemirror-enter-rules": "^0.1.6",
|
|
45
45
|
"prosemirror-flat-list": "^0.7.3",
|
|
46
46
|
"prosemirror-highlight": "^0.16.0",
|
|
47
|
-
"rehype-parse": "^9.0.
|
|
47
|
+
"rehype-parse": "^9.0.1",
|
|
48
48
|
"rehype-remark": "^10.0.1",
|
|
49
49
|
"remark-gfm": "^4.0.1",
|
|
50
50
|
"remark-stringify": "^11.0.0",
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@meowdown/vitest": "0.0.0",
|
|
57
57
|
"@ocavue/tsconfig": "^0.7.1",
|
|
58
|
-
"@tsdown/css": "^0.23.
|
|
58
|
+
"@tsdown/css": "^0.23.1",
|
|
59
59
|
"@types/hast": "^3.0.5",
|
|
60
60
|
"@types/mdast": "^4.0.4",
|
|
61
61
|
"@vitest/browser-playwright": "^5.0.3",
|
|
62
62
|
"dedent": "^1.7.2",
|
|
63
63
|
"diffable-html-snapshot": "^0.3.0",
|
|
64
|
-
"tsdown": "^0.23.
|
|
64
|
+
"tsdown": "^0.23.1",
|
|
65
65
|
"vitest": "^5.0.3"
|
|
66
66
|
},
|
|
67
67
|
"publishConfig": {
|