@prosekit/extensions 0.7.22 → 0.7.24

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 (38) hide show
  1. package/dist/_tsup-dts-rollup.d.ts +38 -15
  2. package/dist/{chunk-4WHSS2ZE.js → chunk-6UYLCVBX.js} +2 -2
  3. package/dist/{chunk-LAQZC3ZM.js → chunk-BV3SHIMW.js} +1 -2
  4. package/dist/{chunk-RE23OQPF.js → chunk-D54VSLLS.js} +2 -2
  5. package/dist/{chunk-HHZL6V6B.js → chunk-HFAZX2J3.js} +27 -16
  6. package/dist/prosekit-extensions-autocomplete.js +13 -11
  7. package/dist/prosekit-extensions-blockquote.js +14 -6
  8. package/dist/prosekit-extensions-bold.js +15 -5
  9. package/dist/prosekit-extensions-code-block.js +22 -9
  10. package/dist/prosekit-extensions-code.js +15 -5
  11. package/dist/prosekit-extensions-commit.js +8 -5
  12. package/dist/prosekit-extensions-drop-cursor.d.ts +2 -2
  13. package/dist/prosekit-extensions-drop-cursor.js +3 -1
  14. package/dist/prosekit-extensions-enter-rule.js +1 -1
  15. package/dist/prosekit-extensions-file.d.ts +5 -5
  16. package/dist/prosekit-extensions-file.js +23 -25
  17. package/dist/prosekit-extensions-gap-cursor.js +3 -1
  18. package/dist/prosekit-extensions-heading.js +10 -7
  19. package/dist/prosekit-extensions-horizontal-rule.js +19 -6
  20. package/dist/prosekit-extensions-image.js +10 -3
  21. package/dist/prosekit-extensions-input-rule.js +1 -1
  22. package/dist/prosekit-extensions-italic.js +15 -5
  23. package/dist/prosekit-extensions-link.js +3 -3
  24. package/dist/prosekit-extensions-list.d.ts +1 -0
  25. package/dist/prosekit-extensions-list.js +83 -13
  26. package/dist/prosekit-extensions-loro.d.ts +4 -4
  27. package/dist/prosekit-extensions-loro.js +33 -13
  28. package/dist/prosekit-extensions-mark-rule.js +1 -1
  29. package/dist/prosekit-extensions-mod-click-prevention.js +8 -2
  30. package/dist/prosekit-extensions-placeholder.js +16 -7
  31. package/dist/prosekit-extensions-readonly.js +4 -1
  32. package/dist/prosekit-extensions-search.js +7 -4
  33. package/dist/prosekit-extensions-strike.js +3 -3
  34. package/dist/prosekit-extensions-table.d.ts +1 -1
  35. package/dist/prosekit-extensions-table.js +1 -1
  36. package/dist/prosekit-extensions-virtual-selection.js +8 -4
  37. package/dist/prosekit-extensions-yjs.js +14 -9
  38. package/package.json +16 -15
@@ -2,6 +2,8 @@ import { Attrs } from '@prosekit/pm/model';
2
2
  import { Attrs as Attrs_2 } from 'prosemirror-model';
3
3
  import type { Awareness } from 'y-protocols/awareness';
4
4
  import { BaseCommandsExtension } from '@prosekit/core';
5
+ import { BlockquoteExtension as BlockquoteExtension_2 } from '../blockquote';
6
+ import { BoldExtension as BoldExtension_2 } from '../bold';
5
7
  import type { BundledHighlighterOptions } from 'shiki';
6
8
  import { BundledLanguage } from 'shiki';
7
9
  import { BundledLanguageInfo } from 'shiki';
@@ -10,11 +12,11 @@ import { BundledTheme } from 'shiki';
10
12
  import { BundledThemeInfo } from 'shiki';
11
13
  import { bundledThemesInfo } from 'shiki';
12
14
  import { CellSelection } from 'prosemirror-tables';
15
+ import { CodeExtension as CodeExtension_2 } from '../code';
13
16
  import { Command } from '@prosekit/pm/state';
14
17
  import { CursorAwareness } from 'loro-prosemirror';
15
18
  import type { DecorationAttrs } from '@prosekit/pm/view';
16
19
  import { DedentListOptions } from 'prosemirror-flat-list';
17
- import { config as default_alias_1 } from '@prosekit/dev/config-vitest';
18
20
  import { DocExtension } from '@prosekit/core';
19
21
  import { EditorState } from '@prosekit/pm/state';
20
22
  import type { EditorView } from '@prosekit/pm/view';
