@prosekit/extensions 0.11.0 → 0.11.2
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/{drop-indicator-CCCaHFvw.js → drop-indicator-B8P652g2.js} +30 -3
- package/dist/prosekit-extensions-autocomplete.d.ts +47 -47
- package/dist/prosekit-extensions-blockquote.d.ts +11 -11
- package/dist/prosekit-extensions-bold.d.ts +16 -16
- package/dist/prosekit-extensions-code-block.d.ts +82 -82
- package/dist/prosekit-extensions-code.d.ts +16 -16
- package/dist/prosekit-extensions-commit.d.ts +20 -20
- package/dist/prosekit-extensions-doc.d.ts +4 -4
- package/dist/prosekit-extensions-drop-cursor.d.ts +20 -20
- package/dist/prosekit-extensions-drop-indicator.d.ts +77 -63
- package/dist/prosekit-extensions-drop-indicator.js +1 -1
- package/dist/prosekit-extensions-enter-rule.d.ts +57 -57
- package/dist/prosekit-extensions-file.d.ts +54 -54
- package/dist/prosekit-extensions-gap-cursor.d.ts +15 -15
- package/dist/prosekit-extensions-hard-break.d.ts +16 -16
- package/dist/prosekit-extensions-heading.d.ts +19 -19
- package/dist/prosekit-extensions-horizontal-rule.d.ts +6 -6
- package/dist/prosekit-extensions-image.d.ts +14 -14
- package/dist/prosekit-extensions-input-rule.d.ts +70 -70
- package/dist/prosekit-extensions-italic.d.ts +16 -16
- package/dist/prosekit-extensions-link.d.ts +24 -24
- package/dist/prosekit-extensions-list.d.ts +38 -38
- package/dist/prosekit-extensions-list.js +1 -1
- package/dist/prosekit-extensions-loro.d.ts +19 -19
- package/dist/prosekit-extensions-mark-rule.d.ts +17 -17
- package/dist/prosekit-extensions-mention.d.ts +10 -10
- package/dist/prosekit-extensions-mod-click-prevention.d.ts +7 -7
- package/dist/prosekit-extensions-paragraph.d.ts +23 -23
- package/dist/prosekit-extensions-placeholder.d.ts +20 -20
- package/dist/prosekit-extensions-readonly.d.ts +2 -2
- package/dist/prosekit-extensions-search.d.ts +36 -36
- package/dist/prosekit-extensions-strike.d.ts +16 -16
- package/dist/prosekit-extensions-table.d.ts +134 -134
- package/dist/prosekit-extensions-text-align.d.ts +29 -29
- package/dist/prosekit-extensions-text.d.ts +4 -4
- package/dist/prosekit-extensions-underline.d.ts +14 -14
- package/dist/prosekit-extensions-virtual-selection.d.ts +11 -11
- package/dist/prosekit-extensions-virtual-selection.js +1 -1
- package/dist/prosekit-extensions-yjs.d.ts +27 -27
- package/dist/{shiki-highlighter-chunk-NV2F_Qjl.d.ts → shiki-highlighter-chunk-D7gKY7Kr.d.ts} +1 -1
- package/dist/shiki-highlighter-chunk.d.ts +1 -1
- package/package.json +8 -8
|
@@ -4,103 +4,103 @@ import { EditorView } from "@prosekit/pm/view";
|
|
|
4
4
|
//#region src/file/file-drop-handler.d.ts
|
|
5
5
|
interface FileDropHandlerOptions {
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
* The editor view.
|
|
8
|
+
*/
|
|
9
9
|
view: EditorView;
|
|
10
10
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
* The event that triggered the drop.
|
|
12
|
+
*/
|
|
13
13
|
event: DragEvent;
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
* The file that was dropped.
|
|
16
|
+
*/
|
|
17
17
|
file: File;
|
|
18
18
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
* The position of the document where the file was dropped.
|
|
20
|
+
*/
|
|
21
21
|
pos: number;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* A function that handles one of the files in a drop event.
|
|
25
|
-
*
|
|
26
|
-
* Returns `true` if the file was handled and thus should not be handled by
|
|
27
|
-
* other handlers.
|
|
28
|
-
*/
|
|
24
|
+
* A function that handles one of the files in a drop event.
|
|
25
|
+
*
|
|
26
|
+
* Returns `true` if the file was handled and thus should not be handled by
|
|
27
|
+
* other handlers.
|
|
28
|
+
*/
|
|
29
29
|
type FileDropHandler = (options: FileDropHandlerOptions) => boolean | void;
|
|
30
30
|
declare function defineFileDropHandler(handler: FileDropHandler): PlainExtension;
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/file/file-paste-handler.d.ts
|
|
33
33
|
interface FilePasteHandlerOptions {
|
|
34
34
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
* The editor view.
|
|
36
|
+
*/
|
|
37
37
|
view: EditorView;
|
|
38
38
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
* The event that triggered the paste.
|
|
40
|
+
*/
|
|
41
41
|
event: ClipboardEvent;
|
|
42
42
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
* The file that was pasted.
|
|
44
|
+
*/
|
|
45
45
|
file: File;
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
* A function that handles one of the files in a paste event.
|
|
49
|
-
*
|
|
50
|
-
* Returns `true` if the file was handled and thus should not be handled by
|
|
51
|
-
* other handlers.
|
|
52
|
-
*/
|
|
48
|
+
* A function that handles one of the files in a paste event.
|
|
49
|
+
*
|
|
50
|
+
* Returns `true` if the file was handled and thus should not be handled by
|
|
51
|
+
* other handlers.
|
|
52
|
+
*/
|
|
53
53
|
type FilePasteHandler = (options: FilePasteHandlerOptions) => boolean | void;
|
|
54
54
|
declare function defineFilePasteHandler(handler: FilePasteHandler): PlainExtension;
|
|
55
55
|
//#endregion
|
|
56
56
|
//#region src/file/file-upload.d.ts
|
|
57
57
|
/**
|
|
58
|
-
* An interface representing the upload progress.
|
|
59
|
-
*/
|
|
58
|
+
* An interface representing the upload progress.
|
|
59
|
+
*/
|
|
60
60
|
interface UploadProgress {
|
|
61
61
|
loaded: number;
|
|
62
62
|
total: number;
|
|
63
63
|
}
|
|
64
64
|
interface UploaderOptions {
|
|
65
65
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
* The file to be uploaded.
|
|
67
|
+
*/
|
|
68
68
|
file: File;
|
|
69
69
|
/**
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
* A callback function that should be called with the upload progress updates.
|
|
71
|
+
*/
|
|
72
72
|
onProgress: (progress: UploadProgress) => void;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
|
-
* The implementation of the actual upload function. You need to implement this
|
|
76
|
-
* function to upload files to your desired destination.
|
|
77
|
-
*/
|
|
75
|
+
* The implementation of the actual upload function. You need to implement this
|
|
76
|
+
* function to upload files to your desired destination.
|
|
77
|
+
*/
|
|
78
78
|
type Uploader<Result> = (options: UploaderOptions) => Promise<Result>;
|
|
79
79
|
/**
|
|
80
|
-
* A class that represents a upload task.
|
|
81
|
-
*/
|
|
80
|
+
* A class that represents a upload task.
|
|
81
|
+
*/
|
|
82
82
|
declare class UploadTask<Result> {
|
|
83
83
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
* An [object URL](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL)
|
|
85
|
+
* representing the file to be uploaded. This URL will be revoked once the
|
|
86
|
+
* upload is complete successfully.
|
|
87
|
+
*/
|
|
88
88
|
readonly objectURL: string;
|
|
89
89
|
/**
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
* A boolean indicating whether the upload is complete (either successfully or with an error).
|
|
91
|
+
*/
|
|
92
92
|
protected done: boolean;
|
|
93
93
|
/**
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
* A promise that fulfills once the upload is complete, or rejects if an error occurs.
|
|
95
|
+
*/
|
|
96
96
|
readonly finished: Promise<Result>;
|
|
97
97
|
private subscribers;
|
|
98
98
|
/**
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
* Creates a new upload task. You can find the upload task by its object URL
|
|
100
|
+
* later using `UploadTask.get()`.
|
|
101
|
+
*
|
|
102
|
+
* @param options - The options for the upload task.
|
|
103
|
+
*/
|
|
104
104
|
constructor({
|
|
105
105
|
file,
|
|
106
106
|
uploader
|
|
@@ -109,16 +109,16 @@ declare class UploadTask<Result> {
|
|
|
109
109
|
uploader: Uploader<Result>;
|
|
110
110
|
});
|
|
111
111
|
/**
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
* Subscribes to progress updates. Returns a function to unsubscribe.
|
|
113
|
+
*/
|
|
114
114
|
subscribeProgress(callback: (progress: UploadProgress) => void): VoidFunction;
|
|
115
115
|
/**
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
* Finds an upload task by its object URL.
|
|
117
|
+
*/
|
|
118
118
|
static get<Result = unknown>(objectURL: string): UploadTask<Result> | undefined;
|
|
119
119
|
/**
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
* Deletes an upload task by its object URL.
|
|
121
|
+
*/
|
|
122
122
|
static delete(objectURL: string): void;
|
|
123
123
|
}
|
|
124
124
|
//#endregion
|
|
@@ -4,23 +4,23 @@ import "prosemirror-gapcursor";
|
|
|
4
4
|
//#region src/gap-cursor/gap-cursor.d.ts
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
9
|
type GapCursorExtension = PlainExtension;
|
|
10
10
|
/**
|
|
11
|
-
* Capture clicks near and arrow-key-motion past places that don't have a
|
|
12
|
-
* normally selectable position nearby, and create a gap cursor selection for
|
|
13
|
-
* them. The cursor is drawn as an element with class `ProseMirror-gapcursor`.
|
|
14
|
-
*
|
|
15
|
-
* You can either include `prosekit/extensions/gap-cursor.css` or add your own
|
|
16
|
-
* styles to make it visible.
|
|
17
|
-
*
|
|
18
|
-
* See
|
|
19
|
-
* [prosemirror-gapcursor](https://github.com/ProseMirror/prosemirror-gapcursor)
|
|
20
|
-
* for more information.
|
|
21
|
-
*
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
11
|
+
* Capture clicks near and arrow-key-motion past places that don't have a
|
|
12
|
+
* normally selectable position nearby, and create a gap cursor selection for
|
|
13
|
+
* them. The cursor is drawn as an element with class `ProseMirror-gapcursor`.
|
|
14
|
+
*
|
|
15
|
+
* You can either include `prosekit/extensions/gap-cursor.css` or add your own
|
|
16
|
+
* styles to make it visible.
|
|
17
|
+
*
|
|
18
|
+
* See
|
|
19
|
+
* [prosemirror-gapcursor](https://github.com/ProseMirror/prosemirror-gapcursor)
|
|
20
|
+
* for more information.
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
24
|
declare function defineGapCursor(): GapCursorExtension;
|
|
25
25
|
//#endregion
|
|
26
26
|
export { type GapCursorExtension, defineGapCursor };
|
|
@@ -4,50 +4,50 @@ import { Attrs } from "@prosekit/pm/model";
|
|
|
4
4
|
|
|
5
5
|
//#region src/hard-break/hard-break-commands.d.ts
|
|
6
6
|
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
9
|
type HardBreakCommandsExtension = Extension<{
|
|
10
10
|
Commands: {
|
|
11
11
|
insertHardBreak: [];
|
|
12
12
|
};
|
|
13
13
|
}>;
|
|
14
14
|
/**
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
21
|
declare function defineHardBreakCommands(): HardBreakCommandsExtension;
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/hard-break/hard-break-spec.d.ts
|
|
24
24
|
/**
|
|
25
|
-
* @internal
|
|
26
|
-
*/
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
27
|
type HardBreakSpecExtension = Extension<{
|
|
28
28
|
Nodes: {
|
|
29
29
|
hardBreak: Attrs;
|
|
30
30
|
};
|
|
31
31
|
}>;
|
|
32
32
|
/**
|
|
33
|
-
* @internal
|
|
34
|
-
*/
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
35
|
declare function defineHardBreakSpec(): HardBreakSpecExtension;
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/hard-break/hard-break.d.ts
|
|
38
38
|
/**
|
|
39
|
-
* @internal
|
|
40
|
-
*/
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
41
|
type HardBreakExtension = Union<[HardBreakSpecExtension, HardBreakCommandsExtension]>;
|
|
42
42
|
/**
|
|
43
|
-
* @public
|
|
44
|
-
*/
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
45
|
declare function defineHardBreak(): HardBreakExtension;
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region src/hard-break/hard-break-keymap.d.ts
|
|
48
48
|
/**
|
|
49
|
-
* @internal
|
|
50
|
-
*/
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
51
|
declare function defineHardBreakKeymap(): PlainExtension;
|
|
52
52
|
//#endregion
|
|
53
53
|
export { type HardBreakCommandsExtension, type HardBreakExtension, type HardBreakSpecExtension, defineHardBreak, defineHardBreakCommands, defineHardBreakKeymap, defineHardBreakSpec };
|
|
@@ -7,8 +7,8 @@ interface HeadingAttrs {
|
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/heading/heading-commands.d.ts
|
|
9
9
|
/**
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
12
|
type HeadingCommandsExtension = Extension<{
|
|
13
13
|
Commands: {
|
|
14
14
|
setHeading: [attrs?: HeadingAttrs | undefined];
|
|
@@ -17,47 +17,47 @@ type HeadingCommandsExtension = Extension<{
|
|
|
17
17
|
};
|
|
18
18
|
}>;
|
|
19
19
|
/**
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
22
|
declare function defineHeadingCommands(): HeadingCommandsExtension;
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/heading/heading-spec.d.ts
|
|
25
25
|
/**
|
|
26
|
-
* @internal
|
|
27
|
-
*/
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
28
|
type HeadingSpecExtension = Extension<{
|
|
29
29
|
Nodes: {
|
|
30
30
|
heading: HeadingAttrs;
|
|
31
31
|
};
|
|
32
32
|
}>;
|
|
33
33
|
/**
|
|
34
|
-
* @internal
|
|
35
|
-
*/
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
36
|
declare function defineHeadingSpec(): HeadingSpecExtension;
|
|
37
37
|
//#endregion
|
|
38
38
|
//#region src/heading/heading.d.ts
|
|
39
39
|
/**
|
|
40
|
-
* @internal
|
|
41
|
-
*/
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
42
|
type HeadingExtension = Union<[HeadingSpecExtension, HeadingCommandsExtension]>;
|
|
43
43
|
/**
|
|
44
|
-
* @public
|
|
45
|
-
*/
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
46
|
declare function defineHeading(): HeadingExtension;
|
|
47
47
|
//#endregion
|
|
48
48
|
//#region src/heading/heading-input-rule.d.ts
|
|
49
49
|
/**
|
|
50
|
-
* Converts the text block to a heading when `#` is typed at the start of a new
|
|
51
|
-
* line followed by a space.
|
|
52
|
-
*
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
50
|
+
* Converts the text block to a heading when `#` is typed at the start of a new
|
|
51
|
+
* line followed by a space.
|
|
52
|
+
*
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
55
|
declare function defineHeadingInputRule(): PlainExtension;
|
|
56
56
|
//#endregion
|
|
57
57
|
//#region src/heading/heading-keymap.d.ts
|
|
58
58
|
/**
|
|
59
|
-
* @internal
|
|
60
|
-
*/
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
61
|
declare function defineHeadingKeymap(): PlainExtension;
|
|
62
62
|
//#endregion
|
|
63
63
|
export { type HeadingAttrs, type HeadingCommandsExtension, type HeadingExtension, type HeadingSpecExtension, defineHeading, defineHeadingCommands, defineHeadingInputRule, defineHeadingKeymap, defineHeadingSpec };
|
|
@@ -9,8 +9,8 @@ type HorizontalRuleCommandsExtension = Extension<{
|
|
|
9
9
|
};
|
|
10
10
|
}>;
|
|
11
11
|
/**
|
|
12
|
-
* Returns a command that inserts a horizontal rule at the current selection.
|
|
13
|
-
*/
|
|
12
|
+
* Returns a command that inserts a horizontal rule at the current selection.
|
|
13
|
+
*/
|
|
14
14
|
declare function insertHorizontalRule(): Command;
|
|
15
15
|
declare function defineHorizontalRuleCommands(): HorizontalRuleCommandsExtension;
|
|
16
16
|
//#endregion
|
|
@@ -25,14 +25,14 @@ declare function defineHorizontalRuleSpec(): HorizontalRuleSpecExtension;
|
|
|
25
25
|
//#region src/horizontal-rule/horizontal-rule.d.ts
|
|
26
26
|
type HorizontalRuleExtension = Union<[HorizontalRuleSpecExtension, HorizontalRuleCommandsExtension]>;
|
|
27
27
|
/**
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
30
|
declare function defineHorizontalRule(): HorizontalRuleExtension;
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/horizontal-rule/horizontal-rule-input-rule.d.ts
|
|
33
33
|
/**
|
|
34
|
-
* @public
|
|
35
|
-
*/
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
36
|
declare function defineHorizontalRuleInputRule(): PlainExtension;
|
|
37
37
|
//#endregion
|
|
38
38
|
export { type HorizontalRuleCommandsExtension, type HorizontalRuleExtension, type HorizontalRuleSpecExtension, defineHorizontalRule, defineHorizontalRuleCommands, defineHorizontalRuleInputRule, defineHorizontalRuleSpec, insertHorizontalRule };
|
|
@@ -3,48 +3,48 @@ import { Extension, Union } from "@prosekit/core";
|
|
|
3
3
|
//#region src/image/image-spec.d.ts
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
8
|
interface ImageAttrs {
|
|
9
9
|
src?: string | null;
|
|
10
10
|
width?: number | null;
|
|
11
11
|
height?: number | null;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
16
|
type ImageSpecExtension = Extension<{
|
|
17
17
|
Nodes: {
|
|
18
18
|
image: ImageAttrs;
|
|
19
19
|
};
|
|
20
20
|
}>;
|
|
21
21
|
/**
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
24
|
declare function defineImageSpec(): ImageSpecExtension;
|
|
25
25
|
//#endregion
|
|
26
26
|
//#region src/image/image-commands.d.ts
|
|
27
27
|
/**
|
|
28
|
-
* @internal
|
|
29
|
-
*/
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
30
|
type ImageCommandsExtension = Extension<{
|
|
31
31
|
Commands: {
|
|
32
32
|
insertImage: [attrs?: ImageAttrs];
|
|
33
33
|
};
|
|
34
34
|
}>;
|
|
35
35
|
/**
|
|
36
|
-
* @internal
|
|
37
|
-
*/
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
38
|
declare function defineImageCommands(): ImageCommandsExtension;
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region src/image/image.d.ts
|
|
41
41
|
/**
|
|
42
|
-
* @internal
|
|
43
|
-
*/
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
44
|
type ImageExtension = Union<[ImageSpecExtension, ImageCommandsExtension]>;
|
|
45
45
|
/**
|
|
46
|
-
* @public
|
|
47
|
-
*/
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
48
|
declare function defineImage(): ImageExtension;
|
|
49
49
|
//#endregion
|
|
50
50
|
export { type ImageAttrs, type ImageCommandsExtension, type ImageExtension, type ImageSpecExtension, defineImage, defineImageCommands, defineImageSpec };
|
|
@@ -5,43 +5,43 @@ import { Attrs, MarkType, NodeType, ProseMirrorNode } from "@prosekit/pm/model";
|
|
|
5
5
|
//#region src/input-rule/index.d.ts
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Defines an input rule extension.
|
|
9
|
-
*
|
|
10
|
-
* @param rule - The ProseMirror input rule to add.
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
8
|
+
* Defines an input rule extension.
|
|
9
|
+
*
|
|
10
|
+
* @param rule - The ProseMirror input rule to add.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
14
|
declare function defineInputRule(rule: InputRule): PlainExtension;
|
|
15
15
|
/**
|
|
16
|
-
* Options for {@link defineMarkInputRule}.
|
|
17
|
-
*
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
16
|
+
* Options for {@link defineMarkInputRule}.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
20
|
interface MarkInputRuleOptions {
|
|
21
21
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
* The regular expression to match against, which should end with `$` and has
|
|
23
|
+
* exactly one capture group. All other matched text outside the capture group
|
|
24
|
+
* will be deleted.
|
|
25
|
+
*/
|
|
26
26
|
regex: RegExp;
|
|
27
27
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
* The type of mark to set.
|
|
29
|
+
*/
|
|
30
30
|
type: string | MarkType;
|
|
31
31
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
* Attributes to set on the mark.
|
|
33
|
+
*/
|
|
34
34
|
attrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
|
|
35
35
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
* Whether this rule should fire inside marks marked as [code](https://prosemirror.net/docs/ref/#model.MarkSpec.code).
|
|
37
|
+
*
|
|
38
|
+
* @default `false`
|
|
39
|
+
*/
|
|
40
40
|
inCodeMark?: boolean;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
|
-
* @internal
|
|
44
|
-
*/
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
45
|
declare function createMarkInputRule({
|
|
46
46
|
regex,
|
|
47
47
|
type,
|
|
@@ -49,52 +49,52 @@ declare function createMarkInputRule({
|
|
|
49
49
|
inCodeMark
|
|
50
50
|
}: MarkInputRuleOptions): InputRule;
|
|
51
51
|
/**
|
|
52
|
-
* Defines an input rule for automatically adding inline marks when a given
|
|
53
|
-
* pattern is typed.
|
|
54
|
-
*
|
|
55
|
-
* @public
|
|
56
|
-
*/
|
|
52
|
+
* Defines an input rule for automatically adding inline marks when a given
|
|
53
|
+
* pattern is typed.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
57
|
declare function defineMarkInputRule(options: MarkInputRuleOptions): PlainExtension;
|
|
58
58
|
/**
|
|
59
|
-
* Defines an input rule that changes the type of a textblock when the matched
|
|
60
|
-
* text is typed into it.
|
|
61
|
-
*
|
|
62
|
-
* See also [textblockTypeInputRule](https://prosemirror.net/docs/ref/#inputrules.textblockTypeInputRule)
|
|
63
|
-
*
|
|
64
|
-
* @param options
|
|
65
|
-
*
|
|
66
|
-
* @public
|
|
67
|
-
*/
|
|
59
|
+
* Defines an input rule that changes the type of a textblock when the matched
|
|
60
|
+
* text is typed into it.
|
|
61
|
+
*
|
|
62
|
+
* See also [textblockTypeInputRule](https://prosemirror.net/docs/ref/#inputrules.textblockTypeInputRule)
|
|
63
|
+
*
|
|
64
|
+
* @param options
|
|
65
|
+
*
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
68
|
declare function defineTextBlockInputRule({
|
|
69
69
|
regex,
|
|
70
70
|
type,
|
|
71
71
|
attrs
|
|
72
72
|
}: {
|
|
73
73
|
/**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
* The regular expression to match against, which should end with `$`. It
|
|
75
|
+
* usually also starts with `^` to that it is only matched at the start of a
|
|
76
|
+
* textblock.
|
|
77
|
+
*/
|
|
78
78
|
regex: RegExp;
|
|
79
79
|
/**
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
* The node type to replace the matched text with.
|
|
81
|
+
*/
|
|
82
82
|
type: string | NodeType;
|
|
83
83
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
* Attributes to set on the node.
|
|
85
|
+
*/
|
|
86
86
|
attrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
|
|
87
87
|
}): PlainExtension;
|
|
88
88
|
/**
|
|
89
|
-
* Defines an input rule for automatically wrapping a textblock when a given
|
|
90
|
-
* string is typed.
|
|
91
|
-
*
|
|
92
|
-
* See also [wrappingInputRule](https://prosemirror.net/docs/ref/#inputrules.wrappingInputRule)
|
|
93
|
-
*
|
|
94
|
-
* @param options
|
|
95
|
-
*
|
|
96
|
-
* @public
|
|
97
|
-
*/
|
|
89
|
+
* Defines an input rule for automatically wrapping a textblock when a given
|
|
90
|
+
* string is typed.
|
|
91
|
+
*
|
|
92
|
+
* See also [wrappingInputRule](https://prosemirror.net/docs/ref/#inputrules.wrappingInputRule)
|
|
93
|
+
*
|
|
94
|
+
* @param options
|
|
95
|
+
*
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
98
|
declare function defineWrappingInputRule({
|
|
99
99
|
regex,
|
|
100
100
|
type,
|
|
@@ -102,27 +102,27 @@ declare function defineWrappingInputRule({
|
|
|
102
102
|
join
|
|
103
103
|
}: {
|
|
104
104
|
/**
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
* The regular expression to match against, which should end with `$`. It
|
|
106
|
+
* usually also starts with `^` to that it is only matched at the start of a
|
|
107
|
+
* textblock.
|
|
108
|
+
*/
|
|
109
109
|
regex: RegExp;
|
|
110
110
|
/**
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
* The type of node to wrap in.
|
|
112
|
+
*/
|
|
113
113
|
type: string | NodeType;
|
|
114
114
|
/**
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
* Attributes to set on the node.
|
|
116
|
+
*/
|
|
117
117
|
attrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
|
|
118
118
|
/**
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
119
|
+
* By default, if there's a node with the same type above the newly wrapped
|
|
120
|
+
* node, the rule will try to
|
|
121
|
+
* [join](https://prosemirror.net/docs/ref/#transform.Transform.join) those
|
|
122
|
+
* two nodes. You can pass a join predicate, which takes a regular expression
|
|
123
|
+
* match and the node before the wrapped node, and can return a boolean to
|
|
124
|
+
* indicate whether a join should happen.
|
|
125
|
+
*/
|
|
126
126
|
join?: (match: RegExpMatchArray, node: ProseMirrorNode) => boolean;
|
|
127
127
|
}): PlainExtension;
|
|
128
128
|
//#endregion
|