@prosekit/extensions 0.8.0 → 0.9.1

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 (100) hide show
  1. package/dist/commit/style.css +1 -1
  2. package/dist/commit/style.js +0 -0
  3. package/dist/enter-rule-RdhEA900.js +96 -0
  4. package/dist/gap-cursor/style.css +6 -3
  5. package/dist/gap-cursor/style.js +0 -0
  6. package/dist/input-rule-Gji4N7Oe.js +93 -0
  7. package/dist/list/style.css +7 -7
  8. package/dist/list/style.js +0 -0
  9. package/dist/loro/style.css +13 -9
  10. package/dist/loro/style.js +0 -0
  11. package/dist/mark-rule-wEOcDt6i.js +160 -0
  12. package/dist/placeholder/style.css +3 -3
  13. package/dist/placeholder/style.js +0 -0
  14. package/dist/prosekit-extensions-autocomplete.d.ts +33 -3
  15. package/dist/prosekit-extensions-autocomplete.js +126 -174
  16. package/dist/prosekit-extensions-blockquote.d.ts +48 -8
  17. package/dist/prosekit-extensions-blockquote.js +64 -78
  18. package/dist/prosekit-extensions-bold.d.ts +54 -8
  19. package/dist/prosekit-extensions-bold.js +61 -73
  20. package/dist/prosekit-extensions-code-block.d.ts +159 -20
  21. package/dist/prosekit-extensions-code-block.js +201 -184
  22. package/dist/prosekit-extensions-code.d.ts +54 -8
  23. package/dist/prosekit-extensions-code.js +44 -56
  24. package/dist/prosekit-extensions-commit.d.ts +52 -4
  25. package/dist/prosekit-extensions-commit.js +140 -183
  26. package/dist/prosekit-extensions-doc.d.ts +19 -2
  27. package/dist/prosekit-extensions-doc.js +14 -12
  28. package/dist/prosekit-extensions-drop-cursor.d.ts +35 -3
  29. package/dist/prosekit-extensions-drop-cursor.js +14 -8
  30. package/dist/prosekit-extensions-enter-rule.d.ts +105 -5
  31. package/dist/prosekit-extensions-enter-rule.js +3 -8
  32. package/dist/prosekit-extensions-file.d.ts +129 -8
  33. package/dist/prosekit-extensions-file.js +124 -132
  34. package/dist/prosekit-extensions-gap-cursor.d.ts +26 -2
  35. package/dist/prosekit-extensions-gap-cursor.js +21 -9
  36. package/dist/prosekit-extensions-hard-break.d.ts +53 -0
  37. package/dist/prosekit-extensions-hard-break.js +58 -0
  38. package/dist/prosekit-extensions-heading.d.ts +63 -9
  39. package/dist/prosekit-extensions-heading.js +121 -95
  40. package/dist/prosekit-extensions-horizontal-rule.d.ts +38 -8
  41. package/dist/prosekit-extensions-horizontal-rule.js +53 -71
  42. package/dist/prosekit-extensions-image.d.ts +50 -7
  43. package/dist/prosekit-extensions-image.js +71 -62
  44. package/dist/prosekit-extensions-input-rule.d.ts +129 -6
  45. package/dist/prosekit-extensions-input-rule.js +3 -14
  46. package/dist/prosekit-extensions-italic.d.ts +54 -8
  47. package/dist/prosekit-extensions-italic.js +51 -63
  48. package/dist/prosekit-extensions-link.d.ts +62 -10
  49. package/dist/prosekit-extensions-link.js +95 -100
  50. package/dist/prosekit-extensions-list.d.ts +104 -17
  51. package/dist/prosekit-extensions-list.js +115 -158
  52. package/dist/prosekit-extensions-loro.d.ts +69 -11
  53. package/dist/prosekit-extensions-loro.js +49 -77
  54. package/dist/prosekit-extensions-mark-rule.d.ts +37 -2
  55. package/dist/prosekit-extensions-mark-rule.js +3 -6
  56. package/dist/prosekit-extensions-mention.d.ts +39 -4
  57. package/dist/prosekit-extensions-mention.js +52 -50
  58. package/dist/prosekit-extensions-mod-click-prevention.d.ts +17 -2
  59. package/dist/prosekit-extensions-mod-click-prevention.js +20 -16
  60. package/dist/prosekit-extensions-paragraph.d.ts +60 -7
  61. package/dist/prosekit-extensions-paragraph.js +46 -45
  62. package/dist/prosekit-extensions-placeholder.d.ts +33 -2
  63. package/dist/prosekit-extensions-placeholder.js +39 -56
  64. package/dist/prosekit-extensions-readonly.d.ts +10 -1
  65. package/dist/prosekit-extensions-readonly.js +13 -14
  66. package/dist/prosekit-extensions-search.d.ts +74 -3
  67. package/dist/prosekit-extensions-search.js +48 -47
  68. package/dist/prosekit-extensions-strike.d.ts +47 -8
  69. package/dist/prosekit-extensions-strike.js +44 -49
  70. package/dist/prosekit-extensions-table.d.ts +231 -26
  71. package/dist/prosekit-extensions-table.js +3 -34
  72. package/dist/prosekit-extensions-text-align.d.ts +71 -8
  73. package/dist/prosekit-extensions-text-align.js +63 -44
  74. package/dist/prosekit-extensions-text.d.ts +19 -2
  75. package/dist/prosekit-extensions-text.js +13 -11
  76. package/dist/prosekit-extensions-underline.d.ts +43 -7
  77. package/dist/prosekit-extensions-underline.js +33 -37
  78. package/dist/prosekit-extensions-virtual-selection.d.ts +21 -2
  79. package/dist/prosekit-extensions-virtual-selection.js +49 -52
  80. package/dist/prosekit-extensions-yjs.d.ts +90 -14
  81. package/dist/prosekit-extensions-yjs.js +88 -131
  82. package/dist/prosekit-extensions.d.ts +1 -1
  83. package/dist/search/style.css +4 -3
  84. package/dist/search/style.js +0 -0
  85. package/dist/shiki-highlighter-chunk-CZGvZlhf.d.ts +18 -0
  86. package/dist/shiki-highlighter-chunk.d.ts +2 -0
  87. package/dist/shiki-highlighter-chunk.js +32 -39
  88. package/dist/table/style.css +10 -13
  89. package/dist/table/style.js +0 -0
  90. package/dist/table-DnVliJ6E.js +287 -0
  91. package/dist/virtual-selection/style.css +2 -2
  92. package/dist/virtual-selection/style.js +0 -0
  93. package/dist/yjs/style.css +9 -8
  94. package/dist/yjs/style.js +0 -0
  95. package/package.json +81 -54
  96. package/dist/_tsup-dts-rollup.d.ts +0 -2459
  97. package/dist/chunk-6UYLCVBX.js +0 -185
  98. package/dist/chunk-D54VSLLS.js +0 -105
  99. package/dist/chunk-I2UMHK3L.js +0 -99
  100. package/dist/chunk-QVFEYPQ6.js +0 -306
