@portabletext/editor 1.44.8 → 1.44.10
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/editor-provider.cjs.map +1 -1
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/index.cjs +20 -5
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -13
- package/lib/index.d.ts +1 -13
- package/lib/index.js +20 -5
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.cts +1 -13
- package/lib/plugins/index.d.ts +1 -13
- package/package.json +1 -1
- package/src/behaviors/behavior.types.event.ts +1 -13
- package/src/editor/Editable.tsx +3 -2
- package/src/editor/range-decorations-machine.ts +21 -3
package/lib/plugins/index.d.cts
CHANGED
|
@@ -4826,19 +4826,7 @@ declare type ExternalBehaviorEvent =
|
|
|
4826
4826
|
}
|
|
4827
4827
|
}
|
|
4828
4828
|
}
|
|
4829
|
-
|
|
|
4830
|
-
AbstractBehaviorEvent,
|
|
4831
|
-
'type',
|
|
4832
|
-
| 'annotation.toggle'
|
|
4833
|
-
| 'decorator.toggle'
|
|
4834
|
-
| 'insert.blocks'
|
|
4835
|
-
| 'list item.add'
|
|
4836
|
-
| 'list item.remove'
|
|
4837
|
-
| 'list item.toggle'
|
|
4838
|
-
| 'style.add'
|
|
4839
|
-
| 'style.remove'
|
|
4840
|
-
| 'style.toggle'
|
|
4841
|
-
>
|
|
4829
|
+
| AbstractBehaviorEvent
|
|
4842
4830
|
| SyntheticBehaviorEvent
|
|
4843
4831
|
| CustomBehaviorEvent
|
|
4844
4832
|
|
package/lib/plugins/index.d.ts
CHANGED
|
@@ -4826,19 +4826,7 @@ declare type ExternalBehaviorEvent =
|
|
|
4826
4826
|
}
|
|
4827
4827
|
}
|
|
4828
4828
|
}
|
|
4829
|
-
|
|
|
4830
|
-
AbstractBehaviorEvent,
|
|
4831
|
-
'type',
|
|
4832
|
-
| 'annotation.toggle'
|
|
4833
|
-
| 'decorator.toggle'
|
|
4834
|
-
| 'insert.blocks'
|
|
4835
|
-
| 'list item.add'
|
|
4836
|
-
| 'list item.remove'
|
|
4837
|
-
| 'list item.toggle'
|
|
4838
|
-
| 'style.add'
|
|
4839
|
-
| 'style.remove'
|
|
4840
|
-
| 'style.toggle'
|
|
4841
|
-
>
|
|
4829
|
+
| AbstractBehaviorEvent
|
|
4842
4830
|
| SyntheticBehaviorEvent
|
|
4843
4831
|
| CustomBehaviorEvent
|
|
4844
4832
|
|
package/package.json
CHANGED
|
@@ -48,19 +48,7 @@ export type ExternalBehaviorEvent =
|
|
|
48
48
|
value?: {[prop: string]: unknown}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
|
|
|
52
|
-
AbstractBehaviorEvent,
|
|
53
|
-
'type',
|
|
54
|
-
| 'annotation.toggle'
|
|
55
|
-
| 'decorator.toggle'
|
|
56
|
-
| 'insert.blocks'
|
|
57
|
-
| 'list item.add'
|
|
58
|
-
| 'list item.remove'
|
|
59
|
-
| 'list item.toggle'
|
|
60
|
-
| 'style.add'
|
|
61
|
-
| 'style.remove'
|
|
62
|
-
| 'style.toggle'
|
|
63
|
-
>
|
|
51
|
+
| AbstractBehaviorEvent
|
|
64
52
|
| SyntheticBehaviorEvent
|
|
65
53
|
| CustomBehaviorEvent
|
|
66
54
|
|
package/src/editor/Editable.tsx
CHANGED
|
@@ -175,10 +175,11 @@ export const PortableTextEditable = forwardRef<
|
|
|
175
175
|
|
|
176
176
|
const rangeDecorationsActor = useActorRef(rangeDecorationsMachine, {
|
|
177
177
|
input: {
|
|
178
|
+
rangeDecorations: rangeDecorations ?? [],
|
|
178
179
|
readOnly,
|
|
179
|
-
slateEditor,
|
|
180
180
|
schema: schemaTypes,
|
|
181
|
-
|
|
181
|
+
slateEditor,
|
|
182
|
+
skipSetup: !editorActor.getSnapshot().matches({setup: 'setting up'}),
|
|
182
183
|
},
|
|
183
184
|
})
|
|
184
185
|
useSelector(rangeDecorationsActor, (s) => s.context.updateCount)
|
|
@@ -50,6 +50,7 @@ export const rangeDecorationsMachine = setup({
|
|
|
50
50
|
context: {} as {
|
|
51
51
|
decoratedRanges: Array<DecoratedRange>
|
|
52
52
|
pendingRangeDecorations: Array<RangeDecoration>
|
|
53
|
+
skipSetup: boolean
|
|
53
54
|
readOnly: boolean
|
|
54
55
|
schema: EditorSchema
|
|
55
56
|
slateEditor: PortableTextSlateEditor
|
|
@@ -59,6 +60,7 @@ export const rangeDecorationsMachine = setup({
|
|
|
59
60
|
rangeDecorations: Array<RangeDecoration>
|
|
60
61
|
readOnly: boolean
|
|
61
62
|
schema: EditorSchema
|
|
63
|
+
skipSetup: boolean
|
|
62
64
|
slateEditor: PortableTextSlateEditor
|
|
63
65
|
},
|
|
64
66
|
events: {} as
|
|
@@ -250,6 +252,7 @@ export const rangeDecorationsMachine = setup({
|
|
|
250
252
|
return different
|
|
251
253
|
},
|
|
252
254
|
'not read only': ({context}) => !context.readOnly,
|
|
255
|
+
'should skip setup': ({context}) => context.skipSetup,
|
|
253
256
|
},
|
|
254
257
|
}).createMachine({
|
|
255
258
|
id: 'range decorations',
|
|
@@ -257,6 +260,7 @@ export const rangeDecorationsMachine = setup({
|
|
|
257
260
|
readOnly: input.readOnly,
|
|
258
261
|
pendingRangeDecorations: input.rangeDecorations,
|
|
259
262
|
decoratedRanges: [],
|
|
263
|
+
skipSetup: input.skipSetup,
|
|
260
264
|
schema: input.schema,
|
|
261
265
|
slateEditor: input.slateEditor,
|
|
262
266
|
updateCount: 0,
|
|
@@ -270,9 +274,23 @@ export const rangeDecorationsMachine = setup({
|
|
|
270
274
|
actions: ['assign readOnly'],
|
|
271
275
|
},
|
|
272
276
|
},
|
|
273
|
-
initial: '
|
|
277
|
+
initial: 'setting up',
|
|
274
278
|
states: {
|
|
275
|
-
|
|
279
|
+
'setting up': {
|
|
280
|
+
always: [
|
|
281
|
+
{
|
|
282
|
+
guard: and(['should skip setup', 'has pending range decorations']),
|
|
283
|
+
target: 'ready',
|
|
284
|
+
actions: [
|
|
285
|
+
'set up initial range decorations',
|
|
286
|
+
'increment update count',
|
|
287
|
+
],
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
guard: 'should skip setup',
|
|
291
|
+
target: 'ready',
|
|
292
|
+
},
|
|
293
|
+
],
|
|
276
294
|
on: {
|
|
277
295
|
'range decorations updated': {
|
|
278
296
|
actions: ['update pending range decorations'],
|
|
@@ -292,7 +310,7 @@ export const rangeDecorationsMachine = setup({
|
|
|
292
310
|
],
|
|
293
311
|
},
|
|
294
312
|
},
|
|
295
|
-
ready: {
|
|
313
|
+
'ready': {
|
|
296
314
|
initial: 'idle',
|
|
297
315
|
on: {
|
|
298
316
|
'range decorations updated': {
|