@prosekit/extensions 0.12.2 → 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 (324) 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/list/style.css +5 -5
  12. package/dist/list/style.css.map +1 -1
  13. package/dist/{mark-rule-BcLB4Uv2.js → mark-rule-CYe8zk4q.js} +6 -6
  14. package/dist/mark-rule-CYe8zk4q.js.map +1 -0
  15. package/dist/{paste-rule-pVb4sqvJ.js → paste-rule-BaDghcaU.js} +7 -7
  16. package/dist/paste-rule-BaDghcaU.js.map +1 -0
  17. package/dist/prosekit-extensions-autocomplete.d.ts +11 -3
  18. package/dist/prosekit-extensions-autocomplete.d.ts.map +1 -1
  19. package/dist/prosekit-extensions-autocomplete.js +171 -60
  20. package/dist/prosekit-extensions-autocomplete.js.map +1 -1
  21. package/dist/prosekit-extensions-background-color.d.ts +62 -0
  22. package/dist/prosekit-extensions-background-color.d.ts.map +1 -0
  23. package/dist/prosekit-extensions-background-color.js +76 -0
  24. package/dist/prosekit-extensions-background-color.js.map +1 -0
  25. package/dist/prosekit-extensions-blockquote.d.ts.map +1 -1
  26. package/dist/prosekit-extensions-blockquote.js +2 -2
  27. package/dist/prosekit-extensions-blockquote.js.map +1 -1
  28. package/dist/prosekit-extensions-bold.d.ts.map +1 -1
  29. package/dist/prosekit-extensions-bold.js +1 -1
  30. package/dist/prosekit-extensions-bold.js.map +1 -1
  31. package/dist/prosekit-extensions-code-block.d.ts +1 -1
  32. package/dist/prosekit-extensions-code-block.d.ts.map +1 -1
  33. package/dist/prosekit-extensions-code-block.js +4 -4
  34. package/dist/prosekit-extensions-code-block.js.map +1 -1
  35. package/dist/prosekit-extensions-code.d.ts.map +1 -1
  36. package/dist/prosekit-extensions-code.js +1 -1
  37. package/dist/prosekit-extensions-code.js.map +1 -1
  38. package/dist/prosekit-extensions-commit.d.ts +0 -1
  39. package/dist/prosekit-extensions-commit.d.ts.map +1 -1
  40. package/dist/prosekit-extensions-commit.js +1 -1
  41. package/dist/prosekit-extensions-commit.js.map +1 -1
  42. package/dist/prosekit-extensions-doc.d.ts +0 -1
  43. package/dist/prosekit-extensions-doc.d.ts.map +1 -1
  44. package/dist/prosekit-extensions-doc.js.map +1 -1
  45. package/dist/prosekit-extensions-drop-cursor.d.ts.map +1 -1
  46. package/dist/prosekit-extensions-drop-cursor.js.map +1 -1
  47. package/dist/prosekit-extensions-drop-indicator.d.ts +0 -1
  48. package/dist/prosekit-extensions-drop-indicator.d.ts.map +1 -1
  49. package/dist/prosekit-extensions-drop-indicator.js +1 -1
  50. package/dist/prosekit-extensions-enter-rule.d.ts +0 -1
  51. package/dist/prosekit-extensions-enter-rule.d.ts.map +1 -1
  52. package/dist/prosekit-extensions-enter-rule.js +1 -1
  53. package/dist/prosekit-extensions-file.d.ts +1 -1
  54. package/dist/prosekit-extensions-file.js +1 -1
  55. package/dist/prosekit-extensions-gap-cursor.d.ts +0 -1
  56. package/dist/prosekit-extensions-gap-cursor.d.ts.map +1 -1
  57. package/dist/prosekit-extensions-gap-cursor.js.map +1 -1
  58. package/dist/prosekit-extensions-hard-break.d.ts.map +1 -1
  59. package/dist/prosekit-extensions-hard-break.js.map +1 -1
  60. package/dist/prosekit-extensions-heading.d.ts.map +1 -1
  61. package/dist/prosekit-extensions-heading.js +7 -7
  62. package/dist/prosekit-extensions-heading.js.map +1 -1
  63. package/dist/prosekit-extensions-horizontal-rule.d.ts.map +1 -1
  64. package/dist/prosekit-extensions-horizontal-rule.js +1 -1
  65. package/dist/prosekit-extensions-horizontal-rule.js.map +1 -1
  66. package/dist/prosekit-extensions-image.d.ts +9 -2
  67. package/dist/prosekit-extensions-image.d.ts.map +1 -1
  68. package/dist/prosekit-extensions-image.js +17 -4
  69. package/dist/prosekit-extensions-image.js.map +1 -1
  70. package/dist/prosekit-extensions-input-rule.d.ts +0 -1
  71. package/dist/prosekit-extensions-input-rule.d.ts.map +1 -1
  72. package/dist/prosekit-extensions-input-rule.js +1 -1
  73. package/dist/prosekit-extensions-italic.d.ts.map +1 -1
  74. package/dist/prosekit-extensions-italic.js +1 -1
  75. package/dist/prosekit-extensions-italic.js.map +1 -1
  76. package/dist/prosekit-extensions-link.d.ts +0 -1
  77. package/dist/prosekit-extensions-link.d.ts.map +1 -1
  78. package/dist/prosekit-extensions-link.js +4 -4
  79. package/dist/prosekit-extensions-link.js.map +1 -1
  80. package/dist/prosekit-extensions-list.d.ts +0 -1
  81. package/dist/prosekit-extensions-list.d.ts.map +1 -1
  82. package/dist/prosekit-extensions-list.js +3 -3
  83. package/dist/prosekit-extensions-list.js.map +1 -1
  84. package/dist/prosekit-extensions-loro.d.ts +16 -17
  85. package/dist/prosekit-extensions-loro.d.ts.map +1 -1
  86. package/dist/prosekit-extensions-loro.js +14 -7
  87. package/dist/prosekit-extensions-loro.js.map +1 -1
  88. package/dist/prosekit-extensions-mark-rule.d.ts +0 -1
  89. package/dist/prosekit-extensions-mark-rule.d.ts.map +1 -1
  90. package/dist/prosekit-extensions-mark-rule.js +1 -1
  91. package/dist/prosekit-extensions-mention.d.ts.map +1 -1
  92. package/dist/prosekit-extensions-mention.js.map +1 -1
  93. package/dist/prosekit-extensions-mod-click-prevention.d.ts +0 -1
  94. package/dist/prosekit-extensions-mod-click-prevention.d.ts.map +1 -1
  95. package/dist/prosekit-extensions-mod-click-prevention.js.map +1 -1
  96. package/dist/prosekit-extensions-paragraph.d.ts.map +1 -1
  97. package/dist/prosekit-extensions-paragraph.js +1 -1
  98. package/dist/prosekit-extensions-paragraph.js.map +1 -1
  99. package/dist/prosekit-extensions-paste-rule.d.ts +0 -1
  100. package/dist/prosekit-extensions-paste-rule.d.ts.map +1 -1
  101. package/dist/prosekit-extensions-paste-rule.js +1 -1
  102. package/dist/prosekit-extensions-placeholder.d.ts.map +1 -1
  103. package/dist/prosekit-extensions-placeholder.js +3 -4
  104. package/dist/prosekit-extensions-placeholder.js.map +1 -1
  105. package/dist/prosekit-extensions-readonly.d.ts +0 -1
  106. package/dist/prosekit-extensions-readonly.d.ts.map +1 -1
  107. package/dist/prosekit-extensions-readonly.js.map +1 -1
  108. package/dist/prosekit-extensions-search.d.ts +0 -1
  109. package/dist/prosekit-extensions-search.d.ts.map +1 -1
  110. package/dist/prosekit-extensions-search.js.map +1 -1
  111. package/dist/prosekit-extensions-strike.d.ts +0 -1
  112. package/dist/prosekit-extensions-strike.d.ts.map +1 -1
  113. package/dist/prosekit-extensions-strike.js +3 -3
  114. package/dist/prosekit-extensions-strike.js.map +1 -1
  115. package/dist/prosekit-extensions-table.d.ts.map +1 -1
  116. package/dist/prosekit-extensions-table.js +1 -2
  117. package/dist/prosekit-extensions-text-align.d.ts +0 -1
  118. package/dist/prosekit-extensions-text-align.d.ts.map +1 -1
  119. package/dist/prosekit-extensions-text-align.js +6 -6
  120. package/dist/prosekit-extensions-text-align.js.map +1 -1
  121. package/dist/prosekit-extensions-text-color.d.ts +62 -0
  122. package/dist/prosekit-extensions-text-color.d.ts.map +1 -0
  123. package/dist/prosekit-extensions-text-color.js +76 -0
  124. package/dist/prosekit-extensions-text-color.js.map +1 -0
  125. package/dist/prosekit-extensions-text.d.ts +0 -1
  126. package/dist/prosekit-extensions-text.d.ts.map +1 -1
  127. package/dist/prosekit-extensions-text.js.map +1 -1
  128. package/dist/prosekit-extensions-underline.d.ts +0 -1
  129. package/dist/prosekit-extensions-underline.d.ts.map +1 -1
  130. package/dist/prosekit-extensions-virtual-selection.d.ts +0 -1
  131. package/dist/prosekit-extensions-virtual-selection.d.ts.map +1 -1
  132. package/dist/prosekit-extensions-virtual-selection.js.map +1 -1
  133. package/dist/prosekit-extensions-yjs.d.ts +9 -2
  134. package/dist/prosekit-extensions-yjs.d.ts.map +1 -1
  135. package/dist/prosekit-extensions-yjs.js +1 -1
  136. package/dist/prosekit-extensions-yjs.js.map +1 -1
  137. package/dist/{shiki-highlighter-chunk-rkzofy4z.d.ts → shiki-highlighter-chunk-DNNm2Vow.d.ts} +1 -1
  138. package/dist/shiki-highlighter-chunk-DNNm2Vow.d.ts.map +1 -0
  139. package/dist/shiki-highlighter-chunk.d.ts +1 -1
  140. package/dist/shiki-highlighter-chunk.js.map +1 -1
  141. package/dist/{table-BRDh_9mG.js → table-4oHfV-Ql.js} +2 -2
  142. package/dist/table-4oHfV-Ql.js.map +1 -0
  143. package/package.json +33 -18
  144. package/src/autocomplete/autocomplete-helpers.ts +19 -14
  145. package/src/autocomplete/autocomplete-plugin.ts +260 -126
  146. package/src/autocomplete/autocomplete-rule.ts +3 -3
  147. package/src/autocomplete/autocomplete.spec.ts +244 -40
  148. package/src/autocomplete/autocomplete.ts +9 -7
  149. package/src/background-color/background-color-commands.spec.ts +71 -0
  150. package/src/background-color/background-color-commands.ts +35 -0
  151. package/src/background-color/background-color-spec.spec.ts +286 -0
  152. package/src/background-color/background-color-spec.ts +58 -0
  153. package/src/background-color/background-color.ts +21 -0
  154. package/src/background-color/index.ts +8 -0
  155. package/src/blockquote/blockquote-commands.ts +1 -7
  156. package/src/blockquote/blockquote-keymap.spec.ts +5 -9
  157. package/src/blockquote/blockquote-keymap.ts +2 -7
  158. package/src/blockquote/blockquote-spec.ts +1 -4
  159. package/src/blockquote/blockquote.ts +3 -12
  160. package/src/blockquote/index.ts +3 -12
  161. package/src/bold/bold-commands.ts +1 -5
  162. package/src/bold/bold-input-rule.spec.ts +1 -5
  163. package/src/bold/bold-input-rule.ts +1 -4
  164. package/src/bold/bold-keymap.ts +1 -5
  165. package/src/bold/bold-spec.ts +1 -4
  166. package/src/bold/bold.ts +3 -12
  167. package/src/bold/index.ts +3 -12
  168. package/src/code/code-commands.ts +1 -5
  169. package/src/code/code-input-rule.ts +1 -4
  170. package/src/code/code-keymap.ts +1 -5
  171. package/src/code/code-spec.ts +1 -4
  172. package/src/code/code.ts +3 -12
  173. package/src/code/index.ts +3 -12
  174. package/src/code-block/code-block-commands.ts +1 -8
  175. package/src/code-block/code-block-highlight.ts +2 -8
  176. package/src/code-block/code-block-keymap.ts +2 -9
  177. package/src/code-block/code-block-shiki.ts +1 -4
  178. package/src/code-block/code-block-spec.spec.ts +4 -11
  179. package/src/code-block/code-block-spec.ts +1 -4
  180. package/src/code-block/code-block.ts +4 -16
  181. package/src/code-block/index.ts +5 -21
  182. package/src/code-block/shiki-highlighter-chunk.ts +1 -7
  183. package/src/code-block/shiki-highlighter.ts +1 -4
  184. package/src/code-block/shiki-parser.ts +1 -4
  185. package/src/commit/index.ts +7 -36
  186. package/src/doc/index.ts +1 -4
  187. package/src/drop-cursor/drop-cursor.ts +1 -4
  188. package/src/drop-cursor/index.ts +1 -5
  189. package/src/drop-indicator/drop-indicator-facet.ts +12 -21
  190. package/src/drop-indicator/index.ts +1 -5
  191. package/src/enter-rule/index.ts +2 -11
  192. package/src/file/file-paste-handler.spec.ts +3 -16
  193. package/src/file/index.ts +3 -16
  194. package/src/gap-cursor/gap-cursor.ts +1 -4
  195. package/src/gap-cursor/index.ts +1 -4
  196. package/src/hard-break/hard-break-commands.ts +1 -5
  197. package/src/hard-break/hard-break-keymap.spec.ts +6 -12
  198. package/src/hard-break/hard-break-keymap.ts +1 -4
  199. package/src/hard-break/hard-break-spec.ts +1 -4
  200. package/src/hard-break/hard-break.ts +3 -12
  201. package/src/hard-break/index.ts +3 -12
  202. package/src/heading/heading-commands.ts +1 -7
  203. package/src/heading/heading-keymap.spec.ts +8 -12
  204. package/src/heading/heading-keymap.ts +7 -14
  205. package/src/heading/heading-spec.ts +1 -4
  206. package/src/heading/heading.ts +3 -12
  207. package/src/heading/index.ts +3 -12
  208. package/src/horizontal-rule/horizontal-rule-commands.spec.ts +1 -5
  209. package/src/horizontal-rule/horizontal-rule-commands.ts +2 -9
  210. package/src/horizontal-rule/horizontal-rule-input-rule.spec.ts +5 -9
  211. package/src/horizontal-rule/horizontal-rule-input-rule.ts +1 -5
  212. package/src/horizontal-rule/horizontal-rule-spec.ts +1 -4
  213. package/src/horizontal-rule/horizontal-rule.ts +3 -12
  214. package/src/horizontal-rule/index.ts +3 -13
  215. package/src/image/image-commands/upload-image.spec.ts +245 -0
  216. package/src/image/image-commands/upload-image.ts +46 -11
  217. package/src/image/image-commands.ts +2 -8
  218. package/src/image/image-spec.ts +1 -4
  219. package/src/image/image-upload-handler.ts +2 -8
  220. package/src/image/image.ts +3 -12
  221. package/src/image/index.ts +3 -13
  222. package/src/input-rule/index.ts +2 -13
  223. package/src/italic/index.ts +3 -12
  224. package/src/italic/italic-commands.spec.ts +2 -10
  225. package/src/italic/italic-commands.ts +1 -5
  226. package/src/italic/italic-input-rule.spec.ts +1 -5
  227. package/src/italic/italic-input-rule.ts +1 -4
  228. package/src/italic/italic-keymap.ts +1 -5
  229. package/src/italic/italic-spec.ts +1 -4
  230. package/src/italic/italic.ts +3 -12
  231. package/src/link/index.spec.ts +10 -13
  232. package/src/link/index.ts +1 -5
  233. package/src/link/link-paste-rule.spec.ts +2 -9
  234. package/src/link/link-regex.spec.ts +1 -5
  235. package/src/list/index.ts +3 -12
  236. package/src/list/list-commands.ts +1 -5
  237. package/src/list/list-input-rules.ts +1 -4
  238. package/src/list/list-keymap.spec.ts +6 -10
  239. package/src/list/list-keymap.ts +2 -8
  240. package/src/list/list-plugins.ts +1 -4
  241. package/src/list/list-serializer.ts +2 -9
  242. package/src/list/list-spec.ts +3 -13
  243. package/src/list/list.spec.ts +10 -21
  244. package/src/list/list.ts +3 -12
  245. package/src/list/style.css +5 -5
  246. package/src/loro/index.ts +3 -13
  247. package/src/loro/loro-commands.ts +2 -8
  248. package/src/loro/loro-cursor-plugin.ts +21 -21
  249. package/src/loro/loro-keymap.ts +3 -11
  250. package/src/loro/loro-sync-plugin.ts +2 -8
  251. package/src/loro/loro-undo-plugin.ts +2 -8
  252. package/src/loro/loro.ts +16 -21
  253. package/src/mark-rule/apply.ts +3 -13
  254. package/src/mark-rule/mark-rule.spec.ts +2 -13
  255. package/src/mark-rule/mark-rule.ts +2 -13
  256. package/src/mark-rule/range.ts +2 -8
  257. package/src/mark-rule/types.ts +1 -4
  258. package/src/mention/index.ts +1 -8
  259. package/src/mod-click-prevention/index.ts +2 -9
  260. package/src/paragraph/paragraph-commands.ts +1 -5
  261. package/src/paragraph/paragraph-keymap.ts +2 -5
  262. package/src/paragraph/paragraph-spec.ts +1 -4
  263. package/src/paragraph/paragraph.ts +3 -14
  264. package/src/paste-rule/index.ts +2 -10
  265. package/src/paste-rule/mark-paste-rule.spec.ts +3 -13
  266. package/src/paste-rule/mark-paste-rule.ts +4 -14
  267. package/src/paste-rule/paste-rule-plugin.ts +2 -11
  268. package/src/paste-rule/paste-rule.spec.ts +4 -19
  269. package/src/paste-rule/split-text-by-regex.spec.ts +1 -5
  270. package/src/placeholder/index.ts +4 -16
  271. package/src/readonly/index.ts +2 -8
  272. package/src/search/index.ts +1 -6
  273. package/src/strike/index.ts +2 -2
  274. package/src/table/index.ts +10 -40
  275. package/src/table/table-commands/delete-cell-selection.spec.ts +1 -5
  276. package/src/table/table-commands/exit-table.spec.ts +1 -5
  277. package/src/table/table-commands/insert-table.spec.ts +1 -5
  278. package/src/table/table-commands/insert-table.ts +1 -4
  279. package/src/table/table-commands/move-table-column.spec.ts +1 -5
  280. package/src/table/table-commands/move-table-column.ts +1 -4
  281. package/src/table/table-commands/move-table-row.spec.ts +1 -5
  282. package/src/table/table-commands/move-table-row.ts +1 -4
  283. package/src/table/table-commands/select-table-cell.spec.ts +1 -5
  284. package/src/table/table-commands/select-table-column.spec.ts +1 -5
  285. package/src/table/table-commands/select-table-row.spec.ts +1 -5
  286. package/src/table/table-commands/select-table.spec.ts +1 -5
  287. package/src/table/table-commands/select-table.ts +1 -4
  288. package/src/table/table-commands.ts +8 -32
  289. package/src/table/table-plugins.ts +2 -8
  290. package/src/table/table-spec.spec.ts +2 -11
  291. package/src/table/table-spec.ts +2 -8
  292. package/src/table/table-utils.ts +2 -6
  293. package/src/table/table.ts +2 -8
  294. package/src/table/test-utils.ts +1 -4
  295. package/src/testing/clipboard.ts +1 -2
  296. package/src/testing/index.ts +9 -14
  297. package/src/testing/keyboard.ts +0 -30
  298. package/src/text/index.ts +1 -4
  299. package/src/text-align/index.ts +6 -6
  300. package/src/text-color/index.ts +3 -0
  301. package/src/text-color/text-color-commands.spec.ts +71 -0
  302. package/src/text-color/text-color-commands.ts +35 -0
  303. package/src/text-color/text-color-spec.spec.ts +297 -0
  304. package/src/text-color/text-color-spec.ts +58 -0
  305. package/src/text-color/text-color.ts +21 -0
  306. package/src/virtual-selection/index.ts +3 -14
  307. package/src/yjs/index.ts +5 -20
  308. package/src/yjs/yjs-commands.ts +2 -8
  309. package/src/yjs/yjs-cursor-plugin.ts +3 -5
  310. package/src/yjs/yjs-keymap.ts +3 -11
  311. package/src/yjs/yjs-sync-plugin.ts +1 -4
  312. package/src/yjs/yjs-types.ts +10 -0
  313. package/src/yjs/yjs-undo-plugin.ts +2 -8
  314. package/src/yjs/yjs.ts +6 -24
  315. package/dist/drop-indicator-B1QHFb5m.js.map +0 -1
  316. package/dist/enter-rule-CzWOZF_Z.js.map +0 -1
  317. package/dist/file-DrfcSid-.js.map +0 -1
  318. package/dist/index-oIc1a2f2.d.ts.map +0 -1
  319. package/dist/input-rule-dmsb3j6w.js.map +0 -1
  320. package/dist/mark-rule-BcLB4Uv2.js.map +0 -1
  321. package/dist/paste-rule-pVb4sqvJ.js.map +0 -1
  322. package/dist/shiki-highlighter-chunk-rkzofy4z.d.ts.map +0 -1
  323. package/dist/table-BRDh_9mG.js.map +0 -1
  324. package/src/testing/format-html.ts +0 -5
