@prosekit/extensions 0.14.0 → 0.14.2

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 (248) hide show
  1. package/dist/{drop-indicator-B_oMfeVP.js → drop-indicator-DJq8pF92.js} +1 -1
  2. package/dist/{drop-indicator-B_oMfeVP.js.map → drop-indicator-DJq8pF92.js.map} +1 -1
  3. package/dist/{file-iLVR0eM0.js → file-upload-I9m1EJAM.js} +1 -1
  4. package/dist/file-upload-I9m1EJAM.js.map +1 -0
  5. package/dist/{index-cp1u4e0e.d.ts → file-upload-dr3IXUty.d.ts} +1 -1
  6. package/dist/file-upload-dr3IXUty.d.ts.map +1 -0
  7. package/dist/{paste-rule-BaDghcaU.js → mark-paste-rule--F1QPUcU.js} +2 -2
  8. package/dist/mark-paste-rule--F1QPUcU.js.map +1 -0
  9. package/dist/{mark-rule-CYe8zk4q.js → mark-rule-Bqdm49Eq.js} +2 -2
  10. package/dist/mark-rule-Bqdm49Eq.js.map +1 -0
  11. package/dist/prosekit-extensions-autocomplete.d.ts +1 -1
  12. package/dist/prosekit-extensions-autocomplete.js +17 -17
  13. package/dist/prosekit-extensions-autocomplete.js.map +1 -1
  14. package/dist/prosekit-extensions-background-color.d.ts +1 -1
  15. package/dist/prosekit-extensions-background-color.js.map +1 -1
  16. package/dist/prosekit-extensions-blockquote.d.ts +13 -13
  17. package/dist/prosekit-extensions-blockquote.d.ts.map +1 -1
  18. package/dist/prosekit-extensions-blockquote.js +6 -5
  19. package/dist/prosekit-extensions-blockquote.js.map +1 -1
  20. package/dist/prosekit-extensions-bold.d.ts +12 -12
  21. package/dist/prosekit-extensions-bold.d.ts.map +1 -1
  22. package/dist/prosekit-extensions-bold.js +1 -1
  23. package/dist/prosekit-extensions-bold.js.map +1 -1
  24. package/dist/prosekit-extensions-code-block.d.ts +53 -36
  25. package/dist/prosekit-extensions-code-block.d.ts.map +1 -1
  26. package/dist/prosekit-extensions-code-block.js +78 -72
  27. package/dist/prosekit-extensions-code-block.js.map +1 -1
  28. package/dist/prosekit-extensions-code.d.ts +12 -12
  29. package/dist/prosekit-extensions-code.d.ts.map +1 -1
  30. package/dist/prosekit-extensions-code.js +1 -1
  31. package/dist/prosekit-extensions-code.js.map +1 -1
  32. package/dist/prosekit-extensions-commit.d.ts +1 -1
  33. package/dist/prosekit-extensions-commit.js +1 -1
  34. package/dist/prosekit-extensions-drop-indicator.js +1 -1
  35. package/dist/prosekit-extensions-enter-rule.d.ts +6 -78
  36. package/dist/prosekit-extensions-enter-rule.d.ts.map +1 -1
  37. package/dist/prosekit-extensions-enter-rule.js +37 -2
  38. package/dist/prosekit-extensions-enter-rule.js.map +1 -0
  39. package/dist/prosekit-extensions-file.d.ts +2 -2
  40. package/dist/prosekit-extensions-file.js +1 -1
  41. package/dist/prosekit-extensions-hard-break.d.ts +7 -7
  42. package/dist/prosekit-extensions-hard-break.d.ts.map +1 -1
  43. package/dist/prosekit-extensions-hard-break.js.map +1 -1
  44. package/dist/prosekit-extensions-heading.d.ts +15 -15
  45. package/dist/prosekit-extensions-heading.d.ts.map +1 -1
  46. package/dist/prosekit-extensions-heading.js +1 -1
  47. package/dist/prosekit-extensions-heading.js.map +1 -1
  48. package/dist/prosekit-extensions-horizontal-rule.d.ts +7 -7
  49. package/dist/prosekit-extensions-horizontal-rule.d.ts.map +1 -1
  50. package/dist/prosekit-extensions-horizontal-rule.js +11 -10
  51. package/dist/prosekit-extensions-horizontal-rule.js.map +1 -1
  52. package/dist/prosekit-extensions-image.d.ts +13 -12
  53. package/dist/prosekit-extensions-image.d.ts.map +1 -1
  54. package/dist/prosekit-extensions-image.js +10 -10
  55. package/dist/prosekit-extensions-image.js.map +1 -1
  56. package/dist/prosekit-extensions-input-rule.js +89 -2
  57. package/dist/prosekit-extensions-input-rule.js.map +1 -0
  58. package/dist/prosekit-extensions-italic.d.ts +12 -12
  59. package/dist/prosekit-extensions-italic.d.ts.map +1 -1
  60. package/dist/prosekit-extensions-italic.js +1 -1
  61. package/dist/prosekit-extensions-italic.js.map +1 -1
  62. package/dist/prosekit-extensions-link.js +4 -4
  63. package/dist/prosekit-extensions-link.js.map +1 -1
  64. package/dist/prosekit-extensions-list.d.ts +26 -26
  65. package/dist/prosekit-extensions-list.d.ts.map +1 -1
  66. package/dist/prosekit-extensions-list.js +27 -27
  67. package/dist/prosekit-extensions-list.js.map +1 -1
  68. package/dist/prosekit-extensions-loro.d.ts +16 -16
  69. package/dist/prosekit-extensions-loro.d.ts.map +1 -1
  70. package/dist/prosekit-extensions-loro.js.map +1 -1
  71. package/dist/prosekit-extensions-mark-rule.js +1 -1
  72. package/dist/prosekit-extensions-math.d.ts +154 -0
  73. package/dist/prosekit-extensions-math.d.ts.map +1 -0
  74. package/dist/prosekit-extensions-math.js +108 -0
  75. package/dist/prosekit-extensions-math.js.map +1 -0
  76. package/dist/prosekit-extensions-mod-click-prevention.js +1 -1
  77. package/dist/prosekit-extensions-paragraph.d.ts +7 -7
  78. package/dist/prosekit-extensions-paragraph.d.ts.map +1 -1
  79. package/dist/prosekit-extensions-paragraph.js.map +1 -1
  80. package/dist/prosekit-extensions-paste-rule.js +1 -1
  81. package/dist/prosekit-extensions-placeholder.d.ts +1 -1
  82. package/dist/prosekit-extensions-placeholder.js +2 -2
  83. package/dist/prosekit-extensions-placeholder.js.map +1 -1
  84. package/dist/prosekit-extensions-readonly.js +1 -1
  85. package/dist/prosekit-extensions-strike.js +1 -1
  86. package/dist/prosekit-extensions-strike.js.map +1 -1
  87. package/dist/prosekit-extensions-table.d.ts +47 -47
  88. package/dist/prosekit-extensions-table.d.ts.map +1 -1
  89. package/dist/prosekit-extensions-table.js +1 -1
  90. package/dist/prosekit-extensions-text-align.d.ts +1 -1
  91. package/dist/prosekit-extensions-text-color.d.ts +1 -1
  92. package/dist/prosekit-extensions-text-color.js.map +1 -1
  93. package/dist/prosekit-extensions-virtual-selection.js +1 -1
  94. package/dist/prosekit-extensions-yjs.d.ts +3 -3
  95. package/dist/prosekit-extensions-yjs.d.ts.map +1 -1
  96. package/dist/prosekit-extensions-yjs.js.map +1 -1
  97. package/dist/shiki-highlighter-chunk.d.ts +19 -2
  98. package/dist/shiki-highlighter-chunk.d.ts.map +1 -0
  99. package/dist/{table-4oHfV-Ql.js → table-B81i9oH9.js} +29 -29
  100. package/dist/table-B81i9oH9.js.map +1 -0
  101. package/package.json +22 -10
  102. package/src/autocomplete/autocomplete-helpers.ts +1 -1
  103. package/src/autocomplete/autocomplete-plugin.ts +2 -2
  104. package/src/autocomplete/autocomplete-rule.ts +1 -1
  105. package/src/autocomplete/autocomplete.spec.ts +4 -4
  106. package/src/autocomplete/autocomplete.ts +2 -2
  107. package/src/autocomplete/index.ts +2 -2
  108. package/src/background-color/background-color-commands.spec.ts +1 -1
  109. package/src/background-color/background-color-commands.ts +1 -1
  110. package/src/background-color/background-color-spec.spec.ts +1 -1
  111. package/src/background-color/background-color.ts +2 -2
  112. package/src/background-color/index.ts +3 -3
  113. package/src/blockquote/blockquote-input-rule.ts +1 -1
  114. package/src/blockquote/blockquote-keymap.spec.ts +1 -1
  115. package/src/blockquote/blockquote-keymap.ts +9 -7
  116. package/src/blockquote/blockquote.ts +4 -4
  117. package/src/blockquote/index.ts +5 -5
  118. package/src/bold/bold-input-rule.spec.ts +2 -2
  119. package/src/bold/bold-input-rule.ts +1 -1
  120. package/src/bold/bold.ts +4 -4
  121. package/src/bold/index.ts +5 -5
  122. package/src/code/code-input-rule.ts +1 -1
  123. package/src/code/code.ts +4 -4
  124. package/src/code/index.ts +5 -5
  125. package/src/code-block/code-block-commands.ts +1 -1
  126. package/src/code-block/code-block-highlight.ts +11 -1
  127. package/src/code-block/code-block-input-rule.ts +3 -3
  128. package/src/code-block/code-block-shiki.ts +13 -5
  129. package/src/code-block/code-block-spec.spec.ts +2 -2
  130. package/src/code-block/code-block-spec.ts +1 -1
  131. package/src/code-block/code-block.ts +4 -4
  132. package/src/code-block/index.ts +9 -9
  133. package/src/code-block/shiki-highlighter.ts +2 -2
  134. package/src/code-block/shiki-parser.ts +2 -2
  135. package/src/drop-cursor/index.ts +1 -1
  136. package/src/drop-indicator/drop-indicator.ts +1 -1
  137. package/src/drop-indicator/index.ts +1 -1
  138. package/src/enter-rule/index.ts +18 -191
  139. package/src/file/file-drop-handler.ts +1 -1
  140. package/src/file/file-paste-handler.spec.ts +3 -3
  141. package/src/file/file-paste-handler.ts +1 -1
  142. package/src/file/index.ts +3 -3
  143. package/src/gap-cursor/index.ts +1 -1
  144. package/src/hard-break/hard-break-keymap.spec.ts +2 -2
  145. package/src/hard-break/hard-break-keymap.ts +1 -1
  146. package/src/hard-break/hard-break.ts +3 -3
  147. package/src/hard-break/index.ts +4 -4
  148. package/src/heading/heading-commands.ts +1 -1
  149. package/src/heading/heading-input-rule.ts +2 -2
  150. package/src/heading/heading-keymap.spec.ts +1 -1
  151. package/src/heading/heading-spec.ts +1 -1
  152. package/src/heading/heading.ts +4 -4
  153. package/src/heading/index.ts +6 -6
  154. package/src/horizontal-rule/horizontal-rule-commands.spec.ts +1 -1
  155. package/src/horizontal-rule/horizontal-rule-commands.ts +13 -11
  156. package/src/horizontal-rule/horizontal-rule-input-rule.spec.ts +2 -2
  157. package/src/horizontal-rule/horizontal-rule-input-rule.ts +1 -1
  158. package/src/horizontal-rule/horizontal-rule.ts +3 -3
  159. package/src/horizontal-rule/index.ts +4 -4
  160. package/src/image/image-commands/insert-image.ts +1 -1
  161. package/src/image/image-commands/upload-image.spec.ts +4 -4
  162. package/src/image/image-commands/upload-image.ts +2 -2
  163. package/src/image/image-commands.ts +3 -3
  164. package/src/image/image-upload-handler.ts +2 -2
  165. package/src/image/image.ts +2 -2
  166. package/src/image/index.ts +6 -6
  167. package/src/italic/index.ts +5 -5
  168. package/src/italic/italic-commands.spec.ts +4 -4
  169. package/src/italic/italic-input-rule.spec.ts +2 -2
  170. package/src/italic/italic-input-rule.ts +1 -1
  171. package/src/italic/italic.ts +4 -4
  172. package/src/link/index.spec.ts +2 -2
  173. package/src/link/index.ts +6 -6
  174. package/src/link/link-paste-rule.spec.ts +2 -2
  175. package/src/link/link-paste-rule.ts +3 -3
  176. package/src/link/link-regex.spec.ts +1 -1
  177. package/src/list/index.ts +8 -8
  178. package/src/list/list-drop-indicator.ts +2 -2
  179. package/src/list/list-input-rules.ts +1 -1
  180. package/src/list/list-keymap.spec.ts +1 -1
  181. package/src/list/list-spec.ts +1 -1
  182. package/src/list/list-types.spec.ts +2 -2
  183. package/src/list/list.spec.ts +6 -6
  184. package/src/list/list.ts +7 -7
  185. package/src/loro/index.ts +6 -6
  186. package/src/loro/loro.ts +5 -5
  187. package/src/mark-rule/apply.ts +2 -2
  188. package/src/mark-rule/index.ts +2 -2
  189. package/src/mark-rule/mark-rule.spec.ts +4 -4
  190. package/src/mark-rule/mark-rule.ts +2 -2
  191. package/src/math/index.ts +22 -0
  192. package/src/math/math-block.ts +96 -0
  193. package/src/math/math-inline.ts +89 -0
  194. package/src/math/math-plugin.ts +8 -0
  195. package/src/math/math.ts +39 -0
  196. package/src/paragraph/index.ts +7 -7
  197. package/src/paragraph/paragraph-keymap.ts +1 -1
  198. package/src/paragraph/paragraph.ts +3 -3
  199. package/src/paste-rule/index.ts +2 -2
  200. package/src/paste-rule/mark-paste-rule.spec.ts +8 -8
  201. package/src/paste-rule/mark-paste-rule.ts +2 -2
  202. package/src/paste-rule/paste-rule.spec.ts +2 -2
  203. package/src/paste-rule/paste-rule.ts +1 -1
  204. package/src/paste-rule/split-text-by-regex.spec.ts +1 -1
  205. package/src/placeholder/index.ts +1 -1
  206. package/src/strike/index.ts +1 -1
  207. package/src/table/index.ts +14 -14
  208. package/src/table/table-commands/delete-cell-selection.spec.ts +3 -3
  209. package/src/table/table-commands/exit-table.spec.ts +2 -2
  210. package/src/table/table-commands/insert-table.spec.ts +1 -1
  211. package/src/table/table-commands/move-table-column.spec.ts +2 -2
  212. package/src/table/table-commands/move-table-row.spec.ts +2 -2
  213. package/src/table/table-commands/select-table-cell.spec.ts +3 -3
  214. package/src/table/table-commands/select-table-cell.ts +1 -1
  215. package/src/table/table-commands/select-table-column.spec.ts +2 -2
  216. package/src/table/table-commands/select-table-column.ts +1 -1
  217. package/src/table/table-commands/select-table-row.spec.ts +2 -2
  218. package/src/table/table-commands/select-table-row.ts +1 -1
  219. package/src/table/table-commands/select-table.spec.ts +2 -2
  220. package/src/table/table-commands/select-table.ts +1 -1
  221. package/src/table/table-commands.ts +9 -9
  222. package/src/table/table-drop-indicator.ts +2 -2
  223. package/src/table/table-spec.spec.ts +4 -4
  224. package/src/table/table.ts +4 -4
  225. package/src/table/test-utils.ts +1 -1
  226. package/src/testing/index.ts +25 -22
  227. package/src/testing/katex.ts +9 -0
  228. package/src/text-color/index.ts +3 -3
  229. package/src/text-color/text-color-commands.spec.ts +1 -1
  230. package/src/text-color/text-color-commands.ts +1 -1
  231. package/src/text-color/text-color-spec.spec.ts +1 -1
  232. package/src/text-color/text-color.ts +2 -2
  233. package/src/yjs/index.ts +7 -7
  234. package/src/yjs/yjs-cursor-plugin.ts +1 -1
  235. package/src/yjs/yjs-types.ts +0 -2
  236. package/src/yjs/yjs-undo-plugin.ts +3 -2
  237. package/src/yjs/yjs.ts +6 -6
  238. package/dist/enter-rule-D-p4ykfv.js +0 -96
  239. package/dist/enter-rule-D-p4ykfv.js.map +0 -1
  240. package/dist/file-iLVR0eM0.js.map +0 -1
  241. package/dist/index-cp1u4e0e.d.ts.map +0 -1
  242. package/dist/input-rule-COGr_GBb.js +0 -90
  243. package/dist/input-rule-COGr_GBb.js.map +0 -1
  244. package/dist/mark-rule-CYe8zk4q.js.map +0 -1
  245. package/dist/paste-rule-BaDghcaU.js.map +0 -1
  246. package/dist/shiki-highlighter-chunk-DNNm2Vow.d.ts +0 -19
  247. package/dist/shiki-highlighter-chunk-DNNm2Vow.d.ts.map +0 -1
  248. package/dist/table-4oHfV-Ql.js.map +0 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/extensions",
