@prosekit/extensions 0.11.1 → 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-QKkPzJIx.js → drop-indicator-B8P652g2.js} +13 -2
- 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 +68 -68
- 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-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 +5 -5
|
@@ -3,35 +3,35 @@ import { PlainExtension } from "@prosekit/core";
|
|
|
3
3
|
//#region src/drop-cursor/drop-cursor.d.ts
|
|
4
4
|
interface DropCursorOptions {
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
* The color of the cursor. Use `false` to apply no color and rely only on class.
|
|
7
|
+
*
|
|
8
|
+
* @default 'black'
|
|
9
|
+
*/
|
|
10
10
|
color?: string | false;
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
* The precise width of the cursor in pixels.
|
|
13
|
+
*
|
|
14
|
+
* @default 1
|
|
15
|
+
*/
|
|
16
16
|
width?: number;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
* A CSS class name to add to the cursor element.
|
|
19
|
+
*/
|
|
20
20
|
class?: string;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* @internal
|
|
24
|
-
*/
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
25
|
type DropCursorExtension = PlainExtension;
|
|
26
26
|
/**
|
|
27
|
-
* Show up a decoration at the drop position when something is dragged over the editor.
|
|
28
|
-
*
|
|
29
|
-
* See [prosemirror-dropcursor](https://github.com/ProseMirror/prosemirror-dropcursor) for more information.
|
|
30
|
-
*
|
|
31
|
-
* You probably want to use `<DropIndicator />` component instead of this extension.
|
|
32
|
-
*
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
27
|
+
* Show up a decoration at the drop position when something is dragged over the editor.
|
|
28
|
+
*
|
|
29
|
+
* See [prosemirror-dropcursor](https://github.com/ProseMirror/prosemirror-dropcursor) for more information.
|
|
30
|
+
*
|
|
31
|
+
* You probably want to use `<DropIndicator />` component instead of this extension.
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
35
|
declare function defineDropCursor(options?: DropCursorOptions): DropCursorExtension;
|
|
36
36
|
//#endregion
|
|
37
37
|
export { type DropCursorExtension, type DropCursorOptions, defineDropCursor };
|
|
@@ -6,78 +6,78 @@ import { Slice } from "@prosekit/pm/model";
|
|
|
6
6
|
//#region src/drop-indicator/types.d.ts
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* A function that will be called when the `dragover` event is fired. You can
|
|
10
|
-
* return `false` to disable the current drop point and thus hide the drop
|
|
11
|
-
* indicator.
|
|
12
|
-
*
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
9
|
+
* A function that will be called when the `dragover` event is fired. You can
|
|
10
|
+
* return `false` to disable the current drop point and thus hide the drop
|
|
11
|
+
* indicator.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
15
|
type DragEventHandler = (options: DragEventHandlerOptions) => boolean;
|
|
16
16
|
/**
|
|
17
|
-
* Options for {@link DragEventHandler}.
|
|
18
|
-
*
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
17
|
+
* Options for {@link DragEventHandler}.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
21
|
interface DragEventHandlerOptions {
|
|
22
22
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
* The editor's view.
|
|
24
|
+
*/
|
|
25
25
|
view: EditorView;
|
|
26
26
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
* The drop position in current document.
|
|
28
|
+
*/
|
|
29
29
|
pos: number;
|
|
30
30
|
/**
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
* The `dragover` event.
|
|
32
|
+
*/
|
|
33
33
|
event: DragEvent;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* A function that will be called when the drop indicator should be shown.
|
|
37
|
-
*
|
|
38
|
-
* @public
|
|
39
|
-
*/
|
|
36
|
+
* A function that will be called when the drop indicator should be shown.
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
40
|
type ShowHandler = (options: ShowHandlerOptions) => void;
|
|
41
41
|
/**
|
|
42
|
-
* Options for {@link ShowHandler}.
|
|
43
|
-
*
|
|
44
|
-
* @public
|
|
45
|
-
*/
|
|
42
|
+
* Options for {@link ShowHandler}.
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
46
|
interface ShowHandlerOptions {
|
|
47
47
|
/**
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
* The editor's view.
|
|
49
|
+
*/
|
|
50
50
|
view: EditorView;
|
|
51
51
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
* The ProseMirror position that the drop indicator should be shown at.
|
|
53
|
+
*/
|
|
54
54
|
pos: number;
|
|
55
55
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
* The line that the drop indicator should be shown at.
|
|
57
|
+
*/
|
|
58
58
|
line: Line;
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
* @internal
|
|
62
|
-
*/
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
63
|
interface Point {
|
|
64
64
|
readonly x: number;
|
|
65
65
|
readonly y: number;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
* @internal
|
|
69
|
-
*/
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
70
|
interface Line {
|
|
71
71
|
readonly p1: Point;
|
|
72
72
|
readonly p2: Point;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
|
-
* An interface matching the internal ProseMirror implementation.
|
|
76
|
-
*
|
|
77
|
-
* See https://github.com/ProseMirror/prosemirror-view/blob/1.38.1/src/input.ts#L657
|
|
78
|
-
*
|
|
79
|
-
* @internal
|
|
80
|
-
*/
|
|
75
|
+
* An interface matching the internal ProseMirror implementation.
|
|
76
|
+
*
|
|
77
|
+
* See https://github.com/ProseMirror/prosemirror-view/blob/1.38.1/src/input.ts#L657
|
|
78
|
+
*
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
81
|
interface ViewDragging {
|
|
82
82
|
readonly slice: Slice;
|
|
83
83
|
readonly move: boolean;
|
|
@@ -86,49 +86,49 @@ interface ViewDragging {
|
|
|
86
86
|
//#endregion
|
|
87
87
|
//#region src/drop-indicator/drop-indicator-facet.d.ts
|
|
88
88
|
/**
|
|
89
|
-
* @internal
|
|
90
|
-
*/
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
91
|
interface DropIndicatorPayload {
|
|
92
92
|
/**
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
* A callback that is called when the drop indicator should be shown.
|
|
94
|
+
*/
|
|
95
95
|
onShow?: ShowHandler;
|
|
96
96
|
/**
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
* A callback that is called when the drop indicator should be hidden.
|
|
98
|
+
*/
|
|
99
99
|
onHide?: VoidFunction;
|
|
100
100
|
/**
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
* A callback that is called when the `dragover` event is fired. You can
|
|
102
|
+
* return `false` to disable the current drop point and thus hide the drop
|
|
103
|
+
* indicator.
|
|
104
|
+
*/
|
|
105
105
|
onDrag?: DragEventHandler;
|
|
106
106
|
}
|
|
107
107
|
//#endregion
|
|
108
108
|
//#region src/drop-indicator/drop-indicator.d.ts
|
|
109
109
|
/**
|
|
110
|
-
* @internal
|
|
111
|
-
*/
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
112
|
type DropIndicatorExtension = PlainExtension;
|
|
113
113
|
/**
|
|
114
|
-
* Defines an extension that controls the behavior of the drop indicator.
|
|
115
|
-
*
|
|
116
|
-
* This extension itself doesn't draw the drop indicator, but it provides the
|
|
117
|
-
* necessary callbacks to do so. You probably don't want to use this extension
|
|
118
|
-
* directly, but rather use the `<DropIndicator>` component.
|
|
119
|
-
*
|
|
120
|
-
* You can add this extension multiple times. If any extension has `onDrag`
|
|
121
|
-
* callback defined, and it returns `false`, then the drop point will be
|
|
122
|
-
* discarded.
|
|
123
|
-
*
|
|
124
|
-
* @public
|
|
125
|
-
*/
|
|
114
|
+
* Defines an extension that controls the behavior of the drop indicator.
|
|
115
|
+
*
|
|
116
|
+
* This extension itself doesn't draw the drop indicator, but it provides the
|
|
117
|
+
* necessary callbacks to do so. You probably don't want to use this extension
|
|
118
|
+
* directly, but rather use the `<DropIndicator>` component.
|
|
119
|
+
*
|
|
120
|
+
* You can add this extension multiple times. If any extension has `onDrag`
|
|
121
|
+
* callback defined, and it returns `false`, then the drop point will be
|
|
122
|
+
* discarded.
|
|
123
|
+
*
|
|
124
|
+
* @public
|
|
125
|
+
*/
|
|
126
126
|
declare function defineDropIndicator(options?: DropIndicatorOptions): DropIndicatorExtension;
|
|
127
127
|
/**
|
|
128
|
-
* Options for {@link defineDropIndicator}.
|
|
129
|
-
*
|
|
130
|
-
* @public
|
|
131
|
-
*/
|
|
128
|
+
* Options for {@link defineDropIndicator}.
|
|
129
|
+
*
|
|
130
|
+
* @public
|
|
131
|
+
*/
|
|
132
132
|
interface DropIndicatorOptions extends DropIndicatorPayload {}
|
|
133
133
|
//#endregion
|
|
134
134
|
export { type DragEventHandler, type DragEventHandlerOptions, type DropIndicatorExtension, type DropIndicatorOptions, type Line, type Point, type ShowHandler, type ShowHandlerOptions, type ViewDragging, defineDropIndicator };
|
|
@@ -5,102 +5,102 @@ import { Attrs, NodeType } from "@prosekit/pm/model";
|
|
|
5
5
|
//#region src/enter-rule/index.d.ts
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @public
|
|
9
|
-
*
|
|
10
|
-
* Options for {@link EnterRuleHandler}.
|
|
11
|
-
*/
|
|
8
|
+
* @public
|
|
9
|
+
*
|
|
10
|
+
* Options for {@link EnterRuleHandler}.
|
|
11
|
+
*/
|
|
12
12
|
interface EnterRuleHandlerOptions {
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
* The current editor state.
|
|
15
|
+
*/
|
|
16
16
|
state: EditorState;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
* The start position of the matched text.
|
|
19
|
+
*/
|
|
20
20
|
from: number;
|
|
21
21
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
* The end position of the matched text.
|
|
23
|
+
*/
|
|
24
24
|
to: number;
|
|
25
25
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
* The matched result from the regular expression.
|
|
27
|
+
*/
|
|
28
28
|
match: RegExpExecArray;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
33
|
type EnterRuleHandler = (options: EnterRuleHandlerOptions) => Transaction | null;
|
|
34
34
|
/**
|
|
35
|
-
* Options for {@link defineEnterRule}.
|
|
36
|
-
*
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
35
|
+
* Options for {@link defineEnterRule}.
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
39
|
type EnterRuleOptions = {
|
|
40
40
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
* The regular expression to match against. It should end with `$`.
|
|
42
|
+
*/
|
|
43
43
|
regex: RegExp;
|
|
44
44
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
* A function to be called when an enter rule is triggered.
|
|
46
|
+
*/
|
|
47
47
|
handler: EnterRuleHandler;
|
|
48
48
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
* Whether to stop further handlers from being called if this rule is triggered.
|
|
50
|
+
*
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
53
|
stop?: boolean;
|
|
54
54
|
};
|
|
55
55
|
/**
|
|
56
|
-
* Options for {@link defineTextBlockEnterRule}.
|
|
57
|
-
*
|
|
58
|
-
* @public
|
|
59
|
-
*/
|
|
56
|
+
* Options for {@link defineTextBlockEnterRule}.
|
|
57
|
+
*
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
60
|
interface TextBlockEnterRuleOptions {
|
|
61
61
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
* The regular expression to match against. It should end with `$`.
|
|
63
|
+
*/
|
|
64
64
|
regex: RegExp;
|
|
65
65
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
* The node type to replace the matched text with.
|
|
67
|
+
*/
|
|
68
68
|
type: string | NodeType;
|
|
69
69
|
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
* Attributes to set on the node. If a function is provided, it will be called
|
|
71
|
+
* with the matched result from the regular expression.
|
|
72
|
+
*/
|
|
73
73
|
attrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
|
|
74
74
|
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
* Whether to stop further handlers from being called if this rule is triggered.
|
|
76
|
+
*
|
|
77
|
+
* @default true
|
|
78
|
+
*/
|
|
79
79
|
stop?: boolean;
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
|
-
* Defines an enter rule. An enter rule applies when the text directly in front of
|
|
83
|
-
* the cursor matches `regex` and user presses Enter. The `regex` should end
|
|
84
|
-
* with `$`.
|
|
85
|
-
*
|
|
86
|
-
* @param options
|
|
87
|
-
*
|
|
88
|
-
* @public
|
|
89
|
-
*/
|
|
82
|
+
* Defines an enter rule. An enter rule applies when the text directly in front of
|
|
83
|
+
* the cursor matches `regex` and user presses Enter. The `regex` should end
|
|
84
|
+
* with `$`.
|
|
85
|
+
*
|
|
86
|
+
* @param options
|
|
87
|
+
*
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
90
|
declare function defineEnterRule({
|
|
91
91
|
regex,
|
|
92
92
|
handler,
|
|
93
93
|
stop
|
|
94
94
|
}: EnterRuleOptions): PlainExtension;
|
|
95
95
|
/**
|
|
96
|
-
* Defines an enter rule that replaces the matched text with a block node.
|
|
97
|
-
*
|
|
98
|
-
* See also {@link defineEnterRule}.
|
|
99
|
-
*
|
|
100
|
-
* @param options
|
|
101
|
-
*
|
|
102
|
-
* @public
|
|
103
|
-
*/
|
|
96
|
+
* Defines an enter rule that replaces the matched text with a block node.
|
|
97
|
+
*
|
|
98
|
+
* See also {@link defineEnterRule}.
|
|
99
|
+
*
|
|
100
|
+
* @param options
|
|
101
|
+
*
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
104
|
declare function defineTextBlockEnterRule({
|
|
105
105
|
regex,
|
|
106
106
|
type,
|
|
@@ -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 };
|