@@ -1,16 +1,6 @@
1
- import {
2
- getMarkType,
3
- maybeRun,
4
- OBJECT_REPLACEMENT_CHARACTER,
5
- } from '@prosekit/core'
6
- import type {
7
- Mark,
8
- ProseMirrorNode,
9
- } from '@prosekit/pm/model'
10
- import type {
11
- EditorState,
12
- Transaction,
13
- } from '@prosekit/pm/state'
1
+ import { getMarkType, maybeRun, OBJECT_REPLACEMENT_CHARACTER } from '@prosekit/core'
2
+ import type { Mark, ProseMirrorNode } from '@prosekit/pm/model'
3
+ import type { EditorState, Transaction } from '@prosekit/pm/state'
14
4
 
15
5
  import { getCheckRanges } from './range'
16
6
  import type { MarkRuleOptions } from './types'
@@ -1,17 +1,6 @@
1
- import {
2
- createEditor,
3
- defineBaseCommands,
4
- defineMarkSpec,
5
- elementFromNode,
6
- union,
7
- type Editor,
8
- } from '@prosekit/core'
1
+ import { createEditor, defineBaseCommands, defineMarkSpec, elementFromNode, union, type Editor } from '@prosekit/core'
9
2
  import type { ProseMirrorNode } from '@prosekit/pm/model'
