@prosekit/extensions 0.11.1 → 0.11.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.
Files changed (48) hide show
  1. package/dist/{drop-indicator-QKkPzJIx.js → drop-indicator-B8P652g2.js} +13 -2
  2. package/dist/paste-rule-Cca3n5TA.js +173 -0
  3. package/dist/prosekit-extensions-autocomplete.d.ts +47 -47
  4. package/dist/prosekit-extensions-blockquote.d.ts +11 -11
  5. package/dist/prosekit-extensions-bold.d.ts +16 -16
  6. package/dist/prosekit-extensions-code-block.d.ts +82 -82
  7. package/dist/prosekit-extensions-code.d.ts +16 -16
  8. package/dist/prosekit-extensions-commit.d.ts +20 -20
  9. package/dist/prosekit-extensions-doc.d.ts +4 -4
  10. package/dist/prosekit-extensions-drop-cursor.d.ts +20 -20
  11. package/dist/prosekit-extensions-drop-indicator.d.ts +68 -68
  12. package/dist/prosekit-extensions-drop-indicator.js +1 -1
  13. package/dist/prosekit-extensions-enter-rule.d.ts +57 -57
  14. package/dist/prosekit-extensions-file.d.ts +54 -54
  15. package/dist/prosekit-extensions-gap-cursor.d.ts +15 -15
  16. package/dist/prosekit-extensions-hard-break.d.ts +16 -16
  17. package/dist/prosekit-extensions-heading.d.ts +19 -19
  18. package/dist/prosekit-extensions-horizontal-rule.d.ts +6 -6
  19. package/dist/prosekit-extensions-image.d.ts +14 -14
  20. package/dist/prosekit-extensions-input-rule.d.ts +70 -70
  21. package/dist/prosekit-extensions-italic.d.ts +16 -16
  22. package/dist/prosekit-extensions-link.d.ts +34 -26
  23. package/dist/prosekit-extensions-link.js +19 -2
  24. package/dist/prosekit-extensions-list.d.ts +38 -38
  25. package/dist/prosekit-extensions-list.js +1 -1
  26. package/dist/prosekit-extensions-loro.d.ts +19 -19
  27. package/dist/prosekit-extensions-mark-rule.d.ts +17 -17
  28. package/dist/prosekit-extensions-mention.d.ts +10 -10
  29. package/dist/prosekit-extensions-mod-click-prevention.d.ts +7 -7
  30. package/dist/prosekit-extensions-paragraph.d.ts +23 -23
  31. package/dist/prosekit-extensions-paste-rule.d.ts +93 -0
  32. package/dist/prosekit-extensions-paste-rule.js +3 -0
  33. package/dist/prosekit-extensions-placeholder.d.ts +20 -20
  34. package/dist/prosekit-extensions-placeholder.js +1 -1
  35. package/dist/prosekit-extensions-readonly.d.ts +2 -2
  36. package/dist/prosekit-extensions-search.d.ts +36 -36
  37. package/dist/prosekit-extensions-strike.d.ts +16 -16
  38. package/dist/prosekit-extensions-table.d.ts +134 -134
  39. package/dist/prosekit-extensions-table.js +1 -1
  40. package/dist/prosekit-extensions-text-align.d.ts +29 -29
  41. package/dist/prosekit-extensions-text.d.ts +4 -4
  42. package/dist/prosekit-extensions-underline.d.ts +14 -14
  43. package/dist/prosekit-extensions-virtual-selection.d.ts +11 -11
  44. package/dist/prosekit-extensions-yjs.d.ts +27 -27
  45. package/dist/{shiki-highlighter-chunk-NV2F_Qjl.d.ts → shiki-highlighter-chunk-DSPM0T27.d.ts} +1 -1
  46. package/dist/shiki-highlighter-chunk.d.ts +1 -1
  47. package/package.json +16 -8
  48. /package/dist/{table-3rDWFyBH.js → table-C_qAMj5-.js} +0 -0
