@portabletext/editor 1.39.0 → 1.40.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 +16 -5
- package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
- package/lib/_chunks-cjs/editor-provider.cjs +158 -153
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.get-text-before.cjs +0 -1
- package/lib/_chunks-cjs/selector.get-text-before.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.is-at-the-start-of-block.cjs +0 -3
- package/lib/_chunks-cjs/selector.is-at-the-start-of-block.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs +0 -4
- package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs.map +1 -1
- package/lib/_chunks-cjs/{parse-blocks.cjs → util.selection-point-to-block-offset.cjs} +74 -4
- package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs.map +1 -0
- package/lib/_chunks-cjs/util.slice-blocks.cjs +2 -2
- package/lib/_chunks-cjs/util.slice-blocks.cjs.map +1 -1
- package/lib/_chunks-cjs/util.split-text-block.cjs +68 -0
- package/lib/_chunks-cjs/util.split-text-block.cjs.map +1 -0
- package/lib/_chunks-es/behavior.core.js +17 -6
- package/lib/_chunks-es/behavior.core.js.map +1 -1
- package/lib/_chunks-es/editor-provider.js +155 -150
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/_chunks-es/selector.get-text-before.js +1 -2
- package/lib/_chunks-es/selector.get-text-before.js.map +1 -1
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js +1 -4
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js.map +1 -1
- package/lib/_chunks-es/selector.is-overlapping-selection.js +1 -5
- package/lib/_chunks-es/selector.is-overlapping-selection.js.map +1 -1
- package/lib/_chunks-es/{parse-blocks.js → util.selection-point-to-block-offset.js} +76 -5
- package/lib/_chunks-es/util.selection-point-to-block-offset.js.map +1 -0
- package/lib/_chunks-es/util.slice-blocks.js +2 -2
- package/lib/_chunks-es/util.slice-blocks.js.map +1 -1
- package/lib/_chunks-es/util.split-text-block.js +70 -0
- package/lib/_chunks-es/util.split-text-block.js.map +1 -0
- package/lib/behaviors/index.d.cts +1516 -911
- package/lib/behaviors/index.d.ts +1516 -911
- package/lib/index.cjs +197 -200
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1247 -717
- package/lib/index.d.ts +1247 -717
- package/lib/index.js +204 -207
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.cjs +11 -12
- package/lib/plugins/index.cjs.map +1 -1
- package/lib/plugins/index.d.cts +1238 -721
- package/lib/plugins/index.d.ts +1238 -721
- package/lib/plugins/index.js +3 -4
- package/lib/plugins/index.js.map +1 -1
- package/lib/selectors/index.d.cts +1237 -710
- package/lib/selectors/index.d.ts +1237 -710
- package/lib/utils/index.cjs +15 -87
- package/lib/utils/index.cjs.map +1 -1
- package/lib/utils/index.d.cts +1290 -713
- package/lib/utils/index.d.ts +1290 -713
- package/lib/utils/index.js +13 -86
- package/lib/utils/index.js.map +1 -1
- package/package.json +10 -10
- package/src/behavior-actions/behavior.action.decorator.add.ts +13 -2
- package/src/behaviors/behavior.core.block-objects.ts +32 -2
- package/src/behaviors/behavior.default.ts +59 -16
- package/src/behaviors/behavior.types.ts +67 -30
- package/src/editor/Editable.tsx +122 -68
- package/src/editor/PortableTextEditor.tsx +8 -8
- package/src/editor/__tests__/self-solving.test.tsx +1 -1
- package/src/editor/components/Element.tsx +1 -3
- package/src/editor/create-editor.ts +13 -5
- package/src/editor/editor-machine.ts +13 -3
- package/src/editor/editor-provider.tsx +11 -7
- package/src/editor/editor-selector.ts +4 -3
- package/src/editor/editor-snapshot.ts +2 -2
- package/src/editor/plugins/create-with-event-listeners.ts +18 -3
- package/src/editor/plugins/createWithPortableTextMarkModel.ts +1 -2
- package/src/internal-utils/block-keys.ts +9 -0
- package/src/internal-utils/collapse-selection.ts +36 -0
- package/src/internal-utils/compound-client-rect.ts +28 -0
- package/src/internal-utils/drag-selection.test.ts +507 -0
- package/src/internal-utils/drag-selection.ts +66 -0
- package/src/internal-utils/editor-selection.test.ts +40 -0
- package/src/internal-utils/editor-selection.ts +60 -0
- package/src/internal-utils/event-position.ts +55 -80
- package/src/internal-utils/inline-object-selection.ts +115 -0
- package/src/internal-utils/selection-block-keys.ts +20 -0
- package/src/internal-utils/selection-elements.ts +61 -0
- package/src/internal-utils/selection-focus-text.ts +38 -0
- package/src/internal-utils/selection-text.test.ts +23 -0
- package/src/internal-utils/selection-text.ts +90 -0
- package/src/internal-utils/split-string.ts +12 -0
- package/src/internal-utils/string-overlap.test.ts +14 -0
- package/src/internal-utils/string-overlap.ts +28 -0
- package/src/internal-utils/string-utils.ts +7 -0
- package/src/internal-utils/terse-pt.test.ts +60 -0
- package/src/internal-utils/terse-pt.ts +36 -0
- package/src/internal-utils/text-block-key.test.ts +30 -0
- package/src/internal-utils/text-block-key.ts +30 -0
- package/src/internal-utils/text-marks.test.ts +33 -0
- package/src/internal-utils/text-marks.ts +26 -0
- package/src/internal-utils/text-selection.test.ts +175 -0
- package/src/internal-utils/text-selection.ts +122 -0
- package/src/internal-utils/value-annotations.ts +31 -0
- package/src/internal-utils/values.ts +16 -5
- package/src/utils/index.ts +5 -0
- package/src/utils/util.block-offset-to-block-selection-point.ts +28 -0
- package/src/utils/util.block-offset-to-selection-point.ts +33 -0
- package/src/utils/util.block-offsets-to-selection.ts +3 -3
- package/src/utils/util.is-equal-selections.ts +20 -0
- package/src/utils/util.is-selection-collapsed.ts +15 -0
- package/src/utils/util.reverse-selection.ts +9 -5
- package/src/utils/util.selection-point-to-block-offset.ts +31 -0
- package/lib/_chunks-cjs/parse-blocks.cjs.map +0 -1
- package/lib/_chunks-es/parse-blocks.js.map +0 -1
- package/src/editor/components/use-draggable.ts +0 -123
|
@@ -5,16 +5,16 @@ import { ReactEditor, withReact, Slate } from "slate-react";
|
|
|
5
5
|
import { useSelector, useActorRef } from "@xstate/react";
|
|
6
6
|
import debug$e from "debug";
|
|
7
7
|
import isEqual from "lodash/isEqual.js";
|
|
8
|
-
import { Editor, Element, Range, Point, Text, Operation, Transforms, Path,
|
|
9
|
-
import { setup,
|
|
8
|
+
import { Editor, Element, Range, Point, Text, Operation, Transforms, Path, insertText, Node, createEditor } from "slate";
|
|
9
|
+
import { setup, stateIn, fromCallback, assign, enqueueActions, emit, assertEvent, and, not, createActor } from "xstate";
|
|
10
10
|
import { unset, set, setIfMissing, insert, diffMatchPatch as diffMatchPatch$1, applyAll } from "@portabletext/patches";
|
|
11
11
|
import { defineType, defineField, isKeySegment, isPortableTextTextBlock, isPortableTextSpan as isPortableTextSpan$1, isPortableTextListBlock } from "@sanity/types";
|
|
12
12
|
import flatten from "lodash/flatten.js";
|
|
13
13
|
import isPlainObject from "lodash/isPlainObject.js";
|
|
14
14
|
import uniq from "lodash/uniq.js";
|
|
15
15
|
import getRandomValues from "get-random-values-esm";
|
|
16
|
-
import { parseBlock, blockOffsetsToSelection, isTextBlock, parseBlocks } from "./
|
|
17
|
-
import { sliceBlocks, blockOffsetToSpanSelectionPoint,
|
|
16
|
+
import { parseBlock, selectionPointToBlockOffset, blockOffsetsToSelection, isTextBlock, parseBlocks } from "./util.selection-point-to-block-offset.js";
|
|
17
|
+
import { sliceBlocks, blockOffsetToSpanSelectionPoint, isKeyedSegment as isKeyedSegment$1 } from "./util.slice-blocks.js";
|
|
18
18
|
import { htmlToBlocks } from "@portabletext/block-tools";
|
|
19
19
|
import { toHTML } from "@portabletext/to-html";
|
|
20
20
|
import { Schema } from "@sanity/schema";
|
|
@@ -22,11 +22,11 @@ import get from "lodash/get.js";
|
|
|
22
22
|
import isUndefined from "lodash/isUndefined.js";
|
|
23
23
|
import omitBy from "lodash/omitBy.js";
|
|
24
24
|
import { createGuards, getFocusSpan, isSelectionCollapsed, getSelectedBlocks, isSelectionExpanded } from "./selector.is-at-the-start-of-block.js";
|
|
25
|
-
import { getTrimmedSelection,
|
|
25
|
+
import { getTrimmedSelection, isActiveAnnotation, isActiveDecorator, isActiveListItem, isActiveStyle, isOverlappingSelection, isSelectingEntireBlocks } from "./selector.is-overlapping-selection.js";
|
|
26
26
|
import omit from "lodash/omit.js";
|
|
27
27
|
import { DOMEditor } from "slate-dom";
|
|
28
28
|
import startCase from "lodash.startcase";
|
|
29
|
-
import { defineBehavior, raise, isClipboardBehaviorEvent, isDragBehaviorEvent, isKeyboardBehaviorEvent, isMouseBehaviorEvent, coreBehaviors, isCustomBehaviorEvent } from "./behavior.core.js";
|
|
29
|
+
import { defineBehavior, raise, isClipboardBehaviorEvent, isDragBehaviorEvent, isInputBehaviorEvent, isKeyboardBehaviorEvent, isMouseBehaviorEvent, coreBehaviors, isCustomBehaviorEvent } from "./behavior.core.js";
|
|
30
30
|
import { Subject } from "rxjs";
|
|
31
31
|
import { useEffectEvent } from "use-effect-event";
|
|
32
32
|
function createEditorSchema(portableTextType) {
|
|
@@ -218,7 +218,7 @@ function toSlateRange(selection, editor) {
|
|
|
218
218
|
path: toSlatePath(selection.focus.path, editor),
|
|
219
219
|
offset: selection.focus.offset
|
|
220
220
|
};
|
|
221
|
-
return focus.path.length === 0 || anchor.path.length === 0 ? null : focus ? {
|
|
221
|
+
return focus.path.length === 0 || anchor.path.length === 0 ? null : anchor && focus ? {
|
|
222
222
|
anchor,
|
|
223
223
|
focus
|
|
224
224
|
} : null;
|
|
@@ -243,12 +243,7 @@ function toSlateValue(value, {
|
|
|
243
243
|
_type,
|
|
244
244
|
_key,
|
|
245
245
|
...rest
|
|
246
|
-
} = block
|
|
247
|
-
_key: VOID_CHILD_KEY,
|
|
248
|
-
_type: "span",
|
|
249
|
-
text: "",
|
|
250
|
-
marks: []
|
|
251
|
-
}];
|
|
246
|
+
} = block;
|
|
252
247
|
if (block && block._type === schemaTypes.block.name) {
|
|
253
248
|
const textBlock = block;
|
|
254
249
|
let hasInlines = !1;
|
|
@@ -261,7 +256,12 @@ function toSlateValue(value, {
|
|
|
261
256
|
return cType !== "span" ? (hasInlines = !0, keepObjectEquality({
|
|
262
257
|
_type: cType,
|
|
263
258
|
_key: cKey,
|
|
264
|
-
children:
|
|
259
|
+
children: [{
|
|
260
|
+
_key: VOID_CHILD_KEY,
|
|
261
|
+
_type: "span",
|
|
262
|
+
text: "",
|
|
263
|
+
marks: []
|
|
264
|
+
}],
|
|
265
265
|
value: cRest,
|
|
266
266
|
__inline: !0
|
|
267
267
|
}, keyMap)) : child;
|
|
@@ -276,7 +276,12 @@ function toSlateValue(value, {
|
|
|
276
276
|
return keepObjectEquality({
|
|
277
277
|
_type,
|
|
278
278
|
_key,
|
|
279
|
-
children:
|
|
279
|
+
children: [{
|
|
280
|
+
_key: VOID_CHILD_KEY,
|
|
281
|
+
_type: "span",
|
|
282
|
+
text: "",
|
|
283
|
+
marks: []
|
|
284
|
+
}],
|
|
280
285
|
value: rest
|
|
281
286
|
}, keyMap);
|
|
282
287
|
}) : [];
|
|
@@ -332,65 +337,7 @@ function fromSlateValue(value, textBlockType, keyMap = {}) {
|
|
|
332
337
|
function isEqualToEmptyEditor(children, schemaTypes) {
|
|
333
338
|
return children === void 0 || children && Array.isArray(children) && children.length === 0 || children && Array.isArray(children) && children.length === 1 && Element.isElement(children[0]) && children[0]._type === schemaTypes.block.name && "style" in children[0] && children[0].style === schemaTypes.styles[0].value && !("listItem" in children[0]) && Array.isArray(children[0].children) && children[0].children.length === 1 && Text.isText(children[0].children[0]) && children[0].children[0]._type === "span" && !children[0].children[0].marks?.join("") && children[0].children[0].text === "";
|
|
334
339
|
}
|
|
335
|
-
const IS_PROCESSING_REMOTE_CHANGES = /* @__PURE__ */ new WeakMap(), KEY_TO_SLATE_ELEMENT = /* @__PURE__ */ new WeakMap(), KEY_TO_VALUE_ELEMENT = /* @__PURE__ */ new WeakMap(), SLATE_TO_PORTABLE_TEXT_RANGE = /* @__PURE__ */ new WeakMap(), EditorActorContext = createContext({})
|
|
336
|
-
function getActiveDecorators({
|
|
337
|
-
schema,
|
|
338
|
-
slateEditorInstance
|
|
339
|
-
}) {
|
|
340
|
-
const decorators = schema.decorators.map((decorator) => decorator.value);
|
|
341
|
-
return ({
|
|
342
|
-
...Editor.marks(slateEditorInstance) ?? {}
|
|
343
|
-
}.marks ?? []).filter((mark) => decorators.includes(mark));
|
|
344
|
-
}
|
|
345
|
-
function getValue({
|
|
346
|
-
editorActorSnapshot,
|
|
347
|
-
slateEditorInstance
|
|
348
|
-
}) {
|
|
349
|
-
return fromSlateValue(slateEditorInstance.children, editorActorSnapshot.context.schema.block.name, KEY_TO_VALUE_ELEMENT.get(slateEditorInstance));
|
|
350
|
-
}
|
|
351
|
-
function defaultCompare(a, b) {
|
|
352
|
-
return a === b;
|
|
353
|
-
}
|
|
354
|
-
function useEditorSelector(editor, selector, t0) {
|
|
355
|
-
const $ = c(3), compare = t0 === void 0 ? defaultCompare : t0;
|
|
356
|
-
let t1;
|
|
357
|
-
return $[0] !== editor._internal.slateEditor.instance || $[1] !== selector ? (t1 = (editorActorSnapshot) => {
|
|
358
|
-
const snapshot = getEditorSnapshot({
|
|
359
|
-
editorActorSnapshot,
|
|
360
|
-
slateEditorInstance: editor._internal.slateEditor.instance
|
|
361
|
-
});
|
|
362
|
-
return selector(snapshot);
|
|
363
|
-
}, $[0] = editor._internal.slateEditor.instance, $[1] = selector, $[2] = t1) : t1 = $[2], useSelector(editor._internal.editorActor, t1, compare);
|
|
364
|
-
}
|
|
365
|
-
function getEditorSnapshot({
|
|
366
|
-
editorActorSnapshot,
|
|
367
|
-
slateEditorInstance
|
|
368
|
-
}) {
|
|
369
|
-
return {
|
|
370
|
-
context: {
|
|
371
|
-
converters: [...editorActorSnapshot.context.converters],
|
|
372
|
-
activeDecorators: getActiveDecorators({
|
|
373
|
-
schema: editorActorSnapshot.context.schema,
|
|
374
|
-
slateEditorInstance
|
|
375
|
-
}),
|
|
376
|
-
keyGenerator: editorActorSnapshot.context.keyGenerator,
|
|
377
|
-
readOnly: editorActorSnapshot.matches({
|
|
378
|
-
"edit mode": "read only"
|
|
379
|
-
}),
|
|
380
|
-
schema: editorActorSnapshot.context.schema,
|
|
381
|
-
selection: editorActorSnapshot.context.selection,
|
|
382
|
-
value: getValue({
|
|
383
|
-
editorActorSnapshot,
|
|
384
|
-
slateEditorInstance
|
|
385
|
-
})
|
|
386
|
-
},
|
|
387
|
-
beta: {
|
|
388
|
-
hasTag: (tag) => editorActorSnapshot.hasTag(tag),
|
|
389
|
-
internalDrag: editorActorSnapshot.context.internalDrag
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
const PortableTextEditorContext = createContext(null), usePortableTextEditor = () => {
|
|
340
|
+
const IS_PROCESSING_REMOTE_CHANGES = /* @__PURE__ */ new WeakMap(), KEY_TO_SLATE_ELEMENT = /* @__PURE__ */ new WeakMap(), KEY_TO_VALUE_ELEMENT = /* @__PURE__ */ new WeakMap(), SLATE_TO_PORTABLE_TEXT_RANGE = /* @__PURE__ */ new WeakMap(), EditorActorContext = createContext({}), PortableTextEditorContext = createContext(null), usePortableTextEditor = () => {
|
|
394
341
|
const editor = useContext(PortableTextEditorContext);
|
|
395
342
|
if (!editor)
|
|
396
343
|
throw new Error("The `usePortableTextEditor` hook must be used inside the <PortableTextEditor> component's context.");
|
|
@@ -2947,14 +2894,12 @@ const insertBreakActionImplementation = ({
|
|
|
2947
2894
|
}) ? removeListItemActionImplementation({
|
|
2948
2895
|
context,
|
|
2949
2896
|
action: {
|
|
2950
|
-
...action
|
|
2951
|
-
type: "list item.remove"
|
|
2897
|
+
...action
|
|
2952
2898
|
}
|
|
2953
2899
|
}) : addListItemActionImplementation({
|
|
2954
2900
|
context,
|
|
2955
2901
|
action: {
|
|
2956
|
-
...action
|
|
2957
|
-
type: "list item.add"
|
|
2902
|
+
...action
|
|
2958
2903
|
}
|
|
2959
2904
|
});
|
|
2960
2905
|
}, removeListItemActionImplementation = ({
|
|
@@ -3011,14 +2956,12 @@ const toggleStyleActionImplementation = ({
|
|
|
3011
2956
|
}) ? removeStyleActionImplementation({
|
|
3012
2957
|
context,
|
|
3013
2958
|
action: {
|
|
3014
|
-
...action
|
|
3015
|
-
type: "style.remove"
|
|
2959
|
+
...action
|
|
3016
2960
|
}
|
|
3017
2961
|
}) : addStyleActionImplementation({
|
|
3018
2962
|
context,
|
|
3019
2963
|
action: {
|
|
3020
|
-
...action
|
|
3021
|
-
type: "style.add"
|
|
2964
|
+
...action
|
|
3022
2965
|
}
|
|
3023
2966
|
});
|
|
3024
2967
|
}, removeStyleActionImplementation = ({
|
|
@@ -3099,10 +3042,10 @@ const decoratorAddActionImplementation = ({
|
|
|
3099
3042
|
} : void 0, selection = manualSelection ? toSlateRange(manualSelection, action.editor) ?? editor.selection : editor.selection;
|
|
3100
3043
|
if (!selection)
|
|
3101
3044
|
return;
|
|
3102
|
-
const editorSelection = toPortableTextRange(value, selection, context.schema), anchorOffset = editorSelection ?
|
|
3045
|
+
const editorSelection = toPortableTextRange(value, selection, context.schema), anchorOffset = editorSelection ? selectionPointToBlockOffset({
|
|
3103
3046
|
value,
|
|
3104
3047
|
selectionPoint: editorSelection.anchor
|
|
3105
|
-
}) : void 0, focusOffset = editorSelection ?
|
|
3048
|
+
}) : void 0, focusOffset = editorSelection ? selectionPointToBlockOffset({
|
|
3106
3049
|
value,
|
|
3107
3050
|
selectionPoint: editorSelection.focus
|
|
3108
3051
|
}) : void 0;
|
|
@@ -3123,10 +3066,6 @@ const decoratorAddActionImplementation = ({
|
|
|
3123
3066
|
},
|
|
3124
3067
|
backward: editorSelection?.backward
|
|
3125
3068
|
}), trimmedSelection = getTrimmedSelection({
|
|
3126
|
-
beta: {
|
|
3127
|
-
hasTag: () => !1,
|
|
3128
|
-
internalDrag: void 0
|
|
3129
|
-
},
|
|
3130
3069
|
context: {
|
|
3131
3070
|
activeDecorators: [],
|
|
3132
3071
|
converters: [],
|
|
@@ -3158,6 +3097,11 @@ const decoratorAddActionImplementation = ({
|
|
|
3158
3097
|
});
|
|
3159
3098
|
}
|
|
3160
3099
|
} else {
|
|
3100
|
+
if (!Array.from(Editor.nodes(editor, {
|
|
3101
|
+
at: selection,
|
|
3102
|
+
match: (node) => editor.isTextSpan(node)
|
|
3103
|
+
}))?.at(0))
|
|
3104
|
+
return;
|
|
3161
3105
|
const [block, blockPath] = Editor.node(editor, selection, {
|
|
3162
3106
|
depth: 1
|
|
3163
3107
|
}), lonelyEmptySpan = editor.isTextBlock(block) && block.children.length === 1 && editor.isTextSpan(block.children[0]) && block.children[0].text === "" ? block.children[0] : void 0;
|
|
@@ -3651,18 +3595,14 @@ const toggleDecoratorActionImplementation = ({
|
|
|
3651
3595
|
editor: action.editor,
|
|
3652
3596
|
decorator: action.decorator
|
|
3653
3597
|
}) ? removeDecoratorActionImplementation({
|
|
3654
|
-
context,
|
|
3655
3598
|
action: {
|
|
3656
|
-
type: "decorator.remove",
|
|
3657
3599
|
editor: action.editor,
|
|
3658
3600
|
decorator: action.decorator
|
|
3659
3601
|
}
|
|
3660
3602
|
}) : decoratorAddActionImplementation({
|
|
3661
3603
|
context,
|
|
3662
3604
|
action: {
|
|
3663
|
-
|
|
3664
|
-
editor: action.editor,
|
|
3665
|
-
decorator: action.decorator
|
|
3605
|
+
...action
|
|
3666
3606
|
}
|
|
3667
3607
|
});
|
|
3668
3608
|
}, debug$8 = debugWithName("API:editable");
|
|
@@ -3921,7 +3861,6 @@ function createEditableAPI(editor, editorActor) {
|
|
|
3921
3861
|
schema: types
|
|
3922
3862
|
},
|
|
3923
3863
|
action: {
|
|
3924
|
-
type: "annotation.add",
|
|
3925
3864
|
annotation: {
|
|
3926
3865
|
name: type.name,
|
|
3927
3866
|
value: value ?? {}
|
|
@@ -4148,9 +4087,7 @@ const addAnnotationActionImplementation = ({
|
|
|
4148
4087
|
}
|
|
4149
4088
|
}))
|
|
4150
4089
|
removeAnnotationActionImplementation({
|
|
4151
|
-
context,
|
|
4152
4090
|
action: {
|
|
4153
|
-
type: "annotation.remove",
|
|
4154
4091
|
annotation: action.annotation,
|
|
4155
4092
|
editor: action.editor
|
|
4156
4093
|
}
|
|
@@ -4159,7 +4096,6 @@ const addAnnotationActionImplementation = ({
|
|
|
4159
4096
|
return addAnnotationActionImplementation({
|
|
4160
4097
|
context,
|
|
4161
4098
|
action: {
|
|
4162
|
-
type: "annotation.add",
|
|
4163
4099
|
annotation: action.annotation,
|
|
4164
4100
|
editor: action.editor
|
|
4165
4101
|
}
|
|
@@ -4333,10 +4269,6 @@ const addAnnotationActionImplementation = ({
|
|
|
4333
4269
|
if (!selection)
|
|
4334
4270
|
throw new Error("Unable to find selection from block offsets");
|
|
4335
4271
|
const trimmedSelection = getTrimmedSelection({
|
|
4336
|
-
beta: {
|
|
4337
|
-
hasTag: () => !1,
|
|
4338
|
-
internalDrag: void 0
|
|
4339
|
-
},
|
|
4340
4272
|
context: {
|
|
4341
4273
|
converters: [],
|
|
4342
4274
|
schema: context.schema,
|
|
@@ -4555,9 +4487,7 @@ const selectActionImplementation = ({
|
|
|
4555
4487
|
return;
|
|
4556
4488
|
}
|
|
4557
4489
|
selectActionImplementation({
|
|
4558
|
-
context,
|
|
4559
4490
|
action: {
|
|
4560
|
-
type: "select",
|
|
4561
4491
|
selection: newSelection,
|
|
4562
4492
|
editor: action.editor
|
|
4563
4493
|
}
|
|
@@ -4584,9 +4514,7 @@ const selectActionImplementation = ({
|
|
|
4584
4514
|
return;
|
|
4585
4515
|
}
|
|
4586
4516
|
selectActionImplementation({
|
|
4587
|
-
context,
|
|
4588
4517
|
action: {
|
|
4589
|
-
type: "select",
|
|
4590
4518
|
selection: newSelection,
|
|
4591
4519
|
editor: action.editor
|
|
4592
4520
|
}
|
|
@@ -4647,13 +4575,11 @@ const selectActionImplementation = ({
|
|
|
4647
4575
|
index === 0 ? (insertBreakActionImplementation({
|
|
4648
4576
|
context,
|
|
4649
4577
|
action: {
|
|
4650
|
-
type: "insert.break",
|
|
4651
4578
|
editor: action.editor
|
|
4652
4579
|
}
|
|
4653
4580
|
}), selectPreviousBlockActionImplementation({
|
|
4654
4581
|
context,
|
|
4655
4582
|
action: {
|
|
4656
|
-
type: "select.previous block",
|
|
4657
4583
|
editor: action.editor,
|
|
4658
4584
|
select: "end"
|
|
4659
4585
|
}
|
|
@@ -4666,7 +4592,6 @@ const selectActionImplementation = ({
|
|
|
4666
4592
|
})) : index === fragment.length - 1 ? (selectNextBlockActionImplementation({
|
|
4667
4593
|
context,
|
|
4668
4594
|
action: {
|
|
4669
|
-
type: "select.next block",
|
|
4670
4595
|
editor: action.editor,
|
|
4671
4596
|
select: "start"
|
|
4672
4597
|
}
|
|
@@ -4699,7 +4624,6 @@ const selectActionImplementation = ({
|
|
|
4699
4624
|
insertBlocksActionImplementation({
|
|
4700
4625
|
context,
|
|
4701
4626
|
action: {
|
|
4702
|
-
type: "insert.blocks",
|
|
4703
4627
|
blocks: action.data,
|
|
4704
4628
|
editor: action.editor,
|
|
4705
4629
|
placement: "auto"
|
|
@@ -4785,7 +4709,6 @@ const selectActionImplementation = ({
|
|
|
4785
4709
|
insertBlockActionImplementation({
|
|
4786
4710
|
context,
|
|
4787
4711
|
action: {
|
|
4788
|
-
type: "insert.block",
|
|
4789
4712
|
block: {
|
|
4790
4713
|
_key: context.keyGenerator(),
|
|
4791
4714
|
_type: action.blockObject.name,
|
|
@@ -4806,7 +4729,6 @@ const selectActionImplementation = ({
|
|
|
4806
4729
|
insertBlockActionImplementation({
|
|
4807
4730
|
context,
|
|
4808
4731
|
action: {
|
|
4809
|
-
type: "insert.block",
|
|
4810
4732
|
block: {
|
|
4811
4733
|
_key: context.keyGenerator(),
|
|
4812
4734
|
_type: context.schema.block.name,
|
|
@@ -4855,9 +4777,7 @@ const selectActionImplementation = ({
|
|
|
4855
4777
|
return;
|
|
4856
4778
|
}
|
|
4857
4779
|
moveBlockActionImplementation({
|
|
4858
|
-
context,
|
|
4859
4780
|
action: {
|
|
4860
|
-
type: "move.block",
|
|
4861
4781
|
at: action.at,
|
|
4862
4782
|
to: [{
|
|
4863
4783
|
_key: destinationBlockKey
|
|
@@ -4887,9 +4807,7 @@ const selectActionImplementation = ({
|
|
|
4887
4807
|
return;
|
|
4888
4808
|
}
|
|
4889
4809
|
moveBlockActionImplementation({
|
|
4890
|
-
context,
|
|
4891
4810
|
action: {
|
|
4892
|
-
type: "move.block",
|
|
4893
4811
|
at: action.at,
|
|
4894
4812
|
to: [{
|
|
4895
4813
|
_key: destinationBlockKey
|
|
@@ -4907,13 +4825,10 @@ const selectActionImplementation = ({
|
|
|
4907
4825
|
action
|
|
4908
4826
|
}) => {
|
|
4909
4827
|
dataTransferSetActionImplementation({
|
|
4910
|
-
context,
|
|
4911
4828
|
action: {
|
|
4912
|
-
type: "data transfer.set",
|
|
4913
4829
|
data: action.data,
|
|
4914
4830
|
dataTransfer: action.originEvent.originEvent.dataTransfer,
|
|
4915
|
-
mimeType: action.mimeType
|
|
4916
|
-
editor: action.editor
|
|
4831
|
+
mimeType: action.mimeType
|
|
4917
4832
|
}
|
|
4918
4833
|
});
|
|
4919
4834
|
}, behaviorActionImplementations = {
|
|
@@ -5370,8 +5285,22 @@ function createWithEventListeners(editorActor, subscriptions) {
|
|
|
5370
5285
|
},
|
|
5371
5286
|
editor
|
|
5372
5287
|
});
|
|
5373
|
-
}, editor.insertData = () => {
|
|
5374
|
-
|
|
5288
|
+
}, editor.insertData = (dataTransfer) => {
|
|
5289
|
+
if (isApplyingBehaviorActions(editor))
|
|
5290
|
+
throw new Error("Unexpected call to .insertData(...)");
|
|
5291
|
+
editorActor.send({
|
|
5292
|
+
type: "behavior event",
|
|
5293
|
+
behaviorEvent: {
|
|
5294
|
+
type: "deserialize",
|
|
5295
|
+
originEvent: {
|
|
5296
|
+
type: "input.*",
|
|
5297
|
+
originEvent: {
|
|
5298
|
+
dataTransfer
|
|
5299
|
+
}
|
|
5300
|
+
}
|
|
5301
|
+
},
|
|
5302
|
+
editor
|
|
5303
|
+
});
|
|
5375
5304
|
}, editor.insertSoftBreak = () => {
|
|
5376
5305
|
if (isApplyingBehaviorActions(editor)) {
|
|
5377
5306
|
insertSoftBreakActionImplementation({
|
|
@@ -5380,7 +5309,6 @@ function createWithEventListeners(editorActor, subscriptions) {
|
|
|
5380
5309
|
schema: editorActor.getSnapshot().context.schema
|
|
5381
5310
|
},
|
|
5382
5311
|
action: {
|
|
5383
|
-
type: "insert.soft break",
|
|
5384
5312
|
editor
|
|
5385
5313
|
}
|
|
5386
5314
|
});
|
|
@@ -6133,7 +6061,7 @@ function createSlateEditor(config) {
|
|
|
6133
6061
|
if (existingSlateEditor)
|
|
6134
6062
|
return debug$2("Reusing existing Slate editor instance", config.editorActor.id), existingSlateEditor;
|
|
6135
6063
|
debug$2("Creating new Slate editor instance", config.editorActor.id);
|
|
6136
|
-
const unsubscriptions = [], subscriptions = [], instance = withPlugins(withReact(createEditor
|
|
6064
|
+
const unsubscriptions = [], subscriptions = [], instance = withPlugins(withReact(createEditor()), {
|
|
6137
6065
|
editorActor: config.editorActor,
|
|
6138
6066
|
subscriptions
|
|
6139
6067
|
});
|
|
@@ -6199,12 +6127,24 @@ const keyIs = {
|
|
|
6199
6127
|
guard: ({
|
|
6200
6128
|
snapshot,
|
|
6201
6129
|
event
|
|
6202
|
-
}) =>
|
|
6130
|
+
}) => {
|
|
6131
|
+
const manualSelection = event.offsets ? blockOffsetsToSelection({
|
|
6132
|
+
value: snapshot.context.value,
|
|
6133
|
+
offsets: event.offsets
|
|
6134
|
+
}) : null;
|
|
6135
|
+
return manualSelection ? !isActiveDecorator(event.decorator)({
|
|
6136
|
+
...snapshot,
|
|
6137
|
+
context: {
|
|
6138
|
+
...snapshot.context,
|
|
6139
|
+
selection: manualSelection
|
|
6140
|
+
}
|
|
6141
|
+
}) : !isActiveDecorator(event.decorator)(snapshot);
|
|
6142
|
+
},
|
|
6203
6143
|
actions: [({
|
|
6204
6144
|
event
|
|
6205
6145
|
}) => [raise({
|
|
6206
|
-
|
|
6207
|
-
|
|
6146
|
+
...event,
|
|
6147
|
+
type: "decorator.add"
|
|
6208
6148
|
})]]
|
|
6209
6149
|
}), toggleListItemOff = defineBehavior({
|
|
6210
6150
|
on: "list item.toggle",
|
|
@@ -6412,13 +6352,11 @@ const keyIs = {
|
|
|
6412
6352
|
selection: dragOrigin.selection
|
|
6413
6353
|
}
|
|
6414
6354
|
}) : !1, draggingEntireBlocks = isSelectingEntireBlocks({
|
|
6415
|
-
...snapshot,
|
|
6416
6355
|
context: {
|
|
6417
6356
|
...snapshot.context,
|
|
6418
6357
|
selection: dragOrigin.selection
|
|
6419
6358
|
}
|
|
6420
6359
|
}), draggedBlocks = getSelectedBlocks({
|
|
6421
|
-
...snapshot,
|
|
6422
6360
|
context: {
|
|
6423
6361
|
...snapshot.context,
|
|
6424
6362
|
selection: dragOrigin.selection
|
|
@@ -6427,7 +6365,8 @@ const keyIs = {
|
|
|
6427
6365
|
return droppingOnDragOrigin ? !1 : {
|
|
6428
6366
|
draggingEntireBlocks,
|
|
6429
6367
|
draggedBlocks,
|
|
6430
|
-
dragOrigin
|
|
6368
|
+
dragOrigin,
|
|
6369
|
+
originEvent: event.originEvent
|
|
6431
6370
|
};
|
|
6432
6371
|
},
|
|
6433
6372
|
actions: [({
|
|
@@ -6435,18 +6374,19 @@ const keyIs = {
|
|
|
6435
6374
|
}, {
|
|
6436
6375
|
draggingEntireBlocks,
|
|
6437
6376
|
draggedBlocks,
|
|
6438
|
-
dragOrigin
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
blocks: event.data,
|
|
6442
|
-
placement: draggingEntireBlocks ? event.originEvent.position.block === "start" ? "before" : event.originEvent.position.block === "end" ? "after" : "auto" : "auto"
|
|
6443
|
-
}), ...draggingEntireBlocks ? draggedBlocks.map((block) => raise({
|
|
6377
|
+
dragOrigin,
|
|
6378
|
+
originEvent
|
|
6379
|
+
}) => [...draggingEntireBlocks ? draggedBlocks.map((block) => raise({
|
|
6444
6380
|
type: "delete.block",
|
|
6445
6381
|
blockPath: block.path
|
|
6446
6382
|
})) : [raise({
|
|
6447
6383
|
type: "delete",
|
|
6448
6384
|
selection: dragOrigin.selection
|
|
6449
|
-
})]
|
|
6385
|
+
})], raise({
|
|
6386
|
+
type: "insert.blocks",
|
|
6387
|
+
blocks: event.data,
|
|
6388
|
+
placement: draggingEntireBlocks ? originEvent.position.block === "start" ? "before" : originEvent.position.block === "end" ? "after" : "auto" : "auto"
|
|
6389
|
+
})]]
|
|
6450
6390
|
}), defineBehavior({
|
|
6451
6391
|
on: "deserialization.success",
|
|
6452
6392
|
actions: [({
|
|
@@ -6482,7 +6422,24 @@ const keyIs = {
|
|
|
6482
6422
|
type: "deserialize",
|
|
6483
6423
|
originEvent: event
|
|
6484
6424
|
})]]
|
|
6425
|
+
}), defineBehavior({
|
|
6426
|
+
on: "input.*",
|
|
6427
|
+
actions: [({
|
|
6428
|
+
event
|
|
6429
|
+
}) => [raise({
|
|
6430
|
+
type: "deserialize",
|
|
6431
|
+
originEvent: event
|
|
6432
|
+
})]]
|
|
6485
6433
|
}), toggleAnnotationOff, toggleAnnotationOn, toggleDecoratorOff, toggleDecoratorOn, toggleListItemOff, toggleListItemOn, toggleStyleOff, toggleStyleOn, raiseDeserializationSuccessOrFailure, raiseSerializationSuccessOrFailure, raiseInsertSoftBreak];
|
|
6434
|
+
function getActiveDecorators({
|
|
6435
|
+
schema,
|
|
6436
|
+
slateEditorInstance
|
|
6437
|
+
}) {
|
|
6438
|
+
const decorators = schema.decorators.map((decorator) => decorator.value);
|
|
6439
|
+
return ({
|
|
6440
|
+
...Editor.marks(slateEditorInstance) ?? {}
|
|
6441
|
+
}.marks ?? []).filter((mark) => decorators.includes(mark));
|
|
6442
|
+
}
|
|
6486
6443
|
function createEditorSnapshot({
|
|
6487
6444
|
converters,
|
|
6488
6445
|
editor,
|
|
@@ -6590,10 +6547,10 @@ const editorMachine = setup({
|
|
|
6590
6547
|
self
|
|
6591
6548
|
}) => {
|
|
6592
6549
|
assertEvent(event, ["behavior event", "custom behavior event"]);
|
|
6593
|
-
const defaultAction = event.type === "custom behavior event" || isClipboardBehaviorEvent(event.behaviorEvent) || isDragBehaviorEvent(event.behaviorEvent) ||
|
|
6550
|
+
const defaultAction = event.type === "custom behavior event" || isClipboardBehaviorEvent(event.behaviorEvent) || isDragBehaviorEvent(event.behaviorEvent) || isInputBehaviorEvent(event.behaviorEvent) || isKeyboardBehaviorEvent(event.behaviorEvent) || isMouseBehaviorEvent(event.behaviorEvent) || event.behaviorEvent.type === "deserialize" || event.behaviorEvent.type === "serialize" ? void 0 : {
|
|
6594
6551
|
...event.behaviorEvent,
|
|
6595
6552
|
editor: event.editor
|
|
6596
|
-
}, defaultActionCallback = event.type === "behavior event" ? event.defaultActionCallback : void 0, eventBehaviors = [...context.behaviors.values(), ...defaultBehaviors].filter((behavior) => behavior.on === "*" ? !0 : isClipboardBehaviorEvent(event.behaviorEvent) ? behavior.on === "clipboard.*" || behavior.on === event.behaviorEvent.type : isDragBehaviorEvent(event.behaviorEvent) ? behavior.on === "drag.*" || behavior.on === event.behaviorEvent.type : isKeyboardBehaviorEvent(event.behaviorEvent) ? behavior.on === "keyboard.*" || behavior.on === event.behaviorEvent.type : isMouseBehaviorEvent(event.behaviorEvent) && behavior.on === "mouse.*" || behavior.on === event.behaviorEvent.type);
|
|
6553
|
+
}, defaultActionCallback = event.type === "behavior event" ? event.defaultActionCallback : void 0, eventBehaviors = [...context.behaviors.values(), ...defaultBehaviors].filter((behavior) => behavior.on === "*" ? !0 : isClipboardBehaviorEvent(event.behaviorEvent) ? behavior.on === "clipboard.*" || behavior.on === event.behaviorEvent.type : isDragBehaviorEvent(event.behaviorEvent) ? behavior.on === "drag.*" || behavior.on === event.behaviorEvent.type : isInputBehaviorEvent(event.behaviorEvent) ? behavior.on === "input.*" : isKeyboardBehaviorEvent(event.behaviorEvent) ? behavior.on === "keyboard.*" || behavior.on === event.behaviorEvent.type : isMouseBehaviorEvent(event.behaviorEvent) && behavior.on === "mouse.*" || behavior.on === event.behaviorEvent.type);
|
|
6597
6554
|
if (eventBehaviors.length === 0) {
|
|
6598
6555
|
if (defaultActionCallback) {
|
|
6599
6556
|
withApplyingBehaviorActions(event.editor, () => {
|
|
@@ -7078,13 +7035,61 @@ const editorMachine = setup({
|
|
|
7078
7035
|
}
|
|
7079
7036
|
}
|
|
7080
7037
|
});
|
|
7081
|
-
function
|
|
7038
|
+
function getValue({
|
|
7039
|
+
editorActorSnapshot,
|
|
7040
|
+
slateEditorInstance
|
|
7041
|
+
}) {
|
|
7042
|
+
return fromSlateValue(slateEditorInstance.children, editorActorSnapshot.context.schema.block.name, KEY_TO_VALUE_ELEMENT.get(slateEditorInstance));
|
|
7043
|
+
}
|
|
7044
|
+
function defaultCompare(a, b) {
|
|
7045
|
+
return a === b;
|
|
7046
|
+
}
|
|
7047
|
+
function useEditorSelector(editor, selector, t0) {
|
|
7048
|
+
const $ = c(3), compare = t0 === void 0 ? defaultCompare : t0;
|
|
7049
|
+
let t1;
|
|
7050
|
+
return $[0] !== editor || $[1] !== selector ? (t1 = (editorActorSnapshot) => {
|
|
7051
|
+
const snapshot = getEditorSnapshot({
|
|
7052
|
+
editorActorSnapshot,
|
|
7053
|
+
slateEditorInstance: editor._internal.slateEditor.instance
|
|
7054
|
+
});
|
|
7055
|
+
return selector(snapshot);
|
|
7056
|
+
}, $[0] = editor, $[1] = selector, $[2] = t1) : t1 = $[2], useSelector(editor._internal.editorActor, t1, compare);
|
|
7057
|
+
}
|
|
7058
|
+
function getEditorSnapshot({
|
|
7059
|
+
editorActorSnapshot,
|
|
7060
|
+
slateEditorInstance
|
|
7061
|
+
}) {
|
|
7062
|
+
return {
|
|
7063
|
+
context: {
|
|
7064
|
+
converters: [...editorActorSnapshot.context.converters],
|
|
7065
|
+
activeDecorators: getActiveDecorators({
|
|
7066
|
+
schema: editorActorSnapshot.context.schema,
|
|
7067
|
+
slateEditorInstance
|
|
7068
|
+
}),
|
|
7069
|
+
keyGenerator: editorActorSnapshot.context.keyGenerator,
|
|
7070
|
+
readOnly: editorActorSnapshot.matches({
|
|
7071
|
+
"edit mode": "read only"
|
|
7072
|
+
}),
|
|
7073
|
+
schema: editorActorSnapshot.context.schema,
|
|
7074
|
+
selection: editorActorSnapshot.context.selection,
|
|
7075
|
+
value: getValue({
|
|
7076
|
+
editorActorSnapshot,
|
|
7077
|
+
slateEditorInstance
|
|
7078
|
+
})
|
|
7079
|
+
},
|
|
7080
|
+
beta: {
|
|
7081
|
+
hasTag: (tag) => editorActorSnapshot.hasTag(tag),
|
|
7082
|
+
internalDrag: editorActorSnapshot.context.internalDrag
|
|
7083
|
+
}
|
|
7084
|
+
};
|
|
7085
|
+
}
|
|
7086
|
+
function createInternalEditor(config) {
|
|
7082
7087
|
const editorActor = createActor(editorMachine, {
|
|
7083
7088
|
input: editorConfigToMachineInput(config)
|
|
7084
7089
|
});
|
|
7085
|
-
return editorActor.start(),
|
|
7090
|
+
return editorActor.start(), createInternalEditorFromActor(editorActor);
|
|
7086
7091
|
}
|
|
7087
|
-
function
|
|
7092
|
+
function useCreateInternalEditor(config) {
|
|
7088
7093
|
const $ = c(6);
|
|
7089
7094
|
let t0;
|
|
7090
7095
|
$[0] !== config ? (t0 = editorConfigToMachineInput(config), $[0] = config, $[1] = t0) : t0 = $[1];
|
|
@@ -7094,7 +7099,7 @@ function useCreateEditor(config) {
|
|
|
7094
7099
|
}, $[2] = t0, $[3] = t1) : t1 = $[3];
|
|
7095
7100
|
const editorActor = useActorRef(editorMachine, t1);
|
|
7096
7101
|
let t2, t3;
|
|
7097
|
-
return $[4] !== editorActor ? (t3 =
|
|
7102
|
+
return $[4] !== editorActor ? (t3 = createInternalEditorFromActor(editorActor), $[4] = editorActor, $[5] = t3) : t3 = $[5], t2 = t3, t2;
|
|
7098
7103
|
}
|
|
7099
7104
|
function editorConfigToMachineInput(config) {
|
|
7100
7105
|
return {
|
|
@@ -7107,7 +7112,7 @@ function editorConfigToMachineInput(config) {
|
|
|
7107
7112
|
value: config.initialValue
|
|
7108
7113
|
};
|
|
7109
7114
|
}
|
|
7110
|
-
function
|
|
7115
|
+
function createInternalEditorFromActor(editorActor) {
|
|
7111
7116
|
const slateEditor = createSlateEditor({
|
|
7112
7117
|
editorActor
|
|
7113
7118
|
}), editable = createEditableAPI(slateEditor.instance, editorActor);
|
|
@@ -7194,7 +7199,7 @@ class PortableTextEditor extends Component {
|
|
|
7194
7199
|
* The editor API (currently implemented with Slate).
|
|
7195
7200
|
*/
|
|
7196
7201
|
constructor(props) {
|
|
7197
|
-
super(props), props.editor ? this.editor = props.editor : this.editor =
|
|
7202
|
+
super(props), props.editor ? this.editor = props.editor : this.editor = createInternalEditor({
|
|
7198
7203
|
keyGenerator: props.keyGenerator ?? defaultKeyGenerator,
|
|
7199
7204
|
schema: props.schemaType,
|
|
7200
7205
|
initialValue: props.value,
|
|
@@ -7686,11 +7691,11 @@ function RouteEventsToChanges(props) {
|
|
|
7686
7691
|
}
|
|
7687
7692
|
const EditorContext = React.createContext(void 0);
|
|
7688
7693
|
function EditorProvider(props) {
|
|
7689
|
-
const $ = c(28),
|
|
7694
|
+
const $ = c(28), internalEditor = useCreateInternalEditor(props.initialConfig), editorActor = internalEditor._internal.editorActor, slateEditor = internalEditor._internal.slateEditor;
|
|
7690
7695
|
let t0, t1;
|
|
7691
|
-
$[0] !==
|
|
7692
|
-
editor
|
|
7693
|
-
}), $[0] =
|
|
7696
|
+
$[0] !== internalEditor ? (t1 = new PortableTextEditor({
|
|
7697
|
+
editor: internalEditor
|
|
7698
|
+
}), $[0] = internalEditor, $[1] = t1) : t1 = $[1], t0 = t1;
|
|
7694
7699
|
const portableTextEditor = t0;
|
|
7695
7700
|
let t2;
|
|
7696
7701
|
$[2] !== portableTextEditor.change$ ? (t2 = (change) => {
|
|
@@ -7709,11 +7714,11 @@ function EditorProvider(props) {
|
|
|
7709
7714
|
let t8;
|
|
7710
7715
|
$[20] !== editorActor || $[21] !== t7 ? (t8 = /* @__PURE__ */ jsx(EditorActorContext.Provider, { value: editorActor, children: t7 }), $[20] = editorActor, $[21] = t7, $[22] = t8) : t8 = $[22];
|
|
7711
7716
|
let t9;
|
|
7712
|
-
return $[23] !==
|
|
7717
|
+
return $[23] !== internalEditor || $[24] !== t3 || $[25] !== t4 || $[26] !== t8 ? (t9 = /* @__PURE__ */ jsxs(EditorContext.Provider, { value: internalEditor, children: [
|
|
7713
7718
|
t3,
|
|
7714
7719
|
t4,
|
|
7715
7720
|
t8
|
|
7716
|
-
] }), $[23] =
|
|
7721
|
+
] }), $[23] = internalEditor, $[24] = t3, $[25] = t4, $[26] = t8, $[27] = t9) : t9 = $[27], t9;
|
|
7717
7722
|
}
|
|
7718
7723
|
function useEditor() {
|
|
7719
7724
|
const editor = React.useContext(EditorContext);
|