10
- import {
11
- describe,
12
- expect,
13
- it,
14
- } from 'vitest'
3
+ import { describe, expect, it } from 'vitest'
15
4
 
16
5
  import { defineDoc } from '../doc'
17
6
  import { defineParagraph } from '../paragraph'
@@ -1,16 +1,5 @@
1
- import {
2
- defineFacet,
3
- defineFacetPayload,
4
- pluginFacet,
5
- type PlainExtension,
6
- type PluginPayload,
7
- } from '@prosekit/core'
8
- import {
9
- PluginKey,
10
- ProseMirrorPlugin,
11
- type EditorState,
12
- type Transaction,
13
- } from '@prosekit/pm/state'
1
+ import { defineFacet, defineFacetPayload, pluginFacet, type PlainExtension, type PluginPayload } from '@prosekit/core'
2
+ import { PluginKey, ProseMirrorPlugin, type EditorState, type Transaction } from '@prosekit/pm/state'
14
3
 
15
4
  import { applyMarkRules } from './apply'
16
5
  import type { MarkRuleOptions } from './types'
@@ -1,11 +1,5 @@
1
- import type {
2
- ProseMirrorNode,
3
- ResolvedPos,
4
- } from '@prosekit/pm/model'
5
- import type {
6
- EditorState,
7
- Transaction,
8
- } from '@prosekit/pm/state'
1
+ import type { ProseMirrorNode, ResolvedPos } from '@prosekit/pm/model'
2
+ import type { EditorState, Transaction } from '@prosekit/pm/state'
9
3
  import type { ProsemirrorNode } from 'prosemirror-flat-list'