@@ -1,195 +1,147 @@
1
- // src/autocomplete/autocomplete.ts
2
- import {
3
- defineFacet,
4
- defineFacetPayload,
5
- pluginFacet
6
- } from "@prosekit/core";
1
+ import { OBJECT_REPLACEMENT_CHARACTER, defineFacet, defineFacetPayload, pluginFacet } from "@prosekit/core";
2
+ import { Plugin, PluginKey } from "@prosekit/pm/state";
3
+ import { Decoration, DecorationSet } from "@prosekit/pm/view";
7
4
 
8
- // src/autocomplete/autocomplete-plugin.ts
9
- import { OBJECT_REPLACEMENT_CHARACTER } from "@prosekit/core";
10
- import {
11
- Plugin
12
- } from "@prosekit/pm/state";
13
- import {
14
- Decoration,
15
- DecorationSet
16
- } from "@prosekit/pm/view";
17
-
18
- // src/autocomplete/autocomplete-helpers.ts
19
- import {
20
- PluginKey
21
- } from "@prosekit/pm/state";
5
+ //#region src/autocomplete/autocomplete-helpers.ts
22
6
  function defaultCanMatch({ state }) {
23
- return state.selection.empty && !isInsideCode(state.selection.$from);
7
+ return state.selection.empty && !isInsideCode(state.selection.$from);
24
8
  }
