@portabletext/editor 1.47.0 → 1.47.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_chunks-cjs/behavior.core.cjs +7 -7
- package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
- package/lib/_chunks-cjs/behavior.markdown.cjs.map +1 -1
- package/lib/_chunks-cjs/editor-provider.cjs +379 -326
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-cjs/parse-blocks.cjs +4 -4
- package/lib/_chunks-cjs/parse-blocks.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs.map +1 -1
- package/lib/_chunks-es/behavior.core.js +7 -7
- package/lib/_chunks-es/behavior.core.js.map +1 -1
- package/lib/_chunks-es/behavior.markdown.js.map +1 -1
- package/lib/_chunks-es/editor-provider.js +380 -327
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/_chunks-es/parse-blocks.js +4 -4
- package/lib/_chunks-es/parse-blocks.js.map +1 -1
- package/lib/_chunks-es/selector.is-overlapping-selection.js.map +1 -1
- package/lib/behaviors/index.cjs.map +1 -1
- package/lib/behaviors/index.d.cts +70 -28
- package/lib/behaviors/index.d.ts +70 -28
- package/lib/behaviors/index.js.map +1 -1
- package/lib/index.cjs +12 -14
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +61 -3
- package/lib/index.d.ts +61 -3
- package/lib/index.js +12 -14
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.cjs.map +1 -1
- package/lib/plugins/index.d.cts +68 -23
- package/lib/plugins/index.d.ts +68 -23
- package/lib/plugins/index.js.map +1 -1
- package/lib/selectors/index.d.cts +69 -27
- package/lib/selectors/index.d.ts +69 -27
- package/lib/utils/index.d.cts +74 -29
- package/lib/utils/index.d.ts +74 -29
- package/package.json +6 -6
- package/src/behavior-actions/behavior.action.insert.block.ts +1 -1
- package/src/behavior-actions/behavior.action.split.block.ts +1 -1
- package/src/behavior-actions/behavior.guards.ts +1 -1
- package/src/behaviors/behavior.core.decorators.ts +4 -4
- package/src/behaviors/behavior.core.insert-break.ts +4 -4
- package/src/behaviors/behavior.decorator-pair.ts +1 -1
- package/src/behaviors/behavior.links.ts +1 -1
- package/src/behaviors/behavior.markdown.ts +1 -1
- package/src/behaviors/behavior.perform-event.ts +1 -1
- package/src/converters/converter.portable-text.deserialize.test.ts +2 -3
- package/src/converters/converter.text-html.deserialize.test.ts +62 -5
- package/src/converters/converter.text-html.serialize.test.ts +9 -5
- package/src/converters/converter.text-html.ts +66 -64
- package/src/converters/converter.text-plain.test.ts +9 -4
- package/src/converters/converter.text-plain.ts +91 -87
- package/src/converters/converters.core.ts +13 -8
- package/src/editor/Editable.tsx +18 -13
- package/src/editor/PortableTextEditor.tsx +5 -5
- package/src/editor/__tests__/PortableTextEditorTester.tsx +4 -3
- package/src/editor/__tests__/insert-block.test.tsx +10 -10
- package/src/editor/__tests__/self-solving.test.tsx +2 -2
- package/src/editor/components/Synchronizer.tsx +1 -1
- package/src/editor/create-editor.ts +51 -18
- package/src/editor/editor-machine.ts +1 -1
- package/src/editor/{define-schema.ts → editor-schema.ts} +114 -5
- package/src/editor/editor-snapshot.ts +1 -1
- package/src/editor/get-active-decorators.ts +2 -2
- package/src/editor/{create-editor-schema.ts → legacy-schema.ts} +3 -3
- package/src/editor/mutation-machine.ts +1 -1
- package/src/editor/plugins/createWithObjectKeys.ts +6 -9
- package/src/editor/plugins/createWithPatches.ts +12 -11
- package/src/editor/plugins/createWithPortableTextBlockStyle.ts +2 -6
- package/src/editor/plugins/createWithPortableTextMarkModel.ts +15 -12
- package/src/editor/plugins/createWithSchemaTypes.ts +24 -16
- package/src/editor/plugins/createWithUndoRedo.ts +3 -4
- package/src/editor/plugins/createWithUtils.ts +12 -10
- package/src/editor/plugins/with-plugins.ts +5 -15
- package/src/editor/range-decorations-machine.ts +1 -1
- package/src/editor/sync-machine.ts +1 -1
- package/src/index.ts +2 -2
- package/src/internal-utils/__tests__/operationToPatches.test.ts +12 -10
- package/src/internal-utils/__tests__/patchToOperations.test.ts +3 -2
- package/src/internal-utils/__tests__/values.test.ts +3 -2
- package/src/internal-utils/applyPatch.ts +7 -9
- package/src/internal-utils/create-test-snapshot.ts +1 -1
- package/src/internal-utils/drag-selection.test.ts +1 -1
- package/src/internal-utils/operationToPatches.ts +4 -6
- package/src/internal-utils/parse-blocks.test.ts +1 -1
- package/src/internal-utils/parse-blocks.ts +8 -7
- package/src/internal-utils/slate-children-to-blocks.ts +1 -1
- package/src/internal-utils/slate-utils.ts +1 -1
- package/src/internal-utils/validateValue.ts +4 -6
- package/src/internal-utils/values.ts +5 -5
- package/src/plugins/plugin.decorator-shortcut.ts +1 -1
- package/src/plugins/plugin.markdown.test.tsx +1 -1
- package/src/plugins/plugin.markdown.tsx +1 -1
- package/src/selectors/selector.get-selection-text.test.ts +1 -1
- package/src/selectors/selector.get-trimmed-selection.test.ts +1 -1
|
@@ -4,24 +4,26 @@ import {beforeEach, describe, expect, it} from 'vitest'
|
|
|
4
4
|
import {createActor} from 'xstate'
|
|
5
5
|
import {coreBehaviors} from '../../behaviors/behavior.core'
|
|
6
6
|
import {schemaType} from '../../editor/__tests__/PortableTextEditorTester'
|
|
7
|
-
import {createEditorSchema} from '../../editor/create-editor-schema'
|
|
8
7
|
import {editorMachine} from '../../editor/editor-machine'
|
|
8
|
+
import {legacySchemaToEditorSchema} from '../../editor/editor-schema'
|
|
9
9
|
import {defaultKeyGenerator} from '../../editor/key-generator'
|
|
10
|
+
import {createLegacySchema} from '../../editor/legacy-schema'
|
|
10
11
|
import {withPlugins} from '../../editor/plugins/with-plugins'
|
|
11
12
|
import {createOperationToPatches} from '../operationToPatches'
|
|
12
13
|
|
|
13
|
-
const schemaTypes =
|
|
14
|
+
const schemaTypes = legacySchemaToEditorSchema(createLegacySchema(schemaType))
|
|
15
|
+
const editorActor = createActor(editorMachine, {
|
|
16
|
+
input: {
|
|
17
|
+
behaviors: coreBehaviors,
|
|
18
|
+
schema: schemaTypes,
|
|
19
|
+
keyGenerator: defaultKeyGenerator,
|
|
20
|
+
},
|
|
21
|
+
})
|
|
14
22
|
|
|
15
|
-
const operationToPatches = createOperationToPatches(
|
|
23
|
+
const operationToPatches = createOperationToPatches(editorActor)
|
|
16
24
|
|
|
17
25
|
const editor = withPlugins(createEditor(), {
|
|
18
|
-
editorActor
|
|
19
|
-
input: {
|
|
20
|
-
behaviors: coreBehaviors,
|
|
21
|
-
schema: schemaTypes,
|
|
22
|
-
keyGenerator: defaultKeyGenerator,
|
|
23
|
-
},
|
|
24
|
-
}),
|
|
26
|
+
editorActor,
|
|
25
27
|
subscriptions: [],
|
|
26
28
|
})
|
|
27
29
|
|
|
@@ -4,14 +4,15 @@ import {beforeEach, describe, expect, it} from 'vitest'
|
|
|
4
4
|
import {createActor} from 'xstate'
|
|
5
5
|
import {coreBehaviors} from '../../behaviors/behavior.core'
|
|
6
6
|
import {schemaType} from '../../editor/__tests__/PortableTextEditorTester'
|
|
7
|
-
import {createEditorSchema} from '../../editor/create-editor-schema'
|
|
8
7
|
import {editorMachine} from '../../editor/editor-machine'
|
|
8
|
+
import {legacySchemaToEditorSchema} from '../../editor/editor-schema'
|
|
9
9
|
import {defaultKeyGenerator} from '../../editor/key-generator'
|
|
10
|
+
import {createLegacySchema} from '../../editor/legacy-schema'
|
|
10
11
|
import {withPlugins} from '../../editor/plugins/with-plugins'
|
|
11
12
|
import {createApplyPatch} from '../applyPatch'
|
|
12
13
|
import {VOID_CHILD_KEY} from '../values'
|
|
13
14
|
|
|
14
|
-
const schemaTypes =
|
|
15
|
+
const schemaTypes = legacySchemaToEditorSchema(createLegacySchema(schemaType))
|
|
15
16
|
|
|
16
17
|
const patchToOperations = createApplyPatch(schemaTypes)
|
|
17
18
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {describe, expect, it} from 'vitest'
|
|
2
2
|
import {schemaType} from '../../editor/__tests__/PortableTextEditorTester'
|
|
3
|
-
import {
|
|
3
|
+
import {legacySchemaToEditorSchema} from '../../editor/editor-schema'
|
|
4
|
+
import {createLegacySchema} from '../../editor/legacy-schema'
|
|
4
5
|
import {fromSlateValue, toSlateValue} from '../values'
|
|
5
6
|
|
|
6
|
-
const schemaTypes =
|
|
7
|
+
const schemaTypes = legacySchemaToEditorSchema(createLegacySchema(schemaType))
|
|
7
8
|
|
|
8
9
|
describe('toSlateValue', () => {
|
|
9
10
|
it('checks undefined', () => {
|
|
@@ -30,10 +30,8 @@ import {
|
|
|
30
30
|
type Node,
|
|
31
31
|
type Path as SlatePath,
|
|
32
32
|
} from 'slate'
|
|
33
|
-
import type {
|
|
34
|
-
|
|
35
|
-
PortableTextSlateEditor,
|
|
36
|
-
} from '../types/editor'
|
|
33
|
+
import type {EditorSchema} from '../editor/editor-schema'
|
|
34
|
+
import type {PortableTextSlateEditor} from '../types/editor'
|
|
37
35
|
import {debugWithName} from './debug'
|
|
38
36
|
import {toSlateValue} from './values'
|
|
39
37
|
import {KEY_TO_SLATE_ELEMENT} from './weakMaps'
|
|
@@ -45,7 +43,7 @@ const debugVerbose = debug.enabled && true
|
|
|
45
43
|
* Creates a function that can apply a patch onto a PortableTextSlateEditor.
|
|
46
44
|
*/
|
|
47
45
|
export function createApplyPatch(
|
|
48
|
-
|
|
46
|
+
schema: EditorSchema,
|
|
49
47
|
): (editor: PortableTextSlateEditor, patch: Patch) => boolean {
|
|
50
48
|
return (editor: PortableTextSlateEditor, patch: Patch): boolean => {
|
|
51
49
|
let changed = false
|
|
@@ -61,7 +59,7 @@ export function createApplyPatch(
|
|
|
61
59
|
try {
|
|
62
60
|
switch (patch.type) {
|
|
63
61
|
case 'insert':
|
|
64
|
-
changed = insertPatch(editor, patch,
|
|
62
|
+
changed = insertPatch(editor, patch, schema)
|
|
65
63
|
break
|
|
66
64
|
case 'unset':
|
|
67
65
|
changed = unsetPatch(editor, patch)
|
|
@@ -148,7 +146,7 @@ export function diffMatchPatch(
|
|
|
148
146
|
function insertPatch(
|
|
149
147
|
editor: PortableTextSlateEditor,
|
|
150
148
|
patch: InsertPatch,
|
|
151
|
-
|
|
149
|
+
schema: EditorSchema,
|
|
152
150
|
) {
|
|
153
151
|
const {
|
|
154
152
|
block: targetBlock,
|
|
@@ -169,7 +167,7 @@ function insertPatch(
|
|
|
169
167
|
const {items, position} = patch
|
|
170
168
|
const blocksToInsert = toSlateValue(
|
|
171
169
|
items as PortableTextBlock[],
|
|
172
|
-
{schemaTypes},
|
|
170
|
+
{schemaTypes: schema},
|
|
173
171
|
KEY_TO_SLATE_ELEMENT.get(editor),
|
|
174
172
|
) as Descendant[]
|
|
175
173
|
const targetBlockIndex = targetBlockPath[0]
|
|
@@ -191,7 +189,7 @@ function insertPatch(
|
|
|
191
189
|
targetBlock &&
|
|
192
190
|
toSlateValue(
|
|
193
191
|
[{...targetBlock, children: items as PortableTextChild[]}],
|
|
194
|
-
{schemaTypes},
|
|
192
|
+
{schemaTypes: schema},
|
|
195
193
|
KEY_TO_SLATE_ELEMENT.get(editor),
|
|
196
194
|
)
|
|
197
195
|
const targetChildIndex = targetChildPath[1]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {EditorSnapshot} from '..'
|
|
2
|
-
import {compileSchemaDefinition, defineSchema} from '../editor/
|
|
2
|
+
import {compileSchemaDefinition, defineSchema} from '../editor/editor-schema'
|
|
3
3
|
import {createTestKeyGenerator} from './test-key-generator'
|
|
4
4
|
|
|
5
5
|
export function createTestSnapshot(snapshot: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {describe, expect, test} from 'vitest'
|
|
2
|
-
import {compileSchemaDefinition, defineSchema} from '../editor/
|
|
2
|
+
import {compileSchemaDefinition, defineSchema} from '../editor/editor-schema'
|
|
3
3
|
import type {EditorSelection} from '../types/editor'
|
|
4
4
|
import {createTestSnapshot} from './create-test-snapshot'
|
|
5
5
|
import {getDragSelection} from './drag-selection'
|
|
@@ -21,20 +21,18 @@ import {
|
|
|
21
21
|
type SetNodeOperation,
|
|
22
22
|
type SplitNodeOperation,
|
|
23
23
|
} from 'slate'
|
|
24
|
+
import type {EditorActor} from '../editor/editor-machine'
|
|
24
25
|
import type {PatchFunctions} from '../editor/plugins/createWithPatches'
|
|
25
|
-
import type {
|
|
26
|
-
PortableTextMemberSchemaTypes,
|
|
27
|
-
PortableTextSlateEditor,
|
|
28
|
-
} from '../types/editor'
|
|
26
|
+
import type {PortableTextSlateEditor} from '../types/editor'
|
|
29
27
|
import {debugWithName} from './debug'
|
|
30
28
|
import {fromSlateValue} from './values'
|
|
31
29
|
|
|
32
30
|
const debug = debugWithName('operationToPatches')
|
|
33
31
|
|
|
34
32
|
export function createOperationToPatches(
|
|
35
|
-
|
|
33
|
+
editorActor: EditorActor,
|
|
36
34
|
): PatchFunctions {
|
|
37
|
-
const textBlockName =
|
|
35
|
+
const textBlockName = editorActor.getSnapshot().context.schema.block.name
|
|
38
36
|
function insertTextPatch(
|
|
39
37
|
editor: PortableTextSlateEditor,
|
|
40
38
|
operation: InsertTextOperation,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {describe, expect, test} from 'vitest'
|
|
2
|
-
import {compileSchemaDefinition, defineSchema} from '../editor/
|
|
2
|
+
import {compileSchemaDefinition, defineSchema} from '../editor/editor-schema'
|
|
3
3
|
import {parseBlock, parseSpan} from './parse-blocks'
|
|
4
4
|
import {createTestKeyGenerator} from './test-key-generator'
|
|
5
5
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
ObjectSchemaType,
|
|
3
2
|
PortableTextBlock,
|
|
4
3
|
PortableTextObject,
|
|
5
4
|
PortableTextSpan,
|
|
6
5
|
PortableTextTextBlock,
|
|
7
6
|
TypedObject,
|
|
8
7
|
} from '@sanity/types'
|
|
9
|
-
import type {EditorSchema} from '../editor/
|
|
8
|
+
import type {EditorSchema} from '../editor/editor-schema'
|
|
10
9
|
import type {EditorContext} from '../editor/editor-snapshot'
|
|
11
10
|
import {isTypedObject} from './asserters'
|
|
12
11
|
|
|
@@ -192,9 +191,9 @@ function parseTextBlock({
|
|
|
192
191
|
*/
|
|
193
192
|
if (
|
|
194
193
|
typeof parsedBlock.style !== 'string' ||
|
|
195
|
-
!context.schema.styles.find((style) => style.
|
|
194
|
+
!context.schema.styles.find((style) => style.name === block.style)
|
|
196
195
|
) {
|
|
197
|
-
const defaultStyle = context.schema.styles.at(0)?.
|
|
196
|
+
const defaultStyle = context.schema.styles.at(0)?.name
|
|
198
197
|
|
|
199
198
|
if (defaultStyle !== undefined) {
|
|
200
199
|
parsedBlock.style = defaultStyle
|
|
@@ -208,7 +207,7 @@ function parseTextBlock({
|
|
|
208
207
|
*/
|
|
209
208
|
if (
|
|
210
209
|
typeof parsedBlock.listItem !== 'string' ||
|
|
211
|
-
!context.schema.lists.find((list) => list.
|
|
210
|
+
!context.schema.lists.find((list) => list.name === block.listItem)
|
|
212
211
|
) {
|
|
213
212
|
delete parsedBlock.listItem
|
|
214
213
|
}
|
|
@@ -272,7 +271,7 @@ export function parseSpan({
|
|
|
272
271
|
}
|
|
273
272
|
|
|
274
273
|
if (
|
|
275
|
-
context.schema.decorators.some((decorator) => decorator.
|
|
274
|
+
context.schema.decorators.some((decorator) => decorator.name === mark)
|
|
276
275
|
) {
|
|
277
276
|
return [mark]
|
|
278
277
|
}
|
|
@@ -362,7 +361,9 @@ function parseObject({
|
|
|
362
361
|
options,
|
|
363
362
|
}: {
|
|
364
363
|
object: TypedObject
|
|
365
|
-
context: Pick<EditorContext, 'keyGenerator'> & {
|
|
364
|
+
context: Pick<EditorContext, 'keyGenerator'> & {
|
|
365
|
+
schemaType: EditorSchema['blockObjects'][0]
|
|
366
|
+
}
|
|
366
367
|
options: {refreshKeys: boolean}
|
|
367
368
|
}): PortableTextObject {
|
|
368
369
|
// Validates all props on the object and only takes those that match
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {PortableTextBlock} from '@sanity/types'
|
|
2
2
|
import type {Descendant} from 'slate'
|
|
3
|
-
import type {EditorSchema} from '../editor/
|
|
3
|
+
import type {EditorSchema} from '../editor/editor-schema'
|
|
4
4
|
|
|
5
5
|
export function slateChildrenToBlocks(
|
|
6
6
|
schema: EditorSchema,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Editor, Element, Node, Range, type Path, type Point} from 'slate'
|
|
2
|
-
import type {EditorSchema} from '../editor/
|
|
2
|
+
import type {EditorSchema} from '../editor/editor-schema'
|
|
3
3
|
import type {EditorSelection, PortableTextSlateEditor} from '../types/editor'
|
|
4
4
|
import {fromSlateValue} from './values'
|
|
5
5
|
|
|
@@ -6,10 +6,8 @@ import {
|
|
|
6
6
|
type PortableTextTextBlock,
|
|
7
7
|
} from '@sanity/types'
|
|
8
8
|
import {flatten, isPlainObject, uniq} from 'lodash'
|
|
9
|
-
import type {
|
|
10
|
-
|
|
11
|
-
PortableTextMemberSchemaTypes,
|
|
12
|
-
} from '../types/editor'
|
|
9
|
+
import type {EditorSchema} from '../editor/editor-schema'
|
|
10
|
+
import type {InvalidValueResolution} from '../types/editor'
|
|
13
11
|
|
|
14
12
|
export interface Validation {
|
|
15
13
|
valid: boolean
|
|
@@ -19,7 +17,7 @@ export interface Validation {
|
|
|
19
17
|
|
|
20
18
|
export function validateValue(
|
|
21
19
|
value: PortableTextBlock[] | undefined,
|
|
22
|
-
types:
|
|
20
|
+
types: EditorSchema,
|
|
23
21
|
keyGenerator: () => string,
|
|
24
22
|
): Validation {
|
|
25
23
|
let resolution: InvalidValueResolution | null = null
|
|
@@ -270,7 +268,7 @@ export function validateValue(
|
|
|
270
268
|
|
|
271
269
|
// Test that every annotation mark used has a definition
|
|
272
270
|
const annotationMarks = allUsedMarks.filter(
|
|
273
|
-
(mark) => !types.decorators.map((dec) => dec.
|
|
271
|
+
(mark) => !types.decorators.map((dec) => dec.name).includes(mark),
|
|
274
272
|
)
|
|
275
273
|
const orphanedMarks = annotationMarks.filter(
|
|
276
274
|
(mark) =>
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
} from '@sanity/types'
|
|
8
8
|
import {isEqual} from 'lodash'
|
|
9
9
|
import {Element, Text, type Descendant, type Node} from 'slate'
|
|
10
|
-
import type {
|
|
10
|
+
import type {EditorSchema} from '../editor/editor-schema'
|
|
11
11
|
|
|
12
12
|
export const EMPTY_MARKDEFS: PortableTextObject[] = []
|
|
13
13
|
|
|
@@ -31,7 +31,7 @@ function keepObjectEquality(
|
|
|
31
31
|
|
|
32
32
|
export function toSlateValue(
|
|
33
33
|
value: PortableTextBlock[] | undefined,
|
|
34
|
-
{schemaTypes}: {schemaTypes:
|
|
34
|
+
{schemaTypes}: {schemaTypes: EditorSchema},
|
|
35
35
|
keyMap: Record<string, any> = {},
|
|
36
36
|
): Descendant[] {
|
|
37
37
|
if (value && Array.isArray(value)) {
|
|
@@ -88,7 +88,7 @@ export function toSlateValue(
|
|
|
88
88
|
}
|
|
89
89
|
// TODO: remove this when we have a better way to handle missing style
|
|
90
90
|
if (hasMissingStyle) {
|
|
91
|
-
rest.style = schemaTypes.styles[0].
|
|
91
|
+
rest.style = schemaTypes.styles[0].name
|
|
92
92
|
}
|
|
93
93
|
return keepObjectEquality({_type, _key, ...rest, children}, keyMap)
|
|
94
94
|
}
|
|
@@ -167,7 +167,7 @@ export function fromSlateValue(
|
|
|
167
167
|
|
|
168
168
|
export function isEqualToEmptyEditor(
|
|
169
169
|
children: Descendant[] | PortableTextBlock[],
|
|
170
|
-
schemaTypes:
|
|
170
|
+
schemaTypes: EditorSchema,
|
|
171
171
|
): boolean {
|
|
172
172
|
return (
|
|
173
173
|
children === undefined ||
|
|
@@ -178,7 +178,7 @@ export function isEqualToEmptyEditor(
|
|
|
178
178
|
Element.isElement(children[0]) &&
|
|
179
179
|
children[0]._type === schemaTypes.block.name &&
|
|
180
180
|
'style' in children[0] &&
|
|
181
|
-
children[0].style === schemaTypes.styles[0].
|
|
181
|
+
children[0].style === schemaTypes.styles[0].name &&
|
|
182
182
|
!('listItem' in children[0]) &&
|
|
183
183
|
Array.isArray(children[0].children) &&
|
|
184
184
|
children[0].children.length === 1 &&
|
|
@@ -11,8 +11,8 @@ import {createDecoratorPairBehavior} from '../behaviors/behavior.decorator-pair'
|
|
|
11
11
|
import {effect, execute} from '../behaviors/behavior.types.action'
|
|
12
12
|
import {defineBehavior} from '../behaviors/behavior.types.behavior'
|
|
13
13
|
import type {Editor} from '../editor/create-editor'
|
|
14
|
-
import type {EditorSchema} from '../editor/define-schema'
|
|
15
14
|
import {useEditor} from '../editor/editor-provider'
|
|
15
|
+
import type {EditorSchema} from '../editor/editor-schema'
|
|
16
16
|
import type {BlockOffset} from '../types/block-offset'
|
|
17
17
|
import * as utils from '../utils'
|
|
18
18
|
|
|
@@ -3,8 +3,8 @@ import React from 'react'
|
|
|
3
3
|
import {describe, expect, test, vi} from 'vitest'
|
|
4
4
|
import {render} from 'vitest-browser-react'
|
|
5
5
|
import {PortableTextEditable, type Editor} from '..'
|
|
6
|
-
import {defineSchema} from '../editor/define-schema'
|
|
7
6
|
import {EditorProvider} from '../editor/editor-provider'
|
|
7
|
+
import {defineSchema} from '../editor/editor-schema'
|
|
8
8
|
import {getTersePt} from '../internal-utils/terse-pt'
|
|
9
9
|
import {createTestKeyGenerator} from '../internal-utils/test-key-generator'
|
|
10
10
|
import {getTextMarks} from '../internal-utils/text-marks'
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
createMarkdownBehaviors,
|
|
4
4
|
type MarkdownBehaviorsConfig,
|
|
5
5
|
} from '../behaviors/behavior.markdown'
|
|
6
|
-
import type {EditorSchema} from '../editor/define-schema'
|
|
7
6
|
import {useEditor} from '../editor/editor-provider'
|
|
7
|
+
import type {EditorSchema} from '../editor/editor-schema'
|
|
8
8
|
import {DecoratorShortcutPlugin} from './plugin.decorator-shortcut'
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type {PortableTextBlock} from '@sanity/types'
|
|
2
2
|
import {expect, test} from 'vitest'
|
|
3
3
|
import type {EditorSelection} from '..'
|
|
4
|
-
import {compileSchemaDefinition, defineSchema} from '../editor/
|
|
4
|
+
import {compileSchemaDefinition, defineSchema} from '../editor/editor-schema'
|
|
5
5
|
import {createTestSnapshot} from '../internal-utils/create-test-snapshot'
|
|
6
6
|
import {getSelectionText} from './selector.get-selection-text'
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {PortableTextBlock} from '@sanity/types'
|
|
2
2
|
import {describe, expect, test} from 'vitest'
|
|
3
|
-
import {compileSchemaDefinition, defineSchema} from '../editor/
|
|
3
|
+
import {compileSchemaDefinition, defineSchema} from '../editor/editor-schema'
|
|
4
4
|
import {createTestSnapshot} from '../internal-utils/create-test-snapshot'
|
|
5
5
|
import {parseBlock} from '../internal-utils/parse-blocks'
|
|
6
6
|
import {createTestKeyGenerator} from '../internal-utils/test-key-generator'
|