10
4
 
11
5
  function getSpanTextRanges($from: ResolvedPos, $to: ResolvedPos) {
@@ -1,7 +1,4 @@
1
- import type {
2
- Attrs,
3
- MarkType,
4
- } from '@prosekit/pm/model'
1
+ import type { Attrs, MarkType } from '@prosekit/pm/model'
5
2
 
6
3
  /**
7
4
  * The options for {@link defineMarkRule}.
@@ -1,11 +1,4 @@
1
- import {
2
- defineCommands,
3
- defineNodeSpec,
4
- insertNode,
5
- union,
6
- type Extension,
7
- type Union,
8
- } from '@prosekit/core'
1
+ import { defineCommands, defineNodeSpec, insertNode, union, type Extension, type Union } from '@prosekit/core'
9
2
 
10
3
  export interface MentionAttrs {
11
4
  id: string
@@ -1,12 +1,5 @@
1
- import {
2
- definePlugin,
3
- isApple,
4
- type PlainExtension,
5
- } from '@prosekit/core'
6
- import {
7
- Plugin,
8
- PluginKey,
9
- } from '@prosekit/pm/state'
1
+ import { definePlugin, isApple, type PlainExtension } from '@prosekit/core'
2
+ import { Plugin, PluginKey } from '@prosekit/pm/state'
10
3
  import type { EditorView } from '@prosekit/pm/view'
11
4
 
12
5
  /**
@@ -1,8 +1,4 @@
1
- import {
2
- defineCommands,
3
- setBlockType,
4
- type Extension,
5
- } from '@prosekit/core'
1
+ import { defineCommands, setBlockType, type Extension } from '@prosekit/core'
6
2
  import type { Command } from '@prosekit/pm/state'
7
3
 
8
4
  /**
@@ -1,7 +1,4 @@
1
- import {
2
- defineKeymap,
3
- type PlainExtension,
4
- } from '@prosekit/core'
1
+ import { defineKeymap, type PlainExtension } from '@prosekit/core'
5
2
 
6
3
  import { setParagraph } from './paragraph-commands'
7
4
 
@@ -10,6 +7,6 @@ import { setParagraph } from './paragraph-commands'
10
7
  */
11
8
  export function defineParagraphKeymap(): PlainExtension {
12
9
  return defineKeymap({
13
- 'mod-alt-0': setParagraph(),
10
+ 'Mod-Alt-0': setParagraph(),
14
11
  })
15
12
  }
@@ -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,19 +1,8 @@
1
- import {
2
- Priority,
3
- union,
4
- withPriority,
5
- type Union,
6
- } from '@prosekit/core'
1
+ import { Priority, union, withPriority, type Union } from '@prosekit/core'
7
2
 
8
- import {
9
- defineParagraphCommands,
10
- type ParagraphCommandsExtension,
11
- } from './paragraph-commands'
3
+ import { defineParagraphCommands, type ParagraphCommandsExtension } from './paragraph-commands'
12
4
  import { defineParagraphKeymap } from './paragraph-keymap'
13
- import {
14
- defineParagraphSpec,
15
- type ParagraphSpecExtension,
16
- } from './paragraph-spec'
5
+ import { defineParagraphSpec, type ParagraphSpecExtension } from './paragraph-spec'
17
6
 
18
7
  /**
19
8
  * @internal
@@ -1,10 +1,2 @@
1
- export {
2
- defineMarkPasteRule,
3
- type MarkPasteRuleOptions,
4
- } from './mark-paste-rule'
5
- export {
6
- definePasteRule,
7
- type PasteRuleHandler,
8
- type PasteRuleHandlerOptions,
9
- type PasteRuleOptions,
10
- } from './paste-rule'
1
+ export { defineMarkPasteRule, type MarkPasteRuleOptions } from './mark-paste-rule'
2
+ export { definePasteRule, type PasteRuleHandler, type PasteRuleHandlerOptions, type PasteRuleOptions } from './paste-rule'
@@ -1,21 +1,11 @@
1
- import {
2
- defineMarkSpec,
3
- union,
4
- } from '@prosekit/core'
5
- import {
6
- describe,
7
- expect,
8
- it,
9
- } from 'vitest'
1
+ import { defineMarkSpec, union } from '@prosekit/core'
2
+ import { describe, expect, it } from 'vitest'
10
3
 
11
4
  import { defineBold } from '../bold'
12
5
  import { defineDoc } from '../doc'
13
6
  import { defineParagraph } from '../paragraph'
14
7
  import { setupTestFromExtension } from '../testing'
15
- import {
16
- pasteHTML,
17
- pasteText,
18
- } from '../testing/clipboard'
8
+ import { pasteHTML, pasteText } from '../testing/clipboard'
19
9
  import { defineText } from '../text'
20
10
 
21
11
  import type { MarkPasteRuleOptions } from './mark-paste-rule'
@@ -1,16 +1,6 @@
1
- import {
2
- getMarkType,
3
- type PlainExtension,
4
- } from '@prosekit/core'
5
- import type {
6
- Attrs,
7
- MarkType,
8
- ProseMirrorNode,
9
- } from '@prosekit/pm/model'
10
- import {
11
- Fragment,
12
- Slice,
13
- } from '@prosekit/pm/model'
1
+ import { getMarkType, type PlainExtension } from '@prosekit/core'
2
+ import type { Attrs, MarkType, ProseMirrorNode } from '@prosekit/pm/model'
3
+ import { Fragment, Slice } from '@prosekit/pm/model'
14
4
 
15
5
  import { definePasteRule } from './paste-rule'
16
6
  import { splitTextByRegex } from './split-text-by-regex'
@@ -88,7 +78,7 @@ function replaceMarkInSlice(options: MarkPasteRuleHandlerOptions, slice: Slice):
88
78
 
89
79
  function replaceMarkInFragment(options: MarkPasteRuleHandlerOptions, fragment: Fragment): Fragment | undefined {
90
80
  let changed = false
91
- let children: ProseMirrorNode[] = []
81
+ const children: ProseMirrorNode[] = []
92
82
 
93
83
  for (const child of fragment.content) {
94
84
  const newChild = replaceMarkInNode(options, child)
@@ -1,15 +1,6 @@
1
- import {
2
- defineFacet,
3
- defineFacetPayload,
4
- pluginFacet,
5
- type PlainExtension,
6
- type PluginPayload,
7
- } from '@prosekit/core'
1
+ import { defineFacet, defineFacetPayload, pluginFacet, type PlainExtension, type PluginPayload } from '@prosekit/core'
8
2
  import type { Slice } from '@prosekit/pm/model'
9
- import {
10
- PluginKey,
11
- ProseMirrorPlugin,
12
- } from '@prosekit/pm/state'
3
+ import { PluginKey, ProseMirrorPlugin } from '@prosekit/pm/state'
13
4
  import type { EditorView } from '@prosekit/pm/view'
14
5
 
15
6
  type PasteRulePayload = (options: { slice: Slice; view: EditorView; plain: boolean }) => Slice
@@ -1,24 +1,9 @@
1
- import {
2
- Priority,
3
- union,
4
- withPriority,
5
- type PlainExtension,
6
- } from '@prosekit/core'
1
+ import { Priority, union, withPriority, type PlainExtension } from '@prosekit/core'
7
2
  import type { ProseMirrorNode } from '@prosekit/pm/model'
8
- import {
9
- Fragment,
10
- Slice,
11
- } from '@prosekit/pm/model'
12
- import {
13
- describe,
14
- expect,
15
- it,
16
- } from 'vitest'
3
+ import { Fragment, Slice } from '@prosekit/pm/model'
4
+ import { describe, expect, it } from 'vitest'
17
5
 
18
- import {
19
- defineTestExtension,
20
- setupTestFromExtension,
21
- } from '../testing'
6
+ import { defineTestExtension, setupTestFromExtension } from '../testing'
22
7
 
23
8
  import { definePasteRule } from './paste-rule'
24
9
 
@@ -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 { splitTextByRegex } from './split-text-by-regex'
8
4
 
@@ -1,19 +1,7 @@
1
- import {
2
- definePlugin,
3
- isInCodeBlock,
4
- maybeRun,
5
- type PlainExtension,
6
- } from '@prosekit/core'
1
+ import { definePlugin, isInCodeBlock, isTextSelection, maybeRun, type PlainExtension } from '@prosekit/core'
7
2
  import type { ProseMirrorNode } from '@prosekit/pm/model'
8
- import {
9
- Plugin,
10
- PluginKey,
11
- type EditorState,
12
- } from '@prosekit/pm/state'
13
- import {
14
- Decoration,
15
- DecorationSet,
16
- } from '@prosekit/pm/view'
3
+ import { Plugin, PluginKey, type EditorState } from '@prosekit/pm/state'
4
+ import { Decoration, DecorationSet } from '@prosekit/pm/view'
17
5
 
18
6
  import { findTable } from '../table'
19
7
 
@@ -98,7 +86,7 @@ function createPlaceholderDecoration(
98
86
  if (!placeholderText) return null
99
87
 
100
88
  const { selection } = state
101
- if (!selection.empty) return null
89
+ if (!selection.empty || !isTextSelection(selection)) return null
102
90
 
103
91
  const $pos = selection.$anchor
104
92
  const node = $pos.parent
@@ -1,11 +1,5 @@
1
- import {
2
- definePlugin,
3
- type PlainExtension,
4
- } from '@prosekit/core'
5
- import {
6
- PluginKey,
7
- ProseMirrorPlugin,
8
- } from '@prosekit/pm/state'
1
+ import { definePlugin, type PlainExtension } from '@prosekit/core'
2
+ import { PluginKey, ProseMirrorPlugin } from '@prosekit/pm/state'
9
3
 
10
4
  /**
11
5
  * Make the editor read-only.
@@ -1,9 +1,4 @@
1
- import {
2
- defineCommands,
3
- definePlugin,
4
- type Extension,
5
- type PlainExtension,
6
- } from '@prosekit/core'
1
+ import { defineCommands, definePlugin, type Extension, type PlainExtension } from '@prosekit/core'
7
2
  import type { Command } from '@prosekit/pm/state'
8
3
  import type { EditorView } from '@prosekit/pm/view'
9
4
  import {
@@ -64,8 +64,8 @@ export function defineStrikeCommands(): StrikeCommandsExtension {
64
64
  */
65
65
  export function defineStrikeKeymap(): PlainExtension {
66
66
  return defineKeymap({
67
- 'Mod-shift-s': toggleMark({ type: 'strike' }),
68
- 'Mod-shift-x': toggleMark({ type: 'strike' }),
67
+ 'Mod-S': toggleMark({ type: 'strike' }),
68
+ 'Mod-X': toggleMark({ type: 'strike' }),
69
69
  })
70
70
  }
71
71
 
@@ -1,40 +1,13 @@
1
- export {
2
- defineTable,
3
- type TableExtension,
4
- } from './table'
5
- export {
6
- defineTableCommands,
7
- type TableCommandsExtension,
8
- } from './table-commands'
1
+ export { defineTable, type TableExtension } from './table'
2
+ export { defineTableCommands, type TableCommandsExtension } from './table-commands'
9
3
  export { exitTable } from './table-commands/exit-table'
10
- export {
11
- insertTable,
12
- type InsertTableOptions,
13
- } from './table-commands/insert-table'
14
- export {
15
- moveTableColumn,
16
- type MoveTableColumnOptions,
17
- } from './table-commands/move-table-column'
18
- export {
19
- moveTableRow,
20
- type MoveTableRowOptions,
21
- } from './table-commands/move-table-row'
22
- export {
23
- selectTable,
24
- type SelectTableOptions,
25
- } from './table-commands/select-table'
26
- export {
27
- selectTableCell,
28
- type SelectTableCellOptions,
29
- } from './table-commands/select-table-cell'
30
- export {
31
- selectTableColumn,
32
- type SelectTableColumnOptions,
33
- } from './table-commands/select-table-column'
34
- export {
35
- selectTableRow,
36
- type SelectTableRowOptions,
37
- } from './table-commands/select-table-row'
4
+ export { insertTable, type InsertTableOptions } from './table-commands/insert-table'
5
+ export { moveTableColumn, type MoveTableColumnOptions } from './table-commands/move-table-column'
6
+ export { moveTableRow, type MoveTableRowOptions } from './table-commands/move-table-row'
7
+ export { selectTable, type SelectTableOptions } from './table-commands/select-table'
8
+ export { selectTableCell, type SelectTableCellOptions } from './table-commands/select-table-cell'
9
+ export { selectTableColumn, type SelectTableColumnOptions } from './table-commands/select-table-column'
10
+ export { selectTableRow, type SelectTableRowOptions } from './table-commands/select-table-row'
38
11
  export { defineTableDropIndicator } from './table-drop-indicator'
39
12
  export { defineTablePlugins } from './table-plugins'
40
13
  export {
@@ -47,7 +20,4 @@ export {
47
20
  type TableRowSpecExtension,
48
21
  type TableSpecExtension,
49
22
  } from './table-spec'
50
- export {
51
- findTable,
52
- isCellSelection,
53
- } from './table-utils'
23
+ export { findTable, isCellSelection } from './table-utils'
@@ -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 { isCellSelection } from '../table-utils'
@@ -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,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
 
@@ -1,7 +1,4 @@
1
- import {
2
- getNodeType,
3
- insertNode,
4
- } from '@prosekit/core'
1
+ import { getNodeType, insertNode } from '@prosekit/core'
5
2
  import type { Schema } from '@prosekit/pm/model'
6
3
  import type { Command } from '@prosekit/pm/state'
7
4
 
@@ -1,10 +1,6 @@
1
1
  import type { Command } from '@prosekit/pm/state'
2
2
  import { CellSelection } from 'prosemirror-tables'
3
- import {
4
- describe,
5
- expect,
6
- it,
7
- } from 'vitest'
3
+ import { describe, expect, it } from 'vitest'
8
4
 
9
5
  import { setupTest } from '../../testing'
10
6
 
@@ -1,4 +1 @@
1
- export {
2
- moveTableColumn,
3
- type MoveTableColumnOptions,
4
- } from 'prosemirror-tables'
1
+ export { moveTableColumn, type MoveTableColumnOptions } from 'prosemirror-tables'
@@ -1,10 +1,6 @@
1
1
  import type { Command } from '@prosekit/pm/state'
2
2
  import { CellSelection } from 'prosemirror-tables'
3
- import {
4
- describe,
5
- expect,
6
- it,
7
- } from 'vitest'
3
+ import { describe, expect, it } from 'vitest'
8
4
 
9
5
  import { setupTest } from '../../testing'
10
6
 
@@ -1,4 +1 @@
1
- export {
2
- moveTableRow,
3
- type MoveTableRowOptions,
4
- } from 'prosemirror-tables'
1
+ export { moveTableRow, type MoveTableRowOptions } from 'prosemirror-tables'
@@ -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 { isCellSelection } from '../table-utils'
@@ -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 { inspectSelectedCells } from '../test-utils'
@@ -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 { inspectSelectedCells } from '../test-utils'
@@ -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 { inspectSelectedCells } from '../test-utils'
@@ -1,8 +1,5 @@
1
1
  import type { Command } from '@prosekit/pm/state'
2
- import {
3
- CellSelection,
4
- TableMap,
5
- } from 'prosemirror-tables'
2
+ import { CellSelection, TableMap } from 'prosemirror-tables'
6
3
 
7
4
  import { findTable } from '../table-utils'
8
5
 
@@ -1,7 +1,4 @@
1
- import {
2
- defineCommands,
3
- type Extension,
4
- } from '@prosekit/core'
1
+ import { defineCommands, type Extension } from '@prosekit/core'
5
2
  import {
6
3
  addColumnAfter,
7
4
  addColumnBefore,
@@ -16,34 +13,13 @@ import {
16
13
 
17
14
  import { deleteCellSelection } from './table-commands/delete-cell-selection'
18
15
  import { exitTable } from './table-commands/exit-table'
19
- import {
20
- insertTable,
21
- type InsertTableOptions,
22
- } from './table-commands/insert-table'
23
- import {
24
- moveTableColumn,
25
- type MoveTableColumnOptions,
26
- } from './table-commands/move-table-column'
27
- import {
28
- moveTableRow,
29
- type MoveTableRowOptions,
30
- } from './table-commands/move-table-row'
31
- import {
32
- selectTable,
33
- type SelectTableOptions,
34
- } from './table-commands/select-table'
35
- import {
36
- selectTableCell,
37
- type SelectTableCellOptions,
38
- } from './table-commands/select-table-cell'
39
- import {
40
- selectTableColumn,
41
- type SelectTableColumnOptions,
42
- } from './table-commands/select-table-column'
43
- import {
44
- selectTableRow,
45
- type SelectTableRowOptions,
46
- } from './table-commands/select-table-row'
16
+ import { insertTable, type InsertTableOptions } from './table-commands/insert-table'
17
+ import { moveTableColumn, type MoveTableColumnOptions } from './table-commands/move-table-column'
18
+ import { moveTableRow, type MoveTableRowOptions } from './table-commands/move-table-row'
19
+ import { selectTable, type SelectTableOptions } from './table-commands/select-table'
20
+ import { selectTableCell, type SelectTableCellOptions } from './table-commands/select-table-cell'
21
+ import { selectTableColumn, type SelectTableColumnOptions } from './table-commands/select-table-column'
22
+ import { selectTableRow, type SelectTableRowOptions } from './table-commands/select-table-row'
47
23
 
48
24
  /**
49
25
  * @internal
@@ -1,11 +1,5 @@
1
- import {
2
- definePlugin,
3
- type PlainExtension,
4
- } from '@prosekit/core'
5
- import {
6
- columnResizing,
7
- tableEditing,
8
- } from 'prosemirror-tables'
1
+ import { definePlugin, type PlainExtension } from '@prosekit/core'
2
+ import { columnResizing, tableEditing } from 'prosemirror-tables'
9
3
 
10
4
  /**
11
5
  * @public