@prosekit/extensions 0.1.2 → 0.1.4
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.
@@ -290,6 +290,15 @@ NODES: "list";
|
|
290
290
|
*/
|
291
291
|
export declare function defineMention(): Extension< {
|
292
292
|
NODES: "mention";
|
293
|
+
COMMAND_ARGS: {
|
294
|
+
insertMention: [attrs: MentionAttrs];
|
295
|
+
};
|
296
|
+
}>;
|
297
|
+
|
298
|
+
export declare function defineMentionCommands(): Extension< {
|
299
|
+
COMMAND_ARGS: {
|
300
|
+
insertMention: [attrs: MentionAttrs];
|
301
|
+
};
|
293
302
|
}>;
|
294
303
|
|
295
304
|
/**
|
@@ -332,6 +341,9 @@ export declare function defineStrikeSpec(): Extension< {
|
|
332
341
|
MARKS: "strike";
|
333
342
|
}>;
|
334
343
|
|
344
|
+
/**
|
345
|
+
* @deprecated Use `defineAutocomplete` instead.
|
346
|
+
*/
|
335
347
|
export declare function defineSuggestion(options: SuggestionOptions): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
336
348
|
|
337
349
|
/**
|
@@ -413,8 +425,8 @@ export declare interface PlaceholderOptions {
|
|
413
425
|
placeholder: string;
|
414
426
|
/**
|
415
427
|
* By default, the placeholder text will be shown whenever the current text
|
416
|
-
* cursor is in an empty node. If you only want to show the placeholder
|
417
|
-
* the whole doc is empty, you can set this option to 'doc'.
|
428
|
+
* cursor is in an empty text node. If you only want to show the placeholder
|
429
|
+
* when the whole doc is empty, you can set this option to 'doc'.
|
418
430
|
*
|
419
431
|
* @default 'block'
|
420
432
|
*/
|
@@ -1,5 +1,10 @@
|
|
1
1
|
// src/mention/index.ts
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
defineCommands,
|
4
|
+
defineNodeSpec,
|
5
|
+
insertNode,
|
6
|
+
union
|
7
|
+
} from "@prosekit/core";
|
3
8
|
function defineMentionSpec() {
|
4
9
|
return defineNodeSpec({
|
5
10
|
name: "mention",
|
@@ -34,10 +39,18 @@ function defineMentionSpec() {
|
|
34
39
|
}
|
35
40
|
});
|
36
41
|
}
|
42
|
+
function defineMentionCommands() {
|
43
|
+
return defineCommands({
|
44
|
+
insertMention: (attrs) => {
|
45
|
+
return insertNode({ type: "mention", attrs });
|
46
|
+
}
|
47
|
+
});
|
48
|
+
}
|
37
49
|
function defineMention() {
|
38
|
-
return union([defineMentionSpec()]);
|
50
|
+
return union([defineMentionSpec(), defineMentionCommands()]);
|
39
51
|
}
|
40
52
|
export {
|
41
53
|
defineMention,
|
54
|
+
defineMentionCommands,
|
42
55
|
defineMentionSpec
|
43
56
|
};
|