@@ -0,0 +1,93 @@
1
+ import { PlainExtension } from "@prosekit/core";
2
+ import { EditorView } from "@prosekit/pm/view";
3
+ import { Attrs, MarkType, ProseMirrorNode, Slice } from "@prosekit/pm/model";
4
+
5
+ //#region src/paste-rule/mark-paste-rule.d.ts
6
+
7
+ /**
8
+ * The options for {@link defineMarkPasteRule}.
9
+ *
10
+ * @public
11
+ */
12
+ interface MarkPasteRuleOptions {
13
+ /**
14
+ * The regular expression to match against. It must have a `g` flag to match
15
+ * all instances of the mark.
16
+ */
17
+ regex: RegExp;
18
+ /**
19
+ * The mark type to apply to the matched text.
20
+ */
21
+ type: string | MarkType;
22
+ /**
23
+ * A function used to compute attributes to set on the mark created by this
24
+ * rule. When it returns `false`, the rule won't match. When it returns `null`
25
+ * or `undefined`, that is interpreted as an empty/default set of attributes.
26
+ * @default null
27
+ */
28
+ getAttrs?: (match: RegExpExecArray) => Attrs | null | undefined | false;
29
+ /**
30
+ * Optional function to determine if a text node should be skipped.
31
+ * Default behavior: skip code nodes and nodes that already have the target mark.
32
+ */
33
+ shouldSkip?: (node: ProseMirrorNode) => boolean;
34
+ }
35
+ /**
36
+ * Defines a paste rule that applies marks based on regex patterns.
37
+ *
38
+ * @public
39
+ */
40
+ declare function defineMarkPasteRule(options: MarkPasteRuleOptions): PlainExtension;
41
+ //#endregion
42
+ //#region src/paste-rule/paste-rule.d.ts
43
+ /**
44
+ * @public
45
+ *
46
+ * Options for {@link PasteRuleHandler}.
47
+ */
48
+ interface PasteRuleHandlerOptions {
49
+ /**
50
+ * The slice to be pasted.
51
+ */
52
+ slice: Slice;
53
+ /**
54
+ * The editor view.
55
+ */
56
+ view: EditorView;
57
+ /**
58
+ * Whether the pasted content is treated as plain text. This is true when the
59
+ * `Shift` key is held when pasting.
60
+ */
61
+ plain: boolean;
62
+ }
63
+ /**
64
+ * @public
65
+ *
66
+ * Can be used to transform pasted or dragged-and-dropped content before it is
67
+ * applied to the document.
68
+ */
69
+ type PasteRuleHandler = (options: PasteRuleHandlerOptions) => Slice;
70
+ /**
71
+ * Options for {@link definePasteRule}.
72
+ *
73
+ * @public
74
+ */
75
+ interface PasteRuleOptions {
76
+ /**
77
+ * A function to be called when a paste rule is triggered.
78
+ */
79
+ handler: PasteRuleHandler;
80
+ }
81
+ /**
82
+ * Defines a paste rule. This rule allows you to modify pasted or dragged
83
+ * content before it is inserted into the document.
84
+ *
85
+ * @param options
86
+ *
87
+ * @public
88
+ */
89
+ declare function definePasteRule({
90
+ handler
91
+ }: PasteRuleOptions): PlainExtension;
92
+ //#endregion
93
+ export { type MarkPasteRuleOptions, type PasteRuleHandler, type PasteRuleHandlerOptions, type PasteRuleOptions, defineMarkPasteRule, definePasteRule };
@@ -0,0 +1,3 @@
1
+ import { defineMarkPasteRule, definePasteRule } from "./paste-rule-Cca3n5TA.js";
2
+
3
+ export { defineMarkPasteRule, definePasteRule };
@@ -4,30 +4,30 @@ import { EditorState } from "@prosekit/pm/state";
4
4
  //#region src/placeholder/index.d.ts
