@prosekit/extensions 0.13.0 → 0.14.0

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 (311) hide show
  1. package/dist/{drop-indicator-B1QHFb5m.js → drop-indicator-B_oMfeVP.js} +11 -10
  2. package/dist/drop-indicator-B_oMfeVP.js.map +1 -0
  3. package/dist/{enter-rule-CzWOZF_Z.js → enter-rule-D-p4ykfv.js} +1 -1
  4. package/dist/enter-rule-D-p4ykfv.js.map +1 -0
  5. package/dist/{file-DrfcSid-.js → file-iLVR0eM0.js} +3 -3
  6. package/dist/file-iLVR0eM0.js.map +1 -0
  7. package/dist/{index-oIc1a2f2.d.ts → index-cp1u4e0e.d.ts} +1 -1
  8. package/dist/index-cp1u4e0e.d.ts.map +1 -0
  9. package/dist/{input-rule-dmsb3j6w.js → input-rule-COGr_GBb.js} +1 -1
  10. package/dist/input-rule-COGr_GBb.js.map +1 -0
  11. package/dist/{mark-rule-BcLB4Uv2.js → mark-rule-CYe8zk4q.js} +6 -6
  12. package/dist/mark-rule-CYe8zk4q.js.map +1 -0
  13. package/dist/{paste-rule-pVb4sqvJ.js → paste-rule-BaDghcaU.js} +7 -7
  14. package/dist/paste-rule-BaDghcaU.js.map +1 -0
  15. package/dist/prosekit-extensions-autocomplete.d.ts.map +1 -1
  16. package/dist/prosekit-extensions-autocomplete.js.map +1 -1
  17. package/dist/prosekit-extensions-background-color.d.ts +62 -0
  18. package/dist/prosekit-extensions-background-color.d.ts.map +1 -0
  19. package/dist/prosekit-extensions-background-color.js +76 -0
  20. package/dist/prosekit-extensions-background-color.js.map +1 -0
  21. package/dist/prosekit-extensions-blockquote.d.ts.map +1 -1
  22. package/dist/prosekit-extensions-blockquote.js +1 -1
  23. package/dist/prosekit-extensions-blockquote.js.map +1 -1
  24. package/dist/prosekit-extensions-bold.d.ts.map +1 -1
  25. package/dist/prosekit-extensions-bold.js +1 -1
  26. package/dist/prosekit-extensions-bold.js.map +1 -1
  27. package/dist/prosekit-extensions-code-block.d.ts +1 -1
  28. package/dist/prosekit-extensions-code-block.d.ts.map +1 -1
  29. package/dist/prosekit-extensions-code-block.js +4 -4
  30. package/dist/prosekit-extensions-code-block.js.map +1 -1
  31. package/dist/prosekit-extensions-code.d.ts.map +1 -1
  32. package/dist/prosekit-extensions-code.js +1 -1
  33. package/dist/prosekit-extensions-code.js.map +1 -1
  34. package/dist/prosekit-extensions-commit.d.ts +0 -1
  35. package/dist/prosekit-extensions-commit.d.ts.map +1 -1
  36. package/dist/prosekit-extensions-commit.js.map +1 -1
  37. package/dist/prosekit-extensions-doc.d.ts +0 -1
  38. package/dist/prosekit-extensions-doc.d.ts.map +1 -1
  39. package/dist/prosekit-extensions-doc.js.map +1 -1
  40. package/dist/prosekit-extensions-drop-cursor.d.ts.map +1 -1
  41. package/dist/prosekit-extensions-drop-cursor.js.map +1 -1
  42. package/dist/prosekit-extensions-drop-indicator.d.ts +0 -1
  43. package/dist/prosekit-extensions-drop-indicator.d.ts.map +1 -1
  44. package/dist/prosekit-extensions-drop-indicator.js +1 -1
  45. package/dist/prosekit-extensions-enter-rule.d.ts +0 -1
  46. package/dist/prosekit-extensions-enter-rule.d.ts.map +1 -1
  47. package/dist/prosekit-extensions-enter-rule.js +1 -1
  48. package/dist/prosekit-extensions-file.d.ts +1 -1
  49. package/dist/prosekit-extensions-file.js +1 -1
  50. package/dist/prosekit-extensions-gap-cursor.d.ts +0 -1
  51. package/dist/prosekit-extensions-gap-cursor.d.ts.map +1 -1
  52. package/dist/prosekit-extensions-gap-cursor.js.map +1 -1
  53. package/dist/prosekit-extensions-hard-break.d.ts.map +1 -1
  54. package/dist/prosekit-extensions-hard-break.js.map +1 -1
  55. package/dist/prosekit-extensions-heading.d.ts.map +1 -1
  56. package/dist/prosekit-extensions-heading.js +1 -1
  57. package/dist/prosekit-extensions-heading.js.map +1 -1
  58. package/dist/prosekit-extensions-horizontal-rule.d.ts.map +1 -1
  59. package/dist/prosekit-extensions-horizontal-rule.js +1 -1
  60. package/dist/prosekit-extensions-horizontal-rule.js.map +1 -1
  61. package/dist/prosekit-extensions-image.d.ts +9 -2
  62. package/dist/prosekit-extensions-image.d.ts.map +1 -1
  63. package/dist/prosekit-extensions-image.js +17 -4
  64. package/dist/prosekit-extensions-image.js.map +1 -1
  65. package/dist/prosekit-extensions-input-rule.d.ts +0 -1
  66. package/dist/prosekit-extensions-input-rule.d.ts.map +1 -1
  67. package/dist/prosekit-extensions-input-rule.js +1 -1
  68. package/dist/prosekit-extensions-italic.d.ts.map +1 -1
  69. package/dist/prosekit-extensions-italic.js +1 -1
  70. package/dist/prosekit-extensions-italic.js.map +1 -1
  71. package/dist/prosekit-extensions-link.d.ts +0 -1
  72. package/dist/prosekit-extensions-link.d.ts.map +1 -1
  73. package/dist/prosekit-extensions-link.js +4 -4
  74. package/dist/prosekit-extensions-link.js.map +1 -1
  75. package/dist/prosekit-extensions-list.d.ts +0 -1
  76. package/dist/prosekit-extensions-list.d.ts.map +1 -1
  77. package/dist/prosekit-extensions-list.js +3 -3
  78. package/dist/prosekit-extensions-list.js.map +1 -1
  79. package/dist/prosekit-extensions-loro.d.ts.map +1 -1
  80. package/dist/prosekit-extensions-loro.js +2 -2
  81. package/dist/prosekit-extensions-loro.js.map +1 -1
  82. package/dist/prosekit-extensions-mark-rule.d.ts +0 -1
  83. package/dist/prosekit-extensions-mark-rule.d.ts.map +1 -1
  84. package/dist/prosekit-extensions-mark-rule.js +1 -1
  85. package/dist/prosekit-extensions-mention.d.ts.map +1 -1
  86. package/dist/prosekit-extensions-mention.js.map +1 -1
  87. package/dist/prosekit-extensions-mod-click-prevention.d.ts +0 -1
  88. package/dist/prosekit-extensions-mod-click-prevention.d.ts.map +1 -1
  89. package/dist/prosekit-extensions-mod-click-prevention.js.map +1 -1
  90. package/dist/prosekit-extensions-paragraph.d.ts.map +1 -1
  91. package/dist/prosekit-extensions-paragraph.js.map +1 -1
  92. package/dist/prosekit-extensions-paste-rule.d.ts +0 -1
  93. package/dist/prosekit-extensions-paste-rule.d.ts.map +1 -1
  94. package/dist/prosekit-extensions-paste-rule.js +1 -1
  95. package/dist/prosekit-extensions-placeholder.d.ts.map +1 -1
  96. package/dist/prosekit-extensions-placeholder.js +1 -1
  97. package/dist/prosekit-extensions-placeholder.js.map +1 -1
  98. package/dist/prosekit-extensions-readonly.d.ts +0 -1
  99. package/dist/prosekit-extensions-readonly.d.ts.map +1 -1
  100. package/dist/prosekit-extensions-readonly.js.map +1 -1
  101. package/dist/prosekit-extensions-search.d.ts +0 -1
  102. package/dist/prosekit-extensions-search.d.ts.map +1 -1
  103. package/dist/prosekit-extensions-search.js.map +1 -1
  104. package/dist/prosekit-extensions-strike.d.ts +0 -1
  105. package/dist/prosekit-extensions-strike.d.ts.map +1 -1
  106. package/dist/prosekit-extensions-strike.js +1 -1
  107. package/dist/prosekit-extensions-table.d.ts.map +1 -1
  108. package/dist/prosekit-extensions-table.js +1 -1
  109. package/dist/prosekit-extensions-text-align.d.ts +0 -1
  110. package/dist/prosekit-extensions-text-align.d.ts.map +1 -1
  111. package/dist/prosekit-extensions-text-align.js +2 -2
  112. package/dist/prosekit-extensions-text-align.js.map +1 -1
  113. package/dist/prosekit-extensions-text-color.d.ts +62 -0
  114. package/dist/prosekit-extensions-text-color.d.ts.map +1 -0
  115. package/dist/prosekit-extensions-text-color.js +76 -0
  116. package/dist/prosekit-extensions-text-color.js.map +1 -0
  117. package/dist/prosekit-extensions-text.d.ts +0 -1
  118. package/dist/prosekit-extensions-text.d.ts.map +1 -1
  119. package/dist/prosekit-extensions-text.js.map +1 -1
  120. package/dist/prosekit-extensions-underline.d.ts +0 -1
  121. package/dist/prosekit-extensions-underline.d.ts.map +1 -1
  122. package/dist/prosekit-extensions-virtual-selection.d.ts +0 -1
  123. package/dist/prosekit-extensions-virtual-selection.d.ts.map +1 -1
  124. package/dist/prosekit-extensions-virtual-selection.js.map +1 -1
  125. package/dist/prosekit-extensions-yjs.d.ts +9 -2
  126. package/dist/prosekit-extensions-yjs.d.ts.map +1 -1
  127. package/dist/prosekit-extensions-yjs.js.map +1 -1
  128. package/dist/{shiki-highlighter-chunk-rkzofy4z.d.ts → shiki-highlighter-chunk-DNNm2Vow.d.ts} +1 -1
  129. package/dist/shiki-highlighter-chunk-DNNm2Vow.d.ts.map +1 -0
  130. package/dist/shiki-highlighter-chunk.d.ts +1 -1
  131. package/dist/shiki-highlighter-chunk.js.map +1 -1
  132. package/dist/{table-BRDh_9mG.js → table-4oHfV-Ql.js} +2 -2
  133. package/dist/table-4oHfV-Ql.js.map +1 -0
  134. package/package.json +28 -14
  135. package/src/autocomplete/autocomplete-helpers.ts +1 -5
  136. package/src/autocomplete/autocomplete-plugin.ts +3 -13
  137. package/src/autocomplete/autocomplete.spec.ts +4 -19
  138. package/src/autocomplete/autocomplete.ts +1 -7
  139. package/src/background-color/background-color-commands.spec.ts +71 -0
  140. package/src/background-color/background-color-commands.ts +35 -0
  141. package/src/background-color/background-color-spec.spec.ts +286 -0
  142. package/src/background-color/background-color-spec.ts +58 -0
  143. package/src/background-color/background-color.ts +21 -0
  144. package/src/background-color/index.ts +8 -0
  145. package/src/blockquote/blockquote-commands.ts +1 -7
  146. package/src/blockquote/blockquote-keymap.spec.ts +1 -5
  147. package/src/blockquote/blockquote-keymap.ts +1 -6
  148. package/src/blockquote/blockquote-spec.ts +1 -4
  149. package/src/blockquote/blockquote.ts +3 -12
  150. package/src/blockquote/index.ts +3 -12
  151. package/src/bold/bold-commands.ts +1 -5
  152. package/src/bold/bold-input-rule.spec.ts +1 -5
  153. package/src/bold/bold-input-rule.ts +1 -4
  154. package/src/bold/bold-keymap.ts +1 -5
  155. package/src/bold/bold-spec.ts +1 -4
  156. package/src/bold/bold.ts +3 -12
  157. package/src/bold/index.ts +3 -12
  158. package/src/code/code-commands.ts +1 -5
  159. package/src/code/code-input-rule.ts +1 -4
  160. package/src/code/code-keymap.ts +1 -5
  161. package/src/code/code-spec.ts +1 -4
  162. package/src/code/code.ts +3 -12
  163. package/src/code/index.ts +3 -12
  164. package/src/code-block/code-block-commands.ts +1 -8
  165. package/src/code-block/code-block-highlight.ts +2 -8
  166. package/src/code-block/code-block-keymap.ts +2 -9
  167. package/src/code-block/code-block-shiki.ts +1 -4
  168. package/src/code-block/code-block-spec.spec.ts +4 -11
  169. package/src/code-block/code-block-spec.ts +1 -4
  170. package/src/code-block/code-block.ts +4 -16
  171. package/src/code-block/index.ts +5 -21
  172. package/src/code-block/shiki-highlighter-chunk.ts +1 -7
  173. package/src/code-block/shiki-highlighter.ts +1 -4
  174. package/src/code-block/shiki-parser.ts +1 -4
  175. package/src/commit/index.ts +6 -35
  176. package/src/doc/index.ts +1 -4
  177. package/src/drop-cursor/drop-cursor.ts +1 -4
  178. package/src/drop-cursor/index.ts +1 -5
  179. package/src/drop-indicator/drop-indicator-facet.ts +12 -21
  180. package/src/drop-indicator/index.ts +1 -5
  181. package/src/enter-rule/index.ts +2 -11
  182. package/src/file/file-paste-handler.spec.ts +3 -16
  183. package/src/file/index.ts +3 -16
  184. package/src/gap-cursor/gap-cursor.ts +1 -4
  185. package/src/gap-cursor/index.ts +1 -4
  186. package/src/hard-break/hard-break-commands.ts +1 -5
  187. package/src/hard-break/hard-break-keymap.spec.ts +1 -5
  188. package/src/hard-break/hard-break-keymap.ts +1 -4
  189. package/src/hard-break/hard-break-spec.ts +1 -4
  190. package/src/hard-break/hard-break.ts +3 -12
  191. package/src/hard-break/index.ts +3 -12
  192. package/src/heading/heading-commands.ts +1 -7
  193. package/src/heading/heading-keymap.spec.ts +1 -5
  194. package/src/heading/heading-keymap.ts +1 -8
  195. package/src/heading/heading-spec.ts +1 -4
  196. package/src/heading/heading.ts +3 -12
  197. package/src/heading/index.ts +3 -12
  198. package/src/horizontal-rule/horizontal-rule-commands.spec.ts +1 -5
  199. package/src/horizontal-rule/horizontal-rule-commands.ts +2 -9
  200. package/src/horizontal-rule/horizontal-rule-input-rule.spec.ts +5 -9
  201. package/src/horizontal-rule/horizontal-rule-input-rule.ts +1 -5
  202. package/src/horizontal-rule/horizontal-rule-spec.ts +1 -4
  203. package/src/horizontal-rule/horizontal-rule.ts +3 -12
  204. package/src/horizontal-rule/index.ts +3 -13
  205. package/src/image/image-commands/upload-image.spec.ts +245 -0
  206. package/src/image/image-commands/upload-image.ts +46 -11
  207. package/src/image/image-commands.ts +2 -8
  208. package/src/image/image-spec.ts +1 -4
  209. package/src/image/image-upload-handler.ts +2 -8
  210. package/src/image/image.ts +3 -12
  211. package/src/image/index.ts +3 -13
  212. package/src/input-rule/index.ts +2 -13
  213. package/src/italic/index.ts +3 -12
  214. package/src/italic/italic-commands.spec.ts +2 -10
  215. package/src/italic/italic-commands.ts +1 -5
  216. package/src/italic/italic-input-rule.spec.ts +1 -5
  217. package/src/italic/italic-input-rule.ts +1 -4
  218. package/src/italic/italic-keymap.ts +1 -5
  219. package/src/italic/italic-spec.ts +1 -4
  220. package/src/italic/italic.ts +3 -12
  221. package/src/link/index.spec.ts +1 -5
  222. package/src/link/index.ts +1 -5
  223. package/src/link/link-paste-rule.spec.ts +2 -9
  224. package/src/link/link-regex.spec.ts +1 -5
  225. package/src/list/index.ts +3 -12
  226. package/src/list/list-commands.ts +1 -5
  227. package/src/list/list-input-rules.ts +1 -4
  228. package/src/list/list-keymap.spec.ts +1 -5
  229. package/src/list/list-keymap.ts +2 -8
  230. package/src/list/list-plugins.ts +1 -4
  231. package/src/list/list-serializer.ts +2 -9
  232. package/src/list/list-spec.ts +3 -13
  233. package/src/list/list.spec.ts +10 -21
  234. package/src/list/list.ts +3 -12
  235. package/src/loro/index.ts +3 -13
  236. package/src/loro/loro-commands.ts +2 -8
  237. package/src/loro/loro-cursor-plugin.ts +3 -13
  238. package/src/loro/loro-keymap.ts +2 -10
  239. package/src/loro/loro-sync-plugin.ts +2 -8
  240. package/src/loro/loro-undo-plugin.ts +2 -8
  241. package/src/loro/loro.ts +2 -11
  242. package/src/mark-rule/apply.ts +3 -13
  243. package/src/mark-rule/mark-rule.spec.ts +2 -13
  244. package/src/mark-rule/mark-rule.ts +2 -13
  245. package/src/mark-rule/range.ts +2 -8
  246. package/src/mark-rule/types.ts +1 -4
  247. package/src/mention/index.ts +1 -8
  248. package/src/mod-click-prevention/index.ts +2 -9
  249. package/src/paragraph/paragraph-commands.ts +1 -5
  250. package/src/paragraph/paragraph-keymap.ts +1 -4
  251. package/src/paragraph/paragraph-spec.ts +1 -4
  252. package/src/paragraph/paragraph.ts +3 -14
  253. package/src/paste-rule/index.ts +2 -10
  254. package/src/paste-rule/mark-paste-rule.spec.ts +3 -13
  255. package/src/paste-rule/mark-paste-rule.ts +4 -14
  256. package/src/paste-rule/paste-rule-plugin.ts +2 -11
  257. package/src/paste-rule/paste-rule.spec.ts +4 -19
  258. package/src/paste-rule/split-text-by-regex.spec.ts +1 -5
  259. package/src/placeholder/index.ts +3 -16
  260. package/src/readonly/index.ts +2 -8
  261. package/src/search/index.ts +1 -6
  262. package/src/table/index.ts +10 -40
  263. package/src/table/table-commands/delete-cell-selection.spec.ts +1 -5
  264. package/src/table/table-commands/exit-table.spec.ts +1 -5
  265. package/src/table/table-commands/insert-table.spec.ts +1 -5
  266. package/src/table/table-commands/insert-table.ts +1 -4
  267. package/src/table/table-commands/move-table-column.spec.ts +1 -5
  268. package/src/table/table-commands/move-table-column.ts +1 -4
  269. package/src/table/table-commands/move-table-row.spec.ts +1 -5
  270. package/src/table/table-commands/move-table-row.ts +1 -4
  271. package/src/table/table-commands/select-table-cell.spec.ts +1 -5
  272. package/src/table/table-commands/select-table-column.spec.ts +1 -5
  273. package/src/table/table-commands/select-table-row.spec.ts +1 -5
  274. package/src/table/table-commands/select-table.spec.ts +1 -5
  275. package/src/table/table-commands/select-table.ts +1 -4
  276. package/src/table/table-commands.ts +8 -32
  277. package/src/table/table-plugins.ts +2 -8
  278. package/src/table/table-spec.spec.ts +2 -11
  279. package/src/table/table-spec.ts +2 -8
  280. package/src/table/table-utils.ts +2 -6
  281. package/src/table/table.ts +2 -8
  282. package/src/table/test-utils.ts +1 -4
  283. package/src/testing/clipboard.ts +1 -2
  284. package/src/testing/index.ts +7 -12
  285. package/src/text/index.ts +1 -4
  286. package/src/text-align/index.ts +2 -2
  287. package/src/text-color/index.ts +3 -0
  288. package/src/text-color/text-color-commands.spec.ts +71 -0
  289. package/src/text-color/text-color-commands.ts +35 -0
  290. package/src/text-color/text-color-spec.spec.ts +297 -0
  291. package/src/text-color/text-color-spec.ts +58 -0
  292. package/src/text-color/text-color.ts +21 -0
  293. package/src/virtual-selection/index.ts +3 -14
  294. package/src/yjs/index.ts +5 -20
  295. package/src/yjs/yjs-commands.ts +2 -8
  296. package/src/yjs/yjs-cursor-plugin.ts +3 -5
  297. package/src/yjs/yjs-keymap.ts +2 -10
  298. package/src/yjs/yjs-sync-plugin.ts +1 -4
  299. package/src/yjs/yjs-types.ts +10 -0
  300. package/src/yjs/yjs-undo-plugin.ts +2 -8
  301. package/src/yjs/yjs.ts +6 -24
  302. package/dist/drop-indicator-B1QHFb5m.js.map +0 -1
  303. package/dist/enter-rule-CzWOZF_Z.js.map +0 -1
  304. package/dist/file-DrfcSid-.js.map +0 -1
  305. package/dist/index-oIc1a2f2.d.ts.map +0 -1
  306. package/dist/input-rule-dmsb3j6w.js.map +0 -1
  307. package/dist/mark-rule-BcLB4Uv2.js.map +0 -1
  308. package/dist/paste-rule-pVb4sqvJ.js.map +0 -1
  309. package/dist/shiki-highlighter-chunk-rkzofy4z.d.ts.map +0 -1
  310. package/dist/table-BRDh_9mG.js.map +0 -1
  311. package/src/testing/format-html.ts +0 -5
