@prosekit/core 0.8.2 → 0.8.4

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 (168) hide show
  1. package/dist/editor-CfkZ4TNU.d.ts +748 -0
  2. package/dist/editor-CfkZ4TNU.d.ts.map +1 -0
  3. package/dist/{editor-DbMrpnmL.js → editor-CizSwUN8.js} +102 -192
  4. package/dist/editor-CizSwUN8.js.map +1 -0
  5. package/dist/prosekit-core-test.d.ts +20 -19
  6. package/dist/prosekit-core-test.d.ts.map +1 -0
  7. package/dist/prosekit-core-test.js +4 -5
  8. package/dist/prosekit-core-test.js.map +1 -0
  9. package/dist/prosekit-core.d.ts +782 -757
  10. package/dist/prosekit-core.d.ts.map +1 -0
  11. package/dist/prosekit-core.js +30 -45
  12. package/dist/prosekit-core.js.map +1 -0
  13. package/package.json +14 -11
  14. package/src/commands/add-mark.ts +53 -0
  15. package/src/commands/expand-mark.ts +96 -0
  16. package/src/commands/insert-default-block.spec.ts +102 -0
  17. package/src/commands/insert-default-block.ts +49 -0
  18. package/src/commands/insert-node.ts +71 -0
  19. package/src/commands/insert-text.ts +24 -0
  20. package/src/commands/remove-mark.ts +54 -0
  21. package/src/commands/remove-node.ts +43 -0
  22. package/src/commands/select-all.ts +16 -0
  23. package/src/commands/set-block-type.ts +64 -0
  24. package/src/commands/set-node-attrs.ts +68 -0
  25. package/src/commands/toggle-mark.ts +65 -0
  26. package/src/commands/toggle-node.ts +47 -0
  27. package/src/commands/toggle-wrap.spec.ts +35 -0
  28. package/src/commands/toggle-wrap.ts +42 -0
  29. package/src/commands/unset-block-type.spec.ts +49 -0
  30. package/src/commands/unset-block-type.ts +84 -0
  31. package/src/commands/unset-mark.spec.ts +35 -0
  32. package/src/commands/unset-mark.ts +38 -0
  33. package/src/commands/wrap.ts +50 -0
  34. package/src/editor/action.spec.ts +143 -0
  35. package/src/editor/action.ts +248 -0
  36. package/src/editor/editor.spec.ts +186 -0
  37. package/src/editor/editor.ts +563 -0
  38. package/src/editor/union.spec.ts +108 -0
  39. package/src/editor/union.ts +47 -0
  40. package/src/editor/with-priority.ts +25 -0
  41. package/src/error.ts +28 -0
  42. package/src/extensions/clipboard-serializer.ts +107 -0
  43. package/src/extensions/command.ts +121 -0
  44. package/src/extensions/default-state.spec.ts +60 -0
  45. package/src/extensions/default-state.ts +76 -0
  46. package/src/extensions/doc.ts +31 -0
  47. package/src/extensions/events/doc-change.ts +34 -0
  48. package/src/extensions/events/dom-event.spec.ts +70 -0
  49. package/src/extensions/events/dom-event.ts +117 -0
  50. package/src/extensions/events/editor-event.ts +293 -0
  51. package/src/extensions/events/focus.spec.ts +50 -0
  52. package/src/extensions/events/focus.ts +28 -0
  53. package/src/extensions/events/plugin-view.ts +132 -0
  54. package/src/extensions/history.ts +81 -0
  55. package/src/extensions/keymap-base.ts +60 -0
  56. package/src/extensions/keymap.spec.ts +89 -0
  57. package/src/extensions/keymap.ts +96 -0
  58. package/src/extensions/mark-spec.spec.ts +177 -0
  59. package/src/extensions/mark-spec.ts +181 -0
  60. package/src/extensions/mark-view-effect.ts +85 -0
  61. package/src/extensions/mark-view.ts +43 -0
  62. package/src/extensions/node-spec.spec.ts +224 -0
  63. package/src/extensions/node-spec.ts +199 -0
  64. package/src/extensions/node-view-effect.ts +85 -0
  65. package/src/extensions/node-view.ts +43 -0
  66. package/src/extensions/paragraph.ts +61 -0
  67. package/src/extensions/plugin.ts +91 -0
  68. package/src/extensions/text.ts +34 -0
  69. package/src/facets/base-extension.ts +54 -0
  70. package/src/facets/command.ts +21 -0
  71. package/src/facets/facet-extension.spec.ts +173 -0
  72. package/src/facets/facet-extension.ts +53 -0
  73. package/src/facets/facet-node.spec.ts +265 -0
  74. package/src/facets/facet-node.ts +185 -0
  75. package/src/facets/facet-types.ts +9 -0
  76. package/src/facets/facet.spec.ts +76 -0
  77. package/src/facets/facet.ts +84 -0
  78. package/src/facets/root.ts +44 -0
  79. package/src/facets/schema-spec.ts +30 -0
  80. package/src/facets/schema.ts +26 -0
  81. package/src/facets/state.ts +57 -0
  82. package/src/facets/union-extension.ts +41 -0
  83. package/src/index.ts +302 -0
  84. package/src/test/index.ts +4 -0
  85. package/src/test/test-builder.ts +68 -0
  86. package/src/test/test-editor.spec.ts +104 -0
  87. package/src/test/test-editor.ts +113 -0
  88. package/src/testing/index.ts +283 -0
  89. package/src/testing/keyboard.ts +5 -0
  90. package/src/types/any-function.ts +4 -0
  91. package/src/types/assert-type-equal.ts +8 -0
  92. package/src/types/attrs.ts +32 -0
  93. package/src/types/base-node-view-options.ts +33 -0
  94. package/src/types/dom-node.ts +1 -0
  95. package/src/types/extension-command.ts +52 -0
  96. package/src/types/extension-mark.ts +15 -0
  97. package/src/types/extension-node.ts +15 -0
  98. package/src/types/extension.spec.ts +56 -0
  99. package/src/types/extension.ts +168 -0
  100. package/src/types/model.ts +54 -0
  101. package/src/types/object-entries.ts +13 -0
  102. package/src/types/pick-string-literal.spec.ts +10 -0
  103. package/src/types/pick-string-literal.ts +6 -0
  104. package/src/types/pick-sub-type.spec.ts +20 -0
  105. package/src/types/pick-sub-type.ts +6 -0
  106. package/src/types/priority.ts +12 -0
  107. package/src/types/setter.ts +4 -0
  108. package/src/types/simplify-deeper.spec.ts +40 -0
  109. package/src/types/simplify-deeper.ts +6 -0
  110. package/src/types/simplify-union.spec.ts +21 -0
  111. package/src/types/simplify-union.ts +11 -0
  112. package/src/utils/array-grouping.spec.ts +29 -0
  113. package/src/utils/array-grouping.ts +25 -0
  114. package/src/utils/array.ts +21 -0
  115. package/src/utils/assert.ts +13 -0
  116. package/src/utils/attrs-match.ts +20 -0
  117. package/src/utils/can-use-regex-lookbehind.ts +12 -0
  118. package/src/utils/clsx.spec.ts +14 -0
  119. package/src/utils/clsx.ts +12 -0
  120. package/src/utils/collect-children.ts +21 -0
  121. package/src/utils/collect-nodes.ts +37 -0
  122. package/src/utils/combine-event-handlers.spec.ts +27 -0
  123. package/src/utils/combine-event-handlers.ts +27 -0
  124. package/src/utils/contains-inline-node.ts +17 -0
  125. package/src/utils/deep-equals.spec.ts +26 -0
  126. package/src/utils/deep-equals.ts +29 -0
  127. package/src/utils/default-block-at.ts +15 -0
  128. package/src/utils/editor-content.spec.ts +47 -0
  129. package/src/utils/editor-content.ts +77 -0
  130. package/src/utils/env.ts +6 -0
  131. package/src/utils/find-parent-node-of-type.ts +29 -0
  132. package/src/utils/find-parent-node.spec.ts +68 -0
  133. package/src/utils/find-parent-node.ts +55 -0
  134. package/src/utils/get-custom-selection.ts +19 -0
  135. package/src/utils/get-dom-api.ts +56 -0
  136. package/src/utils/get-id.spec.ts +14 -0
  137. package/src/utils/get-id.ts +13 -0
  138. package/src/utils/get-mark-type.ts +20 -0
  139. package/src/utils/get-node-type.ts +20 -0
  140. package/src/utils/get-node-types.ts +19 -0
  141. package/src/utils/includes-mark.ts +18 -0
  142. package/src/utils/is-at-block-start.ts +26 -0
  143. package/src/utils/is-in-code-block.ts +18 -0
  144. package/src/utils/is-mark-absent.spec.ts +53 -0
  145. package/src/utils/is-mark-absent.ts +42 -0
  146. package/src/utils/is-mark-active.ts +27 -0
  147. package/src/utils/is-node-active.ts +25 -0
  148. package/src/utils/is-subset.spec.ts +12 -0
  149. package/src/utils/is-subset.ts +11 -0
  150. package/src/utils/maybe-run.spec.ts +39 -0
  151. package/src/utils/maybe-run.ts +11 -0
  152. package/src/utils/merge-objects.spec.ts +30 -0
  153. package/src/utils/merge-objects.ts +11 -0
  154. package/src/utils/merge-specs.ts +35 -0
  155. package/src/utils/object-equal.spec.ts +26 -0
  156. package/src/utils/object-equal.ts +28 -0
  157. package/src/utils/output-spec.test.ts +95 -0
  158. package/src/utils/output-spec.ts +130 -0
  159. package/src/utils/parse.spec.ts +46 -0
  160. package/src/utils/parse.ts +321 -0
  161. package/src/utils/remove-undefined-values.spec.ts +15 -0
  162. package/src/utils/remove-undefined-values.ts +9 -0
  163. package/src/utils/set-selection-around.ts +11 -0
  164. package/src/utils/type-assertion.ts +91 -0
  165. package/src/utils/unicode.spec.ts +10 -0
  166. package/src/utils/unicode.ts +4 -0
  167. package/src/utils/with-skip-code-block.ts +15 -0
  168. package/dist/editor-CjVyjJqw.d.ts +0 -739
