@portabletext/editor 1.47.14 → 1.48.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.
- package/lib/_chunks-cjs/behavior.core.cjs +8 -9
- package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
- package/lib/_chunks-cjs/editor-provider.cjs +171 -115
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-es/behavior.core.js +8 -9
- package/lib/_chunks-es/behavior.core.js.map +1 -1
- package/lib/_chunks-es/editor-provider.js +172 -116
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/behaviors/index.cjs +11 -11
- package/lib/behaviors/index.cjs.map +1 -1
- package/lib/behaviors/index.d.cts +11 -8
- package/lib/behaviors/index.d.ts +11 -8
- package/lib/behaviors/index.js +12 -12
- package/lib/behaviors/index.js.map +1 -1
- package/lib/index.cjs +4 -4
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +6 -4
- package/lib/index.d.ts +6 -4
- package/lib/index.js +5 -5
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.cjs +7 -11
- package/lib/plugins/index.cjs.map +1 -1
- package/lib/plugins/index.d.cts +4 -3
- package/lib/plugins/index.d.ts +4 -3
- package/lib/plugins/index.js +8 -12
- package/lib/plugins/index.js.map +1 -1
- package/lib/selectors/index.d.cts +4 -3
- package/lib/selectors/index.d.ts +4 -3
- package/lib/utils/index.d.cts +4 -3
- package/lib/utils/index.d.ts +4 -3
- package/package.json +3 -3
- package/src/behavior-actions/behavior.actions.ts +0 -9
- package/src/behaviors/behavior.core.dnd.ts +1 -1
- package/src/behaviors/behavior.default.ts +3 -3
- package/src/behaviors/behavior.emoji-picker.ts +7 -9
- package/src/behaviors/behavior.perform-event.ts +143 -76
- package/src/behaviors/behavior.types.action.ts +14 -11
- package/src/behaviors/index.ts +1 -1
- package/src/editor/components/Element.tsx +3 -5
- package/src/editor/editor-context.tsx +7 -0
- package/src/editor/editor-machine.ts +1 -0
- package/src/editor/editor-provider.tsx +1 -3
- package/src/editor/plugins/createWithUndoRedo.ts +8 -11
- package/src/editor/with-applying-behavior-actions.ts +9 -11
- package/src/internal-utils/global-scope.ts +19 -0
- package/src/internal-utils/globally-scoped-context.ts +39 -0
- package/src/plugins/plugin.decorator-shortcut.ts +3 -2
- package/src/plugins/plugin.one-line.tsx +3 -3
- package/src/behavior-actions/behavior.action.noop.ts +0 -5
package/lib/index.d.cts
CHANGED
|
@@ -63,6 +63,7 @@ import {
|
|
|
63
63
|
} from 'xstate'
|
|
64
64
|
import type {EventObject, Snapshot} from 'xstate'
|
|
65
65
|
import {GuardArgs} from 'xstate/guards'
|
|
66
|
+
import {Editor as Editor_2} from './create-editor'
|
|
66
67
|
|
|
67
68
|
declare type AbstractBehaviorEvent =
|
|
68
69
|
| {
|
|
@@ -302,11 +303,12 @@ declare type BehaviorAction =
|
|
|
302
303
|
event: SyntheticBehaviorEvent
|
|
303
304
|
}
|
|
304
305
|
| {
|
|
305
|
-
type: '
|
|
306
|
-
event: SyntheticBehaviorEvent | CustomBehaviorEvent
|
|
306
|
+
type: 'forward'
|
|
307
|
+
event: NativeBehaviorEvent | SyntheticBehaviorEvent | CustomBehaviorEvent
|
|
307
308
|
}
|
|
308
309
|
| {
|
|
309
|
-
type: '
|
|
310
|
+
type: 'raise'
|
|
311
|
+
event: SyntheticBehaviorEvent | CustomBehaviorEvent
|
|
310
312
|
}
|
|
311
313
|
| {
|
|
312
314
|
type: 'effect'
|
|
@@ -6815,7 +6817,7 @@ declare type UnsetEvent = {
|
|
|
6815
6817
|
* ```
|
|
6816
6818
|
* @group Hooks
|
|
6817
6819
|
*/
|
|
6818
|
-
export declare function useEditor():
|
|
6820
|
+
export declare function useEditor(): Editor_2
|
|
6819
6821
|
|
|
6820
6822
|
/**
|
|
6821
6823
|
* @public
|
package/lib/index.d.ts
CHANGED
|
@@ -63,6 +63,7 @@ import {
|
|
|
63
63
|
} from 'xstate'
|
|
64
64
|
import type {EventObject, Snapshot} from 'xstate'
|
|
65
65
|
import {GuardArgs} from 'xstate/guards'
|
|
66
|
+
import {Editor as Editor_2} from './create-editor'
|
|
66
67
|
|
|
67
68
|
declare type AbstractBehaviorEvent =
|
|
68
69
|
| {
|
|
@@ -302,11 +303,12 @@ declare type BehaviorAction =
|
|
|
302
303
|
event: SyntheticBehaviorEvent
|
|
303
304
|
}
|
|
304
305
|
| {
|
|
305
|
-
type: '
|
|
306
|
-
event: SyntheticBehaviorEvent | CustomBehaviorEvent
|
|
306
|
+
type: 'forward'
|
|
307
|
+
event: NativeBehaviorEvent | SyntheticBehaviorEvent | CustomBehaviorEvent
|
|
307
308
|
}
|
|
308
309
|
| {
|
|
309
|
-
type: '
|
|
310
|
+
type: 'raise'
|
|
311
|
+
event: SyntheticBehaviorEvent | CustomBehaviorEvent
|
|
310
312
|
}
|
|
311
313
|
| {
|
|
312
314
|
type: 'effect'
|
|
@@ -6815,7 +6817,7 @@ declare type UnsetEvent = {
|
|
|
6815
6817
|
* ```
|
|
6816
6818
|
* @group Hooks
|
|
6817
6819
|
*/
|
|
6818
|
-
export declare function useEditor():
|
|
6820
|
+
export declare function useEditor(): Editor_2
|
|
6819
6821
|
|
|
6820
6822
|
/**
|
|
6821
6823
|
* @public
|
package/lib/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import { parseBlocks } from "./_chunks-es/parse-blocks.js";
|
|
|
17
17
|
import isEqual from "lodash/isEqual.js";
|
|
18
18
|
import { getSelectionEndPoint } from "./_chunks-es/util.get-selection-start-point.js";
|
|
19
19
|
import { isSelectingEntireBlocks } from "./_chunks-es/selector.is-selecting-entire-blocks.js";
|
|
20
|
-
import { defineBehavior, isHotkey } from "./_chunks-es/behavior.core.js";
|
|
20
|
+
import { defineBehavior, forward, isHotkey } from "./_chunks-es/behavior.core.js";
|
|
21
21
|
import uniq from "lodash/uniq.js";
|
|
22
22
|
import { setup, fromCallback, assign, and } from "xstate";
|
|
23
23
|
function EditorEventListener(props) {
|
|
@@ -413,8 +413,6 @@ const EMPTY_ANNOTATIONS = [], inlineBlockStyle = {
|
|
|
413
413
|
effect: () => {
|
|
414
414
|
setDragPositionBlock(event_0.position.block);
|
|
415
415
|
}
|
|
416
|
-
}, {
|
|
417
|
-
type: "noop"
|
|
418
416
|
}]]
|
|
419
417
|
});
|
|
420
418
|
return editorActor.send({
|
|
@@ -432,12 +430,14 @@ const EMPTY_ANNOTATIONS = [], inlineBlockStyle = {
|
|
|
432
430
|
guard: ({
|
|
433
431
|
event: event_1
|
|
434
432
|
}) => event_1.type !== "drag.dragover",
|
|
435
|
-
actions: [(
|
|
433
|
+
actions: [({
|
|
434
|
+
event: event_2
|
|
435
|
+
}) => [{
|
|
436
436
|
type: "effect",
|
|
437
437
|
effect: () => {
|
|
438
438
|
setDragPositionBlock(void 0);
|
|
439
439
|
}
|
|
440
|
-
}]]
|
|
440
|
+
}, forward(event_2)]]
|
|
441
441
|
});
|
|
442
442
|
return editorActor.send({
|
|
443
443
|
type: "add behavior",
|