@@ -0,0 +1,58 @@
1
+ import { defineMarkSpec, type Extension } from '@prosekit/core'
2
+
3
+ /**
4
+ * Attributes for the `backgroundColor` mark.
5
+ *
6
+ * @public
7
+ */
8
+ export interface BackgroundColorAttrs {
9
+ color: string
10
+ }
11
+
12
+ /**
13
+ * @internal
14
+ */
15
+ export type BackgroundColorSpecExtension = Extension<{
16
+ Marks: {
17
+ backgroundColor: BackgroundColorAttrs
18
+ }
19
+ }>
20
+
21
+ /**
22
+ * @internal
23
+ */
24
+ export function defineBackgroundColorSpec(): BackgroundColorSpecExtension {
25
+ return defineMarkSpec<'backgroundColor', BackgroundColorAttrs>({
26
+ name: 'backgroundColor',
27
+ attrs: {
28
+ color: {
29
+ validate: 'string',
30
+ },
31
+ },
32
+ parseDOM: [
33
+ {
34
+ tag: ':where([style*="background-color:"], [data-background-color])',
35
+ getAttrs: (node): BackgroundColorAttrs | false => {
36
+ // When both `data-background-color` and `style="background-color"` are present, we
37
+ // prioritize the `data-background-color` attribute. This avoids the
38
+ // browser's default behavior of changing hex colors to rgba in style
39
+ // attribute.
40
+ const value = node.getAttribute('data-background-color')
41
+ if (value && value !== 'inherit') {
42
+ return { color: value }
43
+ }
44
+ const color = node.style.backgroundColor
45
+ if (color && color !== 'inherit') {
46
+ return { color }
47
+ }
48
+ return false
49
+ },
50
+ consuming: false,
51
+ },
52
+ ],
53
+ toDOM(mark) {
54
+ const color = (mark.attrs as BackgroundColorAttrs).color
55
+ return ['span', { 'style': `background-color: ${color};`, 'data-background-color': color }, 0]
56
+ },
57
+ })
58
+ }
@@ -0,0 +1,21 @@
1
+ import { union, type Union } from '@prosekit/core'
2
+
3
+ import { defineBackgroundColorCommands, type BackgroundColorCommandsExtension } from './background-color-commands'
4
+ import { defineBackgroundColorSpec, type BackgroundColorSpecExtension } from './background-color-spec'
5
+
6
+ /**
7
+ * @internal
8
+ */
9
+ export type BackgroundColorExtension = Union<[BackgroundColorSpecExtension, BackgroundColorCommandsExtension]>
10
+
11
+ /**
12
+ * Defines the `backgroundColor` mark and some commands for it.
13
+ *
14
+ * @public
15
+ */
16
+ export function defineBackgroundColor(): BackgroundColorExtension {
17
+ return union(
18
+ defineBackgroundColorSpec(),
19
+ defineBackgroundColorCommands(),
20
+ )
21
+ }
@@ -0,0 +1,8 @@
1
+ export { defineBackgroundColor, type BackgroundColorExtension } from './background-color'
2
+ export {
3
+ addBackgroundColor,
4
+ defineBackgroundColorCommands,
5
+ removeBackgroundColor,
6
+ type BackgroundColorCommandsExtension,
7
+ } from './background-color-commands'
8
+ export { defineBackgroundColorSpec, type BackgroundColorAttrs, type BackgroundColorSpecExtension } from './background-color-spec'
@@ -1,10 +1,4 @@
1
- import {
2
- defineCommands,
3
- insertNode,
4
- toggleWrap,
5
- wrap,
6
- type Extension,
7
- } from '@prosekit/core'
1
+ import { defineCommands, insertNode, toggleWrap, wrap, type Extension } from '@prosekit/core'
8
2
 
