@prosekit/extensions 0.1.2 → 0.1.3

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
  /**
@@ -413,8 +422,8 @@ export declare interface PlaceholderOptions {
413
422
  placeholder: string;
414
423
  /**
415
424
  * 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 when
417
- * the whole doc is empty, you can set this option to 'doc'.
425
+ * cursor is in an empty text node. If you only want to show the placeholder
426
+ * when the whole doc is empty, you can set this option to 'doc'.
418
427
  *
419
428
  * @default 'block'
420
429
  */
@@ -1,3 +1,4 @@
1
1
  export { defineMentionSpec } from './_tsup-dts-rollup';
2
+ export { defineMentionCommands } from './_tsup-dts-rollup';
2
3
  export { defineMention } from './_tsup-dts-rollup';
3
4
  export { MentionAttrs } from './_tsup-dts-rollup';
@@ -1,5 +1,10 @@
1
1
  // src/mention/index.ts
2
- import { defineNodeSpec, union } from "@prosekit/core";
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
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/extensions",
3
3
  "type": "module",
4
- "version": "0.1.2",
4
+ "version": "0.1.3",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",