@@ -0,0 +1,321 @@
1
+ import {
2
+ DOMParser,
3
+ DOMSerializer,
4
+ type ParseOptions,
5
+ type ProseMirrorNode,
6
+ type Schema,
7
+ } from '@prosekit/pm/model'
8
+ import { EditorState } from '@prosekit/pm/state'
9
+
10
+ import type { DOMNode } from '../types/dom-node'
11
+ import type {
12
+ NodeJSON,
13
+ StateJSON,
14
+ } from '../types/model'
15
+
16
+ import {
17
+ getBrowserDocument,
18
+ getBrowserWindow,
19
+ } from './get-dom-api'
20
+
21
+ /** @public */
22
+ export interface DOMParserOptions extends ParseOptions {
23
+ DOMParser?: typeof DOMParser
24
+ }
25
+
26
+ /** @public */
27
+ export interface DOMSerializerOptions {
28
+ DOMSerializer?: { fromSchema: typeof DOMSerializer.fromSchema }
29
+ }
30
+
31
+ /** @public */
32
+ export interface DOMDocumentOptions {
33
+ /**
34
+ * The Document object to use for DOM operations. If not provided, defaults to
35
+ * the current browser's document object. Useful for server-side rendering or
36
+ * testing environments.
37
+ */
38
+ document?: Document
39
+ }
40
+
41
+ /** @public */
42
+ export interface JSONParserOptions {
43
+ /**
44
+ * The editor schema to use.
45
+ */
46
+ schema: Schema
47
+ }
48
+
49
+ /////////////// JSON <=> State ///////////////
50
+
51
+ /**
52
+ * Return a JSON object representing this state.
53
+ *
54
+ * @public
55
+ *
56
+ * @example
57
+ *
58
+ * ```ts
59
+ * const state = editor.state
60
+ * const json = jsonFromState(state)
61
+ * ```
62
+ */
63
+ export function jsonFromState(state: EditorState): StateJSON {
64
+ return state.toJSON() as StateJSON
65
+ }
66
+
67
+ /**
68
+ * Parse a JSON object to a ProseMirror state.
69
+ *
70
+ * @public
71
+ *
72
+ * @example
73
+ *
74
+ * ```ts
75
+ * const json = { state: { type: 'doc', content: [{ type: 'paragraph' }], selection: { type: 'text', from: 1, to: 1 } } }
76
+ * const state = stateFromJSON(json, { schema: editor.schema })
77
+ * ```
78
+ */
79
+ export function stateFromJSON(
80
+ json: StateJSON,
81
+ options: JSONParserOptions,
82
+ ): EditorState {
83
+ return EditorState.fromJSON({ schema: options.schema }, json)
84
+ }
85
+
86
+ /////////////// JSON <=> Node ///////////////
87
+
88
+ /**
89
+ * Return a JSON object representing this node.
90
+ *
91
+ * @public
92
+ *
93
+ * @example
94
+ *
95
+ * ```ts
96
+ * const node = editor.state.doc
97
+ * const json = jsonFromNode(node)
98
+ * ```
99
+ */
100
+ export function jsonFromNode(node: ProseMirrorNode): NodeJSON {
101
+ return node.toJSON() as NodeJSON
102
+ }
103
+
104
+ /**
105
+ * Parse a JSON object to a ProseMirror node.
106
+ *
107
+ * @public
108
+ *
109
+ * @example
110
+ *
111
+ * ```ts
112
+ * const json = { type: 'doc', content: [{ type: 'paragraph' }] }
113
+ * const node = nodeFromJSON(json, { schema: editor.schema })
114
+ * ```
115
+ */
116
+ export function nodeFromJSON(
117
+ json: NodeJSON,
118
+ options: JSONParserOptions,
119
+ ): ProseMirrorNode {
120
+ return options.schema.nodeFromJSON(json)
121
+ }
122
+
123
+ /////////////// Node <=> Element ///////////////
124
+
125
+ /**
126
+ * Parse a HTML element to a ProseMirror node.
127
+ *
128
+ * @public
129
+ *
130
+ * @example
131
+ *
132
+ * ```ts
133
+ * const element = document.getElementById('content')
134
+ * const node = nodeFromElement(element, { schema: editor.schema })
135
+ * ```
136
+ */
137
+ export function nodeFromElement(
138
+ element: DOMNode,
139
+ options: DOMParserOptions & JSONParserOptions,
140
+ ): ProseMirrorNode {
141
+ const { DOMParser: CustomDOMParser, schema, ...parseOptions } = options
142
+ return (CustomDOMParser || DOMParser)
143
+ .fromSchema(schema)
144
+ .parse(element, parseOptions)
145
+ }
146
+
147
+ /**
148
+ * Serialize a ProseMirror node to a HTML element.
149
+ *
150
+ * @public
151
+ *
152
+ * @example
153
+ *
154
+ * ```ts
155
+ * const node = editor.state.doc
156
+ * const element = elementFromNode(node)
157
+ * ```
158
+ */
159
+ export function elementFromNode(
160
+ node: ProseMirrorNode,
161
+ options?: DOMSerializerOptions & DOMDocumentOptions,
162
+ ): HTMLElement {
163
+ const Serializer = options?.DOMSerializer || DOMSerializer
164
+ const document = getBrowserDocument(options)
165
+ const schema = node.type.schema
166
+ const serializer = Serializer.fromSchema(schema)
167
+
168
+ if (schema.topNodeType !== node.type) {
169
+ return serializer.serializeNode(node, { document }) as HTMLElement
170
+ } else {
171
+ return serializer.serializeFragment(
172
+ node.content,
173
+ { document },
174
+ document.createElement('div'),
175
+ ) as HTMLElement
176
+ }
177
+ }
178
+
179
+ /////////////// Element <=> HTML ///////////////
180
+
181
+ /**
182
+ * Parse a HTML string to a HTML element.
183
+ *
184
+ * @internal
185
+ */
186
+ export function elementFromHTML(
187
+ html: string,
188
+ options?: DOMDocumentOptions,
189
+ ): HTMLElement {
190
+ const win = getBrowserWindow(options)
191
+ const parser = new win.DOMParser()
192
+ return parser.parseFromString(`<body><div>${html}</div></body>`, 'text/html')
193
+ .body.firstElementChild as HTMLElement
194
+ }
195
+
196
+ /**
197
+ * @internal
198
+ */
199
+ function htmlFromElement(element: HTMLElement): string {
200
+ return element.outerHTML
201
+ }
202
+
203
+ /////////////// Node <=> HTML ///////////////
204
+
205
+ /**
206
+ * Parse a HTML string to a ProseMirror node.
207
+ *
208
+ * @public
209
+ *
210
+ * @example
211
+ *
212
+ * ```ts
213
+ * const html = '<p>Hello, world!</p>'
214
+ * const node = nodeFromHTML(html, { schema: editor.schema })
215
+ * ```
216
+ */
217
+ export function nodeFromHTML(
218
+ html: string,
219
+ options: DOMParserOptions & JSONParserOptions & DOMDocumentOptions,
220
+ ): ProseMirrorNode {
221
+ return nodeFromElement(elementFromHTML(html, options), options)
222
+ }
223
+
224
+ /**
225
+ * Serialize a ProseMirror node to a HTML string
226
+ *
227
+ * @public
228
+ *
229
+ * @example
230
+ *
231
+ * ```ts
232
+ * const node = document.getElementById('content')
233
+ * const html = htmlFromNode(node)
234
+ * ```
235
+ */
236
+ export function htmlFromNode(
237
+ node: ProseMirrorNode,
238
+ options?: DOMSerializerOptions & DOMDocumentOptions,
239
+ ): string {
240
+ return elementFromNode(node, options).outerHTML
241
+ }
242
+
243
+ /////////////// JSON <=> Element ///////////////
244
+
245
+ /**
246
+ * Serialize a HTML element to a ProseMirror document JSON object.
247
+ *
248
+ * @public
249
+ *
250
+ * @example
251
+ *
252
+ * ```ts
253
+ * const element = document.getElementById('content')
254
+ * const json = jsonFromElement(element, { schema: editor.schema })
255
+ * ```
256
+ */
257
+ export function jsonFromElement(
258
+ element: DOMNode,
259
+ options: DOMParserOptions & JSONParserOptions,
260
+ ): NodeJSON {
261
+ return jsonFromNode(nodeFromElement(element, options))
262
+ }
263
+
264
+ /**
265
+ * Parse a ProseMirror document JSON object to a HTML element.
266
+ *
267
+ * @public
268
+ *
269
+ * @example
270
+ *
271
+ * ```ts
272
+ * const json = { type: 'doc', content: [{ type: 'paragraph' }] }
273
+ * const element = elementFromJSON(json, { schema: editor.schema })
274
+ * ```
275
+ */
276
+ export function elementFromJSON(
277
+ json: NodeJSON,
278
+ options: JSONParserOptions & DOMSerializerOptions & DOMDocumentOptions,
279
+ ): HTMLElement {
280
+ return elementFromNode(nodeFromJSON(json, options), options)
281
+ }
282
+
283
+ /////////////// JSON <=> HTML ///////////////
284
+
285
+ /**
286
+ * Parse a HTML string to a ProseMirror document JSON object.
287
+ *
288
+ * @public
289
+ *
290
+ * @example
291
+ *
292
+ * ```ts
293
+ * const html = '<p>Hello, world!</p>'
294
+ * const json = jsonFromHTML(html, { schema: editor.schema })
295
+ * ```
296
+ */
297
+ export function jsonFromHTML(
298
+ html: string,
299
+ options: DOMDocumentOptions & DOMParserOptions & JSONParserOptions,
300
+ ): NodeJSON {
301
+ return jsonFromElement(elementFromHTML(html, options), options)
302
+ }
303
+
304
+ /**
305
+ * Parse a ProseMirror document JSON object to a HTML string.
306
+ *
307
+ * @public
308
+ *
309
+ * @example
310
+ *
311
+ * ```ts
312
+ * const json = { type: 'doc', content: [{ type: 'paragraph' }] }
313
+ * const html = htmlFromJSON(json, { schema: editor.schema })
314
+ * ```
315
+ */
316
+ export function htmlFromJSON(
317
+ json: NodeJSON,
318
+ options: JSONParserOptions & DOMSerializerOptions & DOMDocumentOptions,
319
+ ): string {
320
+ return htmlFromElement(elementFromJSON(json, options))
321
+ }
@@ -0,0 +1,15 @@
1
+ import {
2
+ expect,
3
+ test,
4
+ } from 'vitest'
5
+
6
+ import { removeUndefinedValues } from './remove-undefined-values'
7
+
8
+ test('removeUndefinedValues', () => {
9
+ const obj1 = { a: 1, b: undefined, c: null }
10
+ const obj2 = { a: 1, c: null }
11
+
12
+ expect(Object.keys(obj1).length).toEqual(3)
13
+ expect(Object.keys(obj2).length).toEqual(2)
14
+ expect(removeUndefinedValues(obj1)).toEqual(obj2)
15
+ })
@@ -0,0 +1,9 @@
1
+ export function removeUndefinedValues<T extends object>(obj: T): T {
2
+ const result = {} as Record<string, unknown>
3
+ for (const [key, value] of Object.entries(obj)) {
4
+ if (value !== undefined) {
5
+ result[key] = value
6
+ }
7
+ }
8
+ return result as T
9
+ }
@@ -0,0 +1,11 @@
1
+ import {
2
+ TextSelection,
3
+ type Transaction,
4
+ } from '@prosekit/pm/state'
5
+
6
+ export function setSelectionAround(tr: Transaction, pos: number): void {
7
+ const docSize = tr.doc.content.size
8
+ const $pos = tr.doc.resolve(pos > docSize ? docSize : pos < 0 ? 0 : pos)
9
+ const selection = TextSelection.between($pos, $pos)
10
+ tr.setSelection(selection)
11
+ }
@@ -0,0 +1,91 @@
1
+ import {
2
+ Fragment,
3
+ Mark,
4
+ ProseMirrorNode,
5
+ Slice,
6
+ } from '@prosekit/pm/model'
7
+ import {
8
+ AllSelection,
9
+ NodeSelection,
10
+ Selection,
11
+ TextSelection,
12
+ } from '@prosekit/pm/state'
13
+
14
+ /**
15
+ * Checks if the given object is a {@link ProseMirrorNode} instance.
16
+ */
17
+ export function isProseMirrorNode(value: unknown): value is ProseMirrorNode {
18
+ return value instanceof ProseMirrorNode
19
+ }
20
+
21
+ /**
22
+ * Checks if the given object is a {@link Mark} instance.
23
+ *
24
+ * @public
25
+ */
26
+ export function isMark(value: unknown): value is Mark {
27
+ return value instanceof Mark
28
+ }
29
+
30
+ /**
31
+ * Checks if the given object is a {@link Fragment} instance.
32
+ *
33
+ * @public
34
+ */
35
+ export function isFragment(value: unknown): value is Fragment {
36
+ return value instanceof Fragment
37
+ }
38
+
39
+ /**
40
+ * Checks if the given object is a {@link Slice} instance.
41
+ *
42
+ * @public
43
+ */
44
+ export function isSlice(value: unknown): value is Slice {
45
+ return value instanceof Slice
46
+ }
47
+
48
+ /**
49
+ * Checks if the given object is a {@link Selection} instance.
50
+ *
51
+ * @public
52
+ */
53
+ export function isSelection(value: unknown): value is Selection {
54
+ return value instanceof Selection
55
+ }
56
+
57
+ /**
58
+ * Checks if the given object is a {@link TextSelection} instance.
59
+ *
60
+ * @public
61
+ */
62
+ export function isTextSelection(value: Selection): value is TextSelection {
63
+ return value instanceof TextSelection
64
+ }
65
+
66
+ /**
67
+ * Checks if the given object is a {@link NodeSelection} instance.
68
+ *
69
+ * @public
70
+ */
71
+ export function isNodeSelection(value: Selection): value is NodeSelection {
72
+ return value instanceof NodeSelection
73
+ }
74
+
75
+ /**
76
+ * Checks if the given object is a {@link AllSelection} instance.
77
+ *
78
+ * @public
79
+ */
80
+ export function isAllSelection(value: Selection): value is AllSelection {
81
+ return value instanceof AllSelection
82
+ }
83
+
84
+ /**
85
+ * @internal
86
+ */
87
+ export function isNotNullish<T>(
88
+ value: T | null | undefined,
89
+ ): value is T {
90
+ return value != null
91
+ }
@@ -0,0 +1,10 @@
1
+ import {
2
+ expect,
3
+ test,
4
+ } from 'vitest'
5
+
6
+ import { OBJECT_REPLACEMENT_CHARACTER } from './unicode'
7
+
8
+ test('constant value', () => {
9
+ expect(OBJECT_REPLACEMENT_CHARACTER).toBe('\uFFFC')
10
+ })
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export const OBJECT_REPLACEMENT_CHARACTER = '\uFFFC'
@@ -0,0 +1,15 @@
1
+ import type { Command } from '@prosekit/pm/state'
2
+
3
+ import { isInCodeBlock } from './is-in-code-block'
4
+
5
+ /**
6
+ * @internal
7
+ */
8
+ export function withSkipCodeBlock(command: Command): Command {
9
+ return (state, dispatch, view) => {
10
+ if (isInCodeBlock(state.selection)) {
11
+ return false
12
+ }
13
+ return command(state, dispatch, view)
14
+ }
15
+ }