25
9
  function isInsideCode($pos) {
26
- for (let d = $pos.depth; d > 0; d--) {
27
- if ($pos.node(d).type.spec.code) {
28
- return true;
29
- }
30
- }
31
- return $pos.marks().some((mark) => mark.type.name === "code");
10
+ for (let d = $pos.depth; d > 0; d--) if ($pos.node(d).type.spec.code) return true;
11
+ return $pos.marks().some((mark) => mark.type.name === "code");
32
12
  }
33
13
  function getPluginState(state) {
34
- return pluginKey.getState(state);
14
+ return pluginKey.getState(state);
35
15
  }
36
16
  function getTrMeta(tr) {
37
- return tr.getMeta(pluginKey);
17
+ return tr.getMeta(pluginKey);
38
18
  }
39
19
  function setTrMeta(tr, meta) {
40
- return tr.setMeta(pluginKey, meta);
20
+ return tr.setMeta(pluginKey, meta);
41
21
  }
42
- var pluginKey = new PluginKey(
43
- "prosekit-autocomplete"
44
- );
22
+ const pluginKey = new PluginKey("prosekit-autocomplete");
45
23
 
46
- // src/autocomplete/autocomplete-plugin.ts
47
- function createAutocompletePlugin({
48
- getRules
49
- }) {
50
- return new Plugin({
51
- key: pluginKey,
52
- state: {
53
- init: () => {
54
- return { active: false, ignore: null, matching: null };
55
- },
56
- apply: (tr, prevValue, oldState, newState) => {
57
- const meta = getTrMeta(tr);
58
- if (!tr.docChanged && oldState.selection.eq(newState.selection) && !meta) {
59
- return prevValue;
60
- }
61
- if (meta) {
62
- return meta;
63
- }
64
- const nextValue = calcPluginState(newState, getRules());
65
- if (nextValue.active && prevValue.ignore != null && nextValue.matching?.from === prevValue.ignore) {
66
- return prevValue;
67
- }
68
- return nextValue;
69
- }
70
- },
71
- view: () => ({
72
- update: (view, prevState) => {
73
- const prevValue = getPluginState(prevState);
74
- const currValue = getPluginState(view.state);
75
- if (prevValue?.active && prevValue.matching && prevValue.matching.rule !== currValue?.matching?.rule) {
76
- prevValue.matching.rule.onLeave?.();
77
- }
78
- if (currValue?.active && currValue.matching && currValue.matching.from !== currValue.ignore) {
79
- const { from, to, match, rule } = currValue.matching;
80
- const textContent = view.state.doc.textBetween(
81
- from,
82
- to,
83
- null,
84
- OBJECT_REPLACEMENT_CHARACTER
85
- );
86
- const deleteMatch = () => {
87
- if (view.state.doc.textBetween(
88
- from,
89
- to,
90
- null,
91
- OBJECT_REPLACEMENT_CHARACTER
92
- ) === textContent) {
93
- view.dispatch(view.state.tr.delete(from, to));
94
- }
95
- };
96
- const ignoreMatch = () => {
97
- view.dispatch(
98
- setTrMeta(view.state.tr, {
99
- active: false,
100
- ignore: from,
101
- matching: null
102
- })
103
- );
104
- };
105
- rule.onMatch({
106
- state: view.state,
107
- match,
108
- from,
109
- to,
110
- deleteMatch,
111
- ignoreMatch
112
- });
113
- }
114
- }
115
- }),
116
- props: {
117
- decorations: (state) => {
118
- const pluginState = getPluginState(state);
119
- if (pluginState?.active && pluginState.matching) {
120
- const { from, to } = pluginState.matching;
121
- const deco = Decoration.inline(from, to, {
122
- class: "prosemirror-prediction-match"
123
- });
124
- return DecorationSet.create(state.doc, [deco]);
125
- }
126
- return null;
127
- }
128
- }
129
- });
24
+ //#endregion
25
+ //#region src/autocomplete/autocomplete-plugin.ts
26
+ function createAutocompletePlugin({ getRules }) {
27
+ return new Plugin({
28
+ key: pluginKey,
29
+ state: {
30
+ init: () => {
31
+ return {
32
+ ignores: [],
33
+ matching: null
34
+ };
35
+ },
36
+ apply: (tr, prevValue, oldState, newState) => {
37
+ const meta = getTrMeta(tr);
38
+ if (!tr.docChanged && oldState.selection.eq(newState.selection) && !meta) return prevValue;
39
+ if (meta) {
40
+ let ignores = prevValue.ignores;
41
+ if (!ignores.includes(meta.ignore)) ignores = [...ignores, meta.ignore];
42
+ return {
43
+ matching: null,
44
+ ignores
45
+ };
46
+ }
47
+ const ignoreSet = new Set(prevValue.ignores.map((pos) => tr.mapping.map(pos)));
48
+ let matching = calcPluginStateMatching(newState, getRules());
49
+ if (matching && ignoreSet.has(matching.from)) matching = null;
50
+ return {
51
+ matching,
52
+ ignores: Array.from(ignoreSet)
53
+ };
54
+ }
55
+ },
56
+ view: () => ({ update: (view, prevState) => {
57
+ const prevValue = getPluginState(prevState);
58
+ const currValue = getPluginState(view.state);
59
+ if (prevValue?.matching && prevValue.matching.rule !== currValue?.matching?.rule) prevValue.matching.rule.onLeave?.();
60
+ if (currValue?.matching && !currValue.ignores.includes(currValue.matching.from)) {
61
+ const { from, to, match, rule } = currValue.matching;
62
+ const textContent = view.state.doc.textBetween(from, to, null, OBJECT_REPLACEMENT_CHARACTER);
63
+ const deleteMatch = () => {
64
+ if (view.state.doc.textBetween(from, to, null, OBJECT_REPLACEMENT_CHARACTER) === textContent) view.dispatch(view.state.tr.delete(from, to));
65
+ };
66
+ const ignoreMatch = () => {
67
+ view.dispatch(setTrMeta(view.state.tr, { ignore: from }));
68
+ };
69
+ rule.onMatch({
70
+ state: view.state,
71
+ match,
72
+ from,
73
+ to,
74
+ deleteMatch,
75
+ ignoreMatch
76
+ });
77
+ }
78
+ } }),
79
+ props: { decorations: (state) => {
80
+ const pluginState = getPluginState(state);
81
+ if (pluginState?.matching) {
82
+ const { from, to } = pluginState.matching;
83
+ const deco = Decoration.inline(from, to, { class: "prosemirror-prediction-match" });
84
+ return DecorationSet.create(state.doc, [deco]);
85
+ }
86
+ return null;
87
+ } }
88
+ });
130
89
  }
131
- var MAX_MATCH = 200;
132
- function calcPluginState(state, rules) {
133
- const $pos = state.selection.$from;
134
- const parentOffset = $pos.parentOffset;
135
- const textBefore = $pos.parent.textBetween(
136
- Math.max(0, parentOffset - MAX_MATCH),
137
- parentOffset,
138
- null,
139
- OBJECT_REPLACEMENT_CHARACTER
140
- );
141
- for (const rule of rules) {
142
- if (!rule.canMatch({ state })) {
143
- continue;
144
- }
145
- rule.regex.lastIndex = 0;
146
- const match = rule.regex.exec(textBefore);
147
- if (!match) {
148
- continue;
149
- }
150
- const from = $pos.pos - textBefore.length + match.index;
151
- return {
152
- active: true,
153
- ignore: null,
154
- matching: {
155
- rule,
156
- match,
157
- from,
158
- to: $pos.pos
159
- }
160
- };
161
- }
162
- return { active: false, ignore: null, matching: null };
90
+ const MAX_MATCH = 200;
91
+ function calcPluginStateMatching(state, rules) {
92
+ const $pos = state.selection.$from;
93
+ const parentOffset = $pos.parentOffset;
94
+ const textBefore = $pos.parent.textBetween(Math.max(0, parentOffset - MAX_MATCH), parentOffset, null, OBJECT_REPLACEMENT_CHARACTER);
95
+ for (const rule of rules) {
96
+ if (!rule.canMatch({ state })) continue;
97
+ rule.regex.lastIndex = 0;
98
+ const match = rule.regex.exec(textBefore);
99
+ if (!match) continue;
100
+ const to = $pos.pos;
101
+ const from = to - textBefore.length + match.index;
102
+ return {
103
+ rule,
104
+ match,
105
+ from,
106
+ to
107
+ };
108
+ }
109
+ return null;
163
110
  }
164
111
 
165
- // src/autocomplete/autocomplete.ts
112
+ //#endregion
113
+ //#region src/autocomplete/autocomplete.ts
166
114
  function defineAutocomplete(rule) {
167
- return defineFacetPayload(autocompleteFacet, [rule]);
115
+ return defineFacetPayload(autocompleteFacet, [rule]);
168
116
  }
169
- var autocompleteFacet = defineFacet({
170
- reduce: () => {
171
- let rules = [];
172
- const getRules = () => rules;
173
- const plugin = createAutocompletePlugin({ getRules });
174
- return function reducer(inputs) {
175
- rules = inputs;
176
- return plugin;
177
- };
178
- },
179
- parent: pluginFacet,
180
- singleton: true
117
+ const autocompleteFacet = defineFacet({
118
+ reduce: () => {
119
+ let rules = [];
120
+ const getRules = () => rules;
121
+ const plugin = createAutocompletePlugin({ getRules });
122
+ return function reducer(inputs) {
123
+ rules = inputs;
124
+ return plugin;
125
+ };
126
+ },
127
+ parent: pluginFacet,
128
+ singleton: true
181
129
  });
182
130
 
183
- // src/autocomplete/autocomplete-rule.ts
131
+ //#endregion
132
+ //#region src/autocomplete/autocomplete-rule.ts
184
133
  var AutocompleteRule = class {
185
- constructor(options) {
186
- this.regex = options.regex;
187
- this.onMatch = options.onEnter;
188
- this.onLeave = options.onLeave;
189
- this.canMatch = options.canMatch ?? defaultCanMatch;
190
- }
191
- };
192
- export {
193
- AutocompleteRule,
194
- defineAutocomplete
134
+ regex;
135
+ onMatch;
136
+ onLeave;
137
+ canMatch;
138
+ constructor(options) {
139
+ this.regex = options.regex;
140
+ this.onMatch = options.onEnter;
141
+ this.onLeave = options.onLeave;
142
+ this.canMatch = options.canMatch ?? defaultCanMatch;
143
+ }
195
144
  };
145
+
146
+ //#endregion
147
+ export { AutocompleteRule, defineAutocomplete };
@@ -1,8 +1,48 @@
1
- export { defineBlockquote_alias_1 as defineBlockquote } from './_tsup-dts-rollup.js';
2
- export { BlockquoteExtension_alias_1 as BlockquoteExtension } from './_tsup-dts-rollup.js';
3
- export { defineBlockquoteCommands_alias_1 as defineBlockquoteCommands } from './_tsup-dts-rollup.js';
4
- export { BlockquoteCommandsExtension_alias_1 as BlockquoteCommandsExtension } from './_tsup-dts-rollup.js';
5
- export { defineBlockquoteInputRule_alias_1 as defineBlockquoteInputRule } from './_tsup-dts-rollup.js';
6
- export { defineBlockquoteKeymap_alias_1 as defineBlockquoteKeymap } from './_tsup-dts-rollup.js';
7
- export { defineBlockquoteSpec_alias_1 as defineBlockquoteSpec } from './_tsup-dts-rollup.js';
8
- export { BlockquoteSpecExtension_alias_1 as BlockquoteSpecExtension } from './_tsup-dts-rollup.js';
1
+ import { Extension, PlainExtension, Union } from "@prosekit/core";
2
+ import { Attrs } from "@prosekit/pm/model";
3
+
4
+ //#region src/blockquote/blockquote-commands.d.ts
5
+ type BlockquoteCommandsExtension = Extension<{
6
+ Commands: {
7
+ setBlockquote: [];
8
+ insertBlockquote: [];
9
+ toggleBlockquote: [];
10
+ };
11
+ }>;
12
+ /**
13
+ * @internal
14
+ */
15
+ declare function defineBlockquoteCommands(): BlockquoteCommandsExtension;
16
+ //#endregion
17
+ //#region src/blockquote/blockquote-spec.d.ts
18
+ type BlockquoteSpecExtension = Extension<{
19
+ Nodes: {
20
+ blockquote: Attrs;
21
+ };
22
+ }>;
23
+ declare function defineBlockquoteSpec(): BlockquoteSpecExtension;
24
+ //#endregion
25
+ //#region src/blockquote/blockquote.d.ts
26
+ /**
27
+ * @internal
28
+ */
29
+ type BlockquoteExtension = Union<[BlockquoteSpecExtension, BlockquoteCommandsExtension]>;
30
+ /**
31
+ * @public
32
+ */
33
+ declare function defineBlockquote(): BlockquoteExtension;
34
+ //#endregion
35
+ //#region src/blockquote/blockquote-input-rule.d.ts
36
+ /**
37
+ * Wraps the text block in a blockquote when `>` is typed at the start of a new
38
+ * line followed by a space.
39
+ */
40
+ declare function defineBlockquoteInputRule(): PlainExtension;
41
+ //#endregion
42
+ //#region src/blockquote/blockquote-keymap.d.ts
43
+ /**
44
+ * @internal
45
+ */
46
+ declare function defineBlockquoteKeymap(): PlainExtension;
47
+ //#endregion
48
+ export { BlockquoteCommandsExtension, BlockquoteExtension, BlockquoteSpecExtension, defineBlockquote, defineBlockquoteCommands, defineBlockquoteInputRule, defineBlockquoteKeymap, defineBlockquoteSpec };
@@ -1,97 +1,83 @@
1
- import {
2
- defineWrappingInputRule
3
- } from "./chunk-I2UMHK3L.js";
4
-
5
- // src/blockquote/blockquote.ts
6
- import {
7
- union
8
- } from "@prosekit/core";
1
+ import { defineWrappingInputRule } from "./input-rule-Gji4N7Oe.js";
2
+ import { defineCommands, defineKeymap, defineNodeSpec, insertNode, isAtBlockStart, toggleWrap, union, wrap } from "@prosekit/core";
3
+ import { joinBackward } from "@prosekit/pm/commands";
9
4
 
10
- // src/blockquote/blockquote-commands.ts
11
- import {
12
- defineCommands,
13
- insertNode,
14
- toggleWrap,
15
- wrap
16
- } from "@prosekit/core";
5
+ //#region src/blockquote/blockquote-commands.ts
6
+ /**
7
+ * @internal
8
+ */
17
9
  function defineBlockquoteCommands() {
18
- return defineCommands({
19
- setBlockquote: () => {
20
- return wrap({ type: "blockquote" });
21
- },
22
- insertBlockquote: () => {
23
- return insertNode({ type: "blockquote" });
24
- },
25
- toggleBlockquote: () => {
26
- return toggleWrap({ type: "blockquote" });
27
- }
28
- });
10
+ return defineCommands({
11
+ setBlockquote: () => {
12
+ return wrap({ type: "blockquote" });
13
+ },
14
+ insertBlockquote: () => {
15
+ return insertNode({ type: "blockquote" });
16
+ },
17
+ toggleBlockquote: () => {
18
+ return toggleWrap({ type: "blockquote" });
19
+ }
20
+ });
29
21
  }
30
22
 
31
- // src/blockquote/blockquote-input-rule.ts
23
+ //#endregion
24
+ //#region src/blockquote/blockquote-input-rule.ts
25
+ /**
26
+ * Wraps the text block in a blockquote when `>` is typed at the start of a new
27
+ * line followed by a space.
28
+ */
32
29
  function defineBlockquoteInputRule() {
33
- return defineWrappingInputRule({
34
- regex: /^>\s/,
35
- type: "blockquote"
36
- });
30
+ return defineWrappingInputRule({
31
+ regex: /^>\s/,
32
+ type: "blockquote"
33
+ });
37
34
  }
38
35
 
39
- // src/blockquote/blockquote-keymap.ts
40
- import {
41
- defineKeymap,
42
- isAtBlockStart,
43
- toggleWrap as toggleWrap2
44
- } from "@prosekit/core";
45
- import { joinBackward } from "@prosekit/pm/commands";
36
+ //#endregion
37
+ //#region src/blockquote/blockquote-keymap.ts
46
38
  function toggleBlockquoteKeybinding() {
47
- return toggleWrap2({ type: "blockquote" });
39
+ return toggleWrap({ type: "blockquote" });
48
40
  }
49
41
  function backspaceUnsetBlockquote() {
50
- return (state, dispatch, view) => {
51
- const $pos = isAtBlockStart(state, view);
52
- if ($pos?.node(-1).type.name === "blockquote") {
53
- return joinBackward(state, dispatch, view);
54
- }
55
- return false;
56
- };
42
+ return (state, dispatch, view) => {
43
+ const $pos = isAtBlockStart(state, view);
44
+ if ($pos?.node(-1).type.name === "blockquote") return joinBackward(state, dispatch, view);
45
+ return false;
46
+ };
57
47
  }
48
+ /**
49
+ * @internal
50
+ */
58
51
  function defineBlockquoteKeymap() {
59
- return defineKeymap({
60
- "mod-shift-b": toggleBlockquoteKeybinding(),
61
- "Backspace": backspaceUnsetBlockquote()
62
- });
52
+ return defineKeymap({
53
+ "mod-shift-b": toggleBlockquoteKeybinding(),
54
+ "Backspace": backspaceUnsetBlockquote()
55
+ });
63
56
  }
64
57
 
65
- // src/blockquote/blockquote-spec.ts
66
- import {
67
- defineNodeSpec
68
- } from "@prosekit/core";
58
+ //#endregion
59
+ //#region src/blockquote/blockquote-spec.ts
69
60
  function defineBlockquoteSpec() {
70
- return defineNodeSpec({
71
- name: "blockquote",
72
- content: "block+",
73
- group: "block",
74
- defining: true,
75
- parseDOM: [{ tag: "blockquote" }],
76
- toDOM() {
77
- return ["blockquote", 0];
78
- }
79
- });
61
+ return defineNodeSpec({
62
+ name: "blockquote",
63
+ content: "block+",
64
+ group: "block",
65
+ defining: true,
66
+ parseDOM: [{ tag: "blockquote" }],
67
+ toDOM() {
68
+ return ["blockquote", 0];
69
+ }
70
+ });
80
71
  }
81
72
 
82
- // src/blockquote/blockquote.ts
73
+ //#endregion
74
+ //#region src/blockquote/blockquote.ts
75
+ /**
76
+ * @public
77
+ */
83
78
  function defineBlockquote() {
84
- return union(
85
- defineBlockquoteSpec(),
86
- defineBlockquoteInputRule(),
87
- defineBlockquoteCommands(),
88
- defineBlockquoteKeymap()
89
- );
79
+ return union(defineBlockquoteSpec(), defineBlockquoteInputRule(), defineBlockquoteCommands(), defineBlockquoteKeymap());
90
80
  }
91
- export {
92
- defineBlockquote,
93
- defineBlockquoteCommands,
94
- defineBlockquoteInputRule,
95
- defineBlockquoteKeymap,
96
- defineBlockquoteSpec
97
- };
81
+
82
+ //#endregion
83
+ export { defineBlockquote, defineBlockquoteCommands, defineBlockquoteInputRule, defineBlockquoteKeymap, defineBlockquoteSpec };
@@ -1,8 +1,54 @@
1
- export { defineBold_alias_1 as defineBold } from './_tsup-dts-rollup.js';
2
- export { BoldExtension_alias_1 as BoldExtension } from './_tsup-dts-rollup.js';
3
- export { defineBoldCommands_alias_1 as defineBoldCommands } from './_tsup-dts-rollup.js';
4
- export { BoldCommandsExtension_alias_1 as BoldCommandsExtension } from './_tsup-dts-rollup.js';
5
- export { defineBoldInputRule_alias_1 as defineBoldInputRule } from './_tsup-dts-rollup.js';
6
- export { defineBoldKeymap_alias_1 as defineBoldKeymap } from './_tsup-dts-rollup.js';
7
- export { defineBoldSpec_alias_1 as defineBoldSpec } from './_tsup-dts-rollup.js';
8
- export { BoldSpecExtension_alias_1 as BoldSpecExtension } from './_tsup-dts-rollup.js';
1
+ import { Extension, PlainExtension, Union } from "@prosekit/core";
2
+ import { Attrs } from "@prosekit/pm/model";
3
+
4
+ //#region src/bold/bold-commands.d.ts
5
+ /**
6
+ * @internal
7
+ */
8
+ type BoldCommandsExtension = Extension<{
9
+ Commands: {
10
+ toggleBold: [];
11
+ };
12
+ }>;
13
+ /**
14
+ * @internal
15
+ */
16
+ declare function defineBoldCommands(): BoldCommandsExtension;
17
+ //#endregion
18
+ //#region src/bold/bold-spec.d.ts
19
+ /**
20
+ * @internal
21
+ */
22
+ type BoldSpecExtension = Extension<{
23
+ Marks: {
24
+ bold: Attrs;
25
+ };
26
+ }>;
27
+ /**
28
+ * @internal
29
+ */
30
+ declare function defineBoldSpec(): BoldSpecExtension;
31
+ //#endregion
32
+ //#region src/bold/bold.d.ts
33
+ /**
34
+ * @internal
35
+ */
36
+ type BoldExtension = Union<[BoldSpecExtension, BoldCommandsExtension]>;
37
+ /**
38
+ * @public
39
+ */
40
+ declare function defineBold(): BoldExtension;
41
+ //#endregion
42
+ //#region src/bold/bold-input-rule.d.ts
43
+ /**
44
+ * @internal
45
+ */
46
+ declare function defineBoldInputRule(): PlainExtension;
47
+ //#endregion
48
+ //#region src/bold/bold-keymap.d.ts
49
+ /**
50
+ * @internal
51
+ */
52
+ declare function defineBoldKeymap(): PlainExtension;
53
+ //#endregion
54
+ export { BoldCommandsExtension, BoldExtension, BoldSpecExtension, defineBold, defineBoldCommands, defineBoldInputRule, defineBoldKeymap, defineBoldSpec };