@prosekit/extensions 0.11.6 → 0.11.7
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/{enter-rule-RdhEA900.js → enter-rule-5tkoU2Ir.js} +2 -3
- package/dist/enter-rule-5tkoU2Ir.js.map +1 -0
- package/dist/{file-DVUhe5KJ.js → file-nRyo7PMB.js} +2 -4
- package/dist/{file-DVUhe5KJ.js.map → file-nRyo7PMB.js.map} +1 -1
- package/dist/index-DY6lIIYV.d.ts.map +1 -1
- package/dist/{input-rule-B17tpW4m.js → input-rule-DO_iy2aT.js} +4 -7
- package/dist/input-rule-DO_iy2aT.js.map +1 -0
- package/dist/{paste-rule-BIztzELg.js → paste-rule-Brej6cWi.js} +2 -3
- package/dist/{paste-rule-BIztzELg.js.map → paste-rule-Brej6cWi.js.map} +1 -1
- package/dist/prosekit-extensions-autocomplete.js +1 -2
- package/dist/prosekit-extensions-autocomplete.js.map +1 -1
- package/dist/prosekit-extensions-blockquote.js +1 -1
- package/dist/prosekit-extensions-bold.js +1 -1
- package/dist/prosekit-extensions-code-block.js +4 -5
- package/dist/prosekit-extensions-code-block.js.map +1 -1
- package/dist/prosekit-extensions-code.js +1 -1
- package/dist/prosekit-extensions-commit.js +2 -4
- package/dist/prosekit-extensions-commit.js.map +1 -1
- package/dist/prosekit-extensions-enter-rule.js +1 -1
- package/dist/prosekit-extensions-file.js +1 -1
- package/dist/prosekit-extensions-heading.js +1 -1
- package/dist/prosekit-extensions-horizontal-rule.js +1 -1
- package/dist/prosekit-extensions-image.d.ts +85 -29
- package/dist/prosekit-extensions-image.d.ts.map +1 -1
- package/dist/prosekit-extensions-image.js +93 -52
- package/dist/prosekit-extensions-image.js.map +1 -1
- package/dist/prosekit-extensions-input-rule.js +1 -1
- package/dist/prosekit-extensions-italic.js +1 -1
- package/dist/prosekit-extensions-link.js +3 -3
- package/dist/prosekit-extensions-list.js +3 -5
- package/dist/prosekit-extensions-list.js.map +1 -1
- package/dist/prosekit-extensions-paste-rule.js +1 -1
- package/dist/prosekit-extensions-placeholder.js +2 -3
- package/dist/prosekit-extensions-placeholder.js.map +1 -1
- package/dist/prosekit-extensions-search.js +1 -2
- package/dist/prosekit-extensions-search.js.map +1 -1
- package/dist/prosekit-extensions-strike.js +1 -1
- package/dist/prosekit-extensions-table.js +1 -1
- package/dist/{table-BNwuK7xg.js → table-DND_1127.js} +9 -18
- package/dist/{table-BNwuK7xg.js.map → table-DND_1127.js.map} +1 -1
- package/package.json +4 -4
- package/src/file/file-upload.ts +2 -10
- package/src/image/image-commands/insert-image.ts +14 -0
- package/src/image/image-commands/upload-image.ts +137 -0
- package/src/image/image-commands.ts +7 -12
- package/src/image/image-upload-handler.ts +10 -70
- package/src/image/index.ts +8 -3
- package/dist/enter-rule-RdhEA900.js.map +0 -1
- package/dist/input-rule-B17tpW4m.js.map +0 -1
|
@@ -1,7 +1,81 @@
|
|
|
1
1
|
import { FileDropHandlerOptions, FilePasteHandlerOptions, UploadTask, Uploader } from "./index-DY6lIIYV.js";
|
|
2
2
|
import { Extension, PlainExtension, Union } from "@prosekit/core";
|
|
3
3
|
import { Command } from "@prosekit/pm/state";
|
|
4
|
+
import { EditorView } from "@prosekit/pm/view";
|
|
4
5
|
|
|
6
|
+
//#region src/image/image-commands/upload-image.d.ts
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Options for {@link uploadImage}.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
interface UploadImageOptions {
|
|
14
|
+
/**
|
|
15
|
+
* The uploader used to upload the file. It should return a promise that
|
|
16
|
+
* resolves to the URL of the uploaded image.
|
|
17
|
+
*/
|
|
18
|
+
uploader: Uploader<string>;
|
|
19
|
+
/**
|
|
20
|
+
* The file that will be uploaded.
|
|
21
|
+
*/
|
|
22
|
+
file: File;
|
|
23
|
+
/**
|
|
24
|
+
* The position where the image should be inserted. If not provided, the
|
|
25
|
+
* image is inserted at the current selection.
|
|
26
|
+
*/
|
|
27
|
+
pos?: number;
|
|
28
|
+
/**
|
|
29
|
+
* A handler to be called when an error occurs during the upload.
|
|
30
|
+
*/
|
|
31
|
+
onError?: ImageUploadErrorHandler;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Options for the {@link ImageUploadErrorHandler} callback.
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
interface ImageUploadErrorHandlerOptions {
|
|
39
|
+
/**
|
|
40
|
+
* The file that was uploaded.
|
|
41
|
+
*/
|
|
42
|
+
file: File;
|
|
43
|
+
/**
|
|
44
|
+
* The error that occurred during the upload.
|
|
45
|
+
*/
|
|
46
|
+
error: unknown;
|
|
47
|
+
/**
|
|
48
|
+
* The upload task that was used to upload the file.
|
|
49
|
+
*/
|
|
50
|
+
uploadTask: UploadTask<string>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A handler to be called when an error occurs during the upload.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
type ImageUploadErrorHandler = (options: ImageUploadErrorHandlerOptions) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Returns a command that uploads an image file and inserts an image node with a
|
|
60
|
+
* temporary URL which is replaced once the upload completes.
|
|
61
|
+
*
|
|
62
|
+
* @param options
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
declare function uploadImage({
|
|
67
|
+
uploader,
|
|
68
|
+
file,
|
|
69
|
+
pos,
|
|
70
|
+
onError
|
|
71
|
+
}: UploadImageOptions): Command;
|
|
72
|
+
/**
|
|
73
|
+
* Replaces the temporary image URL with the final uploaded URL.
|
|
74
|
+
*
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
declare function replaceImageURL(view: EditorView, oldURL: string, newURL: string): void;
|
|
78
|
+
//#endregion
|
|
5
79
|
//#region src/image/image-spec.d.ts
|
|
6
80
|
/**
|
|
7
81
|
* @public
|
|
@@ -31,15 +105,9 @@ declare function defineImageSpec(): ImageSpecExtension;
|
|
|
31
105
|
type ImageCommandsExtension = Extension<{
|
|
32
106
|
Commands: {
|
|
33
107
|
insertImage: [attrs?: ImageAttrs];
|
|
108
|
+
uploadImage: [options: UploadImageOptions];
|
|
34
109
|
};
|
|
35
110
|
}>;
|
|
36
|
-
/**
|
|
37
|
-
* Returns a command that inserts an image node with the given attributes at the
|
|
38
|
-
* current selection position.
|
|
39
|
-
*
|
|
40
|
-
* @public
|
|
41
|
-
*/
|
|
42
|
-
declare function insertImage(attrs?: ImageAttrs): Command;
|
|
43
111
|
/**
|
|
44
112
|
* @internal
|
|
45
113
|
*/
|
|
@@ -55,6 +123,15 @@ type ImageExtension = Union<[ImageSpecExtension, ImageCommandsExtension]>;
|
|
|
55
123
|
*/
|
|
56
124
|
declare function defineImage(): ImageExtension;
|
|
57
125
|
//#endregion
|
|
126
|
+
//#region src/image/image-commands/insert-image.d.ts
|
|
127
|
+
/**
|
|
128
|
+
* Returns a command that inserts an image node with the given attributes at the
|
|
129
|
+
* current selection position.
|
|
130
|
+
*
|
|
131
|
+
* @public
|
|
132
|
+
*/
|
|
133
|
+
declare function insertImage(attrs?: ImageAttrs): Command;
|
|
134
|
+
//#endregion
|
|
58
135
|
//#region src/image/image-upload-handler.d.ts
|
|
59
136
|
/**
|
|
60
137
|
* A predicate to determine if the pasted file should be uploaded and inserted as an image.
|
|
@@ -67,27 +144,6 @@ type ImageCanDropPredicate = (options: FileDropHandlerOptions) => boolean;
|
|
|
67
144
|
/**
|
|
68
145
|
* A handler to be called when an error occurs during the upload.
|
|
69
146
|
*/
|
|
70
|
-
type ImageUploadErrorHandler = (options: ImageUploadErrorHandlerOptions) => void;
|
|
71
|
-
/**
|
|
72
|
-
* Options for the {@link ImageUploadErrorHandler} callback.
|
|
73
|
-
*/
|
|
74
|
-
interface ImageUploadErrorHandlerOptions {
|
|
75
|
-
/**
|
|
76
|
-
* The file that was uploaded.
|
|
77
|
-
*/
|
|
78
|
-
file: File;
|
|
79
|
-
/**
|
|
80
|
-
* The error that occurred during the upload.
|
|
81
|
-
*/
|
|
82
|
-
error: unknown;
|
|
83
|
-
/**
|
|
84
|
-
* The upload task that was used to upload the file.
|
|
85
|
-
*/
|
|
86
|
-
uploadTask: UploadTask<string>;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Options for {@link defineImageUploadHandler}.
|
|
90
|
-
*/
|
|
91
147
|
interface ImageUploadHandlerOptions {
|
|
92
148
|
/**
|
|
93
149
|
* The uploader used to upload the file. It should return a promise that
|
|
@@ -123,5 +179,5 @@ declare function defineImageUploadHandler({
|
|
|
123
179
|
onError
|
|
124
180
|
}: ImageUploadHandlerOptions): PlainExtension;
|
|
125
181
|
//#endregion
|
|
126
|
-
export { type ImageAttrs, type ImageCanDropPredicate, type ImageCanPastePredicate, type ImageCommandsExtension, type ImageExtension, type ImageSpecExtension, type ImageUploadErrorHandler, type ImageUploadErrorHandlerOptions, type ImageUploadHandlerOptions, defineImage, defineImageCommands, defineImageSpec, defineImageUploadHandler, insertImage };
|
|
182
|
+
export { type ImageAttrs, type ImageCanDropPredicate, type ImageCanPastePredicate, type ImageCommandsExtension, type ImageExtension, type ImageSpecExtension, type ImageUploadErrorHandler, type ImageUploadErrorHandlerOptions, type ImageUploadHandlerOptions, type UploadImageOptions, defineImage, defineImageCommands, defineImageSpec, defineImageUploadHandler, insertImage, replaceImageURL, uploadImage };
|
|
127
183
|
//# sourceMappingURL=prosekit-extensions-image.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-image.d.ts","names":[],"sources":["../src/image/image-spec.ts","../src/image/image-commands.ts","../src/image/image.ts","../src/image/image-upload-handler.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-image.d.ts","names":[],"sources":["../src/image/image-commands/upload-image.ts","../src/image/image-spec.ts","../src/image/image-commands.ts","../src/image/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;AAtCG,KGDL,cAAA,GAAiB,KHCM,CAAA,CGDC,kBHCD,EGDqB,sBHCrB,CAAA,CAAA;;;;AAkBvB,iBGdI,WAAA,CAAA,CHcJ,EGdmB,cHcnB;;;;;;;AAlBZ;;AAKY,iBIZI,WAAA,CJYJ,KAAA,CAAA,EIZwB,UJYxB,CAAA,EIZqC,OJYrC;;;;;;AALK,KKKL,sBAAA,GLLuB,CAAA,OAAA,EKKY,uBLLZ,EAAA,GAAA,OAAA;;;;AAkBvB,KKRA,qBAAA,GLQA,CAAA,OAAA,EKRkC,sBLQlC,EAAA,GAAA,OAAA;;AAQZ;;AAIQ,UKfS,yBAAA,CLeT;;;AAgBR;AAUA;EAA2B,QAAA,EKpCf,QLoCe,CAAA,MAAA,CAAA;;;;;UAAmC,CAAA,EK/BjD,sBL+BiD;;;AAsC9D;;YKhEY;;AJxCZ;AASA;;SAEW,CAAA,EIkCC,uBJlCD;;;AAOX;;;;ACXA;AAAkC,iBGwDlB,wBAAA,CHxDkB;EAAA,QAAA;EAAA,QAAA;EAAA,OAAA;EAAA;AAAA,CAAA,EG6D/B,yBH7D+B,CAAA,EG6DH,cH7DG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { UploadTask, defineFileDropHandler, defineFilePasteHandler } from "./file-
|
|
1
|
+
import { UploadTask, defineFileDropHandler, defineFilePasteHandler } from "./file-nRyo7PMB.js";
|
|
2
2
|
import { ProseKitError, defineCommands, defineNodeSpec, insertNode, union } from "@prosekit/core";
|
|
3
3
|
|
|
4
|
-
//#region src/image/image-commands.ts
|
|
4
|
+
//#region src/image/image-commands/insert-image.ts
|
|
5
5
|
/**
|
|
6
6
|
* Returns a command that inserts an image node with the given attributes at the
|
|
7
7
|
* current selection position.
|
|
@@ -14,11 +14,87 @@ function insertImage(attrs) {
|
|
|
14
14
|
attrs
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/image/image-commands/upload-image.ts
|
|
20
|
+
/**
|
|
21
|
+
* Returns a command that uploads an image file and inserts an image node with a
|
|
22
|
+
* temporary URL which is replaced once the upload completes.
|
|
23
|
+
*
|
|
24
|
+
* @param options
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
function uploadImage({ uploader, file, pos, onError }) {
|
|
29
|
+
return (state, dispatch, view) => {
|
|
30
|
+
const uploadTask = new UploadTask({
|
|
31
|
+
file,
|
|
32
|
+
uploader
|
|
33
|
+
});
|
|
34
|
+
const objectURL = uploadTask.objectURL;
|
|
35
|
+
const attrs = { src: objectURL };
|
|
36
|
+
uploadTask.finished.then((resultURL) => {
|
|
37
|
+
if (view && view.isDestroyed) return;
|
|
38
|
+
else if (typeof resultURL !== "string") {
|
|
39
|
+
const error = new ProseKitError(`Unexpected upload result. Expected a string but got ${typeof resultURL}`);
|
|
40
|
+
onError?.({
|
|
41
|
+
file,
|
|
42
|
+
error,
|
|
43
|
+
uploadTask
|
|
44
|
+
});
|
|
45
|
+
} else if (!view) {
|
|
46
|
+
const error = new ProseKitError("View must be available to replace the image URL");
|
|
47
|
+
onError?.({
|
|
48
|
+
file,
|
|
49
|
+
error,
|
|
50
|
+
uploadTask
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
replaceImageURL(view, objectURL, resultURL);
|
|
54
|
+
UploadTask.delete(objectURL);
|
|
55
|
+
}
|
|
56
|
+
}).catch((error) => {
|
|
57
|
+
onError?.({
|
|
58
|
+
file,
|
|
59
|
+
error,
|
|
60
|
+
uploadTask
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
return insertNode({
|
|
64
|
+
type: "image",
|
|
65
|
+
attrs,
|
|
66
|
+
pos
|
|
67
|
+
})(state, dispatch, view);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Replaces the temporary image URL with the final uploaded URL.
|
|
72
|
+
*
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
function replaceImageURL(view, oldURL, newURL) {
|
|
76
|
+
const positions = [];
|
|
77
|
+
view.state.doc.descendants((node, pos) => {
|
|
78
|
+
if (node.type.name === "image") {
|
|
79
|
+
if (node.attrs.src === oldURL) positions.push(pos);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
if (positions.length === 0) return;
|
|
83
|
+
const tr = view.state.tr;
|
|
84
|
+
for (const pos of positions) tr.setNodeAttribute(pos, "src", newURL);
|
|
85
|
+
view.dispatch(tr);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/image/image-commands.ts
|
|
17
90
|
/**
|
|
18
91
|
* @internal
|
|
19
92
|
*/
|
|
20
93
|
function defineImageCommands() {
|
|
21
|
-
return defineCommands({
|
|
94
|
+
return defineCommands({
|
|
95
|
+
insertImage,
|
|
96
|
+
uploadImage
|
|
97
|
+
});
|
|
22
98
|
}
|
|
23
99
|
|
|
24
100
|
//#endregion
|
|
@@ -98,63 +174,28 @@ const defaultOnError = ({ error }) => {
|
|
|
98
174
|
* @param options
|
|
99
175
|
*/
|
|
100
176
|
function defineImageUploadHandler({ uploader, canPaste = defaultCanUpload, canDrop = defaultCanUpload, onError = defaultOnError }) {
|
|
101
|
-
const handleInsert = (view, file, pos) => {
|
|
102
|
-
const uploadTask = new UploadTask({
|
|
103
|
-
file,
|
|
104
|
-
uploader
|
|
105
|
-
});
|
|
106
|
-
const objectURL = uploadTask.objectURL;
|
|
107
|
-
const attrs = { src: objectURL };
|
|
108
|
-
uploadTask.finished.then((resultURL) => {
|
|
109
|
-
if (view.isDestroyed) return;
|
|
110
|
-
else if (typeof resultURL !== "string") {
|
|
111
|
-
const error = new ProseKitError(`Unexpected upload result. Expected a string but got ${typeof resultURL}`);
|
|
112
|
-
onError({
|
|
113
|
-
file,
|
|
114
|
-
error,
|
|
115
|
-
uploadTask
|
|
116
|
-
});
|
|
117
|
-
} else {
|
|
118
|
-
replaceImageURL(view, objectURL, resultURL);
|
|
119
|
-
UploadTask.delete(objectURL);
|
|
120
|
-
}
|
|
121
|
-
}).catch((error) => {
|
|
122
|
-
onError({
|
|
123
|
-
file,
|
|
124
|
-
error,
|
|
125
|
-
uploadTask
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
return insertNode({
|
|
129
|
-
type: "image",
|
|
130
|
-
attrs,
|
|
131
|
-
pos
|
|
132
|
-
})(view.state, view.dispatch, view);
|
|
133
|
-
};
|
|
134
177
|
const handlePaste = (options) => {
|
|
135
178
|
if (!canPaste(options)) return false;
|
|
136
|
-
|
|
179
|
+
const { view, file } = options;
|
|
180
|
+
return uploadImage({
|
|
181
|
+
uploader,
|
|
182
|
+
file,
|
|
183
|
+
onError
|
|
184
|
+
})(view.state, view.dispatch, view);
|
|
137
185
|
};
|
|
138
186
|
const handleDrop = (options) => {
|
|
139
187
|
if (!canDrop(options)) return false;
|
|
140
|
-
|
|
188
|
+
const { view, file, pos } = options;
|
|
189
|
+
return uploadImage({
|
|
190
|
+
uploader,
|
|
191
|
+
file,
|
|
192
|
+
onError,
|
|
193
|
+
pos
|
|
194
|
+
})(view.state, view.dispatch, view);
|
|
141
195
|
};
|
|
142
196
|
return union(defineFilePasteHandler(handlePaste), defineFileDropHandler(handleDrop));
|
|
143
197
|
}
|
|
144
|
-
function replaceImageURL(view, oldURL, newURL) {
|
|
145
|
-
const positions = [];
|
|
146
|
-
view.state.doc.descendants((node, pos) => {
|
|
147
|
-
if (node.type.name === "image") {
|
|
148
|
-
if (node.attrs.src === oldURL) positions.push(pos);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
if (positions.length > 0) {
|
|
152
|
-
const tr = view.state.tr;
|
|
153
|
-
for (const pos of positions) tr.setNodeAttribute(pos, "src", newURL);
|
|
154
|
-
view.dispatch(tr);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
198
|
|
|
158
199
|
//#endregion
|
|
159
|
-
export { defineImage, defineImageCommands, defineImageSpec, defineImageUploadHandler, insertImage };
|
|
200
|
+
export { defineImage, defineImageCommands, defineImageSpec, defineImageUploadHandler, insertImage, replaceImageURL, uploadImage };
|
|
160
201
|
//# sourceMappingURL=prosekit-extensions-image.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-image.js","names":["width: number | null","height: number | null","defaultOnError: ImageUploadErrorHandler","attrs: ImageAttrs","handlePaste: FilePasteHandler","handleDrop: FileDropHandler","positions: number[]"],"sources":["../src/image/image-commands.ts","../src/image/image-spec.ts","../src/image/image.ts","../src/image/image-upload-handler.ts"],"sourcesContent":["import {\n defineCommands,\n insertNode,\n type Extension,\n} from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\n\nimport type { ImageAttrs } from './image-spec'\n\n/**\n * @internal\n */\nexport type ImageCommandsExtension = Extension<{\n Commands: {\n insertImage: [attrs?: ImageAttrs]\n }\n}>\n\n/**\n * Returns a command that inserts an image node with the given attributes at the\n * current selection position.\n *\n * @public\n */\nexport function insertImage(attrs?: ImageAttrs): Command {\n return insertNode({ type: 'image', attrs })\n}\n\n/**\n * @internal\n */\nexport function defineImageCommands(): ImageCommandsExtension {\n return defineCommands({\n insertImage,\n })\n}\n","import {\n defineNodeSpec,\n type Extension,\n} from '@prosekit/core'\n\n/**\n * @public\n */\nexport interface ImageAttrs {\n src?: string | null\n width?: number | null\n height?: number | null\n}\n\n/**\n * @internal\n */\nexport type ImageSpecExtension = Extension<{\n Nodes: {\n image: ImageAttrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineImageSpec(): ImageSpecExtension {\n return defineNodeSpec({\n name: 'image',\n attrs: {\n src: { default: null, validate: 'string|null' },\n width: { default: null, validate: 'number|null' },\n height: { default: null, validate: 'number|null' },\n },\n group: 'block',\n defining: true,\n draggable: true,\n parseDOM: [\n {\n tag: 'img[src]',\n getAttrs: (element): ImageAttrs => {\n if (typeof element === 'string') {\n return { src: null }\n }\n\n const src = element.getAttribute('src') || null\n\n let width: number | null = null\n let height: number | null = null\n\n const rect = element.getBoundingClientRect()\n if (rect.width > 0 && rect.height > 0) {\n width = rect.width\n height = rect.height\n } else if (\n element instanceof HTMLImageElement\n && element.naturalWidth > 0\n && element.naturalHeight > 0\n ) {\n width = element.naturalWidth\n height = element.naturalHeight\n }\n return { src, width, height }\n },\n },\n ],\n toDOM(node) {\n const attrs = node.attrs as ImageAttrs\n return ['img', attrs]\n },\n })\n}\n","import {\n union,\n type Union,\n} from '@prosekit/core'\n\nimport {\n defineImageCommands,\n type ImageCommandsExtension,\n} from './image-commands'\nimport {\n defineImageSpec,\n type ImageSpecExtension,\n} from './image-spec'\n\n/**\n * @internal\n */\nexport type ImageExtension = Union<[ImageSpecExtension, ImageCommandsExtension]>\n\n/**\n * @public\n */\nexport function defineImage(): ImageExtension {\n return union(defineImageSpec(), defineImageCommands())\n}\n","import {\n insertNode,\n ProseKitError,\n union,\n type PlainExtension,\n} from '@prosekit/core'\nimport type { EditorView } from '@prosekit/pm/view'\n\nimport {\n defineFileDropHandler,\n defineFilePasteHandler,\n UploadTask,\n type FileDropHandler,\n type FileDropHandlerOptions,\n type FilePasteHandler,\n type FilePasteHandlerOptions,\n type Uploader,\n} from '../file'\n\nimport type { ImageAttrs } from './image-spec'\n\n/**\n * A predicate to determine if the pasted file should be uploaded and inserted as an image.\n */\nexport type ImageCanPastePredicate = (options: FilePasteHandlerOptions) => boolean\n\n/**\n * A predicate to determine if the dropped file should be uploaded and inserted as an image.\n */\nexport type ImageCanDropPredicate = (options: FileDropHandlerOptions) => boolean\n\n/**\n * A handler to be called when an error occurs during the upload.\n */\nexport type ImageUploadErrorHandler = (options: ImageUploadErrorHandlerOptions) => void\n\n/**\n * Options for the {@link ImageUploadErrorHandler} callback.\n */\nexport interface ImageUploadErrorHandlerOptions {\n /**\n * The file that was uploaded.\n */\n file: File\n /**\n * The error that occurred during the upload.\n */\n error: unknown\n /**\n * The upload task that was used to upload the file.\n */\n uploadTask: UploadTask<string>\n}\n\n/**\n * Options for {@link defineImageUploadHandler}.\n */\nexport interface ImageUploadHandlerOptions {\n /**\n * The uploader used to upload the file. It should return a promise that\n * resolves to the URL of the uploaded image.\n */\n uploader: Uploader<string>\n /**\n * A predicate to determine if the pasted file should be uploaded and inserted as an image.\n * If not provided, it defaults to only allowing paste of files with a content type starting with `image/`.\n */\n canPaste?: ImageCanPastePredicate\n /**\n * A predicate to determine if the dropped file should be uploaded and inserted as an image.\n * If not provided, it defaults to only allowing drop of files with a content type starting with `image/`.\n */\n canDrop?: ImageCanDropPredicate\n /**\n * A handler to be called when an error occurs during the upload.\n * If not provided, it defaults to logging the error to the console.\n */\n onError?: ImageUploadErrorHandler\n}\n\nfunction defaultCanUpload({ file }: { file: File }): boolean {\n // Only handle image files by default\n return file.type.startsWith('image/')\n}\n\nconst defaultOnError: ImageUploadErrorHandler = ({ error }) => {\n console.error('[prosekit] Failed to upload image:', error)\n}\n\n/**\n * Returns an extension that handles image file uploads when pasting or dropping\n * images into the editor.\n *\n * @param options\n */\nexport function defineImageUploadHandler({\n uploader,\n canPaste = defaultCanUpload,\n canDrop = defaultCanUpload,\n onError = defaultOnError,\n}: ImageUploadHandlerOptions): PlainExtension {\n const handleInsert = (view: EditorView, file: File, pos?: number): boolean => {\n const uploadTask = new UploadTask({ file, uploader })\n const objectURL = uploadTask.objectURL\n const attrs: ImageAttrs = { src: objectURL }\n uploadTask.finished.then((resultURL) => {\n if (view.isDestroyed) {\n return\n } else if (typeof resultURL !== 'string') {\n const error = new ProseKitError(`Unexpected upload result. Expected a string but got ${typeof resultURL}`)\n onError({ file, error, uploadTask })\n } else {\n replaceImageURL(view, objectURL, resultURL)\n UploadTask.delete(objectURL)\n }\n }).catch((error) => {\n onError({ file, error, uploadTask })\n })\n const command = insertNode({ type: 'image', attrs, pos })\n return command(view.state, view.dispatch, view)\n }\n\n const handlePaste: FilePasteHandler = (options) => {\n if (!canPaste(options)) return false\n return handleInsert(options.view, options.file)\n }\n\n const handleDrop: FileDropHandler = (options) => {\n if (!canDrop(options)) return false\n return handleInsert(options.view, options.file, options.pos)\n }\n\n return union(\n defineFilePasteHandler(handlePaste),\n defineFileDropHandler(handleDrop),\n )\n}\n\nfunction replaceImageURL(view: EditorView, oldURL: string, newURL: string) {\n const positions: number[] = []\n view.state.doc.descendants((node, pos) => {\n if (node.type.name === 'image') {\n const attrs = node.attrs as ImageAttrs\n if (attrs.src === oldURL) {\n positions.push(pos)\n }\n }\n })\n if (positions.length > 0) {\n const tr = view.state.tr\n for (const pos of positions) {\n tr.setNodeAttribute(pos, 'src', newURL)\n }\n view.dispatch(tr)\n }\n}\n"],"mappings":";;;;;;;;;;AAwBA,SAAgB,YAAY,OAA6B;AACvD,QAAO,WAAW;EAAE,MAAM;EAAS;EAAO,CAAC;;;;;AAM7C,SAAgB,sBAA8C;AAC5D,QAAO,eAAe,EACpB,aACD,CAAC;;;;;;;;ACRJ,SAAgB,kBAAsC;AACpD,QAAO,eAAe;EACpB,MAAM;EACN,OAAO;GACL,KAAK;IAAE,SAAS;IAAM,UAAU;IAAe;GAC/C,OAAO;IAAE,SAAS;IAAM,UAAU;IAAe;GACjD,QAAQ;IAAE,SAAS;IAAM,UAAU;IAAe;GACnD;EACD,OAAO;EACP,UAAU;EACV,WAAW;EACX,UAAU,CACR;GACE,KAAK;GACL,WAAW,YAAwB;AACjC,QAAI,OAAO,YAAY,SACrB,QAAO,EAAE,KAAK,MAAM;IAGtB,MAAM,MAAM,QAAQ,aAAa,MAAM,IAAI;IAE3C,IAAIA,QAAuB;IAC3B,IAAIC,SAAwB;IAE5B,MAAM,OAAO,QAAQ,uBAAuB;AAC5C,QAAI,KAAK,QAAQ,KAAK,KAAK,SAAS,GAAG;AACrC,aAAQ,KAAK;AACb,cAAS,KAAK;eAEd,mBAAmB,oBAChB,QAAQ,eAAe,KACvB,QAAQ,gBAAgB,GAC3B;AACA,aAAQ,QAAQ;AAChB,cAAS,QAAQ;;AAEnB,WAAO;KAAE;KAAK;KAAO;KAAQ;;GAEhC,CAC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AAsB,WAAW,CAClC;;AAGH,SAAS,gBAAgB,MAAkB,QAAgB,QAAgB;CACzE,MAAMC,YAAsB,EAAE;AAC9B,MAAK,MAAM,IAAI,aAAa,MAAM,QAAQ;AACxC,MAAI,KAAK,KAAK,SAAS,SAErB;OADc,KAAK,MACT,QAAQ,OAChB,WAAU,KAAK,IAAI;;GAGvB;AACF,KAAI,UAAU,SAAS,GAAG;EACxB,MAAM,KAAK,KAAK,MAAM;AACtB,OAAK,MAAM,OAAO,UAChB,IAAG,iBAAiB,KAAK,OAAO,OAAO;AAEzC,OAAK,SAAS,GAAG"}
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-image.js","names":["attrs: ImageAttrs","positions: number[]","width: number | null","height: number | null","defaultOnError: ImageUploadErrorHandler","handlePaste: FilePasteHandler","handleDrop: FileDropHandler"],"sources":["../src/image/image-commands/insert-image.ts","../src/image/image-commands/upload-image.ts","../src/image/image-commands.ts","../src/image/image-spec.ts","../src/image/image.ts","../src/image/image-upload-handler.ts"],"sourcesContent":["import { insertNode } from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\n\nimport type { ImageAttrs } from '../image-spec'\n\n/**\n * Returns a command that inserts an image node with the given attributes at the\n * current selection position.\n *\n * @public\n */\nexport function insertImage(attrs?: ImageAttrs): Command {\n return insertNode({ type: 'image', attrs })\n}\n","import {\n insertNode,\n ProseKitError,\n} from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\nimport type { EditorView } from '@prosekit/pm/view'\n\nimport {\n UploadTask,\n type Uploader,\n} from '../../file'\nimport type { ImageAttrs } from '../image-spec'\n\n/**\n * Options for {@link uploadImage}.\n *\n * @public\n */\nexport interface UploadImageOptions {\n /**\n * The uploader used to upload the file. It should return a promise that\n * resolves to the URL of the uploaded image.\n */\n uploader: Uploader<string>\n /**\n * The file that will be uploaded.\n */\n file: File\n /**\n * The position where the image should be inserted. If not provided, the\n * image is inserted at the current selection.\n */\n pos?: number\n /**\n * A handler to be called when an error occurs during the upload.\n */\n onError?: ImageUploadErrorHandler\n}\n\n/**\n * Options for the {@link ImageUploadErrorHandler} callback.\n *\n * @public\n */\nexport interface ImageUploadErrorHandlerOptions {\n /**\n * The file that was uploaded.\n */\n file: File\n /**\n * The error that occurred during the upload.\n */\n error: unknown\n /**\n * The upload task that was used to upload the file.\n */\n uploadTask: UploadTask<string>\n}\n\n/**\n * A handler to be called when an error occurs during the upload.\n *\n * @public\n */\nexport type ImageUploadErrorHandler = (options: ImageUploadErrorHandlerOptions) => void\n\n/**\n * Returns a command that uploads an image file and inserts an image node with a\n * temporary URL which is replaced once the upload completes.\n *\n * @param options\n *\n * @public\n */\nexport function uploadImage({ uploader, file, pos, onError }: UploadImageOptions): Command {\n return (state, dispatch, view) => {\n const uploadTask = new UploadTask({ file, uploader })\n const objectURL = uploadTask.objectURL\n const attrs: ImageAttrs = { src: objectURL }\n\n uploadTask.finished\n .then((resultURL) => {\n if (view && view.isDestroyed) {\n return\n } else if (typeof resultURL !== 'string') {\n const error = new ProseKitError(\n `Unexpected upload result. Expected a string but got ${typeof resultURL}`,\n )\n onError?.({ file, error, uploadTask })\n } else if (!view) {\n const error = new ProseKitError(\n 'View must be available to replace the image URL',\n )\n onError?.({ file, error, uploadTask })\n } else {\n replaceImageURL(view, objectURL, resultURL)\n UploadTask.delete(objectURL)\n }\n })\n .catch((error) => {\n onError?.({ file, error, uploadTask })\n })\n\n return insertNode({ type: 'image', attrs, pos })(state, dispatch, view)\n }\n}\n\n/**\n * Replaces the temporary image URL with the final uploaded URL.\n *\n * @internal\n */\nexport function replaceImageURL(\n view: EditorView,\n oldURL: string,\n newURL: string,\n): void {\n const positions: number[] = []\n view.state.doc.descendants((node, pos) => {\n if (node.type.name === 'image') {\n const attrs = node.attrs as ImageAttrs\n if (attrs.src === oldURL) {\n positions.push(pos)\n }\n }\n })\n\n if (positions.length === 0) {\n return\n }\n\n const tr = view.state.tr\n for (const pos of positions) {\n tr.setNodeAttribute(pos, 'src', newURL)\n }\n view.dispatch(tr)\n}\n","import {\n defineCommands,\n type Extension,\n} from '@prosekit/core'\n\nimport { insertImage } from './image-commands/insert-image'\nimport {\n uploadImage,\n type UploadImageOptions,\n} from './image-commands/upload-image'\nimport type { ImageAttrs } from './image-spec'\n\n/**\n * @internal\n */\nexport type ImageCommandsExtension = Extension<{\n Commands: {\n insertImage: [attrs?: ImageAttrs]\n uploadImage: [options: UploadImageOptions]\n }\n}>\n\n/**\n * @internal\n */\nexport function defineImageCommands(): ImageCommandsExtension {\n return defineCommands({\n insertImage,\n uploadImage,\n })\n}\n","import {\n defineNodeSpec,\n type Extension,\n} from '@prosekit/core'\n\n/**\n * @public\n */\nexport interface ImageAttrs {\n src?: string | null\n width?: number | null\n height?: number | null\n}\n\n/**\n * @internal\n */\nexport type ImageSpecExtension = Extension<{\n Nodes: {\n image: ImageAttrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineImageSpec(): ImageSpecExtension {\n return defineNodeSpec({\n name: 'image',\n attrs: {\n src: { default: null, validate: 'string|null' },\n width: { default: null, validate: 'number|null' },\n height: { default: null, validate: 'number|null' },\n },\n group: 'block',\n defining: true,\n draggable: true,\n parseDOM: [\n {\n tag: 'img[src]',\n getAttrs: (element): ImageAttrs => {\n if (typeof element === 'string') {\n return { src: null }\n }\n\n const src = element.getAttribute('src') || null\n\n let width: number | null = null\n let height: number | null = null\n\n const rect = element.getBoundingClientRect()\n if (rect.width > 0 && rect.height > 0) {\n width = rect.width\n height = rect.height\n } else if (\n element instanceof HTMLImageElement\n && element.naturalWidth > 0\n && element.naturalHeight > 0\n ) {\n width = element.naturalWidth\n height = element.naturalHeight\n }\n return { src, width, height }\n },\n },\n ],\n toDOM(node) {\n const attrs = node.attrs as ImageAttrs\n return ['img', attrs]\n },\n })\n}\n","import {\n union,\n type Union,\n} from '@prosekit/core'\n\nimport {\n defineImageCommands,\n type ImageCommandsExtension,\n} from './image-commands'\nimport {\n defineImageSpec,\n type ImageSpecExtension,\n} from './image-spec'\n\n/**\n * @internal\n */\nexport type ImageExtension = Union<[ImageSpecExtension, ImageCommandsExtension]>\n\n/**\n * @public\n */\nexport function defineImage(): ImageExtension {\n return union(defineImageSpec(), defineImageCommands())\n}\n","import {\n union,\n type PlainExtension,\n} from '@prosekit/core'\n\nimport {\n defineFileDropHandler,\n defineFilePasteHandler,\n type FileDropHandler,\n type FileDropHandlerOptions,\n type FilePasteHandler,\n type FilePasteHandlerOptions,\n type Uploader,\n} from '../file'\n\nimport {\n uploadImage,\n type ImageUploadErrorHandler,\n} from './image-commands/upload-image'\n\n/**\n * A predicate to determine if the pasted file should be uploaded and inserted as an image.\n */\nexport type ImageCanPastePredicate = (options: FilePasteHandlerOptions) => boolean\n\n/**\n * A predicate to determine if the dropped file should be uploaded and inserted as an image.\n */\nexport type ImageCanDropPredicate = (options: FileDropHandlerOptions) => boolean\n\n/**\n * A handler to be called when an error occurs during the upload.\n */\nexport interface ImageUploadHandlerOptions {\n /**\n * The uploader used to upload the file. It should return a promise that\n * resolves to the URL of the uploaded image.\n */\n uploader: Uploader<string>\n /**\n * A predicate to determine if the pasted file should be uploaded and inserted as an image.\n * If not provided, it defaults to only allowing paste of files with a content type starting with `image/`.\n */\n canPaste?: ImageCanPastePredicate\n /**\n * A predicate to determine if the dropped file should be uploaded and inserted as an image.\n * If not provided, it defaults to only allowing drop of files with a content type starting with `image/`.\n */\n canDrop?: ImageCanDropPredicate\n /**\n * A handler to be called when an error occurs during the upload.\n * If not provided, it defaults to logging the error to the console.\n */\n onError?: ImageUploadErrorHandler\n}\n\nfunction defaultCanUpload({ file }: { file: File }): boolean {\n // Only handle image files by default\n return file.type.startsWith('image/')\n}\n\nconst defaultOnError: ImageUploadErrorHandler = ({ error }) => {\n console.error('[prosekit] Failed to upload image:', error)\n}\n\n/**\n * Returns an extension that handles image file uploads when pasting or dropping\n * images into the editor.\n *\n * @param options\n */\nexport function defineImageUploadHandler({\n uploader,\n canPaste = defaultCanUpload,\n canDrop = defaultCanUpload,\n onError = defaultOnError,\n}: ImageUploadHandlerOptions): PlainExtension {\n const handlePaste: FilePasteHandler = (options) => {\n if (!canPaste(options)) return false\n const { view, file } = options\n const command = uploadImage({ uploader, file, onError })\n return command(view.state, view.dispatch, view)\n }\n\n const handleDrop: FileDropHandler = (options) => {\n if (!canDrop(options)) return false\n const { view, file, pos } = options\n const command = uploadImage({ uploader, file, onError, pos })\n return command(view.state, view.dispatch, view)\n }\n\n return union(\n defineFilePasteHandler(handlePaste),\n defineFileDropHandler(handleDrop),\n )\n}\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,YAAY,OAA6B;AACvD,QAAO,WAAW;EAAE,MAAM;EAAS;EAAO,CAAC;;;;;;;;;;;;;AC8D7C,SAAgB,YAAY,EAAE,UAAU,MAAM,KAAK,WAAwC;AACzF,SAAQ,OAAO,UAAU,SAAS;EAChC,MAAM,aAAa,IAAI,WAAW;GAAE;GAAM;GAAU,CAAC;EACrD,MAAM,YAAY,WAAW;EAC7B,MAAMA,QAAoB,EAAE,KAAK,WAAW;AAE5C,aAAW,SACR,MAAM,cAAc;AACnB,OAAI,QAAQ,KAAK,YACf;YACS,OAAO,cAAc,UAAU;IACxC,MAAM,QAAQ,IAAI,cAChB,uDAAuD,OAAO,YAC/D;AACD,cAAU;KAAE;KAAM;KAAO;KAAY,CAAC;cAC7B,CAAC,MAAM;IAChB,MAAM,QAAQ,IAAI,cAChB,kDACD;AACD,cAAU;KAAE;KAAM;KAAO;KAAY,CAAC;UACjC;AACL,oBAAgB,MAAM,WAAW,UAAU;AAC3C,eAAW,OAAO,UAAU;;IAE9B,CACD,OAAO,UAAU;AAChB,aAAU;IAAE;IAAM;IAAO;IAAY,CAAC;IACtC;AAEJ,SAAO,WAAW;GAAE,MAAM;GAAS;GAAO;GAAK,CAAC,CAAC,OAAO,UAAU,KAAK;;;;;;;;AAS3E,SAAgB,gBACd,MACA,QACA,QACM;CACN,MAAMC,YAAsB,EAAE;AAC9B,MAAK,MAAM,IAAI,aAAa,MAAM,QAAQ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AAS;;AAGvC,MAAMC,kBAA2C,EAAE,YAAY;AAC7D,SAAQ,MAAM,sCAAsC,MAAM;;;;;;;;AAS5D,SAAgB,yBAAyB,EACvC,UACA,WAAW,kBACX,UAAU,kBACV,UAAU,kBACkC;CAC5C,MAAMC,eAAiC,YAAY;AACjD,MAAI,CAAC,SAAS,QAAQ,CAAE,QAAO;EAC/B,MAAM,EAAE,MAAM,SAAS;AAEvB,SADgB,YAAY;GAAE;GAAU;GAAM;GAAS,CAAC,CACzC,KAAK,OAAO,KAAK,UAAU,KAAK;;CAGjD,MAAMC,cAA+B,YAAY;AAC/C,MAAI,CAAC,QAAQ,QAAQ,CAAE,QAAO;EAC9B,MAAM,EAAE,MAAM,MAAM,QAAQ;AAE5B,SADgB,YAAY;GAAE;GAAU;GAAM;GAAS;GAAK,CAAC,CAC9C,KAAK,OAAO,KAAK,UAAU,KAAK;;AAGjD,QAAO,MACL,uBAAuB,YAAY,EACnC,sBAAsB,WAAW,CAClC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { createMarkInputRule, defineInputRule, defineMarkInputRule, defineTextBlockInputRule, defineWrappingInputRule } from "./input-rule-
|
|
1
|
+
import { createMarkInputRule, defineInputRule, defineMarkInputRule, defineTextBlockInputRule, defineWrappingInputRule } from "./input-rule-DO_iy2aT.js";
|
|
2
2
|
|
|
3
3
|
export { createMarkInputRule, defineInputRule, defineMarkInputRule, defineTextBlockInputRule, defineWrappingInputRule };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineMarkInputRule } from "./input-rule-
|
|
1
|
+
import { defineMarkInputRule } from "./input-rule-DO_iy2aT.js";
|
|
2
2
|
import { canUseRegexLookbehind, defineCommands, defineKeymap, defineMarkSpec, toggleMark, union } from "@prosekit/core";
|
|
3
3
|
|
|
4
4
|
//#region src/italic/italic-commands.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineInputRule } from "./input-rule-
|
|
2
|
-
import { defineEnterRule } from "./enter-rule-
|
|
1
|
+
import { defineInputRule } from "./input-rule-DO_iy2aT.js";
|
|
2
|
+
import { defineEnterRule } from "./enter-rule-5tkoU2Ir.js";
|
|
3
3
|
import { defineMarkRule } from "./mark-rule-CGmswjQ_.js";
|
|
4
|
-
import { defineMarkPasteRule } from "./paste-rule-
|
|
4
|
+
import { defineMarkPasteRule } from "./paste-rule-Brej6cWi.js";
|
|
5
5
|
import { addMark, defineCommands, defineMarkSpec, expandMark, removeMark, toggleMark, union } from "@prosekit/core";
|
|
6
6
|
import { InputRule } from "@prosekit/pm/inputrules";
|
|
7
7
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineInputRule } from "./input-rule-
|
|
1
|
+
import { defineInputRule } from "./input-rule-DO_iy2aT.js";
|
|
2
2
|
import { defineDropIndicator } from "./drop-indicator-E7nCfdnR.js";
|
|
3
3
|
import { defineClipboardSerializer, defineCommands, defineKeymap, defineNodeSpec, definePlugin, insertNode, union } from "@prosekit/core";
|
|
4
4
|
import { Plugin } from "@prosekit/pm/state";
|
|
@@ -117,8 +117,7 @@ function defineListSerializer() {
|
|
|
117
117
|
return defineClipboardSerializer({
|
|
118
118
|
serializeFragmentWrapper: (fn) => {
|
|
119
119
|
return (...args) => {
|
|
120
|
-
|
|
121
|
-
return joinListElements(dom);
|
|
120
|
+
return joinListElements(fn(...args));
|
|
122
121
|
};
|
|
123
122
|
},
|
|
124
123
|
serializeNodeWrapper: (fn) => {
|
|
@@ -158,9 +157,8 @@ function getMarkers(node) {
|
|
|
158
157
|
* @internal
|
|
159
158
|
*/
|
|
160
159
|
function defineListSpec() {
|
|
161
|
-
const spec = createListSpec();
|
|
162
160
|
return defineNodeSpec({
|
|
163
|
-
...
|
|
161
|
+
...createListSpec(),
|
|
164
162
|
toDOM: (node) => {
|
|
165
163
|
return listToDOM({
|
|
166
164
|
node,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-list.js","names":["onDrag: DragEventHandler"],"sources":["../src/list/list-commands.ts","../src/list/list-drop-indicator.ts","../src/list/list-input-rules.ts","../src/list/list-keymap.ts","../src/list/list-plugins.ts","../src/list/list-serializer.ts","../src/list/list-spec.ts","../src/list/list.ts"],"sourcesContent":["import {\n defineCommands,\n insertNode,\n type Extension,\n} from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\nimport {\n createDedentListCommand as dedentList,\n createIndentListCommand as indentList,\n createMoveListCommand as moveList,\n createSplitListCommand as splitList,\n createToggleCollapsedCommand as toggleCollapsed,\n createToggleListCommand as toggleList,\n createUnwrapListCommand as unwrapList,\n createWrapInListCommand as wrapInList,\n type DedentListOptions,\n type IndentListOptions,\n type ListAttributes,\n type ToggleCollapsedOptions,\n type UnwrapListOptions,\n} from 'prosemirror-flat-list'\n\nfunction insertList(attrs?: ListAttributes): Command {\n return insertNode({ type: 'list', attrs })\n}\n\n/**\n * @internal\n */\nexport type ListCommandsExtension = Extension<{\n Commands: {\n dedentList: [options?: DedentListOptions]\n indentList: [options?: IndentListOptions]\n moveList: [direction: 'up' | 'down']\n splitList: []\n toggleCollapsed: [options?: ToggleCollapsedOptions]\n unwrapList: [options?: UnwrapListOptions]\n toggleList: [attrs?: ListAttributes]\n wrapInList: [attrs?: ListAttributes]\n insertList: [attrs?: ListAttributes]\n }\n}>\n\n/**\n * Defines list commands.\n *\n * @internal\n */\nexport function defineListCommands(): ListCommandsExtension {\n return defineCommands({\n dedentList,\n indentList,\n moveList,\n splitList,\n toggleCollapsed,\n unwrapList,\n toggleList,\n wrapInList,\n insertList,\n })\n}\n","import type { PlainExtension } from '@prosekit/core'\n\nimport type { DragEventHandler } from '../drop-indicator'\nimport { defineDropIndicator } from '../drop-indicator'\n\n/**\n * Configures drop indicator to avoid unexpected drop point.\n *\n * We don't want to drag a list node and drop it as the first\n * child of another list node.\n *\n * @internal\n */\nexport function defineListDropIndicator(): PlainExtension {\n return defineDropIndicator({\n onDrag,\n })\n}\n\nconst onDrag: DragEventHandler = ({ view, pos }): boolean => {\n const slice = view.dragging?.slice\n if (\n slice\n && slice.openStart === 0\n && slice.openEnd === 0\n && slice.content.childCount === 1\n ) {\n const node = slice.content.child(0)\n if (node.type.name === 'list') {\n const $pos = view.state.doc.resolve(pos)\n if ($pos.parent.type.name === 'list' && $pos.index() === 0) {\n return false\n }\n }\n }\n return true\n}\n","import {\n union,\n type Extension,\n} from '@prosekit/core'\nimport { listInputRules } from 'prosemirror-flat-list'\n\nimport { defineInputRule } from '../input-rule'\n\n/**\n * @internal\n */\nexport function defineListInputRules(): Extension {\n return union(listInputRules.map(defineInputRule))\n}\n","import {\n defineKeymap,\n type PlainExtension,\n} from '@prosekit/core'\nimport {\n chainCommands,\n deleteSelection,\n} from '@prosekit/pm/commands'\nimport {\n createDedentListCommand,\n createIndentListCommand,\n deleteCommand,\n enterCommand,\n joinCollapsedListBackward,\n joinListUp,\n protectCollapsed,\n} from 'prosemirror-flat-list'\n\n// This is different from the one exported by prosemirror-flat-list, because\n// some commands are moved to `defineBaseKeymap` in `prosekit/core`.\nconst backspaceCommand = chainCommands(\n protectCollapsed,\n deleteSelection,\n joinListUp,\n joinCollapsedListBackward,\n)\n\nconst dedentListCommand = createDedentListCommand()\nconst indentListCommand = createIndentListCommand()\n\nconst listKeymap = {\n 'Enter': enterCommand,\n 'Backspace': backspaceCommand,\n 'Delete': deleteCommand,\n 'Mod-]': indentListCommand,\n 'Mod-[': dedentListCommand,\n 'Tab': indentListCommand,\n 'Shift-Tab': dedentListCommand,\n}\n\n/**\n * Returns a extension that adds key bindings for list.\n *\n * @internal\n */\nexport function defineListKeymap(): PlainExtension {\n return defineKeymap(listKeymap)\n}\n","import {\n definePlugin,\n type PlainExtension,\n} from '@prosekit/core'\nimport { Plugin } from '@prosekit/pm/state'\nimport {\n createListEventPlugin,\n createListRenderingPlugin,\n createSafariInputMethodWorkaroundPlugin,\n unwrapListSlice,\n} from 'prosemirror-flat-list'\n\nfunction createListClipboardPlugin(): Plugin {\n return new Plugin({\n props: {\n transformCopied: unwrapListSlice,\n },\n })\n}\n\nfunction createListPlugins(): Plugin[] {\n return [\n createListEventPlugin(),\n createListRenderingPlugin(),\n createListClipboardPlugin(),\n createSafariInputMethodWorkaroundPlugin(),\n ]\n}\n\n/**\n * @internal\n */\nexport function defineListPlugins(): PlainExtension {\n return definePlugin(createListPlugins)\n}\n","import { isElementLike } from '@ocavue/utils'\nimport {\n defineClipboardSerializer,\n type PlainExtension,\n} from '@prosekit/core'\nimport {\n joinListElements,\n listToDOM,\n} from 'prosemirror-flat-list'\n\n/**\n * @internal\n */\nexport function defineListSerializer(): PlainExtension {\n return defineClipboardSerializer({\n serializeFragmentWrapper: (fn) => {\n return (...args) => {\n const dom = fn(...args)\n return joinListElements(dom)\n }\n },\n serializeNodeWrapper: (fn) => {\n return (...args) => {\n const dom = fn(...args)\n return isElementLike(dom) ? joinListElements(dom) : dom\n }\n },\n nodesFromSchemaWrapper: (fn) => {\n return (...args) => {\n const nodes = fn(...args)\n return {\n ...nodes,\n list: (node) => listToDOM({ node, nativeList: true, getMarkers: () => null }),\n }\n }\n },\n })\n}\n","import {\n defineNodeSpec,\n type Extension,\n} from '@prosekit/core'\nimport type {\n DOMOutputSpec,\n ProseMirrorNode,\n} from '@prosekit/pm/model'\nimport {\n createListSpec,\n listToDOM,\n type ListAttributes,\n} from 'prosemirror-flat-list'\n\nimport type { ListAttrs } from './list-types'\n\n/**\n * @internal\n */\nexport type ListSpecExtension = Extension<{\n Nodes: {\n list: ListAttrs\n }\n}>\n\nfunction getMarkers(node: ProseMirrorNode): DOMOutputSpec[] {\n const attrs = node.attrs as ListAttributes\n switch (attrs.kind) {\n case 'task':\n // Use a `label` element here so that the area around the checkbox is also checkable.\n return [\n [\n 'label',\n [\n 'input',\n { type: 'checkbox', checked: attrs.checked ? '' : undefined },\n ],\n ],\n ]\n default:\n // Always return an empty array so that the marker element is rendered. This\n // is required to make the drop indicator locate the correct position.\n return []\n }\n}\n\n/**\n * @internal\n */\nexport function defineListSpec(): ListSpecExtension {\n const spec = createListSpec()\n\n return defineNodeSpec<'list', ListAttrs>({\n ...spec,\n toDOM: (node) => {\n return listToDOM({ node, getMarkers })\n },\n name: 'list',\n })\n}\n","import {\n union,\n type Union,\n} from '@prosekit/core'\n\nimport {\n defineListCommands,\n type ListCommandsExtension,\n} from './list-commands'\nimport { defineListDropIndicator } from './list-drop-indicator'\nimport { defineListInputRules } from './list-input-rules'\nimport { defineListKeymap } from './list-keymap'\nimport { defineListPlugins } from './list-plugins'\nimport { defineListSerializer } from './list-serializer'\nimport {\n defineListSpec,\n type ListSpecExtension,\n} from './list-spec'\n\n/**\n * @internal\n */\nexport type ListExtension = Union<[ListSpecExtension, ListCommandsExtension]>\n\n/**\n * @public\n */\nexport function defineList(): ListExtension {\n return union(\n defineListSpec(),\n defineListPlugins(),\n defineListKeymap(),\n defineListInputRules(),\n defineListCommands(),\n defineListSerializer(),\n defineListDropIndicator(),\n )\n}\n"],"mappings":";;;;;;;;;AAsBA,SAAS,WAAW,OAAiC;AACnD,QAAO,WAAW;EAAE,MAAM;EAAQ;EAAO,CAAC;;;;;;;AAyB5C,SAAgB,qBAA4C;AAC1D,QAAO,eAAe;EACpB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;;;;;;;;;;;;;AC9CJ,SAAgB,0BAA0C;AACxD,QAAO,oBAAoB,EACzB,QACD,CAAC;;AAGJ,MAAMA,UAA4B,EAAE,MAAM,UAAmB;CAC3D,MAAM,QAAQ,KAAK,UAAU;AAC7B,KACE,SACG,MAAM,cAAc,KACpB,MAAM,YAAY,KAClB,MAAM,QAAQ,eAAe,GAGhC;MADa,MAAM,QAAQ,MAAM,EAAE,CAC1B,KAAK,SAAS,QAAQ;GAC7B,MAAM,OAAO,KAAK,MAAM,IAAI,QAAQ,IAAI;AACxC,OAAI,KAAK,OAAO,KAAK,SAAS,UAAU,KAAK,OAAO,KAAK,EACvD,QAAO;;;AAIb,QAAO;;;;;;;;ACxBT,SAAgB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9D,CACF,CACF;EACH,QAGE,QAAO,EAAE;;;;;;AAOf,SAAgB,iBAAoC;CAClD,MAAM,OAAO,gBAAgB;AAE7B,QAAO,eAAkC;EACvC,GAAG;EACH,QAAQ,SAAS;AACf,UAAO,UAAU;IAAE;IAAM;IAAY,CAAC;;EAExC,MAAM;EACP,CAAC;;;;;;;;AC/BJ,SAAgB,aAA4B;AAC1C,QAAO,MACL,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,CAC1B"}
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-list.js","names":["onDrag: DragEventHandler"],"sources":["../src/list/list-commands.ts","../src/list/list-drop-indicator.ts","../src/list/list-input-rules.ts","../src/list/list-keymap.ts","../src/list/list-plugins.ts","../src/list/list-serializer.ts","../src/list/list-spec.ts","../src/list/list.ts"],"sourcesContent":["import {\n defineCommands,\n insertNode,\n type Extension,\n} from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\nimport {\n createDedentListCommand as dedentList,\n createIndentListCommand as indentList,\n createMoveListCommand as moveList,\n createSplitListCommand as splitList,\n createToggleCollapsedCommand as toggleCollapsed,\n createToggleListCommand as toggleList,\n createUnwrapListCommand as unwrapList,\n createWrapInListCommand as wrapInList,\n type DedentListOptions,\n type IndentListOptions,\n type ListAttributes,\n type ToggleCollapsedOptions,\n type UnwrapListOptions,\n} from 'prosemirror-flat-list'\n\nfunction insertList(attrs?: ListAttributes): Command {\n return insertNode({ type: 'list', attrs })\n}\n\n/**\n * @internal\n */\nexport type ListCommandsExtension = Extension<{\n Commands: {\n dedentList: [options?: DedentListOptions]\n indentList: [options?: IndentListOptions]\n moveList: [direction: 'up' | 'down']\n splitList: []\n toggleCollapsed: [options?: ToggleCollapsedOptions]\n unwrapList: [options?: UnwrapListOptions]\n toggleList: [attrs?: ListAttributes]\n wrapInList: [attrs?: ListAttributes]\n insertList: [attrs?: ListAttributes]\n }\n}>\n\n/**\n * Defines list commands.\n *\n * @internal\n */\nexport function defineListCommands(): ListCommandsExtension {\n return defineCommands({\n dedentList,\n indentList,\n moveList,\n splitList,\n toggleCollapsed,\n unwrapList,\n toggleList,\n wrapInList,\n insertList,\n })\n}\n","import type { PlainExtension } from '@prosekit/core'\n\nimport type { DragEventHandler } from '../drop-indicator'\nimport { defineDropIndicator } from '../drop-indicator'\n\n/**\n * Configures drop indicator to avoid unexpected drop point.\n *\n * We don't want to drag a list node and drop it as the first\n * child of another list node.\n *\n * @internal\n */\nexport function defineListDropIndicator(): PlainExtension {\n return defineDropIndicator({\n onDrag,\n })\n}\n\nconst onDrag: DragEventHandler = ({ view, pos }): boolean => {\n const slice = view.dragging?.slice\n if (\n slice\n && slice.openStart === 0\n && slice.openEnd === 0\n && slice.content.childCount === 1\n ) {\n const node = slice.content.child(0)\n if (node.type.name === 'list') {\n const $pos = view.state.doc.resolve(pos)\n if ($pos.parent.type.name === 'list' && $pos.index() === 0) {\n return false\n }\n }\n }\n return true\n}\n","import {\n union,\n type Extension,\n} from '@prosekit/core'\nimport { listInputRules } from 'prosemirror-flat-list'\n\nimport { defineInputRule } from '../input-rule'\n\n/**\n * @internal\n */\nexport function defineListInputRules(): Extension {\n return union(listInputRules.map(defineInputRule))\n}\n","import {\n defineKeymap,\n type PlainExtension,\n} from '@prosekit/core'\nimport {\n chainCommands,\n deleteSelection,\n} from '@prosekit/pm/commands'\nimport {\n createDedentListCommand,\n createIndentListCommand,\n deleteCommand,\n enterCommand,\n joinCollapsedListBackward,\n joinListUp,\n protectCollapsed,\n} from 'prosemirror-flat-list'\n\n// This is different from the one exported by prosemirror-flat-list, because\n// some commands are moved to `defineBaseKeymap` in `prosekit/core`.\nconst backspaceCommand = chainCommands(\n protectCollapsed,\n deleteSelection,\n joinListUp,\n joinCollapsedListBackward,\n)\n\nconst dedentListCommand = createDedentListCommand()\nconst indentListCommand = createIndentListCommand()\n\nconst listKeymap = {\n 'Enter': enterCommand,\n 'Backspace': backspaceCommand,\n 'Delete': deleteCommand,\n 'Mod-]': indentListCommand,\n 'Mod-[': dedentListCommand,\n 'Tab': indentListCommand,\n 'Shift-Tab': dedentListCommand,\n}\n\n/**\n * Returns a extension that adds key bindings for list.\n *\n * @internal\n */\nexport function defineListKeymap(): PlainExtension {\n return defineKeymap(listKeymap)\n}\n","import {\n definePlugin,\n type PlainExtension,\n} from '@prosekit/core'\nimport { Plugin } from '@prosekit/pm/state'\nimport {\n createListEventPlugin,\n createListRenderingPlugin,\n createSafariInputMethodWorkaroundPlugin,\n unwrapListSlice,\n} from 'prosemirror-flat-list'\n\nfunction createListClipboardPlugin(): Plugin {\n return new Plugin({\n props: {\n transformCopied: unwrapListSlice,\n },\n })\n}\n\nfunction createListPlugins(): Plugin[] {\n return [\n createListEventPlugin(),\n createListRenderingPlugin(),\n createListClipboardPlugin(),\n createSafariInputMethodWorkaroundPlugin(),\n ]\n}\n\n/**\n * @internal\n */\nexport function defineListPlugins(): PlainExtension {\n return definePlugin(createListPlugins)\n}\n","import { isElementLike } from '@ocavue/utils'\nimport {\n defineClipboardSerializer,\n type PlainExtension,\n} from '@prosekit/core'\nimport {\n joinListElements,\n listToDOM,\n} from 'prosemirror-flat-list'\n\n/**\n * @internal\n */\nexport function defineListSerializer(): PlainExtension {\n return defineClipboardSerializer({\n serializeFragmentWrapper: (fn) => {\n return (...args) => {\n const dom = fn(...args)\n return joinListElements(dom)\n }\n },\n serializeNodeWrapper: (fn) => {\n return (...args) => {\n const dom = fn(...args)\n return isElementLike(dom) ? joinListElements(dom) : dom\n }\n },\n nodesFromSchemaWrapper: (fn) => {\n return (...args) => {\n const nodes = fn(...args)\n return {\n ...nodes,\n list: (node) => listToDOM({ node, nativeList: true, getMarkers: () => null }),\n }\n }\n },\n })\n}\n","import {\n defineNodeSpec,\n type Extension,\n} from '@prosekit/core'\nimport type {\n DOMOutputSpec,\n ProseMirrorNode,\n} from '@prosekit/pm/model'\nimport {\n createListSpec,\n listToDOM,\n type ListAttributes,\n} from 'prosemirror-flat-list'\n\nimport type { ListAttrs } from './list-types'\n\n/**\n * @internal\n */\nexport type ListSpecExtension = Extension<{\n Nodes: {\n list: ListAttrs\n }\n}>\n\nfunction getMarkers(node: ProseMirrorNode): DOMOutputSpec[] {\n const attrs = node.attrs as ListAttributes\n switch (attrs.kind) {\n case 'task':\n // Use a `label` element here so that the area around the checkbox is also checkable.\n return [\n [\n 'label',\n [\n 'input',\n { type: 'checkbox', checked: attrs.checked ? '' : undefined },\n ],\n ],\n ]\n default:\n // Always return an empty array so that the marker element is rendered. This\n // is required to make the drop indicator locate the correct position.\n return []\n }\n}\n\n/**\n * @internal\n */\nexport function defineListSpec(): ListSpecExtension {\n const spec = createListSpec()\n\n return defineNodeSpec<'list', ListAttrs>({\n ...spec,\n toDOM: (node) => {\n return listToDOM({ node, getMarkers })\n },\n name: 'list',\n })\n}\n","import {\n union,\n type Union,\n} from '@prosekit/core'\n\nimport {\n defineListCommands,\n type ListCommandsExtension,\n} from './list-commands'\nimport { defineListDropIndicator } from './list-drop-indicator'\nimport { defineListInputRules } from './list-input-rules'\nimport { defineListKeymap } from './list-keymap'\nimport { defineListPlugins } from './list-plugins'\nimport { defineListSerializer } from './list-serializer'\nimport {\n defineListSpec,\n type ListSpecExtension,\n} from './list-spec'\n\n/**\n * @internal\n */\nexport type ListExtension = Union<[ListSpecExtension, ListCommandsExtension]>\n\n/**\n * @public\n */\nexport function defineList(): ListExtension {\n return union(\n defineListSpec(),\n defineListPlugins(),\n defineListKeymap(),\n defineListInputRules(),\n defineListCommands(),\n defineListSerializer(),\n defineListDropIndicator(),\n )\n}\n"],"mappings":";;;;;;;;;AAsBA,SAAS,WAAW,OAAiC;AACnD,QAAO,WAAW;EAAE,MAAM;EAAQ;EAAO,CAAC;;;;;;;AAyB5C,SAAgB,qBAA4C;AAC1D,QAAO,eAAe;EACpB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;;;;;;;;;;;;;AC9CJ,SA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,IAAI,GAAG,iBAAiB,IAAI,GAAG;;;EAGxD,yBAAyB,OAAO;AAC9B,WAAQ,GAAG,SAAS;AAElB,WAAO;KACL,GAFY,GAAG,GAAG,KAAK;KAGvB,OAAO,SAAS,UAAU;MAAE;MAAM,YAAY;MAAM,kBAAkB;MAAM,CAAC;KAC9E;;;EAGN,CAAC;;;;;ACXJ,SAAS,WAAW,MAAwC;CAC1D,MAAM,QAAQ,KAAK;AACnB,SAAQ,MAAM,MAAd;EACE,KAAK,OAEH,QAAO,CACL,CACE,SACA,CACE,SACA;GAAE,MAAM;GAAY,SAAS,MAAM,UAAU,KAAK;GAAW,CAC9D,CACF,CACF;EACH,QAGE,QAAO,EAAE;;;;;;AAOf,SAAgB,iBAAoC;AAGlD,QAAO,eAAkC;EACvC,GAHW,gBAAgB;EAI3B,QAAQ,SAAS;AACf,UAAO,UAAU;IAAE;IAAM;IAAY,CAAC;;EAExC,MAAM;EACP,CAAC;;;;;;;;AC/BJ,SAAgB,aAA4B;AAC1C,QAAO,MACL,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,CAC1B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./drop-indicator-E7nCfdnR.js";
|
|
2
|
-
import { findTable } from "./table-
|
|
2
|
+
import { findTable } from "./table-DND_1127.js";
|
|
3
3
|
import { definePlugin, isInCodeBlock, maybeRun } from "@prosekit/core";
|
|
4
4
|
import { Plugin, PluginKey } from "@prosekit/pm/state";
|
|
5
5
|
import { Decoration, DecorationSet } from "@prosekit/pm/view";
|
|
@@ -17,8 +17,7 @@ function createPlaceholderPlugin({ placeholder, strategy = "block" }) {
|
|
|
17
17
|
key: new PluginKey("prosekit-placeholder"),
|
|
18
18
|
props: { decorations: (state) => {
|
|
19
19
|
if (!(typeof strategy === "function" ? strategy : strategy === "doc" ? docStrategy : defaultStrategy)(state)) return null;
|
|
20
|
-
const
|
|
21
|
-
const deco = createPlaceholderDecoration(state, placeholderText);
|
|
20
|
+
const deco = createPlaceholderDecoration(state, maybeRun(placeholder, state));
|
|
22
21
|
if (!deco) return null;
|
|
23
22
|
return DecorationSet.create(state.doc, [deco]);
|
|
24
23
|
} }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-placeholder.js","names":[
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-placeholder.js","names":[],"sources":["../src/placeholder/index.ts"],"sourcesContent":["import {\n definePlugin,\n isInCodeBlock,\n maybeRun,\n type PlainExtension,\n} from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\nimport {\n Plugin,\n PluginKey,\n type EditorState,\n} from '@prosekit/pm/state'\nimport {\n Decoration,\n DecorationSet,\n} from '@prosekit/pm/view'\n\nimport { findTable } from '../table'\n\nexport interface PlaceholderOptions {\n /**\n * The placeholder to use. It can be a static string or a function that\n * receives the current editor state and returns a string.\n */\n placeholder: string | ((state: EditorState) => string)\n\n /**\n * By default, the placeholder text will be shown whenever the current text\n * cursor is in an empty text node and it's not inside a code block or a\n * table node.\n *\n * If you only want to show the placeholder when the whole doc is empty, you\n * can set this option to 'doc'.\n *\n * You can also pass a function that receives the current editor state and\n * returns a boolean value to determine whether the placeholder should be\n * shown.\n *\n * @default 'block'\n */\n strategy?: 'doc' | 'block' | ((state: EditorState) => boolean)\n}\n\n/**\n * Add a placeholder text to the editor when the current block or document is\n * empty.\n */\nexport function definePlaceholder(options: PlaceholderOptions): PlainExtension {\n return definePlugin(createPlaceholderPlugin(options))\n}\n\nfunction createPlaceholderPlugin({\n placeholder,\n strategy = 'block',\n}: PlaceholderOptions): Plugin {\n return new Plugin({\n key: new PluginKey('prosekit-placeholder'),\n props: {\n decorations: (state) => {\n const strategyFn = typeof strategy === 'function'\n ? strategy\n : strategy === 'doc'\n ? docStrategy\n : defaultStrategy\n\n if (!strategyFn(state)) {\n return null\n }\n\n const placeholderText: string = maybeRun(placeholder, state)\n const deco = createPlaceholderDecoration(state, placeholderText)\n if (!deco) {\n return null\n }\n\n return DecorationSet.create(state.doc, [deco])\n },\n },\n })\n}\n\nfunction defaultStrategy(state: EditorState): boolean {\n return !isInCodeBlock(state.selection) && !findTable(state.selection.$from)\n}\n\nfunction docStrategy(state: EditorState): boolean {\n return isDocEmpty(state.doc) && defaultStrategy(state)\n}\n\nfunction isDocEmpty(doc: ProseMirrorNode) {\n return doc.childCount <= 1 && !doc.firstChild?.content.size\n}\n\nfunction createPlaceholderDecoration(\n state: EditorState,\n placeholderText: string,\n): Decoration | null {\n if (!placeholderText) return null\n\n const { selection } = state\n if (!selection.empty) return null\n\n const $pos = selection.$anchor\n const node = $pos.parent\n if (node.content.size > 0) return null\n\n const before = $pos.before()\n\n return Decoration.node(before, before + node.nodeSize, {\n 'class': 'prosekit-placeholder',\n 'data-placeholder': placeholderText,\n })\n}\n"],"mappings":";;;;;;;;;;;AA+CA,SAAgB,kBAAkB,SAA6C;AAC7E,QAAO,aAAa,wBAAwB,QAAQ,CAAC;;AAGvD,SAAS,wBAAwB,EAC/B,aACA,WAAW,WACkB;AAC7B,QAAO,IAAI,OAAO;EAChB,KAAK,IAAI,UAAU,uBAAuB;EAC1C,OAAO,EACL,cAAc,UAAU;AAOtB,OAAI,EANe,OAAO,aAAa,aACnC,WACA,aAAa,QACb,cACA,iBAEY,MAAM,CACpB,QAAO;GAIT,MAAM,OAAO,4BAA4B,OADT,SAAS,aAAa,MAAM,CACI;AAChE,OAAI,CAAC,KACH,QAAO;AAGT,UAAO,cAAc,OAAO,MAAM,KAAK,CAAC,KAAK,CAAC;KAEjD;EACF,CAAC;;AAGJ,SAAS,gBAAgB,OAA6B;AACpD,QAAO,CAAC,cAAc,MAAM,UAAU,IAAI,CAAC,UAAU,MAAM,UAAU,MAAM;;AAG7E,SAAS,YAAY,OAA6B;AAChD,QAAO,WAAW,MAAM,IAAI,IAAI,gBAAgB,MAAM;;AAGxD,SAAS,WAAW,KAAsB;AACxC,QAAO,IAAI,cAAc,KAAK,CAAC,IAAI,YAAY,QAAQ;;AAGzD,SAAS,4BACP,OACA,iBACmB;AACnB,KAAI,CAAC,gBAAiB,QAAO;CAE7B,MAAM,EAAE,cAAc;AACtB,KAAI,CAAC,UAAU,MAAO,QAAO;CAE7B,MAAM,OAAO,UAAU;CACvB,MAAM,OAAO,KAAK;AAClB,KAAI,KAAK,QAAQ,OAAO,EAAG,QAAO;CAElC,MAAM,SAAS,KAAK,QAAQ;AAE5B,QAAO,WAAW,KAAK,QAAQ,SAAS,KAAK,UAAU;EACrD,SAAS;EACT,oBAAoB;EACrB,CAAC"}
|
|
@@ -8,8 +8,7 @@ import { SearchQuery, findNext, findNextNoWrap, findPrev, findPrevNoWrap, replac
|
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
10
|
function defineSearchQuery(options) {
|
|
11
|
-
|
|
12
|
-
return definePlugin(search({ initialQuery: query }));
|
|
11
|
+
return definePlugin(search({ initialQuery: new SearchQuery(options) }));
|
|
13
12
|
}
|
|
14
13
|
/**
|
|
15
14
|
* Scrolls the active search match into view.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-extensions-search.js","names":[],"sources":["../src/search/index.ts"],"sourcesContent":["import {\n defineCommands,\n definePlugin,\n type Extension,\n type PlainExtension,\n} from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\nimport type { EditorView } from '@prosekit/pm/view'\nimport {\n findNext,\n findNextNoWrap,\n findPrev,\n findPrevNoWrap,\n replaceAll,\n replaceCurrent,\n replaceNext,\n replaceNextNoWrap,\n search,\n SearchQuery,\n} from 'prosemirror-search'\n\n/**\n * Options for {@link defineSearchQuery}\n *\n * @public\n */\nexport interface SearchQueryOptions {\n /**\n * The search string (or regular expression).\n */\n search: string\n\n /**\n * The replace text.\n */\n replace?: string\n\n /**\n * Indicates whether the search is case-sensitive\n *\n * @default false\n */\n caseSensitive?: boolean\n\n /**\n * By default, string search will replace `\\n`, `\\r`, and `\\t` in the query\n * with newline, return, and tab characters. When this is set to true, that\n * behavior is disabled.\n *\n * @default false\n */\n literal?: boolean\n\n /**\n * When true, the search string is interpreted as a regular expression.\n *\n * @default false\n */\n regexp?: boolean\n\n /**\n * Enable whole-word matching.\n *\n * @default false\n */\n wholeWord?: boolean\n}\n\n/**\n * Defines an extension that stores a current search query and replace string.\n *\n * @public\n */\nexport function defineSearchQuery(options: SearchQueryOptions): PlainExtension {\n const query = new SearchQuery(options)\n return definePlugin(search({ initialQuery: query }))\n}\n\n/**\n * Scrolls the active search match into view.\n */\nfunction scrollActiveIntoView(view: EditorView) {\n if (view.isDestroyed) return\n const active = view.dom.querySelector('.ProseMirror-active-search-match')\n active?.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n behavior: 'smooth',\n })\n}\n\n/**\n * Wraps a command and scrolls the active search match into view when the command\n * is applied.\n */\nfunction withScrollActiveIntoView(command: Command): Command {\n return (state, dispatch, view) => {\n const result = command(state, dispatch, view)\n if (result && dispatch && view) {\n // Add a small delay because the command itself will handle scrolling if\n // the view is focused.\n setTimeout(() => scrollActiveIntoView(view), 50)\n }\n return result\n }\n}\n\n/**\n * @internal\n */\nexport type SearchCommandsExtension = Extension<{\n Commands: {\n findNext: []\n findPrev: []\n findNextNoWrap: []\n findPrevNoWrap: []\n replaceNext: []\n replaceNextNoWrap: []\n replaceCurrent: []\n replaceAll: []\n }\n}>\n\n/**\n * Defines commands for search and replace.\n *\n * @public\n */\nexport function defineSearchCommands(): SearchCommandsExtension {\n return defineCommands({\n findNext: () => withScrollActiveIntoView(findNext),\n findPrev: () => withScrollActiveIntoView(findPrev),\n findNextNoWrap: () => withScrollActiveIntoView(findNextNoWrap),\n findPrevNoWrap: () => withScrollActiveIntoView(findPrevNoWrap),\n replaceNext: () => withScrollActiveIntoView(replaceNext),\n replaceNextNoWrap: () => withScrollActiveIntoView(replaceNextNoWrap),\n replaceCurrent: () => withScrollActiveIntoView(replaceCurrent),\n replaceAll: () => withScrollActiveIntoView(replaceAll),\n })\n}\n"],"mappings":";;;;;;;;;AAyEA,SAAgB,kBAAkB,SAA6C;
|
|
1
|
+
{"version":3,"file":"prosekit-extensions-search.js","names":[],"sources":["../src/search/index.ts"],"sourcesContent":["import {\n defineCommands,\n definePlugin,\n type Extension,\n type PlainExtension,\n} from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\nimport type { EditorView } from '@prosekit/pm/view'\nimport {\n findNext,\n findNextNoWrap,\n findPrev,\n findPrevNoWrap,\n replaceAll,\n replaceCurrent,\n replaceNext,\n replaceNextNoWrap,\n search,\n SearchQuery,\n} from 'prosemirror-search'\n\n/**\n * Options for {@link defineSearchQuery}\n *\n * @public\n */\nexport interface SearchQueryOptions {\n /**\n * The search string (or regular expression).\n */\n search: string\n\n /**\n * The replace text.\n */\n replace?: string\n\n /**\n * Indicates whether the search is case-sensitive\n *\n * @default false\n */\n caseSensitive?: boolean\n\n /**\n * By default, string search will replace `\\n`, `\\r`, and `\\t` in the query\n * with newline, return, and tab characters. When this is set to true, that\n * behavior is disabled.\n *\n * @default false\n */\n literal?: boolean\n\n /**\n * When true, the search string is interpreted as a regular expression.\n *\n * @default false\n */\n regexp?: boolean\n\n /**\n * Enable whole-word matching.\n *\n * @default false\n */\n wholeWord?: boolean\n}\n\n/**\n * Defines an extension that stores a current search query and replace string.\n *\n * @public\n */\nexport function defineSearchQuery(options: SearchQueryOptions): PlainExtension {\n const query = new SearchQuery(options)\n return definePlugin(search({ initialQuery: query }))\n}\n\n/**\n * Scrolls the active search match into view.\n */\nfunction scrollActiveIntoView(view: EditorView) {\n if (view.isDestroyed) return\n const active = view.dom.querySelector('.ProseMirror-active-search-match')\n active?.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n behavior: 'smooth',\n })\n}\n\n/**\n * Wraps a command and scrolls the active search match into view when the command\n * is applied.\n */\nfunction withScrollActiveIntoView(command: Command): Command {\n return (state, dispatch, view) => {\n const result = command(state, dispatch, view)\n if (result && dispatch && view) {\n // Add a small delay because the command itself will handle scrolling if\n // the view is focused.\n setTimeout(() => scrollActiveIntoView(view), 50)\n }\n return result\n }\n}\n\n/**\n * @internal\n */\nexport type SearchCommandsExtension = Extension<{\n Commands: {\n findNext: []\n findPrev: []\n findNextNoWrap: []\n findPrevNoWrap: []\n replaceNext: []\n replaceNextNoWrap: []\n replaceCurrent: []\n replaceAll: []\n }\n}>\n\n/**\n * Defines commands for search and replace.\n *\n * @public\n */\nexport function defineSearchCommands(): SearchCommandsExtension {\n return defineCommands({\n findNext: () => withScrollActiveIntoView(findNext),\n findPrev: () => withScrollActiveIntoView(findPrev),\n findNextNoWrap: () => withScrollActiveIntoView(findNextNoWrap),\n findPrevNoWrap: () => withScrollActiveIntoView(findPrevNoWrap),\n replaceNext: () => withScrollActiveIntoView(replaceNext),\n replaceNextNoWrap: () => withScrollActiveIntoView(replaceNextNoWrap),\n replaceCurrent: () => withScrollActiveIntoView(replaceCurrent),\n replaceAll: () => withScrollActiveIntoView(replaceAll),\n })\n}\n"],"mappings":";;;;;;;;;AAyEA,SAAgB,kBAAkB,SAA6C;AAE7E,QAAO,aAAa,OAAO,EAAE,cADf,IAAI,YAAY,QAAQ,EACY,CAAC,CAAC;;;;;AAMtD,SAAS,qBAAqB,MAAkB;AAC9C,KAAI,KAAK,YAAa;AAEtB,CADe,KAAK,IAAI,cAAc,mCAAmC,EACjE,eAAe;EACrB,OAAO;EACP,QAAQ;EACR,UAAU;EACX,CAAC;;;;;;AAOJ,SAAS,yBAAyB,SAA2B;AAC3D,SAAQ,OAAO,UAAU,SAAS;EAChC,MAAM,SAAS,QAAQ,OAAO,UAAU,KAAK;AAC7C,MAAI,UAAU,YAAY,KAGxB,kBAAiB,qBAAqB,KAAK,EAAE,GAAG;AAElD,SAAO;;;;;;;;AAyBX,SAAgB,uBAAgD;AAC9D,QAAO,eAAe;EACpB,gBAAgB,yBAAyB,SAAS;EAClD,gBAAgB,yBAAyB,SAAS;EAClD,sBAAsB,yBAAyB,eAAe;EAC9D,sBAAsB,yBAAyB,eAAe;EAC9D,mBAAmB,yBAAyB,YAAY;EACxD,yBAAyB,yBAAyB,kBAAkB;EACpE,sBAAsB,yBAAyB,eAAe;EAC9D,kBAAkB,yBAAyB,WAAW;EACvD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineMarkInputRule } from "./input-rule-
|
|
1
|
+
import { defineMarkInputRule } from "./input-rule-DO_iy2aT.js";
|
|
2
2
|
import { canUseRegexLookbehind, defineCommands, defineKeymap, defineMarkSpec, toggleMark, union } from "@prosekit/core";
|
|
3
3
|
|
|
4
4
|
//#region src/strike/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "./drop-indicator-E7nCfdnR.js";
|
|
2
|
-
import { defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow } from "./table-
|
|
2
|
+
import { defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow } from "./table-DND_1127.js";
|
|
3
3
|
|
|
4
4
|
export { defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
|