@portabletext/editor 1.48.9 → 1.48.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 +103 -47
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-es/editor-provider.js +103 -47
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/behaviors/index.d.cts +449 -288
- package/lib/behaviors/index.d.ts +449 -288
- package/lib/index.d.cts +449 -288
- package/lib/index.d.ts +449 -288
- package/lib/plugins/index.d.cts +449 -288
- package/lib/plugins/index.d.ts +449 -288
- package/lib/selectors/index.d.cts +449 -288
- package/lib/selectors/index.d.ts +449 -288
- package/lib/utils/index.d.cts +449 -288
- package/lib/utils/index.d.ts +449 -288
- package/package.json +3 -3
- package/src/editor/editor-machine.ts +104 -39
- package/src/editor/sync-machine.ts +10 -4
|
@@ -1652,8 +1652,11 @@ const debug$d = debugWithName("sync machine"), syncValueCallback = ({
|
|
|
1652
1652
|
event
|
|
1653
1653
|
}) => (assertEvent(event, "done syncing"), event.value)
|
|
1654
1654
|
}),
|
|
1655
|
-
"emit done syncing
|
|
1656
|
-
type: "done syncing
|
|
1655
|
+
"emit done syncing value": emit({
|
|
1656
|
+
type: "done syncing value"
|
|
1657
|
+
}),
|
|
1658
|
+
"emit syncing value": emit({
|
|
1659
|
+
type: "syncing value"
|
|
1657
1660
|
})
|
|
1658
1661
|
},
|
|
1659
1662
|
guards: {
|
|
@@ -1729,7 +1732,7 @@ const debug$d = debugWithName("sync machine"), syncValueCallback = ({
|
|
|
1729
1732
|
}
|
|
1730
1733
|
},
|
|
1731
1734
|
"done syncing initial value": {
|
|
1732
|
-
entry: ["emit done syncing
|
|
1735
|
+
entry: ["emit done syncing value", () => {
|
|
1733
1736
|
debug$d("entry: done syncing initial value");
|
|
1734
1737
|
}],
|
|
1735
1738
|
exit: [() => {
|
|
@@ -1788,10 +1791,10 @@ const debug$d = debugWithName("sync machine"), syncValueCallback = ({
|
|
|
1788
1791
|
syncing: {
|
|
1789
1792
|
entry: [() => {
|
|
1790
1793
|
debug$d("entry: syncing->syncing");
|
|
1791
|
-
}],
|
|
1794
|
+
}, "emit syncing value"],
|
|
1792
1795
|
exit: [() => {
|
|
1793
1796
|
debug$d("exit: syncing->syncing");
|
|
1794
|
-
}],
|
|
1797
|
+
}, "emit done syncing value"],
|
|
1795
1798
|
always: {
|
|
1796
1799
|
guard: "pending value equals previous value",
|
|
1797
1800
|
target: "idle",
|
|
@@ -7012,6 +7015,22 @@ const editorMachine = setup({
|
|
|
7012
7015
|
"clear pending events": assign({
|
|
7013
7016
|
pendingEvents: []
|
|
7014
7017
|
}),
|
|
7018
|
+
"defer incoming patches": assign({
|
|
7019
|
+
pendingIncomingPatchesEvents: ({
|
|
7020
|
+
context,
|
|
7021
|
+
event
|
|
7022
|
+
}) => event.type === "patches" ? [...context.pendingIncomingPatchesEvents, event] : context.pendingIncomingPatchesEvents
|
|
7023
|
+
}),
|
|
7024
|
+
"emit pending incoming patches": enqueueActions(({
|
|
7025
|
+
context,
|
|
7026
|
+
enqueue
|
|
7027
|
+
}) => {
|
|
7028
|
+
for (const event of context.pendingIncomingPatchesEvents)
|
|
7029
|
+
enqueue.emit(event);
|
|
7030
|
+
}),
|
|
7031
|
+
"clear pending incoming patches": assign({
|
|
7032
|
+
pendingIncomingPatchesEvents: []
|
|
7033
|
+
}),
|
|
7015
7034
|
"handle blur": ({
|
|
7016
7035
|
event
|
|
7017
7036
|
}) => {
|
|
@@ -7079,6 +7098,7 @@ const editorMachine = setup({
|
|
|
7079
7098
|
getLegacySchema: input.getLegacySchema,
|
|
7080
7099
|
keyGenerator: input.keyGenerator,
|
|
7081
7100
|
pendingEvents: [],
|
|
7101
|
+
pendingIncomingPatchesEvents: [],
|
|
7082
7102
|
schema: input.schema,
|
|
7083
7103
|
selection: null,
|
|
7084
7104
|
initialReadOnly: input.readOnly ?? !1,
|
|
@@ -7162,11 +7182,6 @@ const editorMachine = setup({
|
|
|
7162
7182
|
"remove behavior": {
|
|
7163
7183
|
actions: "remove behavior from context"
|
|
7164
7184
|
},
|
|
7165
|
-
patches: {
|
|
7166
|
-
actions: emit(({
|
|
7167
|
-
event
|
|
7168
|
-
}) => event)
|
|
7169
|
-
},
|
|
7170
7185
|
"update behaviors": {
|
|
7171
7186
|
actions: "assign behaviors"
|
|
7172
7187
|
},
|
|
@@ -7213,7 +7228,7 @@ const editorMachine = setup({
|
|
|
7213
7228
|
states: {
|
|
7214
7229
|
"determine initial edit mode": {
|
|
7215
7230
|
on: {
|
|
7216
|
-
"done syncing
|
|
7231
|
+
"done syncing value": [{
|
|
7217
7232
|
target: "#editor.edit mode.read only.read only",
|
|
7218
7233
|
guard: ({
|
|
7219
7234
|
context
|
|
@@ -7329,7 +7344,7 @@ const editorMachine = setup({
|
|
|
7329
7344
|
initial: "setting up",
|
|
7330
7345
|
states: {
|
|
7331
7346
|
"setting up": {
|
|
7332
|
-
exit: ["emit ready"],
|
|
7347
|
+
exit: ["emit ready", "emit pending incoming patches", "clear pending incoming patches"],
|
|
7333
7348
|
on: {
|
|
7334
7349
|
"internal.patch": {
|
|
7335
7350
|
actions: "defer event"
|
|
@@ -7337,54 +7352,95 @@ const editorMachine = setup({
|
|
|
7337
7352
|
mutation: {
|
|
7338
7353
|
actions: "defer event"
|
|
7339
7354
|
},
|
|
7340
|
-
"done syncing
|
|
7341
|
-
target: "
|
|
7355
|
+
"done syncing value": {
|
|
7356
|
+
target: "set up"
|
|
7357
|
+
},
|
|
7358
|
+
patches: {
|
|
7359
|
+
actions: ["defer incoming patches"]
|
|
7342
7360
|
}
|
|
7343
7361
|
}
|
|
7344
7362
|
},
|
|
7345
|
-
|
|
7346
|
-
|
|
7363
|
+
"set up": {
|
|
7364
|
+
type: "parallel",
|
|
7347
7365
|
states: {
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7366
|
+
"value sync": {
|
|
7367
|
+
initial: "idle",
|
|
7368
|
+
states: {
|
|
7369
|
+
idle: {
|
|
7370
|
+
on: {
|
|
7371
|
+
patches: {
|
|
7372
|
+
actions: [emit(({
|
|
7373
|
+
event
|
|
7374
|
+
}) => event)]
|
|
7375
|
+
},
|
|
7376
|
+
"syncing value": {
|
|
7377
|
+
target: "syncing value"
|
|
7378
|
+
}
|
|
7379
|
+
}
|
|
7356
7380
|
},
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7381
|
+
"syncing value": {
|
|
7382
|
+
exit: ["emit pending incoming patches", "clear pending incoming patches"],
|
|
7383
|
+
on: {
|
|
7384
|
+
patches: {
|
|
7385
|
+
actions: ["defer incoming patches"]
|
|
7386
|
+
},
|
|
7387
|
+
"done syncing value": {
|
|
7388
|
+
target: "idle"
|
|
7389
|
+
}
|
|
7390
|
+
}
|
|
7360
7391
|
}
|
|
7361
7392
|
}
|
|
7362
7393
|
},
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7394
|
+
writing: {
|
|
7395
|
+
initial: "pristine",
|
|
7396
|
+
states: {
|
|
7397
|
+
pristine: {
|
|
7398
|
+
initial: "idle",
|
|
7399
|
+
states: {
|
|
7400
|
+
idle: {
|
|
7401
|
+
on: {
|
|
7402
|
+
normalizing: {
|
|
7403
|
+
target: "normalizing"
|
|
7404
|
+
},
|
|
7405
|
+
"internal.patch": {
|
|
7406
|
+
actions: "defer event",
|
|
7407
|
+
target: "#editor.setup.set up.writing.dirty"
|
|
7408
|
+
},
|
|
7409
|
+
mutation: {
|
|
7410
|
+
actions: "defer event",
|
|
7411
|
+
target: "#editor.setup.set up.writing.dirty"
|
|
7412
|
+
}
|
|
7413
|
+
}
|
|
7414
|
+
},
|
|
7415
|
+
normalizing: {
|
|
7416
|
+
on: {
|
|
7417
|
+
"done normalizing": {
|
|
7418
|
+
target: "idle"
|
|
7419
|
+
},
|
|
7420
|
+
"internal.patch": {
|
|
7421
|
+
actions: "defer event"
|
|
7422
|
+
},
|
|
7423
|
+
mutation: {
|
|
7424
|
+
actions: "defer event"
|
|
7425
|
+
}
|
|
7426
|
+
}
|
|
7427
|
+
}
|
|
7428
|
+
}
|
|
7370
7429
|
},
|
|
7371
|
-
|
|
7372
|
-
|
|
7430
|
+
dirty: {
|
|
7431
|
+
entry: ["emit pending events", "clear pending events"],
|
|
7432
|
+
on: {
|
|
7433
|
+
"internal.patch": {
|
|
7434
|
+
actions: "emit patch event"
|
|
7435
|
+
},
|
|
7436
|
+
mutation: {
|
|
7437
|
+
actions: "emit mutation event"
|
|
7438
|
+
}
|
|
7439
|
+
}
|
|
7373
7440
|
}
|
|
7374
7441
|
}
|
|
7375
7442
|
}
|
|
7376
7443
|
}
|
|
7377
|
-
},
|
|
7378
|
-
dirty: {
|
|
7379
|
-
entry: ["emit pending events", "clear pending events"],
|
|
7380
|
-
on: {
|
|
7381
|
-
"internal.patch": {
|
|
7382
|
-
actions: "emit patch event"
|
|
7383
|
-
},
|
|
7384
|
-
mutation: {
|
|
7385
|
-
actions: "emit mutation event"
|
|
7386
|
-
}
|
|
7387
|
-
}
|
|
7388
7444
|
}
|
|
7389
7445
|
}
|
|
7390
7446
|
}
|