9
3
  export type BlockquoteCommandsExtension = Extension<{
10
4
  Commands: {
@@ -1,8 +1,4 @@
1
- import {
2
- describe,
3
- expect,
4
- it,
5
- } from 'vitest'
1
+ import { describe, expect, it } from 'vitest'
6
2
  import { keyboard } from 'vitest-browser-commands/playwright'
7
3
 
8
4
  import { setupTest } from '../testing'
@@ -1,9 +1,4 @@
1
- import {
2
- defineKeymap,
3
- isAtBlockStart,
4
- toggleWrap,
5
- type PlainExtension,
6
- } from '@prosekit/core'
1
+ import { defineKeymap, isAtBlockStart, toggleWrap, type PlainExtension } from '@prosekit/core'
7
2
  import { joinBackward } from '@prosekit/pm/commands'
8
3
  import type { Command } from '@prosekit/pm/state'
9
4
 
@@ -1,7 +1,4 @@
1
- import {
2
- defineNodeSpec,
3
- type Extension,
4
- } from '@prosekit/core'
1
+ import { defineNodeSpec, type Extension } from '@prosekit/core'
5
2
  import type { Attrs } from '@prosekit/pm/model'
6
3
 
7
4
  export type BlockquoteSpecExtension = Extension<{
@@ -1,18 +1,9 @@
1
- import {
2
- union,
3
- type Union,
4
- } from '@prosekit/core'
1
+ import { union, type Union } from '@prosekit/core'
5
2
 
6
- import {
7
- defineBlockquoteCommands,
8
- type BlockquoteCommandsExtension,
9
- } from './blockquote-commands'
3
+ import { defineBlockquoteCommands, type BlockquoteCommandsExtension } from './blockquote-commands'
10
4
  import { defineBlockquoteInputRule } from './blockquote-input-rule'
11
5
  import { defineBlockquoteKeymap } from './blockquote-keymap'
12
- import {
13
- defineBlockquoteSpec,
14
- type BlockquoteSpecExtension,
15
- } from './blockquote-spec'
6
+ import { defineBlockquoteSpec, type BlockquoteSpecExtension } from './blockquote-spec'
16
7
 
17
8
  /**
18
9
  * @internal
@@ -1,14 +1,5 @@
1
- export {
2
- defineBlockquote,
3
- type BlockquoteExtension,
4
- } from './blockquote'
5
- export {
6
- defineBlockquoteCommands,
7
- type BlockquoteCommandsExtension,
8
- } from './blockquote-commands'
1
+ export { defineBlockquote, type BlockquoteExtension } from './blockquote'
2
+ export { defineBlockquoteCommands, type BlockquoteCommandsExtension } from './blockquote-commands'
9
3
  export { defineBlockquoteInputRule } from './blockquote-input-rule'
10
4
  export { defineBlockquoteKeymap } from './blockquote-keymap'
11
- export {
12
- defineBlockquoteSpec,
13
- type BlockquoteSpecExtension,
14
- } from './blockquote-spec'
5
+ export { defineBlockquoteSpec, type BlockquoteSpecExtension } from './blockquote-spec'
@@ -1,8 +1,4 @@
1
- import {
2
- defineCommands,
3
- toggleMark,
4
- type Extension,
5
- } from '@prosekit/core'
1
+ import { defineCommands, toggleMark, type Extension } from '@prosekit/core'
6
2
 
7
3
  /**
8
4
  * @internal
@@ -1,8 +1,4 @@
1
- import {
2
- describe,
3
- expect,
4
- it,
5
- } from 'vitest'
1
+ import { describe, expect, it } from 'vitest'
6
2
 
7
3
  import { setupTest } from '../testing'
8
4
  import { inputText } from '../testing/keyboard'
@@ -1,7 +1,4 @@
1
- import {
2
- canUseRegexLookbehind,
3
- type PlainExtension,
4
- } from '@prosekit/core'
1
+ import { canUseRegexLookbehind, type PlainExtension } from '@prosekit/core'
5
2
 
6
3
  import { defineMarkInputRule } from '../input-rule'
7
4
 
@@ -1,8 +1,4 @@
1
- import {
2
- defineKeymap,
3
- toggleMark,
4
- type PlainExtension,
5
- } from '@prosekit/core'
1
+ import { defineKeymap, toggleMark, type PlainExtension } from '@prosekit/core'
6
2
 
7
3
  /**
8
4
  * @internal
@@ -1,7 +1,4 @@
1
- import {
2
- defineMarkSpec,
3
- type Extension,
4
- } from '@prosekit/core'
1
+ import { defineMarkSpec, type Extension } from '@prosekit/core'
5
2
  import type { Attrs } from '@prosekit/pm/model'
6
3
 
7
4
  /**
package/src/bold/bold.ts CHANGED
@@ -1,18 +1,9 @@
1
- import {
2
- union,
3
- type Union,
4
- } from '@prosekit/core'
1
+ import { union, type Union } from '@prosekit/core'
5
2
 
6
- import {
7
- defineBoldCommands,
8
- type BoldCommandsExtension,
9
- } from './bold-commands'
3
+ import { defineBoldCommands, type BoldCommandsExtension } from './bold-commands'
10
4
  import { defineBoldInputRule } from './bold-input-rule'
11
5
  import { defineBoldKeymap } from './bold-keymap'
12
- import {
13
- defineBoldSpec,
14
- type BoldSpecExtension,
15
- } from './bold-spec'
6
+ import { defineBoldSpec, type BoldSpecExtension } from './bold-spec'
16
7
 
17
8
  /**
18
9
  * @internal
package/src/bold/index.ts CHANGED
@@ -1,14 +1,5 @@
1
- export {
2
- defineBold,
3
- type BoldExtension,
4
- } from './bold'
5
- export {
6
- defineBoldCommands,
7
- type BoldCommandsExtension,
8
- } from './bold-commands'
1
+ export { defineBold, type BoldExtension } from './bold'
2
+ export { defineBoldCommands, type BoldCommandsExtension } from './bold-commands'
9
3
  export { defineBoldInputRule } from './bold-input-rule'
10
4
  export { defineBoldKeymap } from './bold-keymap'
11
- export {
12
- defineBoldSpec,
13
- type BoldSpecExtension,
14
- } from './bold-spec'
5
+ export { defineBoldSpec, type BoldSpecExtension } from './bold-spec'
@@ -1,8 +1,4 @@
1
- import {
2
- defineCommands,
3
- toggleMark,
4
- type Extension,
5
- } from '@prosekit/core'
1
+ import { defineCommands, toggleMark, type Extension } from '@prosekit/core'
6
2
 
7
3
  /**
8
4
  * @internal
@@ -1,7 +1,4 @@
1
- import {
2
- canUseRegexLookbehind,
3
- type PlainExtension,
4
- } from '@prosekit/core'
1
+ import { canUseRegexLookbehind, type PlainExtension } from '@prosekit/core'
5
2
 
6
3
  import { defineMarkInputRule } from '../input-rule'
7
4
 
@@ -1,8 +1,4 @@
1
- import {
2
- defineKeymap,
3
- toggleMark,
4
- type PlainExtension,
5
- } from '@prosekit/core'
1
+ import { defineKeymap, toggleMark, type PlainExtension } from '@prosekit/core'
6
2
 
7
3
  /**
8
4
  * @internal
@@ -1,7 +1,4 @@
1
- import {
2
- defineMarkSpec,
3
- type Extension,
4
- } from '@prosekit/core'
1
+ import { defineMarkSpec, type Extension } from '@prosekit/core'
5
2
  import type { Attrs } from '@prosekit/pm/model'
6
3
 
7
4
  /**
package/src/code/code.ts CHANGED
@@ -1,18 +1,9 @@
1
- import {
2
- union,
3
- type Union,
4
- } from '@prosekit/core'
1
+ import { union, type Union } from '@prosekit/core'
5
2
 
6
- import {
7
- defineCodeCommands,
8
- type CodeCommandsExtension,
9
- } from './code-commands'
3
+ import { defineCodeCommands, type CodeCommandsExtension } from './code-commands'
10
4
  import { defineCodeInputRule } from './code-input-rule'
11
5
  import { defineCodeKeymap } from './code-keymap'
12
- import {
13
- defineCodeSpec,
14
- type CodeSpecExtension,
15
- } from './code-spec'
6
+ import { defineCodeSpec, type CodeSpecExtension } from './code-spec'
16
7
 
17
8
  /**
18
9
  * @internal
package/src/code/index.ts CHANGED
@@ -1,14 +1,5 @@
1
- export {
2
- defineCode,
3
- type CodeExtension,
4
- } from './code'
5
- export {
6
- defineCodeCommands,
7
- type CodeCommandsExtension,
8
- } from './code-commands'
1
+ export { defineCode, type CodeExtension } from './code'
2
+ export { defineCodeCommands, type CodeCommandsExtension } from './code-commands'
9
3
  export { defineCodeInputRule } from './code-input-rule'
10
4
  export { defineCodeKeymap } from './code-keymap'
11
- export {
12
- defineCodeSpec,
13
- type CodeSpecExtension,
14
- } from './code-spec'
5
+ export { defineCodeSpec, type CodeSpecExtension } from './code-spec'
@@ -1,11 +1,4 @@
1
- import {
2
- defineCommands,
3
- insertNode,
4
- setBlockType,
5
- setNodeAttrs,
6
- toggleNode,
7
- type Extension,
8
- } from '@prosekit/core'
1
+ import { defineCommands, insertNode, setBlockType, setNodeAttrs, toggleNode, type Extension } from '@prosekit/core'
9
2
 
10
3
  import type { CodeBlockAttrs } from './code-block-types'
11
4
 
@@ -1,11 +1,5 @@
1
- import {
2
- definePlugin,
3
- type Extension,
4
- } from '@prosekit/core'
5
- import {
6
- createHighlightPlugin,
7
- type Parser,
8
- } from 'prosemirror-highlight'
1
+ import { definePlugin, type Extension } from '@prosekit/core'
2
+ import { createHighlightPlugin, type Parser } from 'prosemirror-highlight'
9
3
 
10
4
  /**
11
5
  * @public
@@ -1,12 +1,5 @@
1
- import {
2
- defaultBlockAt,
3
- defineKeymap,
4
- type PlainExtension,
5
- } from '@prosekit/core'
6
- import {
7
- TextSelection,
8
- type Command,
9
- } from '@prosekit/pm/state'
1
+ import { defaultBlockAt, defineKeymap, type PlainExtension } from '@prosekit/core'
2
+ import { TextSelection, type Command } from '@prosekit/pm/state'
10
3
 
11
4
  /**
12
5
  * Defines the keymap for code blocks.
@@ -2,10 +2,7 @@ import type { Extension } from '@prosekit/core'
2
2
  import type { SpecialLanguage } from 'shiki'
3
3
 
4
4
  import { defineCodeBlockHighlight } from './code-block-highlight'
5
- import type {
6
- ShikiBundledLanguage,
7
- ShikiBundledTheme,
8
- } from './shiki-bundle'
5
+ import type { ShikiBundledLanguage, ShikiBundledTheme } from './shiki-bundle'
9
6
  import type { ShikiHighlighterOptions } from './shiki-highlighter-chunk'
10
7
  import { createLazyParser } from './shiki-parser'
11
8
 
@@ -1,16 +1,9 @@
1
1
  import { jsonFromHTML } from '@prosekit/core'
2
- import {
3
- describe,
4
- expect,
5
- it,
6
- } from 'vitest'
2
+ import { formatHTML } from 'diffable-html-snapshot'
3
+ import { describe, expect, it } from 'vitest'
7
4
 
8
5
  import { setupTest } from '../testing'
9
- import { formatHTML } from '../testing/format-html'
10
- import {
11
- htmlFromMarkdown,
12
- markdownFromHTML,
13
- } from '../testing/markdown'
6
+ import { htmlFromMarkdown, markdownFromHTML } from '../testing/markdown'
14
7
 
15
8
  describe('defineCodeBlockSpec', () => {
16
9
  it('can parse and serialize code blocks', () => {
@@ -152,7 +145,7 @@ describe('defineCodeBlockSpec', () => {
152
145
  editor.set(n.doc(n.codeBlock({ language: 'javascript' }, '123')))
153
146
  const html = editor.getDocHTML()
154
147
  expect(html).toMatchInlineSnapshot(`"<div><pre data-language="javascript"><code class="language-javascript">123</code></pre></div>"`)
155
- let markdown = markdownFromHTML(html)
148
+ const markdown = markdownFromHTML(html)
156
149
  expect(markdown).toMatchInlineSnapshot(`
157
150
  "\`\`\`javascript
158
151
  123
@@ -1,7 +1,4 @@
1
- import {
2
- defineNodeSpec,
3
- type Extension,
4
- } from '@prosekit/core'
1
+ import { defineNodeSpec, type Extension } from '@prosekit/core'
5
2
 
6
3
  import type { CodeBlockAttrs } from './code-block-types'
7
4
 
@@ -1,21 +1,9 @@
1
- import {
2
- union,
3
- type Union,
4
- } from '@prosekit/core'
1
+ import { union, type Union } from '@prosekit/core'
5
2
 
6
- import {
7
- defineCodeBlockCommands,
8
- type CodeBlockCommandsExtension,
9
- } from './code-block-commands'
10
- import {
11
- defineCodeBlockEnterRule,
12
- defineCodeBlockInputRule,
13
- } from './code-block-input-rule'
3
+ import { defineCodeBlockCommands, type CodeBlockCommandsExtension } from './code-block-commands'
4
+ import { defineCodeBlockEnterRule, defineCodeBlockInputRule } from './code-block-input-rule'
14
5
  import { defineCodeBlockKeymap } from './code-block-keymap'
15
- import {
16
- defineCodeBlockSpec,
17
- type CodeBlockSpecExtension,
18
- } from './code-block-spec'
6
+ import { defineCodeBlockSpec, type CodeBlockSpecExtension } from './code-block-spec'
19
7
 
20
8
  /**
21
9
  * @internal
@@ -1,26 +1,10 @@
1
- export {
2
- defineCodeBlock,
3
- type CodeBlockExtension,
4
- } from './code-block'
5
- export {
6
- defineCodeBlockCommands,
7
- type CodeBlockCommandsExtension,
8
- } from './code-block-commands'
9
- export {
10
- defineCodeBlockHighlight,
11
- type CodeBlockHighlightOptions,
12
- type HighlightParser,
13
- } from './code-block-highlight'
14
- export {
15
- defineCodeBlockEnterRule,
16
- defineCodeBlockInputRule,
17
- } from './code-block-input-rule'
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'
18
5
  export { defineCodeBlockKeymap } from './code-block-keymap'
19
6
  export { defineCodeBlockShiki } from './code-block-shiki'
20
- export {
21
- defineCodeBlockSpec,
22
- type CodeBlockSpecExtension,
23
- } from './code-block-spec'
7
+ export { defineCodeBlockSpec, type CodeBlockSpecExtension } from './code-block-spec'
24
8
  export type { CodeBlockAttrs } from './code-block-types'
25
9
  export {
26
10
  shikiBundledLanguagesInfo,
@@ -1,10 +1,4 @@
1
- import type {
2
- BundledHighlighterOptions,
3
- BundledLanguage,
4
- BundledTheme,
5
- Highlighter,
6
- SpecialLanguage,
7
- } from 'shiki'
1
+ import type { BundledHighlighterOptions, BundledLanguage, BundledTheme, Highlighter, SpecialLanguage } from 'shiki'
8
2
  import { createHighlighter } from 'shiki/bundle/full'
9
3
  import { createJavaScriptRegexEngine } from 'shiki/engine/javascript'
10
4
 
@@ -1,7 +1,4 @@
1
- import type {
2
- HighlighterOptions,
3
- HighlighterResult,
4
- } from './shiki-highlighter-chunk'
1
+ import type { HighlighterOptions, HighlighterResult } from './shiki-highlighter-chunk'
5
2
 
6
3
  let loaded: ((options: HighlighterOptions) => HighlighterResult) | undefined
7
4
 
@@ -2,10 +2,7 @@ import type { Parser } from 'prosemirror-highlight'
2
2
  import { createParser } from 'prosemirror-highlight/shiki'
3
3
 
4
4
  import type { ShikiBundledLanguage } from './shiki-bundle'
5
- import {
6
- createOrGetHighlighter,
7
- type HighlighterOptions,
8
- } from './shiki-highlighter'
5
+ import { createOrGetHighlighter, type HighlighterOptions } from './shiki-highlighter'
9
6
 
10
7
  /**
11
8
  * @internal
@@ -1,33 +1,9 @@
1
- import {
2
- defineDefaultState,
3
- definePlugin,
4
- jsonFromNode,
5
- union,
6
- type NodeJSON,
7
- type PlainExtension,
8
- type StepJSON,
9
- } from '@prosekit/core'
10
- import {
11
- DOMSerializer,
12
- Fragment,
13
- Slice,
14
- type ProseMirrorNode,
15
- } from '@prosekit/pm/model'
16
- import {
17
- PluginKey,
18
- ProseMirrorPlugin,
19
- type Transaction,
20
- } from '@prosekit/pm/state'
1
+ import { defineDefaultState, definePlugin, jsonFromNode, union, type NodeJSON, type PlainExtension, type StepJSON } from '@prosekit/core'
2
+ import { DOMSerializer, Fragment, Slice, type ProseMirrorNode } from '@prosekit/pm/model'
3
+ import { PluginKey, ProseMirrorPlugin, type Transaction } from '@prosekit/pm/state'
21
4
  import { Step } from '@prosekit/pm/transform'
22
- import {
23
- Decoration,
24
- DecorationSet,
25
- type EditorView,
26
- } from '@prosekit/pm/view'
27
- import {
28
- ChangeSet,
29
- type Change,
30
- } from 'prosemirror-changeset'
5
+ import { Decoration, DecorationSet, type EditorView } from '@prosekit/pm/view'
6
+ import { ChangeSet, type Change } from 'prosemirror-changeset'
31
7
 
32
8
  /**
33
9
  * A JSON representation of a commit.
@@ -322,9 +298,4 @@ function defineCommitRecorder(commitRecorder: CommitRecorder): PlainExtension {
322
298
  )
323
299
  }
324
300
 
325
- export {
326
- CommitRecorder,
327
- defineCommitRecorder,
328
- defineCommitViewer,
329
- type Commit,
330
- }
301
+ export { CommitRecorder, defineCommitRecorder, defineCommitViewer, type Commit }
package/src/doc/index.ts CHANGED
@@ -1,7 +1,4 @@
1
- import {
2
- defineNodeSpec,
3
- type Extension,
4
- } from '@prosekit/core'
1
+ import { defineNodeSpec, type Extension } from '@prosekit/core'
5
2
  import type { Attrs } from '@prosekit/pm/model'
6
3
 
7
4
  /**
@@ -1,7 +1,4 @@
1
- import {
2
- definePlugin,
3
- type PlainExtension,
4
- } from '@prosekit/core'
1
+ import { definePlugin, type PlainExtension } from '@prosekit/core'
5
2
  import { dropCursor } from 'prosemirror-dropcursor'
6
3
 
7
4
  export interface DropCursorOptions {
@@ -1,5 +1 @@
1
- export {
2
- defineDropCursor,
3
- type DropCursorExtension,
4
- type DropCursorOptions,
5
- } from './drop-cursor'
1
+ export { defineDropCursor, type DropCursorExtension, type DropCursorOptions } from './drop-cursor'