5
5
  interface PlaceholderOptions {
6
6
  /**
7
- * The placeholder to use. It can be a static string or a function that
8
- * receives the current editor state and returns a string.
9
- */
7
+ * The placeholder to use. It can be a static string or a function that
8
+ * receives the current editor state and returns a string.
9
+ */
10
10
  placeholder: string | ((state: EditorState) => string);
11
11
  /**
12
- * By default, the placeholder text will be shown whenever the current text
13
- * cursor is in an empty text node and it's not inside a code block or a
14
- * table node.
15
- *
16
- * If you only want to show the placeholder when the whole doc is empty, you
17
- * can set this option to 'doc'.
18
- *
19
- * You can also pass a function that receives the current editor state and
20
- * returns a boolean value to determine whether the placeholder should be
21
- * shown.
22
- *
23
- * @default 'block'
24
- */
25
- strategy?: "doc" | "block" | ((state: EditorState) => boolean);
12
+ * By default, the placeholder text will be shown whenever the current text
13
+ * cursor is in an empty text node and it's not inside a code block or a
14
+ * table node.
15
+ *
16
+ * If you only want to show the placeholder when the whole doc is empty, you
17
+ * can set this option to 'doc'.
18
+ *
19
+ * You can also pass a function that receives the current editor state and
20
+ * returns a boolean value to determine whether the placeholder should be
21
+ * shown.
22
+ *
23
+ * @default 'block'
24
+ */
25
+ strategy?: 'doc' | 'block' | ((state: EditorState) => boolean);
26
26
  }
27
27
  /**
28
- * Add a placeholder text to the editor when the current block or document is
29
- * empty.
30
- */
28
+ * Add a placeholder text to the editor when the current block or document is
29
+ * empty.
30
+ */
31
31
  declare function definePlaceholder(options: PlaceholderOptions): PlainExtension;
32
32
  //#endregion
33
33
  export { PlaceholderOptions, definePlaceholder };
@@ -1,4 +1,4 @@
1
- import { findTable } from "./table-3rDWFyBH.js";
1
+ import { findTable } from "./table-C_qAMj5-.js";
2
2
  import { definePlugin, isInCodeBlock, maybeRun } from "@prosekit/core";
3
3
  import { Plugin, PluginKey } from "@prosekit/pm/state";
4
4
  import { Decoration, DecorationSet } from "@prosekit/pm/view";
@@ -3,8 +3,8 @@ import { PlainExtension } from "@prosekit/core";
3
3
  //#region src/readonly/index.d.ts
4
4
 
5
5
  /**
6
- * Make the editor read-only.
7
- */
6
+ * Make the editor read-only.
7
+ */
8
8
  declare function defineReadonly(): PlainExtension;
9
9
  //#endregion
10
10
  export { defineReadonly };
@@ -3,55 +3,55 @@ import { Extension, PlainExtension } from "@prosekit/core";
3
3
  //#region src/search/index.d.ts
4
4
 
5
5
  /**
6
- * Options for {@link defineSearchQuery}
7
- *
8
- * @public
9
- */
6
+ * Options for {@link defineSearchQuery}
7
+ *
8
+ * @public
9
+ */
10
10
  interface SearchQueryOptions {
11
11
  /**
12
- * The search string (or regular expression).
13
- */
12
+ * The search string (or regular expression).
13
+ */
14
14
  search: string;
15
15
  /**
16
- * The replace text.
17
- */
16
+ * The replace text.
17
+ */
18
18
  replace?: string;
19
19
  /**
20
- * Indicates whether the search is case-sensitive
21
- *
22
- * @default false
23
- */
20
+ * Indicates whether the search is case-sensitive
21
+ *
22
+ * @default false
23
+ */
24
24
  caseSensitive?: boolean;
25
25
  /**
26
- * By default, string search will replace `\n`, `\r`, and `\t` in the query
27
- * with newline, return, and tab characters. When this is set to true, that
28
- * behavior is disabled.
29
- *
30
- * @default false
31
- */
26
+ * By default, string search will replace `\n`, `\r`, and `\t` in the query
27
+ * with newline, return, and tab characters. When this is set to true, that
28
+ * behavior is disabled.
29
+ *
30
+ * @default false
31
+ */
32
32
  literal?: boolean;
33
33
  /**
34
- * When true, the search string is interpreted as a regular expression.
35
- *
36
- * @default false
37
- */
34
+ * When true, the search string is interpreted as a regular expression.
35
+ *
36
+ * @default false
37
+ */
38
38
  regexp?: boolean;
39
39
  /**
40
- * Enable whole-word matching.
41
- *
42
- * @default false
43
- */
40
+ * Enable whole-word matching.
41
+ *
42
+ * @default false
43
+ */
44
44
  wholeWord?: boolean;
45
45
  }