3
3
  "type": "module",
4
- "version": "0.14.0",
4
+ "version": "0.14.2",
5
5
  "private": false,
6
6
  "description": "A collection of common extensions for ProseKit",
7
7
  "author": {
@@ -134,6 +134,10 @@
134
134
  "types": "./dist/prosekit-extensions-mark-rule.d.ts",
135
135
  "default": "./dist/prosekit-extensions-mark-rule.js"
136
136
  },
137
+ "./math": {
138
+ "types": "./dist/prosekit-extensions-math.d.ts",
139
+ "default": "./dist/prosekit-extensions-math.js"
140
+ },
137
141
  "./mention": {
138
142
  "types": "./dist/prosekit-extensions-mention.d.ts",
139
143
  "default": "./dist/prosekit-extensions-mention.js"
@@ -215,13 +219,15 @@
215
219
  "src"
216
220
  ],
217
221
  "dependencies": {
218
- "@ocavue/utils": "^1.4.0",
219
- "prosemirror-changeset": "^2.3.1",
222
+ "@ocavue/utils": "^1.5.0",
223
+ "prosemirror-changeset": "^2.4.0",
220
224
  "prosemirror-drop-indicator": "^0.1.3",
221
225
  "prosemirror-dropcursor": "^1.8.2",
226
+ "prosemirror-enter-rules": "^0.1.5",
222
227
  "prosemirror-flat-list": "^0.5.8",
223
228
  "prosemirror-gapcursor": "^1.4.0",
224
- "prosemirror-highlight": "^0.13.0",
229
+ "prosemirror-highlight": "^0.15.0",
230
+ "prosemirror-math": "^0.2.2",
225
231
  "prosemirror-search": "^1.1.0",
226
232
  "prosemirror-tables": "^1.8.5",
227
233
  "shiki": "^3.22.0",
@@ -251,24 +257,26 @@
251
257
  "devDependencies": {
252
258
  "diffable-html-snapshot": "^0.2.0",
253
259
  "just-pick": "^4.2.0",
254
- "loro-crdt": "^1.10.5",
255
- "loro-prosemirror": "^0.4.2",
260
+ "katex": "^0.16.28",
261
+ "loro-crdt": "^1.10.6",
262
+ "loro-prosemirror": "^0.4.3",
256
263
  "rehype-parse": "^9.0.1",
257
264
  "rehype-remark": "^10.0.1",
258
265
  "remark-gfm": "^4.0.1",
259
266
  "remark-html": "^16.0.1",
260
267
  "remark-parse": "^11.0.0",
261
268
  "remark-stringify": "^11.0.0",
262
- "tsdown": "^0.20.1",
263
- "type-fest": "^5.4.3",
269
+ "tsdown": "^0.20.3",
270
+ "type-fest": "^5.4.4",
264
271
  "typescript": "~5.9.3",
265
272
  "unified": "^11.0.5",
266
- "vitest": "^4.0.18",
273
+ "vitest": "^4.1.0-beta.4",
267
274
  "vitest-browser-commands": "^0.2.0",
268
275
  "y-prosemirror": "^1.3.7",
269
276
  "yjs": "^13.6.29",
270
277
  "@prosekit/config-tsdown": "0.0.0",
271
- "@prosekit/config-vitest": "0.0.0"
278
+ "@prosekit/config-vitest": "0.0.0",
279
+ "@prosekit/config-ts": "0.0.0"
272
280
  },
273
281
  "publishConfig": {
274
282
  "dev": {}
@@ -303,6 +311,7 @@
303
311
  "prosekit-extensions-loro": "./src/loro/index.ts",
304
312
  "loro/style": "./src/loro/style.css",
305
313
  "prosekit-extensions-mark-rule": "./src/mark-rule/index.ts",
314
+ "prosekit-extensions-math": "./src/math/index.ts",
306
315
  "prosekit-extensions-mention": "./src/mention/index.ts",
307
316
  "prosekit-extensions-mod-click-prevention": "./src/mod-click-prevention/index.ts",
308
317
  "prosekit-extensions-paragraph": "./src/paragraph/index.ts",
@@ -404,6 +413,9 @@
404
413
  "mark-rule": [
405
414
  "./dist/prosekit-extensions-mark-rule.d.ts"
406
415
  ],
416
+ "math": [
417
+ "./dist/prosekit-extensions-math.d.ts"
418
+ ],
407
419
  "mention": [
408
420
  "./dist/prosekit-extensions-mention.d.ts"
409
421
  ],
@@ -1,7 +1,7 @@
1
1
  import type { ResolvedPos } from '@prosekit/pm/model'
2
2
  import { PluginKey, type EditorState, type Transaction } from '@prosekit/pm/state'
3
3
 
4
- import type { AutocompleteRule } from './autocomplete-rule'
4
+ import type { AutocompleteRule } from './autocomplete-rule.ts'
5
5
 
6
6
  export function defaultCanMatch({ state }: { state: EditorState }): boolean {
7
7
  const $pos = state.selection.$from
@@ -13,8 +13,8 @@ import {
13
13
  type PredictionPluginMatching,
14
14
  type PredictionPluginState,
15
15
  type PredictionTransactionMeta,
16
- } from './autocomplete-helpers'
17
- import type { AutocompleteRule } from './autocomplete-rule'
16
+ } from './autocomplete-helpers.ts'
17
+ import type { AutocompleteRule } from './autocomplete-rule.ts'
18
18
 
19
19
  /**
20
20
  * Creates a plugin that handles autocomplete functionality.
@@ -1,6 +1,6 @@
1
1
  import type { EditorState } from '@prosekit/pm/state'
2
2
 
3
- import { defaultCanMatch } from './autocomplete-helpers'
3
+ import { defaultCanMatch } from './autocomplete-helpers.ts'
4
4
 
5
5
  /**
6
6
  * Options for the {@link MatchHandler} callback.
@@ -2,11 +2,11 @@ import { canUseRegexLookbehind, union } from '@prosekit/core'
2
2
  import { describe, expect, it, vi } from 'vitest'
3
3
  import { keyboard } from 'vitest-browser-commands/playwright'
4
4
 
5
- import { defineTestExtension, setupTestFromExtension } from '../testing'
6
- import { inputText } from '../testing/keyboard'
5
+ import { defineTestExtension, setupTestFromExtension } from '../testing/index.ts'
6
+ import { inputText } from '../testing/keyboard.ts'
7
7
 
8
- import { defineAutocomplete } from './autocomplete'
9
- import { AutocompleteRule, type MatchHandler, type MatchHandlerOptions } from './autocomplete-rule'
8
+ import { AutocompleteRule, type MatchHandler, type MatchHandlerOptions } from './autocomplete-rule.ts'
9
+ import { defineAutocomplete } from './autocomplete.ts'
10
10
 
11
11
  function setupSlashMenu() {
12
12
  const regex = canUseRegexLookbehind() ? /(?<!\S)\/(\S.*)?$/u : /\/(\S.*)?$/u
@@ -1,7 +1,7 @@
1
1
  import { defineFacet, defineFacetPayload, pluginFacet, type Extension, type PluginPayload } from '@prosekit/core'
2
2
 
3
- import { createAutocompletePlugin } from './autocomplete-plugin'
4
- import type { AutocompleteRule } from './autocomplete-rule'
3
+ import { createAutocompletePlugin } from './autocomplete-plugin.ts'
4
+ import type { AutocompleteRule } from './autocomplete-rule.ts'
5
5
 
6
6
  /**
7
7
  * Defines an autocomplete extension that executes logic when the text before
@@ -1,4 +1,3 @@
1
- export { defineAutocomplete } from './autocomplete'
2
1
  export {
3
2
  AutocompleteRule,
4
3
  type AutocompleteRuleOptions,
@@ -6,4 +5,5 @@ export {
6
5
  type CanMatchPredicate,
7
6
  type MatchHandler,
8
7
  type MatchHandlerOptions,
9
- } from './autocomplete-rule'
8
+ } from './autocomplete-rule.ts'
9
+ export { defineAutocomplete } from './autocomplete.ts'
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it } from 'vitest'
2
2
 
3
- import { setupTest } from '../testing'
3
+ import { setupTest } from '../testing/index.ts'
4
4
 
5
5
  describe('addBackgroundColor', () => {
6
6
  it('can add background color to text', () => {
@@ -1,7 +1,7 @@
1
1
  import { addMark, defineCommands, removeMark, type Extension } from '@prosekit/core'
2
2
  import type { Command } from '@prosekit/pm/state'
3
3
 
4
- import type { BackgroundColorAttrs } from './background-color-spec'
4
+ import type { BackgroundColorAttrs } from './background-color-spec.ts'
5
5
 
6
6
  /**
7
7
  * @internal
@@ -1,7 +1,7 @@
1
1
  import { formatHTML } from 'diffable-html-snapshot'
2
2
  import { describe, expect, it } from 'vitest'
3
3
 
4
- import { setupTest } from '../testing'
4
+ import { setupTest } from '../testing/index.ts'
5
5
 
6
6
  describe('defineBackgroundColorSpec', () => {
7
7
  it('should render background color as inline span with style attribute', () => {
@@ -1,7 +1,7 @@
1
1
  import { union, type Union } from '@prosekit/core'
2
2
 
3
- import { defineBackgroundColorCommands, type BackgroundColorCommandsExtension } from './background-color-commands'
4
- import { defineBackgroundColorSpec, type BackgroundColorSpecExtension } from './background-color-spec'
3
+ import { defineBackgroundColorCommands, type BackgroundColorCommandsExtension } from './background-color-commands.ts'
4
+ import { defineBackgroundColorSpec, type BackgroundColorSpecExtension } from './background-color-spec.ts'
5
5
 
6
6
  /**
7
7
  * @internal
@@ -1,8 +1,8 @@
1
- export { defineBackgroundColor, type BackgroundColorExtension } from './background-color'
2
1
  export {
3
2
  addBackgroundColor,
4
3
  defineBackgroundColorCommands,
5
4
  removeBackgroundColor,
6
5
  type BackgroundColorCommandsExtension,
7
- } from './background-color-commands'
8
- export { defineBackgroundColorSpec, type BackgroundColorAttrs, type BackgroundColorSpecExtension } from './background-color-spec'
6
+ } from './background-color-commands.ts'
7
+ export { defineBackgroundColorSpec, type BackgroundColorAttrs, type BackgroundColorSpecExtension } from './background-color-spec.ts'
8
+ export { defineBackgroundColor, type BackgroundColorExtension } from './background-color.ts'
@@ -1,6 +1,6 @@
1
1
  import type { PlainExtension } from '@prosekit/core'
2
2
 
3
- import { defineWrappingInputRule } from '../input-rule'
3
+ import { defineWrappingInputRule } from '../input-rule/index.ts'
4
4
 
5
5
  /**
6
6
  * Wraps the text block in a blockquote when `>` is typed at the start of a new
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, it } from 'vitest'
2
2
  import { keyboard } from 'vitest-browser-commands/playwright'
3
3
 
4
- import { setupTest } from '../testing'
4
+ import { setupTest } from '../testing/index.ts'
5
5
 
6
6
  describe('blockquote keymap', () => {
7
7
  it('should wrap paragraph into blockquote with shortcut', async () => {
@@ -6,14 +6,16 @@ function toggleBlockquoteKeybinding(): Command {
6
6
  return toggleWrap({ type: 'blockquote' })
7
7
  }
8
8
 
9
- function backspaceUnsetBlockquote(): Command {
10
- return (state, dispatch, view) => {
11
- const $pos = isAtBlockStart(state, view)
12
- if ($pos?.node(-1).type.name === 'blockquote') {
13
- return joinBackward(state, dispatch, view)
14
- }
15
- return false
9
+ const backspaceUnsetBlockquoteCommand: Command = (state, dispatch, view): boolean => {
10
+ const $pos = isAtBlockStart(state, view)
11
+ if ($pos?.node(-1).type.name === 'blockquote') {
12
+ return joinBackward(state, dispatch, view)
16
13
  }
14
+ return false
15
+ }
16
+
17
+ function backspaceUnsetBlockquote(): Command {
18
+ return backspaceUnsetBlockquoteCommand
17
19
  }
18
20
  /**
19
21
  * @internal
@@ -1,9 +1,9 @@
1
1
  import { union, type Union } from '@prosekit/core'
2
2
 
3
- import { defineBlockquoteCommands, type BlockquoteCommandsExtension } from './blockquote-commands'
4
- import { defineBlockquoteInputRule } from './blockquote-input-rule'
5
- import { defineBlockquoteKeymap } from './blockquote-keymap'
6
- import { defineBlockquoteSpec, type BlockquoteSpecExtension } from './blockquote-spec'
3
+ import { defineBlockquoteCommands, type BlockquoteCommandsExtension } from './blockquote-commands.ts'
4
+ import { defineBlockquoteInputRule } from './blockquote-input-rule.ts'
5
+ import { defineBlockquoteKeymap } from './blockquote-keymap.ts'
6
+ import { defineBlockquoteSpec, type BlockquoteSpecExtension } from './blockquote-spec.ts'
7
7
 
8
8
  /**
9
9
  * @internal
@@ -1,5 +1,5 @@
1
- export { defineBlockquote, type BlockquoteExtension } from './blockquote'
2
- export { defineBlockquoteCommands, type BlockquoteCommandsExtension } from './blockquote-commands'
3
- export { defineBlockquoteInputRule } from './blockquote-input-rule'
4
- export { defineBlockquoteKeymap } from './blockquote-keymap'
5
- export { defineBlockquoteSpec, type BlockquoteSpecExtension } from './blockquote-spec'
1
+ export { defineBlockquoteCommands, type BlockquoteCommandsExtension } from './blockquote-commands.ts'
2
+ export { defineBlockquoteInputRule } from './blockquote-input-rule.ts'
3
+ export { defineBlockquoteKeymap } from './blockquote-keymap.ts'
4
+ export { defineBlockquoteSpec, type BlockquoteSpecExtension } from './blockquote-spec.ts'
5
+ export { defineBlockquote, type BlockquoteExtension } from './blockquote.ts'
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, it } from 'vitest'
2
2
 
3
- import { setupTest } from '../testing'
4
- import { inputText } from '../testing/keyboard'
3
+ import { setupTest } from '../testing/index.ts'
4
+ import { inputText } from '../testing/keyboard.ts'
5
5
 
6
6
  describe('defineBoldInputRule', () => {
7
7
  const { editor, n, m } = setupTest()
@@ -1,6 +1,6 @@
1
1
  import { canUseRegexLookbehind, type PlainExtension } from '@prosekit/core'
2
2
 
3
- import { defineMarkInputRule } from '../input-rule'
3
+ import { defineMarkInputRule } from '../input-rule/index.ts'
4
4
 
5
5
  /**
6
6
  * @internal
package/src/bold/bold.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { union, type Union } from '@prosekit/core'
2
2
 
3
- import { defineBoldCommands, type BoldCommandsExtension } from './bold-commands'
4
- import { defineBoldInputRule } from './bold-input-rule'
5
- import { defineBoldKeymap } from './bold-keymap'
6
- import { defineBoldSpec, type BoldSpecExtension } from './bold-spec'
3
+ import { defineBoldCommands, type BoldCommandsExtension } from './bold-commands.ts'
4
+ import { defineBoldInputRule } from './bold-input-rule.ts'
5
+ import { defineBoldKeymap } from './bold-keymap.ts'
6
+ import { defineBoldSpec, type BoldSpecExtension } from './bold-spec.ts'
7
7
 
8
8
  /**
9
9
  * @internal
package/src/bold/index.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { defineBold, type BoldExtension } from './bold'
2
- export { defineBoldCommands, type BoldCommandsExtension } from './bold-commands'
3
- export { defineBoldInputRule } from './bold-input-rule'
4
- export { defineBoldKeymap } from './bold-keymap'
5
- export { defineBoldSpec, type BoldSpecExtension } from './bold-spec'
1
+ export { defineBoldCommands, type BoldCommandsExtension } from './bold-commands.ts'
2
+ export { defineBoldInputRule } from './bold-input-rule.ts'
3
+ export { defineBoldKeymap } from './bold-keymap.ts'
4
+ export { defineBoldSpec, type BoldSpecExtension } from './bold-spec.ts'
5
+ export { defineBold, type BoldExtension } from './bold.ts'
@@ -1,6 +1,6 @@
1
1
  import { canUseRegexLookbehind, type PlainExtension } from '@prosekit/core'
2
2
 
3
- import { defineMarkInputRule } from '../input-rule'
3
+ import { defineMarkInputRule } from '../input-rule/index.ts'
4
4
 
5
5
  /**
6
6
  * @internal
package/src/code/code.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { union, type Union } from '@prosekit/core'
2
2
 
3
- import { defineCodeCommands, type CodeCommandsExtension } from './code-commands'
4
- import { defineCodeInputRule } from './code-input-rule'
5
- import { defineCodeKeymap } from './code-keymap'
6
- import { defineCodeSpec, type CodeSpecExtension } from './code-spec'
3
+ import { defineCodeCommands, type CodeCommandsExtension } from './code-commands.ts'
4
+ import { defineCodeInputRule } from './code-input-rule.ts'
5
+ import { defineCodeKeymap } from './code-keymap.ts'
6
+ import { defineCodeSpec, type CodeSpecExtension } from './code-spec.ts'
7
7
 
8
8
  /**
9
9
  * @internal
package/src/code/index.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { defineCode, type CodeExtension } from './code'
2
- export { defineCodeCommands, type CodeCommandsExtension } from './code-commands'
3
- export { defineCodeInputRule } from './code-input-rule'
4
- export { defineCodeKeymap } from './code-keymap'
5
- export { defineCodeSpec, type CodeSpecExtension } from './code-spec'
1
+ export { defineCodeCommands, type CodeCommandsExtension } from './code-commands.ts'
2
+ export { defineCodeInputRule } from './code-input-rule.ts'
3
+ export { defineCodeKeymap } from './code-keymap.ts'
4
+ export { defineCodeSpec, type CodeSpecExtension } from './code-spec.ts'
5
+ export { defineCode, type CodeExtension } from './code.ts'
@@ -1,6 +1,6 @@
1
1
  import { defineCommands, insertNode, setBlockType, setNodeAttrs, toggleNode, type Extension } from '@prosekit/core'
2
2
 
3
- import type { CodeBlockAttrs } from './code-block-types'
3
+ import type { CodeBlockAttrs } from './code-block-types.ts'
4
4
 
5
5
  /**
6
6
  * @internal
@@ -12,7 +12,16 @@ export type HighlightParser = Parser
12
12
  * @public
13
13
  */
14
14
  export type CodeBlockHighlightOptions = {
15
+ /**
16
+ * A parser instance from the `prosemirror-highlight` package.
17
+ */
15
18
  parser: HighlightParser
19
+ /**
20
+ * ProseMirror node types to highlight.
21
+ *
22
+ * @default ['codeBlock', 'mathBlock']
23
+ */
24
+ nodeTypes?: string[]
16
25
  }
17
26
 
18
27
  /**
@@ -27,8 +36,9 @@ export type CodeBlockHighlightOptions = {
27
36
  */
28
37
  export function defineCodeBlockHighlight({
29
38
  parser,
39
+ nodeTypes = ['codeBlock', 'mathBlock'],
30
40
  }: CodeBlockHighlightOptions): Extension {
31
41
  return definePlugin(
32
- createHighlightPlugin({ parser }),
42
+ createHighlightPlugin({ parser, nodeTypes }),
33
43
  )
34
44
  }
@@ -1,9 +1,9 @@
1
1
  import type { PlainExtension } from '@prosekit/core'
2
2
 
3
- import { defineTextBlockEnterRule } from '../enter-rule'
4
- import { defineTextBlockInputRule } from '../input-rule'
3
+ import { defineTextBlockEnterRule } from '../enter-rule/index.ts'
4
+ import { defineTextBlockInputRule } from '../input-rule/index.ts'
5
5
 
6
- import type { CodeBlockAttrs } from './code-block-types'
6
+ import type { CodeBlockAttrs } from './code-block-types.ts'
7
7
 
8
8
  /**
9
9
  * Adds input rules for `codeBlock` nodes.
@@ -1,10 +1,10 @@
1
1
  import type { Extension } from '@prosekit/core'
2
2
  import type { SpecialLanguage } from 'shiki'
3
3
 
4
- import { defineCodeBlockHighlight } from './code-block-highlight'
5
- import type { ShikiBundledLanguage, ShikiBundledTheme } from './shiki-bundle'
6
- import type { ShikiHighlighterOptions } from './shiki-highlighter-chunk'
7
- import { createLazyParser } from './shiki-parser'
4
+ import { defineCodeBlockHighlight } from './code-block-highlight.ts'
5
+ import type { ShikiBundledLanguage, ShikiBundledTheme } from './shiki-bundle.ts'
6
+ import type { ShikiHighlighterOptions } from './shiki-highlighter-chunk.ts'
7
+ import { createLazyParser } from './shiki-parser.ts'
8
8
 
9
9
  /**
10
10
  * The options to configure the Shiki highlighter.
@@ -12,6 +12,13 @@ import { createLazyParser } from './shiki-parser'
12
12
  * @public
13
13
  */
14
14
  export interface CodeBlockShikiOptions extends Omit<ShikiHighlighterOptions, 'themes' | 'langs' | 'engine'> {
15
+ /**
16
+ * ProseMirror node types to highlight.
17
+ *
18
+ * @default ['codeBlock', 'mathBlock']
19
+ */
20
+ nodeTypes?: string[]
21
+
15
22
  /**
16
23
  * A list of Shiki themes to pre-load. The first theme in the list will be
17
24
  * used to render the code block.
@@ -46,10 +53,11 @@ export interface CodeBlockShikiOptions extends Omit<ShikiHighlighterOptions, 'th
46
53
  * @public
47
54
  */
48
55
  export function defineCodeBlockShiki({
56
+ nodeTypes,
49
57
  themes = ['one-dark-pro'],
50
58
  langs = ['text'],
51
59
  ...rest
52
60
  }: CodeBlockShikiOptions = {}): Extension {
53
61
  const parser = createLazyParser({ themes, langs, ...rest })
54
- return defineCodeBlockHighlight({ parser })
62
+ return defineCodeBlockHighlight({ parser, nodeTypes })
55
63
  }
@@ -2,8 +2,8 @@ import { jsonFromHTML } from '@prosekit/core'
2
2
  import { formatHTML } from 'diffable-html-snapshot'
3
3
  import { describe, expect, it } from 'vitest'
4
4
 
5
- import { setupTest } from '../testing'
6
- import { htmlFromMarkdown, markdownFromHTML } from '../testing/markdown'
5
+ import { setupTest } from '../testing/index.ts'
6
+ import { htmlFromMarkdown, markdownFromHTML } from '../testing/markdown.ts'
7
7
 
8
8
  describe('defineCodeBlockSpec', () => {
9
9
  it('can parse and serialize code blocks', () => {
@@ -1,6 +1,6 @@
1
1
  import { defineNodeSpec, type Extension } from '@prosekit/core'
2
2
 
3
- import type { CodeBlockAttrs } from './code-block-types'
3
+ import type { CodeBlockAttrs } from './code-block-types.ts'
4
4
 
5
5
  /**
6
6
  * @internal
@@ -1,9 +1,9 @@
1
1
  import { union, type Union } from '@prosekit/core'
2
2
 
3
- import { defineCodeBlockCommands, type CodeBlockCommandsExtension } from './code-block-commands'
4
- import { defineCodeBlockEnterRule, defineCodeBlockInputRule } from './code-block-input-rule'
5
- import { defineCodeBlockKeymap } from './code-block-keymap'
6
- import { defineCodeBlockSpec, type CodeBlockSpecExtension } from './code-block-spec'
3
+ import { defineCodeBlockCommands, type CodeBlockCommandsExtension } from './code-block-commands.ts'
4
+ import { defineCodeBlockEnterRule, defineCodeBlockInputRule } from './code-block-input-rule.ts'
5
+ import { defineCodeBlockKeymap } from './code-block-keymap.ts'
6
+ import { defineCodeBlockSpec, type CodeBlockSpecExtension } from './code-block-spec.ts'
7
7
 
8
8
  /**
9
9
  * @internal
@@ -1,11 +1,11 @@
1
- export { defineCodeBlock, type CodeBlockExtension } from './code-block'
2
- export { defineCodeBlockCommands, type CodeBlockCommandsExtension } from './code-block-commands'
3
- export { defineCodeBlockHighlight, type CodeBlockHighlightOptions, type HighlightParser } from './code-block-highlight'
4
- export { defineCodeBlockEnterRule, defineCodeBlockInputRule } from './code-block-input-rule'
5
- export { defineCodeBlockKeymap } from './code-block-keymap'
6
- export { defineCodeBlockShiki } from './code-block-shiki'
7
- export { defineCodeBlockSpec, type CodeBlockSpecExtension } from './code-block-spec'
8
- export type { CodeBlockAttrs } from './code-block-types'
1
+ export { defineCodeBlockCommands, type CodeBlockCommandsExtension } from './code-block-commands.ts'
2
+ export { defineCodeBlockHighlight, type CodeBlockHighlightOptions, type HighlightParser } from './code-block-highlight.ts'
3
+ export { defineCodeBlockEnterRule, defineCodeBlockInputRule } from './code-block-input-rule.ts'
4
+ export { defineCodeBlockKeymap } from './code-block-keymap.ts'
5
+ export { defineCodeBlockShiki } from './code-block-shiki.ts'
6
+ export { defineCodeBlockSpec, type CodeBlockSpecExtension } from './code-block-spec.ts'
7
+ export type { CodeBlockAttrs } from './code-block-types.ts'
8
+ export { defineCodeBlock, type CodeBlockExtension } from './code-block.ts'
9
9
  export {
10
10
  shikiBundledLanguagesInfo,
11
11
  shikiBundledThemesInfo,
@@ -13,4 +13,4 @@ export {
13
13
  type ShikiBundledLanguageInfo,
14
14
  type ShikiBundledTheme,
15
15
  type ShikiBundledThemeInfo,
16
- } from './shiki-bundle'
16
+ } from './shiki-bundle.ts'
@@ -1,9 +1,9 @@
1
- import type { HighlighterOptions, HighlighterResult } from './shiki-highlighter-chunk'
1
+ import type { HighlighterOptions, HighlighterResult } from './shiki-highlighter-chunk.ts'
2
2
 
3
3
  let loaded: ((options: HighlighterOptions) => HighlighterResult) | undefined
4
4
 
5
5
  async function load() {
6
- const { createOrGetHighlighter } = await import('./shiki-highlighter-chunk')
6
+ const { createOrGetHighlighter } = await import('./shiki-highlighter-chunk.ts')
7
7
  loaded = createOrGetHighlighter
8
8
  }
9
9
 
@@ -1,8 +1,8 @@
1
1
  import type { Parser } from 'prosemirror-highlight'
2
2
  import { createParser } from 'prosemirror-highlight/shiki'
3
3
 
4
- import type { ShikiBundledLanguage } from './shiki-bundle'
5
- import { createOrGetHighlighter, type HighlighterOptions } from './shiki-highlighter'
4
+ import type { ShikiBundledLanguage } from './shiki-bundle.ts'
5
+ import { createOrGetHighlighter, type HighlighterOptions } from './shiki-highlighter.ts'
6
6
 
7
7
  /**
8
8
  * @internal
@@ -1 +1 @@
1
- export { defineDropCursor, type DropCursorExtension, type DropCursorOptions } from './drop-cursor'
1
+ export { defineDropCursor, type DropCursorExtension, type DropCursorOptions } from './drop-cursor.ts'
@@ -1,7 +1,7 @@
1
1
  import type { PlainExtension } from '@prosekit/core'
2
2
  import type { DropIndicatorPluginOptions } from 'prosemirror-drop-indicator'
3
3
 
4
- import { defineDropIndicatorPayload } from './drop-indicator-facet'
4
+ import { defineDropIndicatorPayload } from './drop-indicator-facet.ts'
5
5
 
6
6
  /**
7
7
  * @internal
@@ -7,4 +7,4 @@ export type {
7
7
  ShowHandlerOptions,
8
8
  ViewDragging,
9
9
  } from 'prosemirror-drop-indicator'
10
- export { defineDropIndicator, type DropIndicatorExtension, type DropIndicatorOptions } from './drop-indicator'
10
+ export { defineDropIndicator, type DropIndicatorExtension, type DropIndicatorOptions } from './drop-indicator.ts'