@@ -24,13 +26,19 @@ import { ExtractMarkActions } from '@prosekit/core';
24
26
  import { ExtractNodeActions } from '@prosekit/core';
25
27
  import { FindParentNodeResult } from '@prosekit/core';
26
28
  import { GapCursor } from 'prosemirror-gapcursor';
29
+ import { HeadingExtension as HeadingExtension_2 } from '../heading';
27
30
  import type { Highlighter } from 'shiki';
28
31
  import { HistoryExtension } from '@prosekit/core';
32
+ import { HorizontalRuleExtension as HorizontalRuleExtension_2 } from '../horizontal-rule';
33
+ import { ImageExtension as ImageExtension_2 } from '../image';
29
34
  import { IndentListOptions } from 'prosemirror-flat-list';
30
35
  import { InputRule } from '@prosekit/pm/inputrules';
31
36
  import type { IsEqual } from 'type-fest';
37
+ import { ItalicExtension as ItalicExtension_2 } from '../italic';
38
+ import { LinkExtension as LinkExtension_2 } from '../link';
32
39
  import { ListAttributes } from 'prosemirror-flat-list';
33
40
  import { ListDOMSerializer } from 'prosemirror-flat-list';
41
+ import { ListExtension as ListExtension_2 } from '../list';
34
42
  import type { LoroDocType } from 'loro-prosemirror';
35
43
  import { LoroSyncPluginProps } from 'loro-prosemirror';
36
44
  import { LoroUndoPluginProps } from 'loro-prosemirror';
@@ -40,7 +48,6 @@ import { NodeAction } from '@prosekit/core';
40
48
  import { NodeChild } from '@prosekit/core';
41
49
  import { NodeJSON } from '@prosekit/core';
42
50
  import type { NodeType } from '@prosekit/pm/model';
43
- import { Options } from 'tsup';
44
51
  import { Parser } from 'prosemirror-highlight';
45
52
  import type { PeerID } from 'loro-crdt';
46
53
  import { PlainExtension } from '@prosekit/core';
@@ -52,11 +59,14 @@ import type { Selection as Selection_2 } from '@prosekit/pm/state';
52
59
  import { SimplifyDeeper } from '@prosekit/core';
53
60
  import type { SpecialLanguage } from 'shiki';
54
61
  import { StepJSON } from '@prosekit/core';
62
+ import { StrikeExtension as StrikeExtension_2 } from '../strike';
63
+ import { TableExtension as TableExtension_2 } from '../table';
55
64
  import { TestEditor } from '@prosekit/core/test';
56
65
  import { TextExtension } from '@prosekit/core';
57
66
  import { ToggleCollapsedOptions } from 'prosemirror-flat-list';
58
67
  import { ToMarkAction } from '@prosekit/core';
59
68
  import { Transaction } from '@prosekit/pm/state';
69
+ import { UnderlineExtension as UnderlineExtension_2 } from '../underline';
60
70
  import { Union } from '@prosekit/core';
61
71
  import { UnwrapListOptions } from 'prosemirror-flat-list';
62
72
  import { WrapInListGetAttrs } from 'prosemirror-flat-list';