46
46
  /**
47
- * Defines an extension that stores a current search query and replace string.
48
- *
49
- * @public
50
- */
47
+ * Defines an extension that stores a current search query and replace string.
48
+ *
49
+ * @public
50
+ */
51
51
  declare function defineSearchQuery(options: SearchQueryOptions): PlainExtension;
52
52
  /**
53
- * @internal
54
- */
53
+ * @internal
54
+ */
55
55
  type SearchCommandsExtension = Extension<{
56
56
  Commands: {
57
57
  findNext: [];
@@ -65,10 +65,10 @@ type SearchCommandsExtension = Extension<{
65
65
  };
66
66
  }>;
67
67
  /**
68
- * Defines commands for search and replace.
69
- *
70
- * @public
71
- */
68
+ * Defines commands for search and replace.
69
+ *
70
+ * @public
71
+ */
72
72
  declare function defineSearchCommands(): SearchCommandsExtension;
73
73
  //#endregion
74
74
  export { SearchCommandsExtension, SearchQueryOptions, defineSearchCommands, defineSearchQuery };
@@ -4,44 +4,44 @@ import { Attrs } from "@prosekit/pm/model";
4
4
  //#region src/strike/index.d.ts
5
5
 
6
6
  /**
7
- * @internal
8
- */
7
+ * @internal
8
+ */
9
9
  type StrikeSpecExtension = Extension<{
10
10
  Marks: {
11
11
  strike: Attrs;
12
12
  };
13
13
  }>;
14
14
  /**
15
- * @internal
16
- */
15
+ * @internal
16
+ */
17
17
  declare function defineStrikeSpec(): StrikeSpecExtension;
18
18
  /**
19
- * @internal
20
- */
19
+ * @internal
20
+ */
21
21
  type StrikeCommandsExtension = Extension<{
22
22
  Commands: {
23
23
  toggleStrike: [];
24
24
  };
25
25
  }>;
26
26
  /**
27
- * @internal
28
- */
27
+ * @internal
28
+ */
29
29
  declare function defineStrikeCommands(): StrikeCommandsExtension;
30
30
  /**
31
- * @internal
32
- */
31
+ * @internal
32
+ */
33
33
  declare function defineStrikeKeymap(): PlainExtension;
34
34
  /**
35
- * @internal
36
- */
35
+ * @internal
36
+ */
37
37
  declare function defineStrikeInputRule(): PlainExtension;
38
38
  /**
39
- * @internal
40
- */
39
+ * @internal
40
+ */
41
41
  type StrikeExtension = Union<[StrikeSpecExtension, StrikeCommandsExtension]>;
42
42
  /**
43
- * @public
44
- */
43
+ * @public
44
+ */
45
45
  declare function defineStrike(): StrikeExtension;
46
46
  //#endregion
47
47
  export { StrikeCommandsExtension, StrikeExtension, StrikeSpecExtension, defineStrike, defineStrikeCommands, defineStrikeInputRule, defineStrikeKeymap, defineStrikeSpec };