@@ -343,10 +353,6 @@ export declare function createOrGetHighlighter_alias_1(options: HighlighterOptio
343
353
  export { DedentListOptions }
344
354
  export { DedentListOptions as DedentListOptions_alias_1 }
345
355
 
346
- export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
347
-
348
- export { default_alias_1 }
349
-
350
356
  export declare function defaultCanMatch({ state }: {
351
357
  state: EditorState;
352
358
  }): boolean;
@@ -800,6 +806,13 @@ export { defineListPlugins }
800
806
  export { defineListPlugins as defineListPlugins_alias_1 }
801
807
  export { defineListPlugins as defineListPlugins_alias_2 }
802
808
 
809
+ /**
810
+ * @internal
811
+ */
812
+ declare function defineListSerializer(): Extension<ExtensionTyping<any, any, any>>;
813
+ export { defineListSerializer }
814
+ export { defineListSerializer as defineListSerializer_alias_1 }
815
+
803
816
  /**
804
817
  * @internal
805
818
  */
@@ -1004,11 +1017,11 @@ export { defineTableSpec as defineTableSpec_alias_1 }
1004
1017
  /**
1005
1018
  * @internal
1006
1019
  */
1007
- export declare function defineTestExtension(): Union<readonly [DocExtension, TextExtension, HeadingExtension, HistoryExtension, ListExtension, BlockquoteExtension, PlainExtension, BaseCommandsExtension, ItalicExtension, BoldExtension, UnderlineExtension, StrikeExtension, CodeExtension, LinkExtension, ImageExtension, Extension<{
1020
+ export declare function defineTestExtension(): Union<readonly [DocExtension, TextExtension, HeadingExtension_2, HistoryExtension, ListExtension_2, BlockquoteExtension_2, PlainExtension, BaseCommandsExtension, ItalicExtension_2, BoldExtension_2, UnderlineExtension_2, StrikeExtension_2, CodeExtension_2, LinkExtension_2, ImageExtension_2, Extension<{
1008
1021
  Nodes: {
1009
1022
  paragraph: Attrs_2;
1010
1023
  };
1011
- }>, TableExtension, HorizontalRuleExtension]>;
1024
+ }>, TableExtension_2, HorizontalRuleExtension_2]>;
1012
1025
 
1013
1026
  /**
1014
1027
  * Adds a `textAlign` attribute to the specified nodes. This will be rendered as
@@ -1328,6 +1341,8 @@ declare function findTable($pos: ResolvedPos): FindParentNodeResult | undefined;
1328
1341
  export { findTable }
1329
1342
  export { findTable as findTable_alias_1 }
1330
1343
 
1344
+ export declare function formatHTML(html: string): Promise<string>;
1345
+
1331
1346
  export { GapCursor }
1332
1347
 
1333
1348
  /**
@@ -1832,6 +1847,10 @@ export declare interface PredictionPluginState {
1832
1847
  */
1833
1848
  export declare function pressKey(input: string): Promise<void>;
1834
1849
 
1850
+ export declare function readHtmlTextFromClipboard(format?: boolean): Promise<string>;
1851
+
1852
+ export declare function readPlainTextFromClipboard(): Promise<string>;
1853
+
1835
1854
  /**
1836
1855
  * @internal
1837
1856
  */
@@ -1983,11 +2002,11 @@ export declare function setTrMeta(tr: Transaction, meta: PredictionPluginState):
1983
2002
  * @internal
1984
2003
  */
1985
2004
  export declare function setupTest(): {
1986
- editor: TestEditor<Union<readonly [DocExtension, TextExtension, HeadingExtension, HistoryExtension, ListExtension, BlockquoteExtension, PlainExtension, BaseCommandsExtension, ItalicExtension, BoldExtension, UnderlineExtension, StrikeExtension, CodeExtension, LinkExtension, ImageExtension, Extension<{
2005
+ editor: TestEditor<Union<readonly [DocExtension, TextExtension, HeadingExtension_2, HistoryExtension, ListExtension_2, BlockquoteExtension_2, PlainExtension, BaseCommandsExtension, ItalicExtension_2, BoldExtension_2, UnderlineExtension_2, StrikeExtension_2, CodeExtension_2, LinkExtension_2, ImageExtension_2, Extension<{
1987
2006
  Nodes: {
1988
2007
  paragraph: Attrs_2;
1989
2008
  };
1990
- }>, TableExtension, HorizontalRuleExtension]>>;
2009
+ }>, TableExtension_2, HorizontalRuleExtension_2]>>;
1991
2010
  m: ToMarkAction<SimplifyDeeper< {
1992
2011
  bold: {
1993
2012
  readonly [x: string]: any;
@@ -2043,13 +2062,13 @@ export declare function setupTest(): {
2043
2062
  readonly [x: string]: any;
2044
2063
  }>;
2045
2064
  image: NodeAction< {
2046
- src?: (string | null) | undefined;
2047
- width?: (number | null) | undefined;
2048
- height?: (number | null) | undefined;
2065
+ src?: string | null | undefined;
2066
+ width?: number | null | undefined;
2067
+ height?: number | null | undefined;
2049
2068
  }>;
2050
2069
  list: NodeAction< {
2051
- kind?: ("bullet" | "ordered" | "task" | "toggle") | undefined;
2052
- order?: (number | null) | undefined;
2070
+ kind?: "bullet" | "ordered" | "task" | "toggle" | undefined;
2071
+ order?: number | null | undefined;
2053
2072
  checked?: boolean | undefined;
2054
2073
  collapsed?: boolean | undefined;
2055
2074
  }>;
@@ -2070,6 +2089,10 @@ export declare function setupTest(): {
2070
2089
  colwidth: number[] | null;
2071
2090
  }>;
2072
2091
  };
2092
+ copy: () => Promise<{
2093
+ html: string;
2094
+ plain: string;
2095
+ }>;
2073
2096
  };
2074
2097
 
2075
2098
  /**
@@ -11,9 +11,9 @@ import {
11
11
 
12
12
  // src/mark-rule/apply.ts
13
13
  import {
14
- OBJECT_REPLACEMENT_CHARACTER,
15
14
  getMarkType,
16
- maybeRun
15
+ maybeRun,
16
+ OBJECT_REPLACEMENT_CHARACTER
17
17
  } from "@prosekit/core";
18
18
 
19
19
  // src/mark-rule/range.ts
@@ -24,7 +24,6 @@ function createMarkInputRule({
24
24
  attrs = null
25
25
  }) {
26
26
  const rule = new InputRule(regex, (state, match, start, end) => {
27
- var _a;
28
27
  const { tr, schema } = state;
29
28
  const [fullText, markText] = match;
30
29
  if (!markText) {
@@ -40,7 +39,7 @@ function createMarkInputRule({
40
39
  if (!isMarkAbsent(tr.doc, markStart, markEnd, markType, attrs)) {
41
40
  return null;
42
41
  }
43
- const initialStoredMarks = (_a = tr.storedMarks) != null ? _a : [];
42
+ const initialStoredMarks = tr.storedMarks ?? [];
44
43
  tr.addMark(markStart, markEnd, mark);
45
44
  if (markEnd < end) {
46
45
  tr.delete(markEnd, end);
@@ -1,11 +1,11 @@
1
1
  // src/enter-rule/index.ts
2
2
  import {
3
- OBJECT_REPLACEMENT_CHARACTER,
4
3
  defineFacet,
5
4
  defineFacetPayload,
6
5
  getNodeType,
7
6
  isTextSelection,
8
7
  maybeRun,
8
+ OBJECT_REPLACEMENT_CHARACTER,
9
9
  pluginFacet
10
10
  } from "@prosekit/core";
11
11
  import { keydownHandler } from "@prosekit/pm/keymap";
@@ -90,7 +90,7 @@ function execRules(view, rules, dispatch) {
90
90
  match
91
91
  });
92
92
  if (!tr) continue;
93
- dispatch == null ? void 0 : dispatch(tr);
93
+ dispatch?.(tr);
94
94
  if (rule.stop) {
95
95
  return true;
96
96
  }
@@ -1,5 +1,7 @@
1
1
  // src/table/table.ts
2
- import { union } from "@prosekit/core";
2
+ import {
3
+ union
4
+ } from "@prosekit/core";
3
5
 
4
6
  // src/table/table-commands.ts
5
7
  import {
@@ -8,7 +10,9 @@ import {
8
10
  getNodeType,
9
11
  insertNode
10
12
  } from "@prosekit/core";
11
- import { TextSelection } from "@prosekit/pm/state";
13
+ import {
14
+ TextSelection
15
+ } from "@prosekit/pm/state";
12
16
  import {
13
17
  addColumnAfter,
14
18
  addColumnBefore,
@@ -25,7 +29,9 @@ import {
25
29
  } from "prosemirror-tables";
26
30
 
27
31
  // src/table/table-utils.ts
28
- import { findParentNode } from "@prosekit/core";
32
+ import {
33
+ findParentNode
34
+ } from "@prosekit/core";
29
35
  import {
30
36
  cellAround,
31
37
  cellNear,
@@ -39,12 +45,11 @@ function findTable($pos) {
39
45
  return findParentNode((node) => node.type.spec.tableRole === "table", $pos);
40
46
  }
41
47
  function findCellRange(selection, anchorHit, headHit) {
42
- var _a, _b;
43
48
  if (anchorHit == null && headHit == null && isCellSelection(selection)) {
44
49
  return [selection.$anchorCell, selection.$headCell];
45
50
  }
46
- const anchor = (_a = anchorHit != null ? anchorHit : headHit) != null ? _a : selection.anchor;
47
- const head = (_b = headHit != null ? headHit : anchorHit) != null ? _b : selection.head;
51
+ const anchor = anchorHit ?? headHit ?? selection.anchor;
52
+ const head = headHit ?? anchorHit ?? selection.head;
48
53
  const doc = selection.$head.doc;
49
54
  const $anchorCell = findCellPos(doc, anchor);
50
55
  const $headCell = findCellPos(doc, head);
@@ -110,7 +115,7 @@ var exitTable = (state, dispatch) => {
110
115
  const above = $head.node(tableDepth - 1);
111
116
  const after = $head.indexAfter(tableDepth - 1);
112
117
  const type = defaultBlockAt(above.contentMatchAt(after));
113
- const node = type == null ? void 0 : type.createAndFill();
118
+ const node = type?.createAndFill();
114
119
  if (!type || !node || !above.canReplaceWith(after, after, type)) {
115
120
  return false;
116
121
  }
@@ -124,7 +129,7 @@ var exitTable = (state, dispatch) => {
124
129
  };
125
130
  function selectTableColumn(options) {
126
131
  return (state, dispatch) => {
127
- const range = findCellRange(state.selection, options == null ? void 0 : options.anchor, options == null ? void 0 : options.head);
132
+ const range = findCellRange(state.selection, options?.anchor, options?.head);
128
133
  if (!range) {
129
134
  return false;
130
135
  }
@@ -138,7 +143,7 @@ function selectTableColumn(options) {
138
143
  }
139
144
  function selectTableRow(options) {
140
145
  return (state, dispatch) => {
141
- const range = findCellRange(state.selection, options == null ? void 0 : options.anchor, options == null ? void 0 : options.head);
146
+ const range = findCellRange(state.selection, options?.anchor, options?.head);
142
147
  if (!range) {
143
148
  return false;
144
149
  }
@@ -152,10 +157,9 @@ function selectTableRow(options) {
152
157
  }
153
158
  function selectTableCell(options) {
154
159
  return (state, dispatch) => {
155
- var _a;
156
160
  const $cellPos = findCellPos(
157
161
  state.doc,
158
- (_a = options == null ? void 0 : options.pos) != null ? _a : state.selection.anchor
162
+ options?.pos ?? state.selection.anchor
159
163
  );
160
164
  if (!$cellPos) {
161
165
  return false;
@@ -169,7 +173,7 @@ function selectTableCell(options) {
169
173
  }
170
174
  function selectTable(options) {
171
175
  return (state, dispatch) => {
172
- const $pos = (options == null ? void 0 : options.pos) ? state.doc.resolve(options.pos) : state.selection.$anchor;
176
+ const $pos = options?.pos ? state.doc.resolve(options.pos) : state.selection.$anchor;
173
177
  const table = findTable($pos);
174
178
  if (!table) {
175
179
  return false;
@@ -188,7 +192,7 @@ function selectTable(options) {
188
192
  const $lastCellPos = tr.doc.resolve(lastCellPos);
189
193
  const selection = new CellSelection2($firstCellPos, $lastCellPos);
190
194
  tr = tr.setSelection(selection);
191
- dispatch == null ? void 0 : dispatch(tr);
195
+ dispatch?.(tr);
192
196
  }
193
197
  return true;
194
198
  };
@@ -215,14 +219,21 @@ function defineTableCommands() {
215
219
  }
216
220
 
217
221
  // src/table/table-plugins.ts
218
- import { definePlugin } from "@prosekit/core";
219
- import { tableEditing, columnResizing } from "prosemirror-tables";
222
+ import {
223
+ definePlugin
224
+ } from "@prosekit/core";
225
+ import {
226
+ columnResizing,
227
+ tableEditing
228
+ } from "prosemirror-tables";
220
229
  function defineTablePlugins() {
221
230
  return definePlugin([tableEditing(), columnResizing()]);
222
231
  }
223
232
 
224
233
  // src/table/table-spec.ts
225
- import { defineNodeSpec } from "@prosekit/core";
234
+ import {
235
+ defineNodeSpec
236
+ } from "@prosekit/core";
226
237
  import { tableNodes } from "prosemirror-tables";
227
238
  var cellContent = "block+";
228
239
  var cellAttrs = {
@@ -7,8 +7,13 @@ import {
7
7
 
8
8
  // src/autocomplete/autocomplete-plugin.ts
9
9
  import { OBJECT_REPLACEMENT_CHARACTER } from "@prosekit/core";
10
- import { Plugin } from "@prosekit/pm/state";
11
- import { Decoration, DecorationSet } from "@prosekit/pm/view";
10
+ import {
11
+ Plugin
12
+ } from "@prosekit/pm/state";
13
+ import {
14
+ Decoration,
15
+ DecorationSet
16
+ } from "@prosekit/pm/view";
12
17
 
13
18
  // src/autocomplete/autocomplete-helpers.ts
14
19
  import {
@@ -49,7 +54,6 @@ function createAutocompletePlugin({
49
54
  return { active: false, ignore: null, matching: null };
50
55
  },
51
56
  apply: (tr, prevValue, oldState, newState) => {
52
- var _a;
53
57
  const meta = getTrMeta(tr);
54
58
  if (!tr.docChanged && oldState.selection.eq(newState.selection) && !meta) {
55
59
  return prevValue;
@@ -58,7 +62,7 @@ function createAutocompletePlugin({
58
62
  return meta;
59
63
  }
60
64
  const nextValue = calcPluginState(newState, getRules());
61
- if (nextValue.active && prevValue.ignore != null && ((_a = nextValue.matching) == null ? void 0 : _a.from) === prevValue.ignore) {
65
+ if (nextValue.active && prevValue.ignore != null && nextValue.matching?.from === prevValue.ignore) {
62
66
  return prevValue;
63
67
  }
64
68
  return nextValue;
@@ -66,13 +70,12 @@ function createAutocompletePlugin({
66
70
  },
67
71
  view: () => ({
68
72
  update: (view, prevState) => {
69
- var _a, _b, _c;
70
73
  const prevValue = getPluginState(prevState);
71
74
  const currValue = getPluginState(view.state);
72
- if ((prevValue == null ? void 0 : prevValue.active) && prevValue.matching && prevValue.matching.rule !== ((_a = currValue == null ? void 0 : currValue.matching) == null ? void 0 : _a.rule)) {
73
- (_c = (_b = prevValue.matching.rule).onLeave) == null ? void 0 : _c.call(_b);
75
+ if (prevValue?.active && prevValue.matching && prevValue.matching.rule !== currValue?.matching?.rule) {
76
+ prevValue.matching.rule.onLeave?.();
74
77
  }
75
- if ((currValue == null ? void 0 : currValue.active) && currValue.matching && currValue.matching.from !== currValue.ignore) {
78
+ if (currValue?.active && currValue.matching && currValue.matching.from !== currValue.ignore) {
76
79
  const { from, to, match, rule } = currValue.matching;
77
80
  const textContent = view.state.doc.textBetween(
78
81
  from,
@@ -113,7 +116,7 @@ function createAutocompletePlugin({
113
116
  props: {
114
117
  decorations: (state) => {
115
118
  const pluginState = getPluginState(state);
116
- if ((pluginState == null ? void 0 : pluginState.active) && pluginState.matching) {
119
+ if (pluginState?.active && pluginState.matching) {
117
120
  const { from, to } = pluginState.matching;
118
121
  const deco = Decoration.inline(from, to, {
119
122
  class: "prosemirror-prediction-match"
@@ -180,11 +183,10 @@ var autocompleteFacet = defineFacet({
180
183
  // src/autocomplete/autocomplete-rule.ts
181
184
  var AutocompleteRule = class {
182
185
  constructor(options) {
183
- var _a;
184
186
  this.regex = options.regex;
185
187
  this.onMatch = options.onEnter;
186
188
  this.onLeave = options.onLeave;
187
- this.canMatch = (_a = options.canMatch) != null ? _a : defaultCanMatch;
189
+ this.canMatch = options.canMatch ?? defaultCanMatch;
188
190
  }
189
191
  };
190
192
  export {
@@ -1,9 +1,11 @@
1
1
  import {
2
2
  defineWrappingInputRule
3
- } from "./chunk-LAQZC3ZM.js";
3
+ } from "./chunk-BV3SHIMW.js";
4
4
 
5
5
  // src/blockquote/blockquote.ts
6
- import { union } from "@prosekit/core";
6
+ import {
7
+ union
8
+ } from "@prosekit/core";
7
9
 
8
10
  // src/blockquote/blockquote-commands.ts
9
11
  import {
@@ -35,7 +37,11 @@ function defineBlockquoteInputRule() {
35
37
  }
36
38
 
37
39
  // src/blockquote/blockquote-keymap.ts
38
- import { defineKeymap, isAtBlockStart, toggleWrap as toggleWrap2 } from "@prosekit/core";
40
+ import {
41
+ defineKeymap,
42
+ isAtBlockStart,
43
+ toggleWrap as toggleWrap2
44
+ } from "@prosekit/core";
39
45
  import { joinBackward } from "@prosekit/pm/commands";
40
46
  function toggleBlockquoteKeybinding() {
41
47
  return toggleWrap2({ type: "blockquote" });
@@ -43,7 +49,7 @@ function toggleBlockquoteKeybinding() {
43
49
  function backspaceUnsetBlockquote() {
44
50
  return (state, dispatch, view) => {
45
51
  const $pos = isAtBlockStart(state, view);
46
- if (($pos == null ? void 0 : $pos.node(-1).type.name) === "blockquote") {
52
+ if ($pos?.node(-1).type.name === "blockquote") {
47
53
  return joinBackward(state, dispatch, view);
48
54
  }
49
55
  return false;
@@ -52,12 +58,14 @@ function backspaceUnsetBlockquote() {
52
58
  function defineBlockquoteKeymap() {
53
59
  return defineKeymap({
54
60
  "mod-shift-b": toggleBlockquoteKeybinding(),
55
- Backspace: backspaceUnsetBlockquote()
61
+ "Backspace": backspaceUnsetBlockquote()
56
62
  });
57
63
  }
58
64
 
59
65
  // src/blockquote/blockquote-spec.ts
60
- import { defineNodeSpec } from "@prosekit/core";
66
+ import {
67
+ defineNodeSpec
68
+ } from "@prosekit/core";
61
69
  function defineBlockquoteSpec() {
62
70
  return defineNodeSpec({
63
71
  name: "blockquote",
@@ -1,12 +1,17 @@
1
1
  import {
2
2
  defineMarkInputRule
3
- } from "./chunk-LAQZC3ZM.js";
3
+ } from "./chunk-BV3SHIMW.js";
4
4
 
5
5
  // src/bold/bold.ts
6
- import { union } from "@prosekit/core";
6
+ import {
7
+ union
8
+ } from "@prosekit/core";
7
9
 
8
10
  // src/bold/bold-commands.ts
9
- import { defineCommands, toggleMark } from "@prosekit/core";
11
+ import {
12
+ defineCommands,
13
+ toggleMark
14
+ } from "@prosekit/core";
10
15
  function defineBoldCommands() {
11
16
  return defineCommands({
12
17
  toggleBold: () => toggleMark({ type: "bold" })
@@ -23,7 +28,10 @@ function defineBoldInputRule() {
23
28
  }
24
29
 
25
30
  // src/bold/bold-keymap.ts
26
- import { defineKeymap, toggleMark as toggleMark2 } from "@prosekit/core";
31
+ import {
32
+ defineKeymap,
33
+ toggleMark as toggleMark2
34
+ } from "@prosekit/core";
27
35
  function defineBoldKeymap() {
28
36
  return defineKeymap({
29
37
  "Mod-b": toggleMark2({ type: "bold" })
@@ -31,7 +39,9 @@ function defineBoldKeymap() {
31
39
  }
32
40
 
33
41
  // src/bold/bold-spec.ts
34
- import { defineMarkSpec } from "@prosekit/core";
42
+ import {
43
+ defineMarkSpec
44
+ } from "@prosekit/core";
35
45
  function defineBoldSpec() {
36
46
  return defineMarkSpec({
37
47
  name: "bold",
@@ -1,12 +1,14 @@
1
1
  import {
2
2
  defineTextBlockEnterRule
3
- } from "./chunk-RE23OQPF.js";
3
+ } from "./chunk-D54VSLLS.js";
4
4
  import {
5
5
  defineTextBlockInputRule
6
- } from "./chunk-LAQZC3ZM.js";
6
+ } from "./chunk-BV3SHIMW.js";
7
7
 
8
8
  // src/code-block/code-block.ts
9
- import { union } from "@prosekit/core";
9
+ import {
10
+ union
11
+ } from "@prosekit/core";
10
12
 
11
13
  // src/code-block/code-block-commands.ts
12
14
  import {
@@ -53,8 +55,13 @@ function getAttrs(match) {
53
55
  }
54
56
 
55
57
  // src/code-block/code-block-keymap.ts
56
- import { defaultBlockAt, defineKeymap } from "@prosekit/core";
57
- import { TextSelection } from "@prosekit/pm/state";
58
+ import {
59
+ defaultBlockAt,
60
+ defineKeymap
61
+ } from "@prosekit/core";
62
+ import {
63
+ TextSelection
64
+ } from "@prosekit/pm/state";
58
65
  function defineCodeBlockKeymap() {
59
66
  return defineKeymap({
60
67
  Enter: existCodeBlock
@@ -90,7 +97,9 @@ var existCodeBlock = (state, dispatch) => {
90
97
  };
91
98
 
92
99
  // src/code-block/code-block-spec.ts
93
- import { defineNodeSpec } from "@prosekit/core";
100
+ import {
101
+ defineNodeSpec
102
+ } from "@prosekit/core";
94
103
  function defineCodeBlockSpec() {
95
104
  return defineNodeSpec({
96
105
  name: "codeBlock",
@@ -128,13 +137,17 @@ function defineCodeBlock() {
128
137
  }
129
138
 
130
139
  // src/code-block/code-block-highlight.ts
131
- import { definePlugin } from "@prosekit/core";
132
- import { createHighlightPlugin } from "prosemirror-highlight";
140
+ import {
141
+ definePlugin
142
+ } from "@prosekit/core";
143
+ import {
144
+ createHighlightPlugin
145
+ } from "prosemirror-highlight";
133
146
  function defineCodeBlockHighlight({
134
147
  parser
135
148
  }) {
136
149
  return definePlugin(
137
- createHighlightPlugin({ parser, nodeTypes: ["codeBlock"] })
150
+ createHighlightPlugin({ parser })
138
151
  );
139
152
  }
140
153
 
@@ -1,12 +1,17 @@
1
1
  import {
2
2
  defineMarkInputRule
3
- } from "./chunk-LAQZC3ZM.js";
3
+ } from "./chunk-BV3SHIMW.js";
4
4
 
5
5
  // src/code/code.ts
6
- import { union } from "@prosekit/core";
6
+ import {
7
+ union
8
+ } from "@prosekit/core";
7
9
 
8
10
  // src/code/code-commands.ts
9
- import { defineCommands, toggleMark } from "@prosekit/core";
11
+ import {
12
+ defineCommands,
13
+ toggleMark
14
+ } from "@prosekit/core";
10
15
  function defineCodeCommands() {
11
16
  return defineCommands({
12
17
  toggleCode: () => toggleMark({ type: "code" })
@@ -23,7 +28,10 @@ function defineCodeInputRule() {
23
28
  }
24
29
 
25
30
  // src/code/code-keymap.ts
26
- import { defineKeymap, toggleMark as toggleMark2 } from "@prosekit/core";
31
+ import {
32
+ defineKeymap,
33
+ toggleMark as toggleMark2
34
+ } from "@prosekit/core";
27
35
  function defineCodeKeymap() {
28
36
  return defineKeymap({
29
37
  "Mod-e": toggleMark2({ type: "code" })
@@ -31,7 +39,9 @@ function defineCodeKeymap() {
31
39
  }
32
40
 
33
41
  // src/code/code-spec.ts
34
- import { defineMarkSpec } from "@prosekit/core";
42
+ import {
43
+ defineMarkSpec
44
+ } from "@prosekit/core";
35
45
  function defineCodeSpec() {
36
46
  return defineMarkSpec({
37
47
  name: "code",
@@ -16,8 +16,13 @@ import {
16
16
  ProseMirrorPlugin
17
17
  } from "@prosekit/pm/state";
18
18
  import { Step } from "@prosekit/pm/transform";
19
- import { Decoration, DecorationSet } from "@prosekit/pm/view";
20
- import { ChangeSet } from "prosemirror-changeset";
19
+ import {
20
+ Decoration,
21
+ DecorationSet
22
+ } from "@prosekit/pm/view";
23
+ import {
24
+ ChangeSet
25
+ } from "prosemirror-changeset";
21
26
  function getChanges(doc, parent, steps) {
22
27
  const initSet = ChangeSet.create(parent);
23
28
  const currSet = initSet.addSteps(
@@ -108,9 +113,7 @@ function decorateChange(prev, change) {
108
113
  }
109
114
  function decorateCommit(doc, parent, steps) {
110
115
  const changes = getChanges(doc, parent, steps);
111
- const decorations = changes.flatMap(
112
- (change) => decorateChange(parent, change)
113
- );
116
+ const decorations = changes.flatMap((change) => decorateChange(parent, change));
114
117
  return DecorationSet.create(doc, decorations);
115
118
  }
116
119
  function defineCommitDecoration(commit) {
@@ -1,3 +1,3 @@
1
- export { DropCursorOptions_alias_1 as DropCursorOptions } from './_tsup-dts-rollup.js';
2
- export { DropCursorExtension_alias_1 as DropCursorExtension } from './_tsup-dts-rollup.js';
3
1
  export { defineDropCursor_alias_1 as defineDropCursor } from './_tsup-dts-rollup.js';
2
+ export { DropCursorExtension_alias_1 as DropCursorExtension } from './_tsup-dts-rollup.js';
3
+ export { DropCursorOptions_alias_1 as DropCursorOptions } from './_tsup-dts-rollup.js';
@@ -1,5 +1,7 @@
1
1
  // src/drop-cursor/drop-cursor.ts
2
- import { definePlugin } from "@prosekit/core";
2
+ import {
3
+ definePlugin
4
+ } from "@prosekit/core";
3
5
  import { dropCursor } from "prosemirror-dropcursor";
4
6
  function defineDropCursor(options) {
5
7
  return definePlugin(() => dropCursor(options));
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  defineEnterRule,
3
3
  defineTextBlockEnterRule
4
- } from "./chunk-RE23OQPF.js";
4
+ } from "./chunk-D54VSLLS.js";
5
5
  export {
6
6
  defineEnterRule,
7
7
  defineTextBlockEnterRule