@portabletext/editor 7.0.5 → 7.1.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-dts/behavior.types.action.d.ts +37 -30
- package/lib/_chunks-dts/behavior.types.action.d.ts.map +1 -1
- package/lib/_chunks-dts/resolve-containers.d.ts.map +1 -1
- package/lib/_chunks-es/get-first-child.js +26 -31
- package/lib/_chunks-es/get-first-child.js.map +1 -1
- package/lib/_chunks-es/{get-node.js → get-parent.js} +35 -60
- package/lib/_chunks-es/get-parent.js.map +1 -0
- package/lib/_chunks-es/get-path-sub-schema.js +87 -43
- package/lib/_chunks-es/get-path-sub-schema.js.map +1 -1
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js +32 -34
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js.map +1 -1
- package/lib/_chunks-es/util.slice-blocks.js +6 -15
- package/lib/_chunks-es/util.slice-blocks.js.map +1 -1
- package/lib/index.js +637 -550
- package/lib/index.js.map +1 -1
- package/lib/selectors/index.d.ts.map +1 -1
- package/lib/selectors/index.js +4 -8
- package/lib/selectors/index.js.map +1 -1
- package/lib/traversal/index.d.ts +94 -18
- package/lib/traversal/index.d.ts.map +1 -1
- package/lib/traversal/index.js +8 -7
- package/lib/traversal/index.js.map +1 -1
- package/lib/utils/index.js +7 -3
- package/lib/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/lib/_chunks-es/get-node.js.map +0 -1
package/lib/index.js
CHANGED
|
@@ -2,15 +2,15 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
3
|
import { useSelector, useActorRef } from "@xstate/react";
|
|
4
4
|
import React, { createContext, useContext, useRef, useEffect, useLayoutEffect, useState, useReducer, useCallback, memo, forwardRef, useMemo, Component, useSyncExternalStore, startTransition } from "react";
|
|
5
|
-
import { isKeyedSegment,
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { rangeEdges,
|
|
5
|
+
import { isKeyedSegment, getNode, getParent, parentPath, getChildren, getNodeChildren } from "./_chunks-es/get-parent.js";
|
|
6
|
+
import { getLeaf, isLeafObject, getAncestor, getSpan, getText, getTextBlock, getUnionSchema, getFirstChild } from "./_chunks-es/get-first-child.js";
|
|
7
|
+
import { isTextBlockNode, hasNode, getNodes, isAncestorPath, isEditableContainer, getSibling, isInline, isObject as isObject$1, isSpanNode, isBlock, getEnclosingBlock, getAncestors, getPathSubSchema, getBlock, resolveContainerAt, getEnclosingContainer } from "./_chunks-es/get-path-sub-schema.js";
|
|
8
|
+
import { rangeEdges, isBackwardRange, comparePoints, rangesOverlap, isAfterPoint, comparePaths, isSelectionCollapsed as isSelectionCollapsed$1, getFocusInlineObject, getFocusTextBlock, getFocusSpan, getFragment, isSelectionExpanded, getSelectionStartBlock, getSelectionEndBlock, isOverlappingSelection, getFocusBlock, getSelectedBlocks, isSelectingEntireBlocks, getSelectedValue, isActiveAnnotation, getActiveAnnotationsMarks, getActiveDecorators, getCaretWordSelection, getSelectionStartChild, getSelectionEndChild, getPreviousSpan, getNextSpan, getSelectionStartPoint, getSelectionEndPoint, getFocusBlockObject, getLastBlock, getFirstBlock, isAtTheEndOfBlock, isAtTheStartOfBlock, getMarkState, getFocusListBlock, getNextBlock, getPreviousBlock, getSelectedTextBlocks, getRootAcceptedTypes, isActiveDecorator, getFocusChild, getActiveAnnotations, isActiveListItem, isActiveStyle } from "./_chunks-es/selector.is-at-the-start-of-block.js";
|
|
9
9
|
import { isSpan, isTextBlock, compileSchema } from "@portabletext/schema";
|
|
10
10
|
import { defineSchema } from "@portabletext/schema";
|
|
11
11
|
import scrollIntoView from "scroll-into-view-if-needed";
|
|
12
|
-
import { getAncestorTextBlock, isEqualSelectionPoints, blockOffsetToSpanSelectionPoint, getBlockKeyFromSelectionPoint, getBlockEndPoint, getBlockStartPoint, isSelectionCollapsed, defaultKeyGenerator, parseBlocks, parseBlock, isListBlock, getSelectionStartPoint as getSelectionStartPoint$1, getSelectionEndPoint as getSelectionEndPoint$1, parseAnnotation, parseMarkDefs, parseSpan, parseInlineObject, isEqualPathSegments } from "./_chunks-es/util.slice-blocks.js";
|
|
13
12
|
import { createKeyboardShortcut, undo, redo, code, underline, italic as italic$1, bold as bold$1 } from "@portabletext/keyboard-shortcuts";
|
|
13
|
+
import { isEqualSelectionPoints, blockOffsetToSpanSelectionPoint, getBlockKeyFromSelectionPoint, getBlockEndPoint, getBlockStartPoint, isSelectionCollapsed, defaultKeyGenerator, parseBlocks, parseBlock, isListBlock, getSelectionStartPoint as getSelectionStartPoint$1, getSelectionEndPoint as getSelectionEndPoint$1, parseAnnotation, parseMarkDefs, parseSpan, parseInlineObject, isEqualPathSegments } from "./_chunks-es/util.slice-blocks.js";
|
|
14
14
|
import rawDebug from "debug";
|
|
15
15
|
import { isEmptyTextBlock, getTextBlockText } from "./_chunks-es/util.is-empty-text-block.js";
|
|
16
16
|
import { setup, fromCallback, assign, and, assertEvent, enqueueActions, emit, not, raise as raise$1, createActor } from "xstate";
|
|
@@ -197,18 +197,6 @@ function safeParse(text) {
|
|
|
197
197
|
return console.error(error), "JSON.parse failed";
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
function getAncestorObjectNode(snapshot, path2) {
|
|
201
|
-
const result = getAncestor(snapshot, path2, (node) => isObjectNode({
|
|
202
|
-
schema: snapshot.context.schema
|
|
203
|
-
}, node));
|
|
204
|
-
if (result && isObjectNode({
|
|
205
|
-
schema: snapshot.context.schema
|
|
206
|
-
}, result.node))
|
|
207
|
-
return {
|
|
208
|
-
node: result.node,
|
|
209
|
-
path: result.path
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
200
|
function commonPath(path2, another) {
|
|
213
201
|
const common = [];
|
|
214
202
|
for (let i = 0; i < path2.length && i < another.length; i++) {
|
|
@@ -314,11 +302,6 @@ function start(editor, at) {
|
|
|
314
302
|
edge: "start"
|
|
315
303
|
});
|
|
316
304
|
}
|
|
317
|
-
function isVoidNode(snapshot, node, path2) {
|
|
318
|
-
return isObjectNode({
|
|
319
|
-
schema: snapshot.context.schema
|
|
320
|
-
}, node) && !isEditableContainer(snapshot, node, path2);
|
|
321
|
-
}
|
|
322
305
|
function pathEquals(path2, another) {
|
|
323
306
|
if (path2.length !== another.length)
|
|
324
307
|
return !1;
|
|
@@ -429,7 +412,7 @@ typeof globalThis < "u" && globalThis.InputEvent && typeof globalThis.InputEvent
|
|
|
429
412
|
if (!el)
|
|
430
413
|
throw new Error(`Cannot find a DOM node for editor path: ${point2.path}`);
|
|
431
414
|
let domPoint;
|
|
432
|
-
if (nodeEntry &&
|
|
415
|
+
if (nodeEntry && isLeafObject(editor, nodeEntry.node, point2.path)) {
|
|
433
416
|
const spacer = el.querySelector("[data-pt-zero-width]");
|
|
434
417
|
if (spacer) {
|
|
435
418
|
const domText = spacer.childNodes[0];
|
|
@@ -444,8 +427,10 @@ typeof globalThis < "u" && globalThis.InputEvent && typeof globalThis.InputEvent
|
|
|
444
427
|
}
|
|
445
428
|
return [el, 0];
|
|
446
429
|
}
|
|
447
|
-
const pointPath = path(editor, point2), pointEntry = getNode(editor, pointPath), pointObjectNode = pointEntry &&
|
|
448
|
-
|
|
430
|
+
const pointPath = path(editor, point2), pointEntry = getNode(editor, pointPath), pointObjectNode = pointEntry && isLeafObject(editor, pointEntry.node, pointPath) ? pointEntry : getAncestor(editor, point2.path, {
|
|
431
|
+
match: (node, ancestorPath) => isLeafObject(editor, node, ancestorPath)
|
|
432
|
+
});
|
|
433
|
+
pointObjectNode && isLeafObject(editor, pointObjectNode.node, pointObjectNode.path) && (point2 = {
|
|
449
434
|
path: point2.path,
|
|
450
435
|
offset: 0
|
|
451
436
|
});
|
|
@@ -599,7 +584,7 @@ typeof globalThis < "u" && globalThis.InputEvent && typeof globalThis.InputEvent
|
|
|
599
584
|
}
|
|
600
585
|
if (path2.length > 1) {
|
|
601
586
|
const parentPath2 = path2.slice(0, -1), parentEntry = getNode(editor, parentPath2);
|
|
602
|
-
if (parentEntry &&
|
|
587
|
+
if (parentEntry && isLeafObject(editor, parentEntry.node, parentPath2))
|
|
603
588
|
return {
|
|
604
589
|
path: parentPath2,
|
|
605
590
|
offset: 0
|
|
@@ -659,9 +644,6 @@ typeof globalThis < "u" && globalThis.InputEvent && typeof globalThis.InputEvent
|
|
|
659
644
|
} : null;
|
|
660
645
|
}
|
|
661
646
|
};
|
|
662
|
-
function getVoidAncestor(snapshot, path2) {
|
|
663
|
-
return getAncestor(snapshot, path2, (node, ancestorPath) => isVoidNode(snapshot, node, ancestorPath));
|
|
664
|
-
}
|
|
665
647
|
function collapse(editor, options = {}) {
|
|
666
648
|
const {
|
|
667
649
|
edge = "anchor"
|
|
@@ -848,7 +830,7 @@ function* positions(editor, options = {}) {
|
|
|
848
830
|
}
|
|
849
831
|
isNewBlock = !0;
|
|
850
832
|
}
|
|
851
|
-
if (
|
|
833
|
+
if (isLeafObject(editor, node, nodePath)) {
|
|
852
834
|
yield {
|
|
853
835
|
path: nodePath,
|
|
854
836
|
offset: 0
|
|
@@ -1424,16 +1406,18 @@ function verifyDiffState(editor, textDiff) {
|
|
|
1424
1406
|
} = textDiff;
|
|
1425
1407
|
if (!hasNode(editor, path2))
|
|
1426
1408
|
return !1;
|
|
1427
|
-
const nodeEntry =
|
|
1409
|
+
const nodeEntry = getSpan(editor, path2);
|
|
1428
1410
|
if (!nodeEntry)
|
|
1429
1411
|
return !1;
|
|
1430
1412
|
const node = nodeEntry.node;
|
|
1431
1413
|
if (diff2.start !== node.text.length || diff2.text.length === 0)
|
|
1432
1414
|
return node.text.slice(diff2.start, diff2.start + diff2.text.length) === diff2.text;
|
|
1433
|
-
const nextSibling = getSibling(editor, path2,
|
|
1415
|
+
const nextSibling = getSibling(editor, path2, {
|
|
1416
|
+
direction: "next"
|
|
1417
|
+
});
|
|
1434
1418
|
if (!nextSibling)
|
|
1435
1419
|
return !1;
|
|
1436
|
-
const nextNodeEntry =
|
|
1420
|
+
const nextNodeEntry = getSpan(editor, nextSibling.path);
|
|
1437
1421
|
return !!nextNodeEntry && nextNodeEntry.node.text.startsWith(diff2.text);
|
|
1438
1422
|
}
|
|
1439
1423
|
function applyStringDiff(text, ...diffs) {
|
|
@@ -1496,11 +1480,15 @@ function normalizePoint(editor, point2) {
|
|
|
1496
1480
|
} = point2;
|
|
1497
1481
|
if (!hasNode(editor, path2))
|
|
1498
1482
|
return null;
|
|
1499
|
-
const leafEntry =
|
|
1483
|
+
const leafEntry = getSpan(editor, path2);
|
|
1500
1484
|
if (!leafEntry)
|
|
1501
1485
|
return null;
|
|
1502
1486
|
let leaf = leafEntry.node;
|
|
1503
|
-
const parentBlock =
|
|
1487
|
+
const parentBlock = getParent(editor, path2, {
|
|
1488
|
+
match: (node) => isTextBlock({
|
|
1489
|
+
schema: editor.schema
|
|
1490
|
+
}, node)
|
|
1491
|
+
});
|
|
1504
1492
|
if (!parentBlock)
|
|
1505
1493
|
return null;
|
|
1506
1494
|
for (; offset > leaf.text.length; ) {
|
|
@@ -1707,7 +1695,7 @@ function createAndroidInputManager({
|
|
|
1707
1695
|
}, handleCompositionStart = (_event) => {
|
|
1708
1696
|
editor.composing = !0, compositionEndTimeoutId && (clearTimeout(compositionEndTimeoutId), compositionEndTimeoutId = null);
|
|
1709
1697
|
}, storeDiff = (path2, diff2) => {
|
|
1710
|
-
const pendingDiffs = editor.pendingDiffs, targetEntry =
|
|
1698
|
+
const pendingDiffs = editor.pendingDiffs, targetEntry = getSpan(editor, path2);
|
|
1711
1699
|
if (!targetEntry)
|
|
1712
1700
|
return;
|
|
1713
1701
|
const target = targetEntry.node, idx = pendingDiffs.findIndex((change) => pathEquals(change.path, path2));
|
|
@@ -1761,7 +1749,7 @@ function createAndroidInputManager({
|
|
|
1761
1749
|
let [start2, end2] = rangeEdges(targetRange2, editor);
|
|
1762
1750
|
const leafNodeEntry = getNode(editor, start2.path), leafResult = leafNodeEntry && (isSpan({
|
|
1763
1751
|
schema: editor.schema
|
|
1764
|
-
}, leafNodeEntry.node) ||
|
|
1752
|
+
}, leafNodeEntry.node) || isLeafObject(editor, leafNodeEntry.node, start2.path)) ? leafNodeEntry : void 0;
|
|
1765
1753
|
if (!leafResult)
|
|
1766
1754
|
return scheduleAction(() => editorActor.send({
|
|
1767
1755
|
type: "behavior event",
|
|
@@ -1857,7 +1845,7 @@ function createAndroidInputManager({
|
|
|
1857
1845
|
anchor
|
|
1858
1846
|
} = targetRange2;
|
|
1859
1847
|
if (canStoreDiff && isCollapsedRange(targetRange2)) {
|
|
1860
|
-
const targetNodeEntry =
|
|
1848
|
+
const targetNodeEntry = getSpan(editor, anchor.path);
|
|
1861
1849
|
if (targetNodeEntry && anchor.offset < targetNodeEntry.node.text.length)
|
|
1862
1850
|
return storeDiff(anchor.path, {
|
|
1863
1851
|
text: "",
|
|
@@ -2842,9 +2830,7 @@ const useChildren = (props) => {
|
|
|
2842
2830
|
schema: editor.schema
|
|
2843
2831
|
}, node))
|
|
2844
2832
|
children = node.children;
|
|
2845
|
-
else if (
|
|
2846
|
-
schema: editor.schema
|
|
2847
|
-
}, node)) {
|
|
2833
|
+
else if (isObject$1(editor, node)) {
|
|
2848
2834
|
const containerConfig = resolveContainerForNode(editor, parentContainer, node);
|
|
2849
2835
|
if (containerConfig) {
|
|
2850
2836
|
const fieldValue = node[containerConfig.field.name];
|
|
@@ -2889,9 +2875,7 @@ const useChildren = (props) => {
|
|
|
2889
2875
|
}
|
|
2890
2876
|
return !1;
|
|
2891
2877
|
}
|
|
2892
|
-
if (
|
|
2893
|
-
schema: editor.schema
|
|
2894
|
-
}, n)) {
|
|
2878
|
+
if (isObject$1(editor, n)) {
|
|
2895
2879
|
if (textBlockParent !== void 0)
|
|
2896
2880
|
return !1;
|
|
2897
2881
|
if (editor.blockObjects.has(n._type))
|
|
@@ -2915,9 +2899,7 @@ const useChildren = (props) => {
|
|
|
2915
2899
|
schema: editor.schema
|
|
2916
2900
|
}, n))
|
|
2917
2901
|
return null;
|
|
2918
|
-
if (
|
|
2919
|
-
schema: editor.schema
|
|
2920
|
-
}, n))
|
|
2902
|
+
if (isObject$1(editor, n))
|
|
2921
2903
|
return resolveContainerForNode(editor, childContainer, n) ? wrapNewPipeline(renderElementComponent(n, i, !0), !0, n._key) : wrapNewPipeline(renderObjectNodeComponent(n, i), isInNewPipelineForChild(n), n._key);
|
|
2922
2904
|
if (isSpan({
|
|
2923
2905
|
schema: editor.schema
|
|
@@ -3298,7 +3280,11 @@ const RestoreDOM = IS_ANDROID ? RestoreDOMComponent : ({
|
|
|
3298
3280
|
lastText === node && lastText.textContent?.length === offset && (native = !1);
|
|
3299
3281
|
}
|
|
3300
3282
|
if (native && node.parentElement && window2?.getComputedStyle(node.parentElement)?.whiteSpace === "pre") {
|
|
3301
|
-
const block =
|
|
3283
|
+
const block = getParent(editor, anchor.path, {
|
|
3284
|
+
match: (node2) => isTextBlock({
|
|
3285
|
+
schema: editor.schema
|
|
3286
|
+
}, node2)
|
|
3287
|
+
});
|
|
3302
3288
|
block && getText(editor, block.path)?.includes(" ") && (native = !1);
|
|
3303
3289
|
}
|
|
3304
3290
|
}
|
|
@@ -3589,7 +3575,7 @@ const RestoreDOM = IS_ANDROID ? RestoreDOMComponent : ({
|
|
|
3589
3575
|
const relatedNodeEntry = getNode(editor, relatedPath), relatedNode = relatedNodeEntry ? relatedNodeEntry.node : void 0;
|
|
3590
3576
|
if (relatedNode && (isTextBlockNode({
|
|
3591
3577
|
schema: editor.schema
|
|
3592
|
-
}, relatedNode) ||
|
|
3578
|
+
}, relatedNode) || isLeafObject(editor, relatedNode, relatedPath)))
|
|
3593
3579
|
return;
|
|
3594
3580
|
}
|
|
3595
3581
|
}
|
|
@@ -3609,14 +3595,22 @@ const RestoreDOM = IS_ANDROID ? RestoreDOMComponent : ({
|
|
|
3609
3595
|
let blockPath = path2;
|
|
3610
3596
|
isTextBlockNode({
|
|
3611
3597
|
schema: editor.schema
|
|
3612
|
-
}, node) || (blockPath =
|
|
3598
|
+
}, node) || (blockPath = getParent(editor, path2, {
|
|
3599
|
+
match: (node2) => isTextBlock({
|
|
3600
|
+
schema: editor.schema
|
|
3601
|
+
}, node2)
|
|
3602
|
+
})?.path ?? path2.slice(0, 1));
|
|
3613
3603
|
const range$1 = range(editor, blockPath);
|
|
3614
3604
|
editor.select(range$1);
|
|
3615
3605
|
return;
|
|
3616
3606
|
}
|
|
3617
3607
|
if (readOnly)
|
|
3618
3608
|
return;
|
|
3619
|
-
const start$1 = start(editor, path2), end$1 = end(editor, path2), startEntry = getNode(editor, start$1.path), startVoidNode = startEntry &&
|
|
3609
|
+
const start$1 = start(editor, path2), end$1 = end(editor, path2), startEntry = getNode(editor, start$1.path), startVoidNode = startEntry && isLeafObject(editor, startEntry.node, start$1.path) ? startEntry : getAncestor(editor, start$1.path, {
|
|
3610
|
+
match: (node2, ancestorPath) => isLeafObject(editor, node2, ancestorPath)
|
|
3611
|
+
}), endEntry = getNode(editor, end$1.path), endVoidNode = endEntry && isLeafObject(editor, endEntry.node, end$1.path) ? endEntry : getAncestor(editor, end$1.path, {
|
|
3612
|
+
match: (node2, ancestorPath) => isLeafObject(editor, node2, ancestorPath)
|
|
3613
|
+
});
|
|
3620
3614
|
if (startVoidNode && endVoidNode && pathEquals(startVoidNode.path, endVoidNode.path)) {
|
|
3621
3615
|
const range$1 = range(editor, start$1);
|
|
3622
3616
|
editor.select(range$1);
|
|
@@ -3758,7 +3752,7 @@ const RestoreDOM = IS_ANDROID ? RestoreDOMComponent : ({
|
|
|
3758
3752
|
if (HAS_BEFORE_INPUT_SUPPORT) {
|
|
3759
3753
|
if ((IS_CHROME || IS_WEBKIT) && selection && (Hotkeys.isDeleteBackward(nativeEvent) || Hotkeys.isDeleteForward(nativeEvent)) && isCollapsedRange(selection)) {
|
|
3760
3754
|
const currentNodeEntry = getNode(editor, selection.anchor.path);
|
|
3761
|
-
if (currentNodeEntry &&
|
|
3755
|
+
if (currentNodeEntry && isLeafObject(editor, currentNodeEntry.node, selection.anchor.path)) {
|
|
3762
3756
|
event.preventDefault(), editorActor.send({
|
|
3763
3757
|
type: "behavior event",
|
|
3764
3758
|
behaviorEvent: {
|
|
@@ -4785,32 +4779,6 @@ function DropIndicator() {
|
|
|
4785
4779
|
zIndex: 5
|
|
4786
4780
|
}, children: /* @__PURE__ */ jsx("span", {}) }), $[0] = t0) : t0 = $[0], t0;
|
|
4787
4781
|
}
|
|
4788
|
-
function defaultCompare(a, b) {
|
|
4789
|
-
return a === b;
|
|
4790
|
-
}
|
|
4791
|
-
function useEditorSelector(editor, selector, t0) {
|
|
4792
|
-
return useSelector(editor, selector, t0 === void 0 ? defaultCompare : t0);
|
|
4793
|
-
}
|
|
4794
|
-
function getEditorSnapshot({
|
|
4795
|
-
editorActorSnapshot,
|
|
4796
|
-
editorEngineInstance
|
|
4797
|
-
}) {
|
|
4798
|
-
return {
|
|
4799
|
-
blockIndexMap: editorEngineInstance.blockIndexMap,
|
|
4800
|
-
context: {
|
|
4801
|
-
containers: editorEngineInstance.publicContainers,
|
|
4802
|
-
converters: editorActorSnapshot.context.converters,
|
|
4803
|
-
keyGenerator: editorActorSnapshot.context.keyGenerator,
|
|
4804
|
-
readOnly: editorActorSnapshot.matches({
|
|
4805
|
-
"edit mode": "read only"
|
|
4806
|
-
}),
|
|
4807
|
-
schema: editorActorSnapshot.context.schema,
|
|
4808
|
-
selection: editorEngineInstance.selection,
|
|
4809
|
-
value: editorEngineInstance.children
|
|
4810
|
-
},
|
|
4811
|
-
decoratorState: editorEngineInstance.decoratorState
|
|
4812
|
-
};
|
|
4813
|
-
}
|
|
4814
4782
|
const emptySet$1 = /* @__PURE__ */ new Set(), emptyState = {
|
|
4815
4783
|
focusedLeafPath: void 0,
|
|
4816
4784
|
selectedLeafPaths: emptySet$1,
|
|
@@ -4885,15 +4853,12 @@ const defaultStore = {
|
|
|
4885
4853
|
getSnapshot: () => defaultSelectionState
|
|
4886
4854
|
}, SelectionStateStoreContext = createContext(defaultStore);
|
|
4887
4855
|
function SelectionStateProvider(t0) {
|
|
4888
|
-
const $ = c(
|
|
4856
|
+
const $ = c(11), {
|
|
4889
4857
|
children
|
|
4890
4858
|
} = t0, editorActor = useContext(EditorActorContext), editorEngine = useEngineStatic();
|
|
4891
4859
|
let t1;
|
|
4892
|
-
$[0] !==
|
|
4893
|
-
const
|
|
4894
|
-
editorActorSnapshot: actorSnapshot,
|
|
4895
|
-
editorEngineInstance: editorEngine
|
|
4896
|
-
}), selection = snapshot.context.selection ? {
|
|
4860
|
+
$[0] !== editorEngine.blockIndexMap || $[1] !== editorEngine.publicContainers || $[2] !== editorEngine.snapshot ? (t1 = () => {
|
|
4861
|
+
const snapshot = editorEngine.snapshot, selection = snapshot.context.selection ? {
|
|
4897
4862
|
anchorPath: snapshot.context.selection.anchor.path,
|
|
4898
4863
|
focusPath: snapshot.context.selection.focus.path,
|
|
4899
4864
|
backward: snapshot.context.selection.backward ?? !1,
|
|
@@ -4907,10 +4872,10 @@ function SelectionStateProvider(t0) {
|
|
|
4907
4872
|
},
|
|
4908
4873
|
blockIndexMap: editorEngine.blockIndexMap
|
|
4909
4874
|
}, selection);
|
|
4910
|
-
}, $[0] =
|
|
4875
|
+
}, $[0] = editorEngine.blockIndexMap, $[1] = editorEngine.publicContainers, $[2] = editorEngine.snapshot, $[3] = t1) : t1 = $[3];
|
|
4911
4876
|
const computeCurrent = t1, [seed] = useState(computeCurrent), stateRef = useRef(seed), [initialSubscribers] = useState(_temp$2), subscribersRef = useRef(initialSubscribers);
|
|
4912
4877
|
let t2, t3;
|
|
4913
|
-
$[
|
|
4878
|
+
$[4] !== computeCurrent || $[5] !== editorActor ? (t2 = () => {
|
|
4914
4879
|
const next = computeCurrent();
|
|
4915
4880
|
if (!selectionStatesEqual(stateRef.current, next)) {
|
|
4916
4881
|
stateRef.current = next;
|
|
@@ -4930,17 +4895,17 @@ function SelectionStateProvider(t0) {
|
|
|
4930
4895
|
}));
|
|
4931
4896
|
});
|
|
4932
4897
|
return () => subscription.unsubscribe();
|
|
4933
|
-
}, t3 = [editorActor, computeCurrent], $[
|
|
4898
|
+
}, t3 = [editorActor, computeCurrent], $[4] = computeCurrent, $[5] = editorActor, $[6] = t2, $[7] = t3) : (t2 = $[6], t3 = $[7]), useEffect(t2, t3);
|
|
4934
4899
|
let t4;
|
|
4935
|
-
$[
|
|
4900
|
+
$[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t4 = {
|
|
4936
4901
|
subscribe: (callback) => (subscribersRef.current.add(callback), () => {
|
|
4937
4902
|
subscribersRef.current.delete(callback);
|
|
4938
4903
|
}),
|
|
4939
4904
|
getSnapshot: () => stateRef.current
|
|
4940
|
-
}, $[
|
|
4905
|
+
}, $[8] = t4) : t4 = $[8];
|
|
4941
4906
|
const store = t4;
|
|
4942
4907
|
let t5;
|
|
4943
|
-
return $[
|
|
4908
|
+
return $[9] !== children ? (t5 = /* @__PURE__ */ jsx(SelectionStateStoreContext.Provider, { value: store, children }), $[9] = children, $[10] = t5) : t5 = $[10], t5;
|
|
4944
4909
|
}
|
|
4945
4910
|
function _temp$2() {
|
|
4946
4911
|
return /* @__PURE__ */ new Set();
|
|
@@ -5355,7 +5320,7 @@ function resolveElementDropPosition(dropPosition, elementPath) {
|
|
|
5355
5320
|
return dropPosition.position;
|
|
5356
5321
|
}
|
|
5357
5322
|
function tupleRefEqual(previous, next) {
|
|
5358
|
-
if (previous.length !== next.length)
|
|
5323
|
+
if (previous === null || previous.length !== next.length)
|
|
5359
5324
|
return !1;
|
|
5360
5325
|
for (let i = 0; i < previous.length; i++)
|
|
5361
5326
|
if (!Object.is(previous[i], next[i]))
|
|
@@ -5363,7 +5328,7 @@ function tupleRefEqual(previous, next) {
|
|
|
5363
5328
|
return !0;
|
|
5364
5329
|
}
|
|
5365
5330
|
function RenderElement(props) {
|
|
5366
|
-
const $ = c(84),
|
|
5331
|
+
const $ = c(84), parentContainer = useContext(ParentContainerContext), parentTextBlock = useContext(ParentTextBlockContext), isInNewPipeline = useContext(NewPipelineContext), engineStatic = useEngineStatic(), schema = props.schema, type = props.element._type;
|
|
5367
5332
|
let t0;
|
|
5368
5333
|
$[0] !== parentContainer || $[1] !== type ? (t0 = findBlockPositionalOverride(parentContainer, type), $[0] = parentContainer, $[1] = type, $[2] = t0) : t0 = $[2];
|
|
5369
5334
|
const blockPositionalOverride = t0;
|
|
@@ -5371,8 +5336,8 @@ function RenderElement(props) {
|
|
|
5371
5336
|
$[3] !== parentTextBlock || $[4] !== type ? (t1 = findInlinePositionalOverride(parentTextBlock, type), $[3] = parentTextBlock, $[4] = type, $[5] = t1) : t1 = $[5];
|
|
5372
5337
|
const inlinePositionalOverride = t1;
|
|
5373
5338
|
let t2;
|
|
5374
|
-
$[6] !== type ? (t2 = (
|
|
5375
|
-
const [globalContainerConfig, globalBlockObjectConfig, globalInlineObjectConfig, textBlockConfig] =
|
|
5339
|
+
$[6] !== type ? (t2 = (engine) => [engine.containers.get(type), engine.blockObjects.get(type), engine.inlineObjects.get(type), engine.textBlocks.get(type)], $[6] = type, $[7] = t2) : t2 = $[7];
|
|
5340
|
+
const [globalContainerConfig, globalBlockObjectConfig, globalInlineObjectConfig, textBlockConfig] = useEngineSelector(t2, tupleRefEqual);
|
|
5376
5341
|
let t3;
|
|
5377
5342
|
bb0: {
|
|
5378
5343
|
if (blockPositionalOverride && "container" in blockPositionalOverride) {
|
|
@@ -5564,13 +5529,13 @@ function RenderTextBlockConfig(props) {
|
|
|
5564
5529
|
}), $[2] = focused, $[3] = props.attributes, $[4] = props.children, $[5] = props.node, $[6] = props.path, $[7] = props.readOnly, $[8] = props.render, $[9] = selected, $[10] = t1) : t1 = $[10], t1;
|
|
5565
5530
|
}
|
|
5566
5531
|
function useSpanConfig(node, _path) {
|
|
5567
|
-
const $ = c(5),
|
|
5532
|
+
const $ = c(5), parentTextBlock = useContext(ParentTextBlockContext);
|
|
5568
5533
|
let t0;
|
|
5569
5534
|
$[0] !== node._type || $[1] !== parentTextBlock ? (t0 = findInlinePositionalOverride(parentTextBlock, node._type), $[0] = node._type, $[1] = parentTextBlock, $[2] = t0) : t0 = $[2];
|
|
5570
5535
|
const positional = t0;
|
|
5571
5536
|
let t1;
|
|
5572
|
-
$[3] !== node._type ? (t1 = (
|
|
5573
|
-
const globalSpan =
|
|
5537
|
+
$[3] !== node._type ? (t1 = (engine) => engine.spans.get(node._type), $[3] = node._type, $[4] = t1) : t1 = $[4];
|
|
5538
|
+
const globalSpan = useEngineSelector(t1);
|
|
5574
5539
|
return positional && "span" in positional ? positional.span.render === void 0 ? globalSpan : positional : globalSpan;
|
|
5575
5540
|
}
|
|
5576
5541
|
function RenderSpan(props) {
|
|
@@ -6025,7 +5990,7 @@ function validateSelection(editorEngine, editorElement) {
|
|
|
6025
5990
|
}
|
|
6026
5991
|
}
|
|
6027
5992
|
const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
6028
|
-
const $ = c(
|
|
5993
|
+
const $ = c(180);
|
|
6029
5994
|
let hotkeys, onBeforeInput, onBlur, onClick, onCopy, onCut, onDrag, onDragEnd, onDragEnter, onDragLeave, onDragOver, onDragStart, onDrop, onFocus, onPaste, propsSelection, rangeDecorations, renderAnnotation, renderBlock, renderChild, renderDecorator, renderListItem, renderPlaceholder, renderStyle, restProps, scrollSelectionIntoView;
|
|
6030
5995
|
$[0] !== props ? ({
|
|
6031
5996
|
hotkeys,
|
|
@@ -6055,65 +6020,62 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6055
6020
|
scrollSelectionIntoView,
|
|
6056
6021
|
...restProps
|
|
6057
6022
|
} = props, $[0] = props, $[1] = hotkeys, $[2] = onBeforeInput, $[3] = onBlur, $[4] = onClick, $[5] = onCopy, $[6] = onCut, $[7] = onDrag, $[8] = onDragEnd, $[9] = onDragEnter, $[10] = onDragLeave, $[11] = onDragOver, $[12] = onDragStart, $[13] = onDrop, $[14] = onFocus, $[15] = onPaste, $[16] = propsSelection, $[17] = rangeDecorations, $[18] = renderAnnotation, $[19] = renderBlock, $[20] = renderChild, $[21] = renderDecorator, $[22] = renderListItem, $[23] = renderPlaceholder, $[24] = renderStyle, $[25] = restProps, $[26] = scrollSelectionIntoView) : (hotkeys = $[1], onBeforeInput = $[2], onBlur = $[3], onClick = $[4], onCopy = $[5], onCut = $[6], onDrag = $[7], onDragEnd = $[8], onDragEnter = $[9], onDragLeave = $[10], onDragOver = $[11], onDragStart = $[12], onDrop = $[13], onFocus = $[14], onPaste = $[15], propsSelection = $[16], rangeDecorations = $[17], renderAnnotation = $[18], renderBlock = $[19], renderChild = $[20], renderDecorator = $[21], renderListItem = $[22], renderPlaceholder = $[23], renderStyle = $[24], restProps = $[25], scrollSelectionIntoView = $[26]);
|
|
6058
|
-
const portableTextEditor = usePortableTextEditor(), [hasInvalidValue, setHasInvalidValue] = useState(!1), editorActor = useContext(EditorActorContext), relayActor = useContext(RelayActorContext);
|
|
6023
|
+
const portableTextEditor = usePortableTextEditor(), [hasInvalidValue, setHasInvalidValue] = useState(!1), editorActor = useContext(EditorActorContext), relayActor = useContext(RelayActorContext), editorEngine = useEngine(), schema = editorEngine.schema, readOnly = useSelector(editorActor, _temp);
|
|
6059
6024
|
let t0;
|
|
6060
|
-
$[27] !==
|
|
6061
|
-
const schema = t0.context.schema, readOnly = useSelector(editorActor, _temp), editorEngine = useEngine();
|
|
6062
|
-
let t1;
|
|
6063
|
-
$[29] !== editorEngine ? (t1 = {
|
|
6025
|
+
$[27] !== editorEngine ? (t0 = {
|
|
6064
6026
|
input: {
|
|
6065
6027
|
editorEngine
|
|
6066
6028
|
}
|
|
6067
|
-
}, $[
|
|
6068
|
-
const validateSelectionActor = useActorRef(validateSelectionMachine,
|
|
6029
|
+
}, $[27] = editorEngine, $[28] = t0) : t0 = $[28];
|
|
6030
|
+
const validateSelectionActor = useActorRef(validateSelectionMachine, t0);
|
|
6031
|
+
let t1;
|
|
6032
|
+
$[29] !== rangeDecorations ? (t1 = rangeDecorations ?? [], $[29] = rangeDecorations, $[30] = t1) : t1 = $[30];
|
|
6069
6033
|
let t2;
|
|
6070
|
-
$[31] !==
|
|
6071
|
-
let t3;
|
|
6072
|
-
$[33] !== editorActor ? (t3 = editorActor.getSnapshot().matches({
|
|
6034
|
+
$[31] !== editorActor ? (t2 = editorActor.getSnapshot().matches({
|
|
6073
6035
|
setup: "setting up"
|
|
6074
|
-
}), $[
|
|
6075
|
-
const
|
|
6076
|
-
let
|
|
6077
|
-
$[
|
|
6036
|
+
}), $[31] = editorActor, $[32] = t2) : t2 = $[32];
|
|
6037
|
+
const t3 = !t2;
|
|
6038
|
+
let t4;
|
|
6039
|
+
$[33] !== editorEngine || $[34] !== readOnly || $[35] !== schema || $[36] !== t1 || $[37] !== t3 ? (t4 = {
|
|
6078
6040
|
input: {
|
|
6079
|
-
rangeDecorations:
|
|
6041
|
+
rangeDecorations: t1,
|
|
6080
6042
|
readOnly,
|
|
6081
6043
|
schema,
|
|
6082
6044
|
editorEngine,
|
|
6083
|
-
skipSetup:
|
|
6045
|
+
skipSetup: t3
|
|
6084
6046
|
}
|
|
6085
|
-
}, $[
|
|
6086
|
-
const rangeDecorationsActor = useActorRef(rangeDecorationsMachine,
|
|
6087
|
-
let
|
|
6088
|
-
$[
|
|
6047
|
+
}, $[33] = editorEngine, $[34] = readOnly, $[35] = schema, $[36] = t1, $[37] = t3, $[38] = t4) : t4 = $[38];
|
|
6048
|
+
const rangeDecorationsActor = useActorRef(rangeDecorationsMachine, t4), decorate = useSelector(rangeDecorationsActor, _temp2), dropPosition = useDropPosition();
|
|
6049
|
+
let t5, t6;
|
|
6050
|
+
$[39] !== rangeDecorationsActor || $[40] !== readOnly ? (t5 = () => {
|
|
6089
6051
|
rangeDecorationsActor.send({
|
|
6090
6052
|
type: "update read only",
|
|
6091
6053
|
readOnly
|
|
6092
6054
|
});
|
|
6093
|
-
},
|
|
6094
|
-
let
|
|
6095
|
-
$[
|
|
6055
|
+
}, t6 = [rangeDecorationsActor, readOnly], $[39] = rangeDecorationsActor, $[40] = readOnly, $[41] = t5, $[42] = t6) : (t5 = $[41], t6 = $[42]), useEffect(t5, t6);
|
|
6056
|
+
let t7, t8;
|
|
6057
|
+
$[43] !== rangeDecorations || $[44] !== rangeDecorationsActor ? (t7 = () => {
|
|
6096
6058
|
rangeDecorationsActor.send({
|
|
6097
6059
|
type: "range decorations updated",
|
|
6098
6060
|
rangeDecorations: rangeDecorations ?? []
|
|
6099
6061
|
});
|
|
6100
|
-
},
|
|
6101
|
-
let
|
|
6102
|
-
$[
|
|
6062
|
+
}, t8 = [rangeDecorationsActor, rangeDecorations], $[43] = rangeDecorations, $[44] = rangeDecorationsActor, $[45] = t7, $[46] = t8) : (t7 = $[45], t8 = $[46]), useEffect(t7, t8);
|
|
6063
|
+
let t9;
|
|
6064
|
+
$[47] !== renderBlock || $[48] !== renderChild || $[49] !== renderListItem || $[50] !== renderStyle ? (t9 = {
|
|
6103
6065
|
renderBlock,
|
|
6104
6066
|
renderChild,
|
|
6105
6067
|
renderListItem,
|
|
6106
6068
|
renderStyle
|
|
6107
|
-
}, $[
|
|
6108
|
-
const legacy =
|
|
6069
|
+
}, $[47] = renderBlock, $[48] = renderChild, $[49] = renderListItem, $[50] = renderStyle, $[51] = t9) : t9 = $[51];
|
|
6070
|
+
const legacy = t9;
|
|
6071
|
+
let t10;
|
|
6072
|
+
$[52] !== dropPosition || $[53] !== legacy || $[54] !== readOnly || $[55] !== schema ? (t10 = (eProps) => /* @__PURE__ */ jsx(RenderElement, { ...eProps, dropPosition, legacy, readOnly, schema }), $[52] = dropPosition, $[53] = legacy, $[54] = readOnly, $[55] = schema, $[56] = t10) : t10 = $[56];
|
|
6073
|
+
const renderElement = t10;
|
|
6109
6074
|
let t11;
|
|
6110
|
-
$[
|
|
6111
|
-
const
|
|
6075
|
+
$[57] !== readOnly || $[58] !== renderAnnotation || $[59] !== renderChild || $[60] !== renderDecorator || $[61] !== renderPlaceholder || $[62] !== schema ? (t11 = (leafProps) => /* @__PURE__ */ jsx(RenderLeaf, { ...leafProps, readOnly, renderAnnotation, renderChild, renderDecorator, renderPlaceholder, schema }), $[57] = readOnly, $[58] = renderAnnotation, $[59] = renderChild, $[60] = renderDecorator, $[61] = renderPlaceholder, $[62] = schema, $[63] = t11) : t11 = $[63];
|
|
6076
|
+
const renderLeaf = t11, renderText = _temp3;
|
|
6112
6077
|
let t12;
|
|
6113
|
-
$[
|
|
6114
|
-
const renderLeaf = t12, renderText = _temp3;
|
|
6115
|
-
let t13;
|
|
6116
|
-
$[66] !== editorActor || $[67] !== editorEngine || $[68] !== propsSelection ? (t13 = () => {
|
|
6078
|
+
$[64] !== editorActor || $[65] !== editorEngine || $[66] !== propsSelection ? (t12 = () => {
|
|
6117
6079
|
if (propsSelection) {
|
|
6118
6080
|
debug.selection.enabled && debug.selection(`Selection from props ${safeStringify(propsSelection)}`);
|
|
6119
6081
|
const resolvedSelection = resolveSelection(editorEngine, propsSelection);
|
|
@@ -6122,10 +6084,10 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6122
6084
|
selection: resolvedSelection
|
|
6123
6085
|
}), editorEngine.onChange());
|
|
6124
6086
|
}
|
|
6125
|
-
}, $[
|
|
6126
|
-
const restoreSelectionFromProps =
|
|
6127
|
-
let
|
|
6128
|
-
$[
|
|
6087
|
+
}, $[64] = editorActor, $[65] = editorEngine, $[66] = propsSelection, $[67] = t12) : t12 = $[67];
|
|
6088
|
+
const restoreSelectionFromProps = t12;
|
|
6089
|
+
let t13, t14;
|
|
6090
|
+
$[68] !== editorActor || $[69] !== rangeDecorationsActor || $[70] !== restoreSelectionFromProps ? (t13 = () => {
|
|
6129
6091
|
const onReady = editorActor.on("ready", () => {
|
|
6130
6092
|
rangeDecorationsActor.send({
|
|
6131
6093
|
type: "ready"
|
|
@@ -6138,13 +6100,13 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6138
6100
|
return () => {
|
|
6139
6101
|
onReady.unsubscribe(), onInvalidValue.unsubscribe(), onValueChanged.unsubscribe();
|
|
6140
6102
|
};
|
|
6141
|
-
},
|
|
6142
|
-
let
|
|
6143
|
-
$[
|
|
6103
|
+
}, t14 = [rangeDecorationsActor, editorActor, restoreSelectionFromProps], $[68] = editorActor, $[69] = rangeDecorationsActor, $[70] = restoreSelectionFromProps, $[71] = t13, $[72] = t14) : (t13 = $[71], t14 = $[72]), useEffect(t13, t14);
|
|
6104
|
+
let t15, t16;
|
|
6105
|
+
$[73] !== hasInvalidValue || $[74] !== propsSelection || $[75] !== restoreSelectionFromProps ? (t15 = () => {
|
|
6144
6106
|
propsSelection && !hasInvalidValue && restoreSelectionFromProps();
|
|
6145
|
-
},
|
|
6146
|
-
let
|
|
6147
|
-
$[
|
|
6107
|
+
}, t16 = [hasInvalidValue, propsSelection, restoreSelectionFromProps], $[73] = hasInvalidValue, $[74] = propsSelection, $[75] = restoreSelectionFromProps, $[76] = t15, $[77] = t16) : (t15 = $[76], t16 = $[77]), useEffect(t15, t16);
|
|
6108
|
+
let t17;
|
|
6109
|
+
$[78] !== editorActor || $[79] !== editorEngine || $[80] !== onCopy ? (t17 = (event) => {
|
|
6148
6110
|
if (DOMEditor.hasSelectableTarget(editorEngine, event.target)) {
|
|
6149
6111
|
if (onCopy)
|
|
6150
6112
|
onCopy(event) !== void 0 && event.preventDefault();
|
|
@@ -6171,16 +6133,16 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6171
6133
|
});
|
|
6172
6134
|
}
|
|
6173
6135
|
}
|
|
6174
|
-
}, $[
|
|
6175
|
-
const handleCopy =
|
|
6176
|
-
let
|
|
6177
|
-
$[
|
|
6136
|
+
}, $[78] = editorActor, $[79] = editorEngine, $[80] = onCopy, $[81] = t17) : t17 = $[81];
|
|
6137
|
+
const handleCopy = t17;
|
|
6138
|
+
let t18;
|
|
6139
|
+
$[82] !== editorActor || $[83] !== editorEngine || $[84] !== onCut ? (t18 = (event_0) => {
|
|
6178
6140
|
if (DOMEditor.hasSelectableTarget(editorEngine, event_0.target)) {
|
|
6179
6141
|
if (onCut)
|
|
6180
6142
|
onCut(event_0) !== void 0 && event_0.preventDefault();
|
|
6181
6143
|
else if (event_0.nativeEvent.clipboardData) {
|
|
6182
6144
|
event_0.stopPropagation(), event_0.preventDefault();
|
|
6183
|
-
const selection_0 =
|
|
6145
|
+
const selection_0 = editorEngine.selection, position_0 = selection_0 ? {
|
|
6184
6146
|
selection: selection_0
|
|
6185
6147
|
} : void 0;
|
|
6186
6148
|
if (!position_0) {
|
|
@@ -6201,10 +6163,10 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6201
6163
|
});
|
|
6202
6164
|
}
|
|
6203
6165
|
}
|
|
6204
|
-
}, $[
|
|
6205
|
-
const handleCut =
|
|
6206
|
-
let
|
|
6207
|
-
$[
|
|
6166
|
+
}, $[82] = editorActor, $[83] = editorEngine, $[84] = onCut, $[85] = t18) : t18 = $[85];
|
|
6167
|
+
const handleCut = t18;
|
|
6168
|
+
let t19;
|
|
6169
|
+
$[86] !== editorActor || $[87] !== editorEngine || $[88] !== onPaste || $[89] !== portableTextEditor || $[90] !== relayActor ? (t19 = (event_1) => {
|
|
6208
6170
|
const value = editorEngine.children, path2 = editorEngine.selection?.focus.path || [], onPasteResult = onPaste?.({
|
|
6209
6171
|
event: event_1,
|
|
6210
6172
|
value,
|
|
@@ -6217,7 +6179,7 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6217
6179
|
}), Promise.resolve(onPasteResult).then((result_1) => {
|
|
6218
6180
|
if (debug.behaviors("Custom paste function from client resolved", result_1), !result_1 || !result_1.insert) {
|
|
6219
6181
|
debug.behaviors("No result from custom paste handler, pasting normally");
|
|
6220
|
-
const selection_1 =
|
|
6182
|
+
const selection_1 = editorEngine.selection, position_1 = selection_1 ? {
|
|
6221
6183
|
selection: selection_1
|
|
6222
6184
|
} : void 0;
|
|
6223
6185
|
if (!position_1) {
|
|
@@ -6242,8 +6204,8 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6242
6204
|
behaviorEvent: {
|
|
6243
6205
|
type: "insert.blocks",
|
|
6244
6206
|
blocks: parseBlocks({
|
|
6245
|
-
keyGenerator:
|
|
6246
|
-
schema:
|
|
6207
|
+
keyGenerator: editorEngine.keyGenerator,
|
|
6208
|
+
schema: editorEngine.schema,
|
|
6247
6209
|
blocks: result_1.insert,
|
|
6248
6210
|
options: {
|
|
6249
6211
|
normalize: !1,
|
|
@@ -6262,7 +6224,7 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6262
6224
|
});
|
|
6263
6225
|
else if (event_1.nativeEvent.clipboardData) {
|
|
6264
6226
|
event_1.preventDefault(), event_1.stopPropagation();
|
|
6265
|
-
const selection_2 =
|
|
6227
|
+
const selection_2 = editorEngine.selection, position_2 = selection_2 ? {
|
|
6266
6228
|
selection: selection_2
|
|
6267
6229
|
} : void 0;
|
|
6268
6230
|
if (!position_2) {
|
|
@@ -6283,18 +6245,18 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6283
6245
|
});
|
|
6284
6246
|
}
|
|
6285
6247
|
debug.behaviors("No result from custom paste handler, pasting normally");
|
|
6286
|
-
}, $[
|
|
6287
|
-
const handlePaste =
|
|
6288
|
-
let
|
|
6289
|
-
$[
|
|
6248
|
+
}, $[86] = editorActor, $[87] = editorEngine, $[88] = onPaste, $[89] = portableTextEditor, $[90] = relayActor, $[91] = t19) : t19 = $[91];
|
|
6249
|
+
const handlePaste = t19;
|
|
6250
|
+
let t20;
|
|
6251
|
+
$[92] !== editorEngine || $[93] !== onFocus || $[94] !== relayActor ? (t20 = (event_2) => {
|
|
6290
6252
|
onFocus && onFocus(event_2), event_2.isDefaultPrevented() || (relayActor.send({
|
|
6291
6253
|
type: "focused",
|
|
6292
6254
|
event: event_2
|
|
6293
|
-
}), !editorEngine.selection && editorEngine.children.length === 1 && isEmptyTextBlock(
|
|
6294
|
-
}, $[
|
|
6295
|
-
const handleOnFocus =
|
|
6296
|
-
let
|
|
6297
|
-
$[
|
|
6255
|
+
}), !editorEngine.selection && editorEngine.children.length === 1 && isEmptyTextBlock(editorEngine, editorEngine.children.at(0)) && (editorEngine.select(start(editorEngine, [])), editorEngine.onChange()));
|
|
6256
|
+
}, $[92] = editorEngine, $[93] = onFocus, $[94] = relayActor, $[95] = t20) : t20 = $[95];
|
|
6257
|
+
const handleOnFocus = t20;
|
|
6258
|
+
let t21;
|
|
6259
|
+
$[96] !== editorActor || $[97] !== editorEngine || $[98] !== onClick ? (t21 = (event_3) => {
|
|
6298
6260
|
if (onClick && onClick(event_3), event_3.isDefaultPrevented() || event_3.isPropagationStopped())
|
|
6299
6261
|
return;
|
|
6300
6262
|
const position_3 = getEventPosition({
|
|
@@ -6311,23 +6273,23 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6311
6273
|
editor: editorEngine,
|
|
6312
6274
|
nativeEvent: event_3
|
|
6313
6275
|
});
|
|
6314
|
-
}, $[
|
|
6315
|
-
const handleClick =
|
|
6316
|
-
let
|
|
6317
|
-
$[
|
|
6276
|
+
}, $[96] = editorActor, $[97] = editorEngine, $[98] = onClick, $[99] = t21) : t21 = $[99];
|
|
6277
|
+
const handleClick = t21;
|
|
6278
|
+
let t22;
|
|
6279
|
+
$[100] !== onBlur || $[101] !== relayActor ? (t22 = (event_4) => {
|
|
6318
6280
|
onBlur && onBlur(event_4), event_4.isPropagationStopped() || relayActor.send({
|
|
6319
6281
|
type: "blurred",
|
|
6320
6282
|
event: event_4
|
|
6321
6283
|
});
|
|
6322
|
-
}, $[
|
|
6323
|
-
const handleOnBlur =
|
|
6324
|
-
let
|
|
6325
|
-
$[
|
|
6284
|
+
}, $[100] = onBlur, $[101] = relayActor, $[102] = t22) : t22 = $[102];
|
|
6285
|
+
const handleOnBlur = t22;
|
|
6286
|
+
let t23;
|
|
6287
|
+
$[103] !== onBeforeInput ? (t23 = (event_5) => {
|
|
6326
6288
|
onBeforeInput && onBeforeInput(event_5);
|
|
6327
|
-
}, $[
|
|
6328
|
-
const handleOnBeforeInput =
|
|
6329
|
-
let
|
|
6330
|
-
$[
|
|
6289
|
+
}, $[103] = onBeforeInput, $[104] = t23) : t23 = $[104];
|
|
6290
|
+
const handleOnBeforeInput = t23;
|
|
6291
|
+
let t24;
|
|
6292
|
+
$[105] !== editorActor || $[106] !== editorEngine || $[107] !== hotkeys || $[108] !== portableTextEditor || $[109] !== props ? (t24 = (event_6) => {
|
|
6331
6293
|
props.onKeyDown && props.onKeyDown(event_6), event_6.isDefaultPrevented() || performHotkey({
|
|
6332
6294
|
editorActor,
|
|
6333
6295
|
editor: editorEngine,
|
|
@@ -6350,10 +6312,10 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6350
6312
|
editor: editorEngine,
|
|
6351
6313
|
nativeEvent: event_6
|
|
6352
6314
|
});
|
|
6353
|
-
}, $[
|
|
6354
|
-
const handleKeyDown =
|
|
6355
|
-
let
|
|
6356
|
-
$[
|
|
6315
|
+
}, $[105] = editorActor, $[106] = editorEngine, $[107] = hotkeys, $[108] = portableTextEditor, $[109] = props, $[110] = t24) : t24 = $[110];
|
|
6316
|
+
const handleKeyDown = t24;
|
|
6317
|
+
let t25;
|
|
6318
|
+
$[111] !== editorActor || $[112] !== editorEngine || $[113] !== props ? (t25 = (event_7) => {
|
|
6357
6319
|
props.onKeyUp && props.onKeyUp(event_7), event_7.isDefaultPrevented() || editorActor.send({
|
|
6358
6320
|
type: "behavior event",
|
|
6359
6321
|
behaviorEvent: {
|
|
@@ -6370,26 +6332,26 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6370
6332
|
editor: editorEngine,
|
|
6371
6333
|
nativeEvent: event_7
|
|
6372
6334
|
});
|
|
6373
|
-
}, $[
|
|
6374
|
-
const handleKeyUp =
|
|
6375
|
-
let
|
|
6335
|
+
}, $[111] = editorActor, $[112] = editorEngine, $[113] = props, $[114] = t25) : t25 = $[114];
|
|
6336
|
+
const handleKeyUp = t25;
|
|
6337
|
+
let t26;
|
|
6376
6338
|
bb0: {
|
|
6377
6339
|
if (scrollSelectionIntoView === void 0) {
|
|
6378
|
-
|
|
6340
|
+
t26 = void 0;
|
|
6379
6341
|
break bb0;
|
|
6380
6342
|
}
|
|
6381
6343
|
if (scrollSelectionIntoView === null) {
|
|
6382
|
-
|
|
6344
|
+
t26 = noop;
|
|
6383
6345
|
break bb0;
|
|
6384
6346
|
}
|
|
6385
|
-
let
|
|
6386
|
-
$[
|
|
6347
|
+
let t272;
|
|
6348
|
+
$[115] !== portableTextEditor || $[116] !== scrollSelectionIntoView ? (t272 = (_editor, domRange) => {
|
|
6387
6349
|
scrollSelectionIntoView(portableTextEditor, domRange);
|
|
6388
|
-
}, $[
|
|
6350
|
+
}, $[115] = portableTextEditor, $[116] = scrollSelectionIntoView, $[117] = t272) : t272 = $[117], t26 = t272;
|
|
6389
6351
|
}
|
|
6390
|
-
const scrollSelectionIntoViewToEngine =
|
|
6391
|
-
let
|
|
6392
|
-
$[
|
|
6352
|
+
const scrollSelectionIntoViewToEngine = t26;
|
|
6353
|
+
let t27, t28;
|
|
6354
|
+
$[118] !== editorActor || $[119] !== editorEngine ? (t27 = () => {
|
|
6393
6355
|
const window2 = DOMEditor.getWindow(editorEngine), onDragEnd_0 = () => {
|
|
6394
6356
|
editorActor.send({
|
|
6395
6357
|
type: "dragend"
|
|
@@ -6402,9 +6364,9 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6402
6364
|
return window2.document.addEventListener("dragend", onDragEnd_0), window2.document.addEventListener("drop", onDrop_0), () => {
|
|
6403
6365
|
window2.document.removeEventListener("dragend", onDragEnd_0), window2.document.removeEventListener("drop", onDrop_0);
|
|
6404
6366
|
};
|
|
6405
|
-
},
|
|
6406
|
-
let
|
|
6407
|
-
$[
|
|
6367
|
+
}, t28 = [editorEngine, editorActor], $[118] = editorActor, $[119] = editorEngine, $[120] = t27, $[121] = t28) : (t27 = $[120], t28 = $[121]), useEffect(t27, t28);
|
|
6368
|
+
let t29;
|
|
6369
|
+
$[122] !== editorActor || $[123] !== editorEngine || $[124] !== onDragStart || $[125] !== readOnly ? (t29 = (event_8) => {
|
|
6408
6370
|
if (readOnly || !DOMEditor.hasTarget(editorEngine, event_8.target) || (onDragStart?.(event_8), event_8.isDefaultPrevented() || event_8.isPropagationStopped()))
|
|
6409
6371
|
return;
|
|
6410
6372
|
const position_4 = getEventPosition({
|
|
@@ -6432,10 +6394,10 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6432
6394
|
},
|
|
6433
6395
|
editor: editorEngine
|
|
6434
6396
|
}), !0;
|
|
6435
|
-
}, $[
|
|
6436
|
-
const handleDragStart =
|
|
6437
|
-
let
|
|
6438
|
-
$[
|
|
6397
|
+
}, $[122] = editorActor, $[123] = editorEngine, $[124] = onDragStart, $[125] = readOnly, $[126] = t29) : t29 = $[126];
|
|
6398
|
+
const handleDragStart = t29;
|
|
6399
|
+
let t30;
|
|
6400
|
+
$[127] !== editorActor || $[128] !== editorEngine || $[129] !== onDrag ? (t30 = (event_9) => {
|
|
6439
6401
|
if (onDrag?.(event_9), !(event_9.isDefaultPrevented() || event_9.isPropagationStopped() || !getEventPosition({
|
|
6440
6402
|
editorActor,
|
|
6441
6403
|
editorEngine,
|
|
@@ -6451,10 +6413,10 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6451
6413
|
},
|
|
6452
6414
|
editor: editorEngine
|
|
6453
6415
|
}), !0;
|
|
6454
|
-
}, $[
|
|
6455
|
-
const handleDrag =
|
|
6456
|
-
let
|
|
6457
|
-
$[
|
|
6416
|
+
}, $[127] = editorActor, $[128] = editorEngine, $[129] = onDrag, $[130] = t30) : t30 = $[130];
|
|
6417
|
+
const handleDrag = t30;
|
|
6418
|
+
let t31;
|
|
6419
|
+
$[131] !== editorActor || $[132] !== editorEngine || $[133] !== onDragEnd ? (t31 = (event_10) => {
|
|
6458
6420
|
if (onDragEnd?.(event_10), !(event_10.isDefaultPrevented() || event_10.isPropagationStopped()))
|
|
6459
6421
|
return editorActor.send({
|
|
6460
6422
|
type: "behavior event",
|
|
@@ -6466,10 +6428,10 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6466
6428
|
},
|
|
6467
6429
|
editor: editorEngine
|
|
6468
6430
|
}), !0;
|
|
6469
|
-
}, $[
|
|
6470
|
-
const handleDragEnd =
|
|
6471
|
-
let
|
|
6472
|
-
$[
|
|
6431
|
+
}, $[131] = editorActor, $[132] = editorEngine, $[133] = onDragEnd, $[134] = t31) : t31 = $[134];
|
|
6432
|
+
const handleDragEnd = t31;
|
|
6433
|
+
let t32;
|
|
6434
|
+
$[135] !== editorActor || $[136] !== editorEngine || $[137] !== onDragEnter ? (t32 = (event_11) => {
|
|
6473
6435
|
if (onDragEnter?.(event_11), event_11.isDefaultPrevented() || event_11.isPropagationStopped())
|
|
6474
6436
|
return;
|
|
6475
6437
|
const position_6 = getEventPosition({
|
|
@@ -6489,10 +6451,10 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6489
6451
|
},
|
|
6490
6452
|
editor: editorEngine
|
|
6491
6453
|
}), !0;
|
|
6492
|
-
}, $[
|
|
6493
|
-
const handleDragEnter =
|
|
6494
|
-
let
|
|
6495
|
-
$[
|
|
6454
|
+
}, $[135] = editorActor, $[136] = editorEngine, $[137] = onDragEnter, $[138] = t32) : t32 = $[138];
|
|
6455
|
+
const handleDragEnter = t32;
|
|
6456
|
+
let t33;
|
|
6457
|
+
$[139] !== editorActor || $[140] !== editorEngine || $[141] !== onDragOver ? (t33 = (event_12) => {
|
|
6496
6458
|
if (onDragOver?.(event_12), event_12.isDefaultPrevented() || event_12.isPropagationStopped())
|
|
6497
6459
|
return;
|
|
6498
6460
|
const position_7 = getEventPosition({
|
|
@@ -6514,10 +6476,10 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6514
6476
|
editor: editorEngine,
|
|
6515
6477
|
nativeEvent: event_12
|
|
6516
6478
|
}), !0;
|
|
6517
|
-
}, $[
|
|
6518
|
-
const handleDragOver =
|
|
6519
|
-
let
|
|
6520
|
-
$[
|
|
6479
|
+
}, $[139] = editorActor, $[140] = editorEngine, $[141] = onDragOver, $[142] = t33) : t33 = $[142];
|
|
6480
|
+
const handleDragOver = t33;
|
|
6481
|
+
let t34;
|
|
6482
|
+
$[143] !== editorActor || $[144] !== editorEngine || $[145] !== onDrop ? (t34 = (event_13) => {
|
|
6521
6483
|
if (onDrop?.(event_13), event_13.isDefaultPrevented() || event_13.isPropagationStopped())
|
|
6522
6484
|
return;
|
|
6523
6485
|
const position_8 = getEventPosition({
|
|
@@ -6542,10 +6504,10 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6542
6504
|
editor: editorEngine,
|
|
6543
6505
|
nativeEvent: event_13
|
|
6544
6506
|
}), !0;
|
|
6545
|
-
}, $[
|
|
6546
|
-
const handleDrop =
|
|
6547
|
-
let
|
|
6548
|
-
$[
|
|
6507
|
+
}, $[143] = editorActor, $[144] = editorEngine, $[145] = onDrop, $[146] = t34) : t34 = $[146];
|
|
6508
|
+
const handleDrop = t34;
|
|
6509
|
+
let t35;
|
|
6510
|
+
$[147] !== editorActor || $[148] !== editorEngine || $[149] !== onDragLeave ? (t35 = (event_14) => {
|
|
6549
6511
|
if (onDragLeave?.(event_14), !(event_14.isDefaultPrevented() || event_14.isPropagationStopped() || !getEventPosition({
|
|
6550
6512
|
editorActor,
|
|
6551
6513
|
editorEngine,
|
|
@@ -6561,10 +6523,10 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6561
6523
|
},
|
|
6562
6524
|
editor: editorEngine
|
|
6563
6525
|
}), !0;
|
|
6564
|
-
}, $[
|
|
6565
|
-
const handleDragLeave =
|
|
6566
|
-
let
|
|
6567
|
-
$[
|
|
6526
|
+
}, $[147] = editorActor, $[148] = editorEngine, $[149] = onDragLeave, $[150] = t35) : t35 = $[150];
|
|
6527
|
+
const handleDragLeave = t35;
|
|
6528
|
+
let t36;
|
|
6529
|
+
$[151] !== forwardedRef || $[152] !== validateSelectionActor ? (t36 = (editorElement) => {
|
|
6568
6530
|
if (typeof forwardedRef == "function" ? forwardedRef(editorElement) : forwardedRef && (forwardedRef.current = editorElement), editorElement) {
|
|
6569
6531
|
const mutationObserver = new MutationObserver(() => {
|
|
6570
6532
|
validateSelectionActor.send({
|
|
@@ -6582,12 +6544,12 @@ const PortableTextEditable = forwardRef(function(props, forwardedRef) {
|
|
|
6582
6544
|
mutationObserver.disconnect();
|
|
6583
6545
|
};
|
|
6584
6546
|
}
|
|
6585
|
-
}, $[
|
|
6586
|
-
const callbackRef =
|
|
6547
|
+
}, $[151] = forwardedRef, $[152] = validateSelectionActor, $[153] = t36) : t36 = $[153];
|
|
6548
|
+
const callbackRef = t36;
|
|
6587
6549
|
if (!portableTextEditor)
|
|
6588
6550
|
return null;
|
|
6589
|
-
let
|
|
6590
|
-
return $[
|
|
6551
|
+
let t37;
|
|
6552
|
+
return $[154] !== callbackRef || $[155] !== decorate || $[156] !== editorActor || $[157] !== handleClick || $[158] !== handleCopy || $[159] !== handleCut || $[160] !== handleDrag || $[161] !== handleDragEnd || $[162] !== handleDragEnter || $[163] !== handleDragLeave || $[164] !== handleDragOver || $[165] !== handleDragStart || $[166] !== handleDrop || $[167] !== handleKeyDown || $[168] !== handleKeyUp || $[169] !== handleOnBeforeInput || $[170] !== handleOnBlur || $[171] !== handleOnFocus || $[172] !== handlePaste || $[173] !== hasInvalidValue || $[174] !== readOnly || $[175] !== renderElement || $[176] !== renderLeaf || $[177] !== restProps || $[178] !== scrollSelectionIntoViewToEngine ? (t37 = hasInvalidValue ? null : /* @__PURE__ */ jsx(SelectionStateProvider, { children: /* @__PURE__ */ jsx(Editable, { ...restProps, ref: callbackRef, editorActor, "data-read-only": readOnly, autoFocus: !1, className: restProps.className || "pt-editable", decorate, onBlur: handleOnBlur, onCopy: handleCopy, onCut: handleCut, onClick: handleClick, onDOMBeforeInput: handleOnBeforeInput, onDragStart: handleDragStart, onDrag: handleDrag, onDragEnd: handleDragEnd, onDragEnter: handleDragEnter, onDragOver: handleDragOver, onDrop: handleDrop, onDragLeave: handleDragLeave, onFocus: handleOnFocus, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onPaste: handlePaste, readOnly, renderElement, renderLeaf, renderText, scrollSelectionIntoView: scrollSelectionIntoViewToEngine }) }), $[154] = callbackRef, $[155] = decorate, $[156] = editorActor, $[157] = handleClick, $[158] = handleCopy, $[159] = handleCut, $[160] = handleDrag, $[161] = handleDragEnd, $[162] = handleDragEnter, $[163] = handleDragLeave, $[164] = handleDragOver, $[165] = handleDragStart, $[166] = handleDrop, $[167] = handleKeyDown, $[168] = handleKeyUp, $[169] = handleOnBeforeInput, $[170] = handleOnBlur, $[171] = handleOnFocus, $[172] = handlePaste, $[173] = hasInvalidValue, $[174] = readOnly, $[175] = renderElement, $[176] = renderLeaf, $[177] = restProps, $[178] = scrollSelectionIntoViewToEngine, $[179] = t37) : t37 = $[179], t37;
|
|
6591
6553
|
});
|
|
6592
6554
|
PortableTextEditable.displayName = "ForwardRef(PortableTextEditable)";
|
|
6593
6555
|
function noop() {
|
|
@@ -6993,17 +6955,11 @@ function createEditableAPI(editor, editorActor) {
|
|
|
6993
6955
|
});
|
|
6994
6956
|
},
|
|
6995
6957
|
isMarkActive: (mark) => {
|
|
6996
|
-
const snapshot =
|
|
6997
|
-
editorActorSnapshot: editorActor.getSnapshot(),
|
|
6998
|
-
editorEngineInstance: editor
|
|
6999
|
-
});
|
|
6958
|
+
const snapshot = editor.snapshot;
|
|
7000
6959
|
return getActiveDecorators(snapshot).includes(mark);
|
|
7001
6960
|
},
|
|
7002
6961
|
marks: () => {
|
|
7003
|
-
const snapshot =
|
|
7004
|
-
editorActorSnapshot: editorActor.getSnapshot(),
|
|
7005
|
-
editorEngineInstance: editor
|
|
7006
|
-
}), activeAnnotations = getActiveAnnotationsMarks(snapshot), activeDecorators = getActiveDecorators(snapshot);
|
|
6962
|
+
const snapshot = editor.snapshot, activeAnnotations = getActiveAnnotationsMarks(snapshot), activeDecorators = getActiveDecorators(snapshot);
|
|
7007
6963
|
return [...activeAnnotations, ...activeDecorators];
|
|
7008
6964
|
},
|
|
7009
6965
|
undo: () => {
|
|
@@ -7093,7 +7049,7 @@ function createEditableAPI(editor, editorActor) {
|
|
|
7093
7049
|
}
|
|
7094
7050
|
},
|
|
7095
7051
|
isVoid: (element) => {
|
|
7096
|
-
const schema =
|
|
7052
|
+
const schema = editor.schema;
|
|
7097
7053
|
return ![schema.block.name, schema.span.name].includes(element._type);
|
|
7098
7054
|
},
|
|
7099
7055
|
findByPath: (path2) => {
|
|
@@ -7129,7 +7085,7 @@ function createEditableAPI(editor, editorActor) {
|
|
|
7129
7085
|
node: span,
|
|
7130
7086
|
path: spanPath
|
|
7131
7087
|
} of spans) {
|
|
7132
|
-
const blockEntry =
|
|
7088
|
+
const blockEntry = getTextBlock(editor, parentPath(spanPath));
|
|
7133
7089
|
blockEntry && blockEntry.node.markDefs?.forEach((def) => {
|
|
7134
7090
|
isSpan({
|
|
7135
7091
|
schema: editor.schema
|
|
@@ -7142,17 +7098,11 @@ function createEditableAPI(editor, editorActor) {
|
|
|
7142
7098
|
}
|
|
7143
7099
|
},
|
|
7144
7100
|
isAnnotationActive: (annotationType) => {
|
|
7145
|
-
const snapshot =
|
|
7146
|
-
editorActorSnapshot: editorActor.getSnapshot(),
|
|
7147
|
-
editorEngineInstance: editor
|
|
7148
|
-
});
|
|
7101
|
+
const snapshot = editor.snapshot;
|
|
7149
7102
|
return isActiveAnnotation(annotationType)(snapshot);
|
|
7150
7103
|
},
|
|
7151
7104
|
addAnnotation: (type, value) => {
|
|
7152
|
-
const snapshotBefore =
|
|
7153
|
-
editorActorSnapshot: editorActor.getSnapshot(),
|
|
7154
|
-
editorEngineInstance: editor
|
|
7155
|
-
}), selectedValueBefore = getSelectedValue(snapshotBefore), focusSpanBefore = getFocusSpan(snapshotBefore), markDefsBefore = selectedValueBefore.flatMap((block) => isTextBlock(snapshotBefore.context, block) ? block.markDefs ?? [] : []);
|
|
7105
|
+
const snapshotBefore = editor.snapshot, selectedValueBefore = getSelectedValue(snapshotBefore), focusSpanBefore = getFocusSpan(snapshotBefore), markDefsBefore = selectedValueBefore.flatMap((block) => isTextBlock(snapshotBefore.context, block) ? block.markDefs ?? [] : []);
|
|
7156
7106
|
editorActor.send({
|
|
7157
7107
|
type: "behavior event",
|
|
7158
7108
|
behaviorEvent: {
|
|
@@ -7164,10 +7114,7 @@ function createEditableAPI(editor, editorActor) {
|
|
|
7164
7114
|
},
|
|
7165
7115
|
editor
|
|
7166
7116
|
});
|
|
7167
|
-
const snapshotAfter =
|
|
7168
|
-
editorActorSnapshot: editorActor.getSnapshot(),
|
|
7169
|
-
editorEngineInstance: editor
|
|
7170
|
-
}), selectedValueAfter = getSelectedValue(snapshotAfter), focusBlockAfter = getFocusBlock(snapshotAfter), focusSpanAfter = getFocusSpan(snapshotAfter), focusSpanDecorators = focusSpanAfter ? getPathSubSchema(snapshotAfter, focusSpanAfter.path).decorators.map((decorator) => decorator.name) : snapshotAfter.context.schema.decorators.map((decorator) => decorator.name), newMarkDefKeysOnFocusSpan = focusSpanAfter?.node.marks?.filter((mark) => !focusSpanBefore?.node.marks?.includes(mark) && !focusSpanDecorators.includes(mark)), markDefs = selectedValueAfter.flatMap((block) => isTextBlock(snapshotAfter.context, block) ? block.markDefs?.map((markDef2) => ({
|
|
7117
|
+
const snapshotAfter = editor.snapshot, selectedValueAfter = getSelectedValue(snapshotAfter), focusBlockAfter = getFocusBlock(snapshotAfter), focusSpanAfter = getFocusSpan(snapshotAfter), focusSpanDecorators = focusSpanAfter ? getPathSubSchema(snapshotAfter, focusSpanAfter.path).decorators.map((decorator) => decorator.name) : snapshotAfter.context.schema.decorators.map((decorator) => decorator.name), newMarkDefKeysOnFocusSpan = focusSpanAfter?.node.marks?.filter((mark) => !focusSpanBefore?.node.marks?.includes(mark) && !focusSpanDecorators.includes(mark)), markDefs = selectedValueAfter.flatMap((block) => isTextBlock(snapshotAfter.context, block) ? block.markDefs?.map((markDef2) => ({
|
|
7171
7118
|
markDef: markDef2,
|
|
7172
7119
|
path: [{
|
|
7173
7120
|
_key: block._key
|
|
@@ -7219,10 +7166,7 @@ function createEditableAPI(editor, editorActor) {
|
|
|
7219
7166
|
});
|
|
7220
7167
|
},
|
|
7221
7168
|
getFragment: () => {
|
|
7222
|
-
const snapshot =
|
|
7223
|
-
editorActorSnapshot: editorActor.getSnapshot(),
|
|
7224
|
-
editorEngineInstance: editor
|
|
7225
|
-
});
|
|
7169
|
+
const snapshot = editor.snapshot;
|
|
7226
7170
|
return getFragment(snapshot).map((entry) => entry.node);
|
|
7227
7171
|
},
|
|
7228
7172
|
isSelectionsOverlapping: (selectionA, selectionB) => !selectionA || !selectionB ? !1 : rangeIncludes(selectionA, selectionB, editor)
|
|
@@ -8309,7 +8253,7 @@ function unsetPatch(editor, patch) {
|
|
|
8309
8253
|
}), !0;
|
|
8310
8254
|
}
|
|
8311
8255
|
function textPatch(snapshot, operation, beforeValue) {
|
|
8312
|
-
const span =
|
|
8256
|
+
const span = getSpan(snapshot, operation.path);
|
|
8313
8257
|
if (!span)
|
|
8314
8258
|
return [];
|
|
8315
8259
|
const beforeSnapshot = {
|
|
@@ -8319,7 +8263,7 @@ function textPatch(snapshot, operation, beforeValue) {
|
|
|
8319
8263
|
value: beforeValue
|
|
8320
8264
|
},
|
|
8321
8265
|
blockIndexMap: /* @__PURE__ */ new Map()
|
|
8322
|
-
}, prevSpan =
|
|
8266
|
+
}, prevSpan = getSpan(beforeSnapshot, operation.path), patch = diffMatchPatch$1(prevSpan?.node.text ?? "", span.node.text, [...operation.path, "text"]);
|
|
8323
8267
|
return patch.value.length ? [patch] : [];
|
|
8324
8268
|
}
|
|
8325
8269
|
function insertNodePatch(operation) {
|
|
@@ -9307,10 +9251,14 @@ const apply = (editor, op) => {
|
|
|
9307
9251
|
focus: op.newProperties.focus
|
|
9308
9252
|
});
|
|
9309
9253
|
if (previousSelectionIsCollapsed && newSelectionIsCollapsed) {
|
|
9310
|
-
const focusSpan =
|
|
9254
|
+
const focusSpan = getSpan(editor, op.properties.focus.path)?.node, newFocusSpan = getSpan(editor, op.newProperties.focus.path)?.node, sameParent = pathEquals(parentPath(op.properties.focus.path), parentPath(op.newProperties.focus.path));
|
|
9311
9255
|
let movedToNextSpan = !1, movedToPreviousSpan = !1;
|
|
9312
9256
|
if (sameParent && focusSpan && newFocusSpan) {
|
|
9313
|
-
const nextSibling = getSibling(editor, op.properties.focus.path,
|
|
9257
|
+
const nextSibling = getSibling(editor, op.properties.focus.path, {
|
|
9258
|
+
direction: "next"
|
|
9259
|
+
}), previousSibling = getSibling(editor, op.properties.focus.path, {
|
|
9260
|
+
direction: "previous"
|
|
9261
|
+
});
|
|
9314
9262
|
movedToNextSpan = nextSibling !== void 0 && pathEquals(nextSibling.path, op.newProperties.focus.path) && focusSpan.text.length === op.properties.focus.offset && op.newProperties.focus.offset === 0, movedToPreviousSpan = previousSibling !== void 0 && pathEquals(previousSibling.path, op.newProperties.focus.path) && op.properties.focus.offset === 0 && newFocusSpan.text.length === op.newProperties.focus.offset;
|
|
9315
9263
|
}
|
|
9316
9264
|
!movedToNextSpan && !movedToPreviousSpan && (editor.decoratorState = {});
|
|
@@ -9511,9 +9459,7 @@ function applyInsertNodeAtPoint(editor, node, at) {
|
|
|
9511
9459
|
schema: editor.schema
|
|
9512
9460
|
}, n) : (n) => isSpan({
|
|
9513
9461
|
schema: editor.schema
|
|
9514
|
-
}, n) ||
|
|
9515
|
-
schema: editor.schema
|
|
9516
|
-
}, n), nodeEntry = getNode(editor, at.path), entry = nodeEntry && match2(nodeEntry.node) ? nodeEntry : void 0;
|
|
9462
|
+
}, n) || isObject$1(editor, n), nodeEntry = getNode(editor, at.path), entry = nodeEntry && match2(nodeEntry.node) ? nodeEntry : void 0;
|
|
9517
9463
|
if (!entry)
|
|
9518
9464
|
return;
|
|
9519
9465
|
const matchPath = entry.path, ref = pathRef(editor, matchPath), isAtEnd = isEnd(editor, at, matchPath);
|
|
@@ -9535,7 +9481,9 @@ function applyMergeNode(editor, path2, position) {
|
|
|
9535
9481
|
const nodeEntry = getNode(editor, path2);
|
|
9536
9482
|
if (!nodeEntry)
|
|
9537
9483
|
return;
|
|
9538
|
-
const node = nodeEntry.node, prevSibling = getSibling(editor, path2,
|
|
9484
|
+
const node = nodeEntry.node, prevSibling = getSibling(editor, path2, {
|
|
9485
|
+
direction: "previous"
|
|
9486
|
+
});
|
|
9539
9487
|
if (!prevSibling)
|
|
9540
9488
|
return;
|
|
9541
9489
|
const prevPath = prevSibling.path, prevKey = prevSibling.node._key ?? "";
|
|
@@ -10020,7 +9968,7 @@ const normalizeNode = (editor, entry) => {
|
|
|
10020
9968
|
schema: editor.schema
|
|
10021
9969
|
}, node)) {
|
|
10022
9970
|
const blockPath = parentPath(path2);
|
|
10023
|
-
if (!
|
|
9971
|
+
if (!getTextBlock(editor, blockPath))
|
|
10024
9972
|
return;
|
|
10025
9973
|
const decorators = getPathSubSchema(editor, path2).decorators.map((decorator) => decorator.name), annotations = node.marks?.filter((mark) => !decorators.includes(mark));
|
|
10026
9974
|
if (node.text === "" && annotations && annotations.length > 0) {
|
|
@@ -10053,7 +10001,7 @@ const normalizeNode = (editor, entry) => {
|
|
|
10053
10001
|
if (isSpan({
|
|
10054
10002
|
schema: editor.schema
|
|
10055
10003
|
}, node)) {
|
|
10056
|
-
const blockPath = parentPath(path2), blockEntry2 =
|
|
10004
|
+
const blockPath = parentPath(path2), blockEntry2 = getTextBlock(editor, blockPath);
|
|
10057
10005
|
if (blockEntry2) {
|
|
10058
10006
|
const block = blockEntry2.node, decorators = getPathSubSchema(editor, path2).decorators.map((decorator) => decorator.name), marks = node.marks ?? [], orphanedAnnotations = marks.filter((mark) => !decorators.includes(mark) && !block.markDefs?.find((def) => def._key === mark));
|
|
10059
10007
|
if (orphanedAnnotations.length > 0) {
|
|
@@ -10107,9 +10055,7 @@ const normalizeNode = (editor, entry) => {
|
|
|
10107
10055
|
}
|
|
10108
10056
|
return;
|
|
10109
10057
|
}
|
|
10110
|
-
if (
|
|
10111
|
-
schema: editor.schema
|
|
10112
|
-
}, node)) {
|
|
10058
|
+
if (isObject$1(editor, node)) {
|
|
10113
10059
|
const resolved = resolveContainerByPath(editor, path2, node), arrayField = resolved && "container" in resolved ? resolved.field : void 0;
|
|
10114
10060
|
if (arrayField) {
|
|
10115
10061
|
const fieldValue = node[arrayField.name], needsField = !Array.isArray(fieldValue);
|
|
@@ -10143,9 +10089,7 @@ const normalizeNode = (editor, entry) => {
|
|
|
10143
10089
|
}
|
|
10144
10090
|
}
|
|
10145
10091
|
}
|
|
10146
|
-
if (
|
|
10147
|
-
schema: editor.schema
|
|
10148
|
-
}, node)) {
|
|
10092
|
+
if (isObject$1(editor, node)) {
|
|
10149
10093
|
const children = [...getChildren(editor, path2)];
|
|
10150
10094
|
if (children.length > 1) {
|
|
10151
10095
|
const seen = /* @__PURE__ */ new Map();
|
|
@@ -10198,7 +10142,7 @@ const normalizeNode = (editor, entry) => {
|
|
|
10198
10142
|
node: child,
|
|
10199
10143
|
position: "before"
|
|
10200
10144
|
});
|
|
10201
|
-
const refetched =
|
|
10145
|
+
const refetched = getTextBlock(editor, path2)?.node;
|
|
10202
10146
|
if (!refetched)
|
|
10203
10147
|
return;
|
|
10204
10148
|
element = refetched;
|
|
@@ -10218,7 +10162,7 @@ const normalizeNode = (editor, entry) => {
|
|
|
10218
10162
|
type: "unset",
|
|
10219
10163
|
path: childPath
|
|
10220
10164
|
});
|
|
10221
|
-
const refetched =
|
|
10165
|
+
const refetched = getTextBlock(editor, path2)?.node;
|
|
10222
10166
|
if (!refetched)
|
|
10223
10167
|
return;
|
|
10224
10168
|
element = refetched, n--;
|
|
@@ -10230,7 +10174,7 @@ const normalizeNode = (editor, entry) => {
|
|
|
10230
10174
|
type: "unset",
|
|
10231
10175
|
path: prevPath
|
|
10232
10176
|
});
|
|
10233
|
-
const refetched =
|
|
10177
|
+
const refetched = getTextBlock(editor, path2)?.node;
|
|
10234
10178
|
if (!refetched)
|
|
10235
10179
|
return;
|
|
10236
10180
|
element = refetched, n--;
|
|
@@ -10238,15 +10182,13 @@ const normalizeNode = (editor, entry) => {
|
|
|
10238
10182
|
loose: !0
|
|
10239
10183
|
})) {
|
|
10240
10184
|
applyMergeNode(editor, childPath, prev.text.length);
|
|
10241
|
-
const refetched =
|
|
10185
|
+
const refetched = getTextBlock(editor, path2)?.node;
|
|
10242
10186
|
if (!refetched)
|
|
10243
10187
|
return;
|
|
10244
10188
|
element = refetched, n--;
|
|
10245
10189
|
}
|
|
10246
10190
|
}
|
|
10247
|
-
} else if (
|
|
10248
|
-
schema: editor.schema
|
|
10249
|
-
}, child)) {
|
|
10191
|
+
} else if (isObject$1(editor, child)) {
|
|
10250
10192
|
if (prev == null || !isSpan({
|
|
10251
10193
|
schema: editor.schema
|
|
10252
10194
|
}, prev)) {
|
|
@@ -10257,7 +10199,7 @@ const normalizeNode = (editor, entry) => {
|
|
|
10257
10199
|
node: newChild,
|
|
10258
10200
|
position: "before"
|
|
10259
10201
|
});
|
|
10260
|
-
const refetched =
|
|
10202
|
+
const refetched = getTextBlock(editor, path2)?.node;
|
|
10261
10203
|
if (!refetched)
|
|
10262
10204
|
return;
|
|
10263
10205
|
element = refetched, n++;
|
|
@@ -10272,7 +10214,7 @@ const normalizeNode = (editor, entry) => {
|
|
|
10272
10214
|
node: newChild,
|
|
10273
10215
|
position: "after"
|
|
10274
10216
|
});
|
|
10275
|
-
const refetched =
|
|
10217
|
+
const refetched = getTextBlock(editor, path2)?.node;
|
|
10276
10218
|
if (!refetched)
|
|
10277
10219
|
return;
|
|
10278
10220
|
element = refetched, n++;
|
|
@@ -10391,56 +10333,43 @@ const shouldNormalize = (_editor, {
|
|
|
10391
10333
|
onContextChange && onContextChange(options), onChange(options);
|
|
10392
10334
|
}, e;
|
|
10393
10335
|
};
|
|
10394
|
-
function
|
|
10395
|
-
|
|
10396
|
-
for (const [type, config] of resolved)
|
|
10397
|
-
projected.set(type, toRegisteredContainer(config));
|
|
10398
|
-
return projected;
|
|
10336
|
+
function defaultCompare(a, b) {
|
|
10337
|
+
return a === b;
|
|
10399
10338
|
}
|
|
10400
|
-
function
|
|
10339
|
+
function useEditorSelector(editor, selector, t0) {
|
|
10340
|
+
return useSelector(editor, selector, t0 === void 0 ? defaultCompare : t0);
|
|
10341
|
+
}
|
|
10342
|
+
function getEditorSnapshot({
|
|
10343
|
+
editorEngineInstance
|
|
10344
|
+
}) {
|
|
10401
10345
|
return {
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10346
|
+
blockIndexMap: editorEngineInstance.blockIndexMap,
|
|
10347
|
+
context: {
|
|
10348
|
+
containers: editorEngineInstance.publicContainers,
|
|
10349
|
+
converters: editorEngineInstance.converters,
|
|
10350
|
+
keyGenerator: editorEngineInstance.keyGenerator,
|
|
10351
|
+
readOnly: editorEngineInstance.readOnly,
|
|
10352
|
+
schema: editorEngineInstance.schema,
|
|
10353
|
+
selection: editorEngineInstance.selection,
|
|
10354
|
+
value: editorEngineInstance.children
|
|
10355
|
+
},
|
|
10356
|
+
decoratorState: editorEngineInstance.decoratorState
|
|
10408
10357
|
};
|
|
10409
10358
|
}
|
|
10410
|
-
function toRegisteredOfEntry(entry) {
|
|
10411
|
-
if ("container" in entry)
|
|
10412
|
-
return toRegisteredContainer(entry);
|
|
10413
|
-
if ("span" in entry)
|
|
10414
|
-
return {
|
|
10415
|
-
kind: "span",
|
|
10416
|
-
type: entry.span.type
|
|
10417
|
-
};
|
|
10418
|
-
if ("blockObject" in entry)
|
|
10419
|
-
return {
|
|
10420
|
-
kind: "blockObject",
|
|
10421
|
-
type: entry.blockObject.type
|
|
10422
|
-
};
|
|
10423
|
-
if ("inlineObject" in entry)
|
|
10424
|
-
return {
|
|
10425
|
-
kind: "inlineObject",
|
|
10426
|
-
type: entry.inlineObject.type
|
|
10427
|
-
};
|
|
10428
|
-
}
|
|
10429
|
-
function isDefined(value) {
|
|
10430
|
-
return value !== void 0;
|
|
10431
|
-
}
|
|
10432
10359
|
function createEditorEngine(config) {
|
|
10433
10360
|
debug.setup("creating new editor engine instance");
|
|
10434
10361
|
const context = config.editorActor.getSnapshot().context, placeholderBlock = createPlaceholderBlock({
|
|
10435
10362
|
context: {
|
|
10436
10363
|
schema: context.schema,
|
|
10437
|
-
containers
|
|
10364
|
+
// No containers registered at engine-init time. NodePlugin
|
|
10365
|
+
// registrations run later, after the engine is attached.
|
|
10366
|
+
containers: /* @__PURE__ */ new Map(),
|
|
10438
10367
|
value: [],
|
|
10439
10368
|
keyGenerator: context.keyGenerator
|
|
10440
10369
|
},
|
|
10441
10370
|
blockIndexMap: /* @__PURE__ */ new Map()
|
|
10442
10371
|
}), editor = createEditor();
|
|
10443
|
-
editor.schema = context.schema, editor.keyGenerator = context.keyGenerator, editor.containers = /* @__PURE__ */ new Map(), editor.publicContainers = /* @__PURE__ */ new Map(), editor.blockObjects = /* @__PURE__ */ new Map(), editor.inlineObjects = /* @__PURE__ */ new Map(), editor.spans = /* @__PURE__ */ new Map(), editor.textBlocks = /* @__PURE__ */ new Map(), editor.decoratedRanges = [], editor.decoratorState = {}, editor.blockIndexMap = /* @__PURE__ */ new Map(), editor.history = {
|
|
10372
|
+
editor.schema = context.schema, editor.keyGenerator = context.keyGenerator, editor.converters = context.initialConverters, editor.readOnly = context.initialReadOnly, editor.containers = /* @__PURE__ */ new Map(), editor.publicContainers = /* @__PURE__ */ new Map(), editor.blockObjects = /* @__PURE__ */ new Map(), editor.inlineObjects = /* @__PURE__ */ new Map(), editor.spans = /* @__PURE__ */ new Map(), editor.textBlocks = /* @__PURE__ */ new Map(), editor.decoratedRanges = [], editor.decoratorState = {}, editor.blockIndexMap = /* @__PURE__ */ new Map(), editor.history = {
|
|
10444
10373
|
undos: [],
|
|
10445
10374
|
redos: []
|
|
10446
10375
|
}, editor.listIndexMap = /* @__PURE__ */ new Map(), editor.remotePatches = [], editor.undoStepId = void 0, editor.children = [placeholderBlock], editor.isDeferringMutations = !1, editor.isNormalizingNode = !1, editor.isPatching = !0, editor.isPerformingBehaviorOperation = !1, editor.isProcessingRemoteChanges = !1, editor.isRedoing = !1, editor.isUndoing = !1, editor.withHistory = !0;
|
|
@@ -10455,6 +10384,17 @@ function createEditorEngine(config) {
|
|
|
10455
10384
|
}, {
|
|
10456
10385
|
blockIndexMap: editorEngine.blockIndexMap,
|
|
10457
10386
|
listIndexMap: editorEngine.listIndexMap
|
|
10387
|
+
}), editorEngine.snapshot = getEditorSnapshot({
|
|
10388
|
+
editorEngineInstance: editorEngine
|
|
10389
|
+
}), config.subscriptions.push(() => {
|
|
10390
|
+
const subscription = config.editorActor.subscribe(() => {
|
|
10391
|
+
editorEngine.snapshot = getEditorSnapshot({
|
|
10392
|
+
editorEngineInstance: editorEngine
|
|
10393
|
+
});
|
|
10394
|
+
});
|
|
10395
|
+
return () => {
|
|
10396
|
+
subscription.unsubscribe();
|
|
10397
|
+
};
|
|
10458
10398
|
}), editorEngine;
|
|
10459
10399
|
}
|
|
10460
10400
|
function createEditorDom(sendBack, editorEngine) {
|
|
@@ -10783,7 +10723,9 @@ const addAnnotationOnCollapsedSelection = defineBehavior({
|
|
|
10783
10723
|
if (!defaultKeyboardShortcuts.arrowDown.guard(event.originEvent) || !isSelectionCollapsed$1(snapshot))
|
|
10784
10724
|
return !1;
|
|
10785
10725
|
const focusedBlockObject = getFocusBlockObject(snapshot);
|
|
10786
|
-
return focusedBlockObject ? !getSibling(snapshot, focusedBlockObject.path,
|
|
10726
|
+
return focusedBlockObject ? !getSibling(snapshot, focusedBlockObject.path, {
|
|
10727
|
+
direction: "next"
|
|
10728
|
+
}) : !1;
|
|
10787
10729
|
},
|
|
10788
10730
|
actions: [({
|
|
10789
10731
|
snapshot
|
|
@@ -10803,7 +10745,9 @@ const addAnnotationOnCollapsedSelection = defineBehavior({
|
|
|
10803
10745
|
if (!defaultKeyboardShortcuts.arrowUp.guard(event.originEvent) || !isSelectionCollapsed$1(snapshot))
|
|
10804
10746
|
return !1;
|
|
10805
10747
|
const focusedBlockObject = getFocusBlockObject(snapshot);
|
|
10806
|
-
return focusedBlockObject ? !getSibling(snapshot, focusedBlockObject.path,
|
|
10748
|
+
return focusedBlockObject ? !getSibling(snapshot, focusedBlockObject.path, {
|
|
10749
|
+
direction: "previous"
|
|
10750
|
+
}) : !1;
|
|
10807
10751
|
},
|
|
10808
10752
|
actions: [({
|
|
10809
10753
|
snapshot
|
|
@@ -10848,7 +10792,9 @@ const addAnnotationOnCollapsedSelection = defineBehavior({
|
|
|
10848
10792
|
}, focusedBlockObject = getFocusBlockObject(positionSnapshot);
|
|
10849
10793
|
if (!focusedBlockObject)
|
|
10850
10794
|
return !1;
|
|
10851
|
-
const previousSibling = getSibling(snapshot, focusedBlockObject.path,
|
|
10795
|
+
const previousSibling = getSibling(snapshot, focusedBlockObject.path, {
|
|
10796
|
+
direction: "previous"
|
|
10797
|
+
});
|
|
10852
10798
|
return (event.position.isEditor || event.position.isContainer) && event.position.block === "start" && !previousSibling;
|
|
10853
10799
|
},
|
|
10854
10800
|
actions: [({
|
|
@@ -10882,7 +10828,9 @@ const addAnnotationOnCollapsedSelection = defineBehavior({
|
|
|
10882
10828
|
}, focusedBlockObject = getFocusBlockObject(positionSnapshot);
|
|
10883
10829
|
if (!focusedBlockObject)
|
|
10884
10830
|
return !1;
|
|
10885
|
-
const nextSibling = getSibling(snapshot, focusedBlockObject.path,
|
|
10831
|
+
const nextSibling = getSibling(snapshot, focusedBlockObject.path, {
|
|
10832
|
+
direction: "next"
|
|
10833
|
+
});
|
|
10886
10834
|
return (event.position.isEditor || event.position.isContainer) && event.position.block === "end" && !nextSibling;
|
|
10887
10835
|
},
|
|
10888
10836
|
actions: [({
|
|
@@ -10907,7 +10855,9 @@ const addAnnotationOnCollapsedSelection = defineBehavior({
|
|
|
10907
10855
|
const focusedTextBlock = getFocusTextBlock(snapshot), selectionCollapsed = isSelectionCollapsed$1(snapshot);
|
|
10908
10856
|
if (!focusedTextBlock || !selectionCollapsed)
|
|
10909
10857
|
return !1;
|
|
10910
|
-
const previousSibling = getSibling(snapshot, focusedTextBlock.path,
|
|
10858
|
+
const previousSibling = getSibling(snapshot, focusedTextBlock.path, {
|
|
10859
|
+
direction: "previous"
|
|
10860
|
+
});
|
|
10911
10861
|
if (!previousSibling || isListBlock(snapshot.context, focusedTextBlock.node))
|
|
10912
10862
|
return !1;
|
|
10913
10863
|
if (isEmptyTextBlock(snapshot.context, focusedTextBlock.node) && !isTextBlockNode(snapshot.context, previousSibling.node)) {
|
|
@@ -10948,7 +10898,9 @@ const addAnnotationOnCollapsedSelection = defineBehavior({
|
|
|
10948
10898
|
const focusedTextBlock = getFocusTextBlock(snapshot), selectionCollapsed = isSelectionCollapsed$1(snapshot);
|
|
10949
10899
|
if (!focusedTextBlock || !selectionCollapsed)
|
|
10950
10900
|
return !1;
|
|
10951
|
-
const nextSibling = getSibling(snapshot, focusedTextBlock.path,
|
|
10901
|
+
const nextSibling = getSibling(snapshot, focusedTextBlock.path, {
|
|
10902
|
+
direction: "next"
|
|
10903
|
+
});
|
|
10952
10904
|
return nextSibling && isEmptyTextBlock(snapshot.context, focusedTextBlock.node) && !isTextBlockNode(snapshot.context, nextSibling.node) ? {
|
|
10953
10905
|
focusedTextBlock,
|
|
10954
10906
|
nextSibling
|
|
@@ -11002,11 +10954,15 @@ function isAtContainerDeadEnd(snapshot, edge) {
|
|
|
11002
10954
|
const focusTextBlock = getFocusTextBlock(snapshot);
|
|
11003
10955
|
if (!focusTextBlock)
|
|
11004
10956
|
return !1;
|
|
11005
|
-
const container = getAncestor(snapshot, focusTextBlock.path,
|
|
10957
|
+
const container = getAncestor(snapshot, focusTextBlock.path, {
|
|
10958
|
+
match: (node, path2) => isEditableContainer(snapshot, node, path2)
|
|
10959
|
+
});
|
|
11006
10960
|
if (!container)
|
|
11007
10961
|
return !1;
|
|
11008
10962
|
const edgeBlock = edge === "end" ? getLastBlock(snapshot) : getFirstBlock(snapshot);
|
|
11009
|
-
return !edgeBlock || !pathEquals(edgeBlock.path, focusTextBlock.path) || !(edge === "end" ? isAtTheEndOfBlock(focusTextBlock)(snapshot) : isAtTheStartOfBlock(focusTextBlock)(snapshot)) ? !1 : getSibling(snapshot, container.path,
|
|
10963
|
+
return !edgeBlock || !pathEquals(edgeBlock.path, focusTextBlock.path) || !(edge === "end" ? isAtTheEndOfBlock(focusTextBlock)(snapshot) : isAtTheStartOfBlock(focusTextBlock)(snapshot)) ? !1 : getSibling(snapshot, container.path, {
|
|
10964
|
+
direction: edge === "end" ? "next" : "previous"
|
|
10965
|
+
}) === void 0;
|
|
11010
10966
|
}
|
|
11011
10967
|
const breakingOutOfContainer = defineBehavior({
|
|
11012
10968
|
on: "insert.break",
|
|
@@ -11021,7 +10977,9 @@ const breakingOutOfContainer = defineBehavior({
|
|
|
11021
10977
|
const lastBlock = getLastBlock(snapshot);
|
|
11022
10978
|
if (!lastBlock || !pathEquals(lastBlock.path, focusTextBlock.path) || !isEmptyTextBlock(snapshot.context, focusTextBlock.node))
|
|
11023
10979
|
return !1;
|
|
11024
|
-
const previousBlock = getSibling(snapshot, focusTextBlock.path,
|
|
10980
|
+
const previousBlock = getSibling(snapshot, focusTextBlock.path, {
|
|
10981
|
+
direction: "previous"
|
|
10982
|
+
});
|
|
11025
10983
|
if (!previousBlock || !isEmptyTextBlock(snapshot.context, previousBlock.node))
|
|
11026
10984
|
return !1;
|
|
11027
10985
|
const escapeAfter = getEscapeTarget(snapshot, focusTextBlock.path);
|
|
@@ -11061,11 +11019,13 @@ const breakingOutOfContainer = defineBehavior({
|
|
|
11061
11019
|
})]]
|
|
11062
11020
|
});
|
|
11063
11021
|
function getEscapeTarget(snapshot, path2) {
|
|
11064
|
-
return getAncestor(snapshot, path2,
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11022
|
+
return getAncestor(snapshot, path2, {
|
|
11023
|
+
match: (node, ancestorPath) => {
|
|
11024
|
+
if (!isEditableContainer(snapshot, node, ancestorPath))
|
|
11025
|
+
return !1;
|
|
11026
|
+
const enclosing = getEnclosingContainer(snapshot, ancestorPath);
|
|
11027
|
+
return enclosing ? enclosing.of.some((member) => member.type === snapshot.context.schema.block.name) : !0;
|
|
11028
|
+
}
|
|
11069
11029
|
})?.path;
|
|
11070
11030
|
}
|
|
11071
11031
|
const coreContainerBehaviors = {
|
|
@@ -11513,7 +11473,7 @@ const coreDndBehaviors = [
|
|
|
11513
11473
|
for (const entry of getNodes(snapshot, {
|
|
11514
11474
|
from: selectionStartBlock.path,
|
|
11515
11475
|
to: selectionEndBlock.path,
|
|
11516
|
-
match: (
|
|
11476
|
+
match: (_, path2) => isBlock(snapshot, path2)
|
|
11517
11477
|
})) {
|
|
11518
11478
|
const block = getBlock(snapshot, entry.path);
|
|
11519
11479
|
block && selectedBlocks.push(block);
|
|
@@ -11570,7 +11530,11 @@ function isAtTheBeginningOfBlock({
|
|
|
11570
11530
|
}) {
|
|
11571
11531
|
if (!isTextBlock(snapshot.context, block) || !snapshot.context.selection || !isSelectionCollapsed(snapshot.context.selection))
|
|
11572
11532
|
return !1;
|
|
11573
|
-
const focusPath = snapshot.context.selection.focus.path, ancestorTextBlock =
|
|
11533
|
+
const focusPath = snapshot.context.selection.focus.path, ancestorTextBlock = getParent(snapshot, focusPath, {
|
|
11534
|
+
match: (node) => isTextBlock({
|
|
11535
|
+
schema: snapshot.context.schema
|
|
11536
|
+
}, node)
|
|
11537
|
+
});
|
|
11574
11538
|
if (!ancestorTextBlock || ancestorTextBlock.node._key !== block._key)
|
|
11575
11539
|
return !1;
|
|
11576
11540
|
const lastSegment = focusPath.at(-1);
|
|
@@ -12121,7 +12085,7 @@ const addAnnotationOperationImplementation = ({
|
|
|
12121
12085
|
}, blockPath);
|
|
12122
12086
|
const splitRange = at ?? editor.selection;
|
|
12123
12087
|
if (splitRange && isRange(splitRange)) {
|
|
12124
|
-
const
|
|
12088
|
+
const splitLeaf = getNode(editor, splitRange.anchor.path)?.node;
|
|
12125
12089
|
if (!(splitLeaf && isCollapsedRange(splitRange) && isSpan({
|
|
12126
12090
|
schema: editor.schema
|
|
12127
12091
|
}, splitLeaf) && splitLeaf.text.length > 0)) {
|
|
@@ -12164,7 +12128,11 @@ const removeAnnotationOperationImplementation = ({
|
|
|
12164
12128
|
const editor = operation.editor, at = operation.at ? resolveSelection(operation.editor, operation.at) : null, effectiveSelection = at ?? editor.selection;
|
|
12165
12129
|
if (effectiveSelection)
|
|
12166
12130
|
if (isCollapsedRange(effectiveSelection)) {
|
|
12167
|
-
const blockEntry =
|
|
12131
|
+
const blockEntry = getParent(snapshot, effectiveSelection.focus.path, {
|
|
12132
|
+
match: (node) => isTextBlock({
|
|
12133
|
+
schema: editor.schema
|
|
12134
|
+
}, node)
|
|
12135
|
+
});
|
|
12168
12136
|
if (!blockEntry)
|
|
12169
12137
|
return;
|
|
12170
12138
|
const {
|
|
@@ -12224,7 +12192,7 @@ const removeAnnotationOperationImplementation = ({
|
|
|
12224
12192
|
withoutNormalizing(editor, () => {
|
|
12225
12193
|
const splitRange = at ?? editor.selection;
|
|
12226
12194
|
if (splitRange && isRange(splitRange)) {
|
|
12227
|
-
const
|
|
12195
|
+
const splitLeaf = getNode(editor, splitRange.anchor.path)?.node;
|
|
12228
12196
|
if (!(splitLeaf && isCollapsedRange(splitRange) && isSpan({
|
|
12229
12197
|
schema: editor.schema
|
|
12230
12198
|
}, splitLeaf) && splitLeaf.text.length > 0)) {
|
|
@@ -12413,9 +12381,7 @@ const childSetOperationImplementation = ({
|
|
|
12413
12381
|
}));
|
|
12414
12382
|
return;
|
|
12415
12383
|
}
|
|
12416
|
-
if (
|
|
12417
|
-
schema: operation.editor.schema
|
|
12418
|
-
}, child)) {
|
|
12384
|
+
if (isObject$1(operation.editor, child)) {
|
|
12419
12385
|
const blockPath = parentPath(childPath), {
|
|
12420
12386
|
inlineObjects
|
|
12421
12387
|
} = getPathSubSchema(snapshot, blockPath), definition = inlineObjects.find((definition2) => definition2.name === child._type);
|
|
@@ -12464,9 +12430,7 @@ const childSetOperationImplementation = ({
|
|
|
12464
12430
|
setNodeProperties(operation.editor, newNode, childPath);
|
|
12465
12431
|
return;
|
|
12466
12432
|
}
|
|
12467
|
-
if (
|
|
12468
|
-
schema: operation.editor.schema
|
|
12469
|
-
}, child)) {
|
|
12433
|
+
if (isObject$1(operation.editor, child)) {
|
|
12470
12434
|
const unsetProps = {};
|
|
12471
12435
|
for (const prop of operation.props)
|
|
12472
12436
|
prop !== "_type" && (prop === "_key" ? unsetProps._key = context.keyGenerator() : unsetProps[prop] = null);
|
|
@@ -12523,7 +12487,11 @@ const childSetOperationImplementation = ({
|
|
|
12523
12487
|
}, node)
|
|
12524
12488
|
}))?.at(0))
|
|
12525
12489
|
return;
|
|
12526
|
-
const blockEntry =
|
|
12490
|
+
const blockEntry = getParent(snapshot, at.focus.path, {
|
|
12491
|
+
match: (node) => isTextBlock({
|
|
12492
|
+
schema: snapshot.context.schema
|
|
12493
|
+
}, node)
|
|
12494
|
+
});
|
|
12527
12495
|
if (!blockEntry)
|
|
12528
12496
|
return;
|
|
12529
12497
|
const {
|
|
@@ -12571,7 +12539,7 @@ const childSetOperationImplementation = ({
|
|
|
12571
12539
|
affinity: "inward"
|
|
12572
12540
|
});
|
|
12573
12541
|
withoutNormalizing(editor, () => {
|
|
12574
|
-
const
|
|
12542
|
+
const decoratorLeaf = getNode(editor, at.anchor.path)?.node;
|
|
12575
12543
|
if (!(decoratorLeaf && isCollapsedRange(at) && isSpan({
|
|
12576
12544
|
schema: editor.schema
|
|
12577
12545
|
}, decoratorLeaf) && decoratorLeaf.text.length > 0)) {
|
|
@@ -12606,7 +12574,11 @@ const childSetOperationImplementation = ({
|
|
|
12606
12574
|
}
|
|
12607
12575
|
});
|
|
12608
12576
|
} else {
|
|
12609
|
-
const textBlockEntry =
|
|
12577
|
+
const textBlockEntry = getParent(snapshot, at.focus.path, {
|
|
12578
|
+
match: (node) => isTextBlock({
|
|
12579
|
+
schema: editor.schema
|
|
12580
|
+
}, node)
|
|
12581
|
+
});
|
|
12610
12582
|
if (!textBlockEntry)
|
|
12611
12583
|
return;
|
|
12612
12584
|
const {
|
|
@@ -12646,15 +12618,21 @@ function unhangRange(snapshot, range2) {
|
|
|
12646
12618
|
let [start2, end2] = rangeEdges(range2, {
|
|
12647
12619
|
children: context.value
|
|
12648
12620
|
});
|
|
12649
|
-
if (start2.offset !== 0 || end2.offset !== 0 || isCollapsedRange(range2) || getSibling(snapshot, end2.path,
|
|
12621
|
+
if (start2.offset !== 0 || end2.offset !== 0 || isCollapsedRange(range2) || getSibling(snapshot, end2.path, {
|
|
12622
|
+
direction: "previous"
|
|
12623
|
+
}) !== void 0)
|
|
12650
12624
|
return range2;
|
|
12651
|
-
const endBlock =
|
|
12625
|
+
const endBlock = getParent(snapshot, end2.path, {
|
|
12626
|
+
match: (node) => isTextBlock({
|
|
12627
|
+
schema: snapshot.context.schema
|
|
12628
|
+
}, node)
|
|
12629
|
+
}), blockPath = endBlock ? endBlock.path : [];
|
|
12652
12630
|
for (const {
|
|
12653
12631
|
path: path2
|
|
12654
12632
|
} of getNodes(snapshot, {
|
|
12655
12633
|
from: start2.path,
|
|
12656
12634
|
to: end2.path,
|
|
12657
|
-
match: (candidate, candidatePath) =>
|
|
12635
|
+
match: (candidate, candidatePath) => isLeafObject(snapshot, candidate, candidatePath) || isEditableContainer(snapshot, candidate, candidatePath)
|
|
12658
12636
|
}))
|
|
12659
12637
|
if (!isAncestorPath(path2, start2.path) && !isAncestorPath(path2, end2.path))
|
|
12660
12638
|
return range2;
|
|
@@ -12691,23 +12669,6 @@ function unhangRange(snapshot, range2) {
|
|
|
12691
12669
|
focus: end2
|
|
12692
12670
|
};
|
|
12693
12671
|
}
|
|
12694
|
-
function getHighestObjectNode(snapshot, path2) {
|
|
12695
|
-
const ancestors = getAncestors(snapshot, path2);
|
|
12696
|
-
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
12697
|
-
const ancestor = ancestors[i];
|
|
12698
|
-
if (ancestor && isVoidNode(snapshot, ancestor.node, ancestor.path))
|
|
12699
|
-
return {
|
|
12700
|
-
node: ancestor.node,
|
|
12701
|
-
path: ancestor.path
|
|
12702
|
-
};
|
|
12703
|
-
}
|
|
12704
|
-
const entry = getNode(snapshot, path2);
|
|
12705
|
-
if (entry && isVoidNode(snapshot, entry.node, entry.path))
|
|
12706
|
-
return {
|
|
12707
|
-
node: entry.node,
|
|
12708
|
-
path: entry.path
|
|
12709
|
-
};
|
|
12710
|
-
}
|
|
12711
12672
|
function pointRef(editor, point2, options = {}) {
|
|
12712
12673
|
const {
|
|
12713
12674
|
affinity = "forward"
|
|
@@ -12726,8 +12687,12 @@ function pointRef(editor, point2, options = {}) {
|
|
|
12726
12687
|
function getFullyCoveredContainers(editor, range2) {
|
|
12727
12688
|
const [start2, end2] = rangeEdges(range2, editor);
|
|
12728
12689
|
return {
|
|
12729
|
-
start: getAncestor(editor, start2.path,
|
|
12730
|
-
|
|
12690
|
+
start: getAncestor(editor, start2.path, {
|
|
12691
|
+
match: (node, path2) => isFullyCovered(editor, node, path2, start2, end2)
|
|
12692
|
+
})?.path,
|
|
12693
|
+
end: getAncestor(editor, end2.path, {
|
|
12694
|
+
match: (node, path2) => isFullyCovered(editor, node, path2, start2, end2)
|
|
12695
|
+
})?.path
|
|
12731
12696
|
};
|
|
12732
12697
|
}
|
|
12733
12698
|
function isFullyCovered(editor, node, path2, rangeStart2, rangeEnd2) {
|
|
@@ -12800,21 +12765,23 @@ function deleteSameBlockRange(editor, start2, end2, capture) {
|
|
|
12800
12765
|
if (pathEquals(start2.path, end2.path))
|
|
12801
12766
|
return removeTextRange(editor, start2.path, start2.offset, end2.offset, capture);
|
|
12802
12767
|
const startEntry = getNode(editor, start2.path);
|
|
12803
|
-
if (startEntry &&
|
|
12768
|
+
if (startEntry && isLeafObject(editor, startEntry.node, start2.path))
|
|
12804
12769
|
return editor.apply({
|
|
12805
12770
|
type: "unset",
|
|
12806
12771
|
path: start2.path
|
|
12807
12772
|
}), null;
|
|
12808
12773
|
const removed = removeTextFromOffset(editor, start2.path, start2.offset, capture);
|
|
12809
12774
|
removeChildrenBetween(editor, start2.path, end2.path);
|
|
12810
|
-
const adjustedEnd = getSibling(editor, start2.path,
|
|
12811
|
-
|
|
12775
|
+
const adjustedEnd = getSibling(editor, start2.path, {
|
|
12776
|
+
direction: "next"
|
|
12777
|
+
});
|
|
12778
|
+
return adjustedEnd ? isLeafObject(editor, adjustedEnd.node, adjustedEnd.path) ? (editor.apply({
|
|
12812
12779
|
type: "unset",
|
|
12813
12780
|
path: adjustedEnd.path
|
|
12814
12781
|
}), removed) : (removeTextUpToOffset(editor, adjustedEnd.path, end2.offset), removed) : removed;
|
|
12815
12782
|
}
|
|
12816
12783
|
function deleteSameParentCrossBlockRange(editor, startBlockPath, endBlockPath, start2, end2, removeEmptyStartBlock) {
|
|
12817
|
-
const startBlockNode = getNode(editor, startBlockPath), endBlockNode = getNode(editor, endBlockPath), startIsVoid = startBlockNode != null &&
|
|
12784
|
+
const startBlockNode = getNode(editor, startBlockPath), endBlockNode = getNode(editor, endBlockPath), startIsVoid = startBlockNode != null && isLeafObject(editor, startBlockNode.node, startBlockPath), endIsVoid = endBlockNode != null && isLeafObject(editor, endBlockNode.node, endBlockPath);
|
|
12818
12785
|
if (startIsVoid || (pathEquals(start2.path, startBlockPath) ? removeAllChildren(editor, startBlockPath) : (removeTextFromOffset(editor, start2.path, start2.offset, !1), removeTrailingChildren(editor, start2.path))), removeBlocksBetween(editor, startBlockPath, endBlockPath), startIsVoid && endIsVoid) {
|
|
12819
12786
|
removeNodeAt(editor, endBlockPath), removeNodeAt(editor, startBlockPath);
|
|
12820
12787
|
return;
|
|
@@ -12832,7 +12799,9 @@ function deleteSameParentCrossBlockRange(editor, startBlockPath, endBlockPath, s
|
|
|
12832
12799
|
removeNodeAt(editor, endBlockPath);
|
|
12833
12800
|
return;
|
|
12834
12801
|
}
|
|
12835
|
-
const adjustedEndBlockPath = getSibling(editor, startBlockPath,
|
|
12802
|
+
const adjustedEndBlockPath = getSibling(editor, startBlockPath, {
|
|
12803
|
+
direction: "next"
|
|
12804
|
+
})?.path ?? startBlockPath;
|
|
12836
12805
|
if (!pathEquals(end2.path, endBlockPath)) {
|
|
12837
12806
|
removeLeadingChildrenOf(editor, adjustedEndBlockPath, end2.path);
|
|
12838
12807
|
const firstChild = getFirstChild(editor, adjustedEndBlockPath);
|
|
@@ -12853,10 +12822,14 @@ function deleteCrossParentRange(editor, startBlockPath, endBlockPath, start2, en
|
|
|
12853
12822
|
if (!lcaContainer || lcaContainer.of.some((member) => member.type === editor.schema.block.name))
|
|
12854
12823
|
removeChildrenBetween(editor, startBranchRoot, endBranchRoot);
|
|
12855
12824
|
else {
|
|
12856
|
-
let cursor = getSibling(editor, startBranchRoot,
|
|
12825
|
+
let cursor = getSibling(editor, startBranchRoot, {
|
|
12826
|
+
direction: "next"
|
|
12827
|
+
});
|
|
12857
12828
|
for (; cursor && !pathEquals(cursor.path, endBranchRoot); ) {
|
|
12858
12829
|
const cursorPath = cursor.path;
|
|
12859
|
-
clearContainerContents(editor, cursorPath), cursor = getSibling(editor, cursorPath,
|
|
12830
|
+
clearContainerContents(editor, cursorPath), cursor = getSibling(editor, cursorPath, {
|
|
12831
|
+
direction: "next"
|
|
12832
|
+
});
|
|
12860
12833
|
}
|
|
12861
12834
|
}
|
|
12862
12835
|
let endLevel = endBlockPath;
|
|
@@ -12883,7 +12856,7 @@ function deleteCrossParentRange(editor, startBlockPath, endBlockPath, start2, en
|
|
|
12883
12856
|
});
|
|
12884
12857
|
}
|
|
12885
12858
|
function removeTextRange(editor, path2, startOffset, endOffset, capture) {
|
|
12886
|
-
const span =
|
|
12859
|
+
const span = getSpan(editor, path2);
|
|
12887
12860
|
if (!span)
|
|
12888
12861
|
return null;
|
|
12889
12862
|
const text = span.node.text.slice(startOffset, endOffset);
|
|
@@ -12895,7 +12868,7 @@ function removeTextRange(editor, path2, startOffset, endOffset, capture) {
|
|
|
12895
12868
|
}), capture ? text : null);
|
|
12896
12869
|
}
|
|
12897
12870
|
function removeTextFromOffset(editor, path2, offset, capture) {
|
|
12898
|
-
const span =
|
|
12871
|
+
const span = getSpan(editor, path2);
|
|
12899
12872
|
if (!span || offset >= span.node.text.length)
|
|
12900
12873
|
return null;
|
|
12901
12874
|
const text = span.node.text.slice(offset);
|
|
@@ -12909,7 +12882,7 @@ function removeTextFromOffset(editor, path2, offset, capture) {
|
|
|
12909
12882
|
function removeTextUpToOffset(editor, path2, offset) {
|
|
12910
12883
|
if (offset <= 0)
|
|
12911
12884
|
return;
|
|
12912
|
-
const span =
|
|
12885
|
+
const span = getSpan(editor, path2);
|
|
12913
12886
|
span && editor.apply({
|
|
12914
12887
|
type: "remove_text",
|
|
12915
12888
|
path: path2,
|
|
@@ -12918,9 +12891,13 @@ function removeTextUpToOffset(editor, path2, offset) {
|
|
|
12918
12891
|
});
|
|
12919
12892
|
}
|
|
12920
12893
|
function removeChildrenBetween(editor, startChildPath, endChildPath) {
|
|
12921
|
-
let cursor = getSibling(editor, startChildPath,
|
|
12894
|
+
let cursor = getSibling(editor, startChildPath, {
|
|
12895
|
+
direction: "next"
|
|
12896
|
+
});
|
|
12922
12897
|
for (; cursor && !pathEquals(cursor.path, endChildPath); )
|
|
12923
|
-
removeNodeAt(editor, cursor.path), cursor = getSibling(editor, startChildPath,
|
|
12898
|
+
removeNodeAt(editor, cursor.path), cursor = getSibling(editor, startChildPath, {
|
|
12899
|
+
direction: "next"
|
|
12900
|
+
});
|
|
12924
12901
|
}
|
|
12925
12902
|
function clearContainerContents(editor, containerPath) {
|
|
12926
12903
|
const node = getNode(editor, containerPath)?.node;
|
|
@@ -12947,27 +12924,43 @@ function clearContainerContents(editor, containerPath) {
|
|
|
12947
12924
|
clearContainerContents(editor, child.path);
|
|
12948
12925
|
}
|
|
12949
12926
|
function removeTrailingChildren(editor, startChildPath) {
|
|
12950
|
-
let cursor = getSibling(editor, startChildPath,
|
|
12927
|
+
let cursor = getSibling(editor, startChildPath, {
|
|
12928
|
+
direction: "next"
|
|
12929
|
+
});
|
|
12951
12930
|
for (; cursor; )
|
|
12952
|
-
removeNodeAt(editor, cursor.path), cursor = getSibling(editor, startChildPath,
|
|
12931
|
+
removeNodeAt(editor, cursor.path), cursor = getSibling(editor, startChildPath, {
|
|
12932
|
+
direction: "next"
|
|
12933
|
+
});
|
|
12953
12934
|
}
|
|
12954
12935
|
function clearTrailingSiblings(editor, startChildPath) {
|
|
12955
|
-
let cursor = getSibling(editor, startChildPath,
|
|
12936
|
+
let cursor = getSibling(editor, startChildPath, {
|
|
12937
|
+
direction: "next"
|
|
12938
|
+
});
|
|
12956
12939
|
for (; cursor; ) {
|
|
12957
12940
|
const cursorPath = cursor.path;
|
|
12958
|
-
clearContainerContents(editor, cursorPath), cursor = getSibling(editor, cursorPath,
|
|
12941
|
+
clearContainerContents(editor, cursorPath), cursor = getSibling(editor, cursorPath, {
|
|
12942
|
+
direction: "next"
|
|
12943
|
+
});
|
|
12959
12944
|
}
|
|
12960
12945
|
}
|
|
12961
12946
|
function removePrecedingSiblings(editor, startChildPath) {
|
|
12962
|
-
let cursor = getSibling(editor, startChildPath,
|
|
12947
|
+
let cursor = getSibling(editor, startChildPath, {
|
|
12948
|
+
direction: "previous"
|
|
12949
|
+
});
|
|
12963
12950
|
for (; cursor; )
|
|
12964
|
-
removeNodeAt(editor, cursor.path), cursor = getSibling(editor, startChildPath,
|
|
12951
|
+
removeNodeAt(editor, cursor.path), cursor = getSibling(editor, startChildPath, {
|
|
12952
|
+
direction: "previous"
|
|
12953
|
+
});
|
|
12965
12954
|
}
|
|
12966
12955
|
function clearPrecedingSiblings(editor, startChildPath) {
|
|
12967
|
-
let cursor = getSibling(editor, startChildPath,
|
|
12956
|
+
let cursor = getSibling(editor, startChildPath, {
|
|
12957
|
+
direction: "previous"
|
|
12958
|
+
});
|
|
12968
12959
|
for (; cursor; ) {
|
|
12969
12960
|
const cursorPath = cursor.path;
|
|
12970
|
-
clearContainerContents(editor, cursorPath), cursor = getSibling(editor, cursorPath,
|
|
12961
|
+
clearContainerContents(editor, cursorPath), cursor = getSibling(editor, cursorPath, {
|
|
12962
|
+
direction: "previous"
|
|
12963
|
+
});
|
|
12971
12964
|
}
|
|
12972
12965
|
}
|
|
12973
12966
|
function parentAcceptsTextBlock(editor, path2) {
|
|
@@ -12988,14 +12981,18 @@ function removeLeadingChildrenOf(editor, blockPath, endChildPath) {
|
|
|
12988
12981
|
removeNodeAt(editor, firstChild.path), firstChild = getFirstChild(editor, blockPath);
|
|
12989
12982
|
}
|
|
12990
12983
|
function removeBlocksBetween(editor, startBlockPath, endBlockPath) {
|
|
12991
|
-
let cursor = getSibling(editor, startBlockPath,
|
|
12984
|
+
let cursor = getSibling(editor, startBlockPath, {
|
|
12985
|
+
direction: "next"
|
|
12986
|
+
});
|
|
12992
12987
|
for (; cursor && !pathEquals(cursor.path, endBlockPath); )
|
|
12993
|
-
removeNodeAt(editor, cursor.path), cursor = getSibling(editor, startBlockPath,
|
|
12988
|
+
removeNodeAt(editor, cursor.path), cursor = getSibling(editor, startBlockPath, {
|
|
12989
|
+
direction: "next"
|
|
12990
|
+
});
|
|
12994
12991
|
}
|
|
12995
12992
|
function mergeBlock(editor, startBlockPath, endBlockPath, removeEmptyStartBlock) {
|
|
12996
12993
|
if (pathEquals(startBlockPath, endBlockPath))
|
|
12997
12994
|
return;
|
|
12998
|
-
const startBlock =
|
|
12995
|
+
const startBlock = getTextBlock(editor, startBlockPath), endBlock = getTextBlock(editor, endBlockPath);
|
|
12999
12996
|
if (!startBlock || !endBlock)
|
|
13000
12997
|
return;
|
|
13001
12998
|
if (removeEmptyStartBlock && isEmptyTextBlock({
|
|
@@ -13027,7 +13024,10 @@ function removeNodeAt(editor, path2) {
|
|
|
13027
13024
|
}
|
|
13028
13025
|
function deleteCollapsed(editor, point2, options) {
|
|
13029
13026
|
withoutNormalizing(editor, () => {
|
|
13030
|
-
const furthestObjectNode =
|
|
13027
|
+
const pointEntry = getNode(editor, point2.path), furthestObjectNode = pointEntry && isLeafObject(editor, pointEntry.node, point2.path) ? pointEntry : getAncestor(editor, point2.path, {
|
|
13028
|
+
match: (node, ancestorPath) => isLeafObject(editor, node, ancestorPath),
|
|
13029
|
+
mode: "highest"
|
|
13030
|
+
});
|
|
13031
13031
|
if (furthestObjectNode) {
|
|
13032
13032
|
editor.apply({
|
|
13033
13033
|
type: "unset",
|
|
@@ -13074,11 +13074,19 @@ function resolveExplicitRange(editor, at) {
|
|
|
13074
13074
|
return null;
|
|
13075
13075
|
const [start2, end2] = rangeEdges(at, editor), startBlock = getEnclosingBlock(editor, start2.path), endBlock = getEnclosingBlock(editor, end2.path);
|
|
13076
13076
|
let clampedStart = start2, clampedEnd = end2;
|
|
13077
|
-
|
|
13077
|
+
const startEntry = getNode(editor, start2.path);
|
|
13078
|
+
if ((startEntry && isLeafObject(editor, startEntry.node, start2.path) ? startEntry : getAncestor(editor, start2.path, {
|
|
13079
|
+
match: (node, ancestorPath) => isLeafObject(editor, node, ancestorPath),
|
|
13080
|
+
mode: "highest"
|
|
13081
|
+
})) && startBlock) {
|
|
13078
13082
|
const beforePoint = before(editor, start2);
|
|
13079
13083
|
beforePoint && isAncestorPath(startBlock.path, beforePoint.path) && (clampedStart = beforePoint);
|
|
13080
13084
|
}
|
|
13081
|
-
|
|
13085
|
+
const endEntry = getNode(editor, end2.path);
|
|
13086
|
+
if ((endEntry && isLeafObject(editor, endEntry.node, end2.path) ? endEntry : getAncestor(editor, end2.path, {
|
|
13087
|
+
match: (node, ancestorPath) => isLeafObject(editor, node, ancestorPath),
|
|
13088
|
+
mode: "highest"
|
|
13089
|
+
})) && endBlock) {
|
|
13082
13090
|
const afterPoint = after(editor, end2);
|
|
13083
13091
|
afterPoint && isAncestorPath(endBlock.path, afterPoint.path) && (clampedEnd = afterPoint);
|
|
13084
13092
|
}
|
|
@@ -13182,10 +13190,6 @@ function transformPoint(point2, innerPrefix) {
|
|
|
13182
13190
|
offset: point2.offset
|
|
13183
13191
|
} : point2;
|
|
13184
13192
|
}
|
|
13185
|
-
function isEmptyContainer(snapshot, path2) {
|
|
13186
|
-
const children = getChildren(snapshot, path2);
|
|
13187
|
-
return children.length === 1 && isEmptyTextBlock(snapshot.context, children[0].node);
|
|
13188
|
-
}
|
|
13189
13193
|
const deleteOperationImplementation = ({
|
|
13190
13194
|
operation
|
|
13191
13195
|
}) => {
|
|
@@ -13194,19 +13198,27 @@ const deleteOperationImplementation = ({
|
|
|
13194
13198
|
throw new Error("Unable to delete without a selection");
|
|
13195
13199
|
const [start2, end2] = rangeEdges(at, operation.editor);
|
|
13196
13200
|
if (operation.unit === "block") {
|
|
13197
|
-
unsetMatchedNodesInRange(operation.editor, start2.path, end2.path, (
|
|
13201
|
+
unsetMatchedNodesInRange(operation.editor, start2.path, end2.path, (_, path2) => isBlock(operation.editor, path2));
|
|
13198
13202
|
return;
|
|
13199
13203
|
}
|
|
13200
13204
|
if (operation.unit === "child") {
|
|
13201
|
-
unsetMatchedNodesInRange(operation.editor, start2.path, end2.path, (
|
|
13205
|
+
unsetMatchedNodesInRange(operation.editor, start2.path, end2.path, (_, path2) => isInline(operation.editor, path2));
|
|
13202
13206
|
return;
|
|
13203
13207
|
}
|
|
13204
13208
|
if (operation.direction === "backward" && operation.unit === "line") {
|
|
13205
|
-
const parentBlockEntry = pathEquals(at.anchor.path, at.focus.path) ?
|
|
13209
|
+
const parentBlockEntry = pathEquals(at.anchor.path, at.focus.path) ? getParent(operation.editor, at.anchor.path, {
|
|
13210
|
+
match: (node) => isTextBlock({
|
|
13211
|
+
schema: operation.editor.schema
|
|
13212
|
+
}, node)
|
|
13213
|
+
}) : (() => {
|
|
13206
13214
|
const fromPath = commonPath(at.anchor.path, at.focus.path), nodeEntry = getNode(operation.editor, fromPath);
|
|
13207
13215
|
return nodeEntry && isTextBlockNode({
|
|
13208
13216
|
schema: operation.editor.schema
|
|
13209
|
-
}, nodeEntry.node) ? nodeEntry :
|
|
13217
|
+
}, nodeEntry.node) ? nodeEntry : getParent(operation.editor, fromPath, {
|
|
13218
|
+
match: (node) => isTextBlock({
|
|
13219
|
+
schema: operation.editor.schema
|
|
13220
|
+
}, node)
|
|
13221
|
+
});
|
|
13210
13222
|
})();
|
|
13211
13223
|
if (parentBlockEntry) {
|
|
13212
13224
|
const parentElementRange = range(operation.editor, parentBlockEntry.path, at.anchor), currentLineRange = findCurrentLineRange(operation.editor, parentElementRange);
|
|
@@ -13221,8 +13233,10 @@ const deleteOperationImplementation = ({
|
|
|
13221
13233
|
}
|
|
13222
13234
|
const direction = operation.direction === "backward" ? "backward" : "forward", selection = operation.at ? "preserve" : "collapse-to-start";
|
|
13223
13235
|
if (isCollapsedRange(at)) {
|
|
13224
|
-
const enclosingContainer = getAncestor(operation.editor, at.anchor.path,
|
|
13225
|
-
|
|
13236
|
+
const enclosingContainer = getAncestor(operation.editor, at.anchor.path, {
|
|
13237
|
+
match: (node, path2) => isObject$1(operation.editor, node) && isEditableContainer(operation.editor, node, path2)
|
|
13238
|
+
}), enclosingContainerChildren = enclosingContainer ? getChildren(operation.editor, enclosingContainer.path) : void 0, [firstChild] = enclosingContainerChildren ?? [];
|
|
13239
|
+
if (enclosingContainer && enclosingContainerChildren?.length === 1 && firstChild && isEmptyTextBlock(operation.editor.context, firstChild.node)) {
|
|
13226
13240
|
unwrapContainer(operation.editor, enclosingContainer.path, operation.direction === "backward" ? "before" : "after");
|
|
13227
13241
|
return;
|
|
13228
13242
|
}
|
|
@@ -13679,10 +13693,10 @@ function splitBlockAndInsert(editor, block, blockPath, splitAt) {
|
|
|
13679
13693
|
affinity: "backward"
|
|
13680
13694
|
});
|
|
13681
13695
|
if (splitAt.offset > 0) {
|
|
13682
|
-
const spanEntry =
|
|
13696
|
+
const spanEntry = getSpan(editor, splitAt.path);
|
|
13683
13697
|
spanEntry && splitAt.offset < spanEntry.node.text.length && applySplitNode(editor, splitAt.path, splitAt.offset);
|
|
13684
13698
|
}
|
|
13685
|
-
const currentBlockPath = blockPathRef.current ?? blockPath, blockEntry =
|
|
13699
|
+
const currentBlockPath = blockPathRef.current ?? blockPath, blockEntry = getTextBlock(editor, currentBlockPath);
|
|
13686
13700
|
if (blockEntry) {
|
|
13687
13701
|
const childSegment = splitAt.path[blockPath.length + 1], childIndex = resolveChildIndex(blockEntry.node.children, childSegment), splitAtIndex = splitAt.offset > 0 ? childIndex + 1 : childIndex;
|
|
13688
13702
|
splitAtIndex > 0 && splitAtIndex < blockEntry.node.children.length && applySplitNode(editor, currentBlockPath, splitAtIndex);
|
|
@@ -13699,7 +13713,7 @@ function mergeTextBlockFragment(args) {
|
|
|
13699
13713
|
endBlockPath,
|
|
13700
13714
|
select: select2,
|
|
13701
13715
|
wasCrossBlock
|
|
13702
|
-
} = args, endBlockEntry =
|
|
13716
|
+
} = args, endBlockEntry = getTextBlock(editor, endBlockPath);
|
|
13703
13717
|
if (!endBlockEntry)
|
|
13704
13718
|
return;
|
|
13705
13719
|
const endBlock = endBlockEntry.node, {
|
|
@@ -13757,7 +13771,11 @@ function executeDeleteThenInsert(args) {
|
|
|
13757
13771
|
const collapsedRange = collapsedRangeRef.unref() ?? editor.selection, collapsedPoint = collapsedRange ? rangeStart(collapsedRange, editor) : void 0;
|
|
13758
13772
|
if (!collapsedPoint)
|
|
13759
13773
|
return;
|
|
13760
|
-
const resolvedBlock =
|
|
13774
|
+
const resolvedBlock = getParent(editor, collapsedPoint.path, {
|
|
13775
|
+
match: (node) => isTextBlock({
|
|
13776
|
+
schema: editor.schema
|
|
13777
|
+
}, node)
|
|
13778
|
+
}), blockIsText = isTextBlock({
|
|
13761
13779
|
schema: editor.schema
|
|
13762
13780
|
}, block), postDeleteSelection = select2 === "none" ? collapsedRange : selectionAtEntry;
|
|
13763
13781
|
if (blockIsText && resolvedBlock) {
|
|
@@ -13807,7 +13825,9 @@ function removeAdjacentEmptyTextBlock(args) {
|
|
|
13807
13825
|
insertedPath
|
|
13808
13826
|
} = args;
|
|
13809
13827
|
for (const direction of ["next", "previous"]) {
|
|
13810
|
-
const sibling = getSibling(editor, insertedPath,
|
|
13828
|
+
const sibling = getSibling(editor, insertedPath, {
|
|
13829
|
+
direction
|
|
13830
|
+
});
|
|
13811
13831
|
if (sibling && isEmptyTextBlock(context, sibling.node)) {
|
|
13812
13832
|
editor.apply({
|
|
13813
13833
|
type: "unset",
|
|
@@ -13877,11 +13897,11 @@ function insertFragmentChildren(editor, block, at) {
|
|
|
13877
13897
|
schema: editor.schema
|
|
13878
13898
|
}, block))
|
|
13879
13899
|
return;
|
|
13880
|
-
at.offset > 0 &&
|
|
13900
|
+
at.offset > 0 && getSpan(editor, at.path) && applySplitNode(editor, at.path, at.offset);
|
|
13881
13901
|
const parent = parentPath(at.path);
|
|
13882
13902
|
let firstInsertedKey;
|
|
13883
13903
|
if (at.offset === 0 && block.children.length === 1) {
|
|
13884
|
-
const firstChild = block.children[0], existingEntry =
|
|
13904
|
+
const firstChild = block.children[0], existingEntry = getSpan(editor, at.path);
|
|
13885
13905
|
if (existingEntry && isSpan({
|
|
13886
13906
|
schema: editor.schema
|
|
13887
13907
|
}, firstChild))
|
|
@@ -13915,7 +13935,11 @@ const insertChildOperationImplementation = ({
|
|
|
13915
13935
|
} = snapshot, focus = operation.editor.selection?.focus;
|
|
13916
13936
|
if (!focus)
|
|
13917
13937
|
throw new Error("Unable to insert child without a focus");
|
|
13918
|
-
const focusBlockEntry =
|
|
13938
|
+
const focusBlockEntry = getParent(operation.editor, focus.path, {
|
|
13939
|
+
match: (node) => isTextBlock({
|
|
13940
|
+
schema: operation.editor.schema
|
|
13941
|
+
}, node)
|
|
13942
|
+
});
|
|
13919
13943
|
if (!focusBlockEntry)
|
|
13920
13944
|
throw new Error("Unable to insert child without a focus block");
|
|
13921
13945
|
const focusBlock = focusBlockEntry.node;
|
|
@@ -13943,7 +13967,9 @@ const insertChildOperationImplementation = ({
|
|
|
13943
13967
|
}, focusSpanEntry.node) && focusSpanEntry.node)
|
|
13944
13968
|
applyInsertNodeAtPoint(operation.editor, span, focus);
|
|
13945
13969
|
else {
|
|
13946
|
-
const nextSibling = getSibling(operation.editor, focusChildPath,
|
|
13970
|
+
const nextSibling = getSibling(operation.editor, focusChildPath, {
|
|
13971
|
+
direction: "next"
|
|
13972
|
+
});
|
|
13947
13973
|
nextSibling ? applyInsertNodeAtPath(operation.editor, span, nextSibling.path) : operation.editor.apply({
|
|
13948
13974
|
type: "insert",
|
|
13949
13975
|
path: focusChildPath,
|
|
@@ -13977,7 +14003,9 @@ const insertChildOperationImplementation = ({
|
|
|
13977
14003
|
}, focusSpanEntry.node) && focusSpanEntry.node)
|
|
13978
14004
|
applyInsertNodeAtPoint(operation.editor, inlineNode, focus);
|
|
13979
14005
|
else {
|
|
13980
|
-
const nextSibling = getSibling(operation.editor, focusChildPath,
|
|
14006
|
+
const nextSibling = getSibling(operation.editor, focusChildPath, {
|
|
14007
|
+
direction: "next"
|
|
14008
|
+
});
|
|
13981
14009
|
nextSibling ? applyInsertNodeAtPath(operation.editor, inlineNode, nextSibling.path) : operation.editor.apply({
|
|
13982
14010
|
type: "insert",
|
|
13983
14011
|
path: focusChildPath,
|
|
@@ -14017,12 +14045,12 @@ const insertChildOperationImplementation = ({
|
|
|
14017
14045
|
if (!nodeEntry)
|
|
14018
14046
|
return;
|
|
14019
14047
|
const node = nodeEntry.node;
|
|
14020
|
-
if (
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
|
|
14048
|
+
if (isLeafObject(editor, node, nodeEntry.path)) {
|
|
14049
|
+
const nextSibling = getSibling(editor, nodeEntry.path, {
|
|
14050
|
+
direction: "next"
|
|
14051
|
+
});
|
|
14024
14052
|
if (nextSibling)
|
|
14025
|
-
if (
|
|
14053
|
+
if (getSpan(editor, nextSibling.path))
|
|
14026
14054
|
path2 = nextSibling.path, offset = 0, applySelect(editor, {
|
|
14027
14055
|
path: path2,
|
|
14028
14056
|
offset
|
|
@@ -14307,7 +14335,9 @@ const abstractAnnotationBehaviors = [defineBehavior({
|
|
|
14307
14335
|
}, focusTextBlock = getFocusTextBlock(adjustedSnapshot);
|
|
14308
14336
|
if (!focusTextBlock)
|
|
14309
14337
|
return !1;
|
|
14310
|
-
const previousSibling = getSibling(adjustedSnapshot, focusTextBlock.path,
|
|
14338
|
+
const previousSibling = getSibling(adjustedSnapshot, focusTextBlock.path, {
|
|
14339
|
+
direction: "previous"
|
|
14340
|
+
});
|
|
14311
14341
|
if (!previousSibling || !isAtTheStartOfBlock(focusTextBlock)(adjustedSnapshot) || !isTextBlock(snapshot.context, previousSibling.node))
|
|
14312
14342
|
return !1;
|
|
14313
14343
|
const previousBlock = {
|
|
@@ -14372,7 +14402,9 @@ const abstractAnnotationBehaviors = [defineBehavior({
|
|
|
14372
14402
|
}, focusTextBlock = getFocusTextBlock(adjustedSnapshot);
|
|
14373
14403
|
if (!focusTextBlock)
|
|
14374
14404
|
return !1;
|
|
14375
|
-
const nextSibling = getSibling(adjustedSnapshot, focusTextBlock.path,
|
|
14405
|
+
const nextSibling = getSibling(adjustedSnapshot, focusTextBlock.path, {
|
|
14406
|
+
direction: "next"
|
|
14407
|
+
});
|
|
14376
14408
|
if (!nextSibling || !isEmptyTextBlock(snapshot.context, focusTextBlock.node) || !isTextBlock(snapshot.context, nextSibling.node))
|
|
14377
14409
|
return !1;
|
|
14378
14410
|
const nextBlockStartPoint = getBlockStartPoint({
|
|
@@ -14420,7 +14452,9 @@ const abstractAnnotationBehaviors = [defineBehavior({
|
|
|
14420
14452
|
}, focusTextBlock = getFocusTextBlock(adjustedSnapshot);
|
|
14421
14453
|
if (!focusTextBlock)
|
|
14422
14454
|
return !1;
|
|
14423
|
-
const nextSibling = getSibling(adjustedSnapshot, focusTextBlock.path,
|
|
14455
|
+
const nextSibling = getSibling(adjustedSnapshot, focusTextBlock.path, {
|
|
14456
|
+
direction: "next"
|
|
14457
|
+
});
|
|
14424
14458
|
return !nextSibling || !isAtTheEndOfBlock(focusTextBlock)(adjustedSnapshot) || !isTextBlockNode(snapshot.context, nextSibling.node) ? !1 : {
|
|
14425
14459
|
nextBlock: {
|
|
14426
14460
|
node: nextSibling.node,
|
|
@@ -15418,7 +15452,9 @@ const abstractInsertBehaviors = [
|
|
|
15418
15452
|
const focusTextBlock = getFocusTextBlock(snapshot);
|
|
15419
15453
|
if (!focusTextBlock)
|
|
15420
15454
|
return !1;
|
|
15421
|
-
const previousSibling = getSibling(snapshot, focusTextBlock.path,
|
|
15455
|
+
const previousSibling = getSibling(snapshot, focusTextBlock.path, {
|
|
15456
|
+
direction: "previous"
|
|
15457
|
+
});
|
|
15422
15458
|
if (!previousSibling)
|
|
15423
15459
|
return !1;
|
|
15424
15460
|
const previousBlock = getBlock(snapshot, previousSibling.path);
|
|
@@ -15539,7 +15575,9 @@ const abstractInsertBehaviors = [
|
|
|
15539
15575
|
snapshot,
|
|
15540
15576
|
event
|
|
15541
15577
|
}) => {
|
|
15542
|
-
const previousSibling = getSibling(snapshot, event.at,
|
|
15578
|
+
const previousSibling = getSibling(snapshot, event.at, {
|
|
15579
|
+
direction: "previous"
|
|
15580
|
+
});
|
|
15543
15581
|
return previousSibling ? {
|
|
15544
15582
|
previousSibling,
|
|
15545
15583
|
savedSelection: snapshot.context.selection
|
|
@@ -15567,7 +15605,9 @@ const abstractInsertBehaviors = [
|
|
|
15567
15605
|
snapshot,
|
|
15568
15606
|
event
|
|
15569
15607
|
}) => {
|
|
15570
|
-
const nextSibling = getSibling(snapshot, event.at,
|
|
15608
|
+
const nextSibling = getSibling(snapshot, event.at, {
|
|
15609
|
+
direction: "next"
|
|
15610
|
+
});
|
|
15571
15611
|
return nextSibling ? {
|
|
15572
15612
|
nextSibling,
|
|
15573
15613
|
savedSelection: snapshot.context.selection
|
|
@@ -15639,7 +15679,9 @@ const abstractInsertBehaviors = [
|
|
|
15639
15679
|
const focusBlockPath = getFocusBlock(snapshot)?.path;
|
|
15640
15680
|
if (!focusBlockPath)
|
|
15641
15681
|
return !1;
|
|
15642
|
-
const previousSibling = getSibling(snapshot, focusBlockPath,
|
|
15682
|
+
const previousSibling = getSibling(snapshot, focusBlockPath, {
|
|
15683
|
+
direction: "previous"
|
|
15684
|
+
});
|
|
15643
15685
|
return previousSibling ? {
|
|
15644
15686
|
previousBlock: previousSibling
|
|
15645
15687
|
} : !1;
|
|
@@ -15661,7 +15703,9 @@ const abstractInsertBehaviors = [
|
|
|
15661
15703
|
const focusBlockPath = getFocusBlock(snapshot)?.path;
|
|
15662
15704
|
if (!focusBlockPath)
|
|
15663
15705
|
return !1;
|
|
15664
|
-
const nextSibling = getSibling(snapshot, focusBlockPath,
|
|
15706
|
+
const nextSibling = getSibling(snapshot, focusBlockPath, {
|
|
15707
|
+
direction: "next"
|
|
15708
|
+
});
|
|
15665
15709
|
return nextSibling ? {
|
|
15666
15710
|
nextBlock: nextSibling
|
|
15667
15711
|
} : !1;
|
|
@@ -15773,7 +15817,15 @@ const abstractInsertBehaviors = [
|
|
|
15773
15817
|
const startPoint = getSelectionStartPoint$1(selection), endPoint = getSelectionEndPoint$1(selection);
|
|
15774
15818
|
if (!startPoint || !endPoint)
|
|
15775
15819
|
return !1;
|
|
15776
|
-
const startBlock =
|
|
15820
|
+
const startBlock = getParent(snapshot, startPoint.path, {
|
|
15821
|
+
match: (node) => isTextBlock({
|
|
15822
|
+
schema: snapshot.context.schema
|
|
15823
|
+
}, node)
|
|
15824
|
+
}), endBlock = getParent(snapshot, endPoint.path, {
|
|
15825
|
+
match: (node) => isTextBlock({
|
|
15826
|
+
schema: snapshot.context.schema
|
|
15827
|
+
}, node)
|
|
15828
|
+
});
|
|
15777
15829
|
if (!startBlock || !endBlock)
|
|
15778
15830
|
return !1;
|
|
15779
15831
|
const startBlockStartPoint = getBlockStartPoint({
|
|
@@ -16191,6 +16243,51 @@ function sortByPriority(items) {
|
|
|
16191
16243
|
result.includes(item) || result.push(item);
|
|
16192
16244
|
return [...result, ...itemsWithoutPriority];
|
|
16193
16245
|
}
|
|
16246
|
+
function pathsOverlap(pathA, pathB) {
|
|
16247
|
+
const minLength = Math.min(pathA.length, pathB.length);
|
|
16248
|
+
for (let i = 0; i < minLength; i++)
|
|
16249
|
+
if (!isEqualPathSegments(pathA[i], pathB[i]))
|
|
16250
|
+
return !1;
|
|
16251
|
+
return !0;
|
|
16252
|
+
}
|
|
16253
|
+
function buildPublicContainers(resolved) {
|
|
16254
|
+
const projected = /* @__PURE__ */ new Map();
|
|
16255
|
+
for (const [type, config] of resolved)
|
|
16256
|
+
projected.set(type, toRegisteredContainer(config));
|
|
16257
|
+
return projected;
|
|
16258
|
+
}
|
|
16259
|
+
function toRegisteredContainer(config) {
|
|
16260
|
+
return {
|
|
16261
|
+
kind: "container",
|
|
16262
|
+
type: config.container.type,
|
|
16263
|
+
field: config.field,
|
|
16264
|
+
...config.of ? {
|
|
16265
|
+
of: config.of.map(toRegisteredOfEntry).filter(isDefined)
|
|
16266
|
+
} : {}
|
|
16267
|
+
};
|
|
16268
|
+
}
|
|
16269
|
+
function toRegisteredOfEntry(entry) {
|
|
16270
|
+
if ("container" in entry)
|
|
16271
|
+
return toRegisteredContainer(entry);
|
|
16272
|
+
if ("span" in entry)
|
|
16273
|
+
return {
|
|
16274
|
+
kind: "span",
|
|
16275
|
+
type: entry.span.type
|
|
16276
|
+
};
|
|
16277
|
+
if ("blockObject" in entry)
|
|
16278
|
+
return {
|
|
16279
|
+
kind: "blockObject",
|
|
16280
|
+
type: entry.blockObject.type
|
|
16281
|
+
};
|
|
16282
|
+
if ("inlineObject" in entry)
|
|
16283
|
+
return {
|
|
16284
|
+
kind: "inlineObject",
|
|
16285
|
+
type: entry.inlineObject.type
|
|
16286
|
+
};
|
|
16287
|
+
}
|
|
16288
|
+
function isDefined(value) {
|
|
16289
|
+
return value !== void 0;
|
|
16290
|
+
}
|
|
16194
16291
|
const PRIMITIVE_TYPES = /* @__PURE__ */ new Set(["string", "number", "boolean"]);
|
|
16195
16292
|
function isChildArrayField(field) {
|
|
16196
16293
|
return field.type === "array" && "of" in field && Array.isArray(field.of);
|
|
@@ -16299,13 +16396,6 @@ function resolveTextBlockConfig(textBlock) {
|
|
|
16299
16396
|
} : {}
|
|
16300
16397
|
};
|
|
16301
16398
|
}
|
|
16302
|
-
function pathsOverlap(pathA, pathB) {
|
|
16303
|
-
const minLength = Math.min(pathA.length, pathB.length);
|
|
16304
|
-
for (let i = 0; i < minLength; i++)
|
|
16305
|
-
if (!isEqualPathSegments(pathA[i], pathB[i]))
|
|
16306
|
-
return !1;
|
|
16307
|
-
return !0;
|
|
16308
|
-
}
|
|
16309
16399
|
function isTypeAlreadyRegistered(maps, attempting, type) {
|
|
16310
16400
|
const claimedAs = (kind) => {
|
|
16311
16401
|
switch (kind) {
|
|
@@ -16333,6 +16423,77 @@ function isTypeAlreadyRegistered(maps, attempting, type) {
|
|
|
16333
16423
|
}
|
|
16334
16424
|
return !1;
|
|
16335
16425
|
}
|
|
16426
|
+
function registerNodeOnEngine(engine, node) {
|
|
16427
|
+
if (node.kind === "container") {
|
|
16428
|
+
if (isTypeAlreadyRegistered(engine, "container", node.type))
|
|
16429
|
+
return;
|
|
16430
|
+
const containerConfig = resolveNestedContainer(engine.schema, node);
|
|
16431
|
+
if (!containerConfig)
|
|
16432
|
+
return;
|
|
16433
|
+
const containers = new Map(engine.containers);
|
|
16434
|
+
containers.set(node.type, containerConfig), engine.containers = containers, engine.publicContainers = buildPublicContainers(containers), normalize(engine, {
|
|
16435
|
+
force: !0
|
|
16436
|
+
}), engine.onChange();
|
|
16437
|
+
return;
|
|
16438
|
+
}
|
|
16439
|
+
if (node.kind === "textBlock") {
|
|
16440
|
+
if (isTypeAlreadyRegistered(engine, "textBlock", node.type))
|
|
16441
|
+
return;
|
|
16442
|
+
const textBlocks = new Map(engine.textBlocks);
|
|
16443
|
+
textBlocks.set(node.type, resolveTextBlockConfig(node)), engine.textBlocks = textBlocks, engine.onChange();
|
|
16444
|
+
return;
|
|
16445
|
+
}
|
|
16446
|
+
if (node.kind === "span") {
|
|
16447
|
+
if (isTypeAlreadyRegistered(engine, "span", node.type))
|
|
16448
|
+
return;
|
|
16449
|
+
const spans = new Map(engine.spans);
|
|
16450
|
+
spans.set(node.type, {
|
|
16451
|
+
span: node
|
|
16452
|
+
}), engine.spans = spans, engine.onChange();
|
|
16453
|
+
return;
|
|
16454
|
+
}
|
|
16455
|
+
if (node.kind === "blockObject") {
|
|
16456
|
+
if (isTypeAlreadyRegistered(engine, "blockObject", node.type))
|
|
16457
|
+
return;
|
|
16458
|
+
const blockObjects = new Map(engine.blockObjects);
|
|
16459
|
+
blockObjects.set(node.type, {
|
|
16460
|
+
blockObject: node
|
|
16461
|
+
}), engine.blockObjects = blockObjects, engine.onChange();
|
|
16462
|
+
return;
|
|
16463
|
+
}
|
|
16464
|
+
if (isTypeAlreadyRegistered(engine, "inlineObject", node.type))
|
|
16465
|
+
return;
|
|
16466
|
+
const inlineObjects = new Map(engine.inlineObjects);
|
|
16467
|
+
inlineObjects.set(node.type, {
|
|
16468
|
+
inlineObject: node
|
|
16469
|
+
}), engine.inlineObjects = inlineObjects, engine.onChange();
|
|
16470
|
+
}
|
|
16471
|
+
function unregisterNodeOnEngine(engine, node) {
|
|
16472
|
+
if (node.kind === "container") {
|
|
16473
|
+
const containers = new Map(engine.containers);
|
|
16474
|
+
containers.delete(node.type), engine.containers = containers, engine.publicContainers = buildPublicContainers(containers), normalize(engine, {
|
|
16475
|
+
force: !0
|
|
16476
|
+
}), engine.onChange();
|
|
16477
|
+
return;
|
|
16478
|
+
}
|
|
16479
|
+
if (node.kind === "textBlock") {
|
|
16480
|
+
const textBlocks = new Map(engine.textBlocks);
|
|
16481
|
+
textBlocks.delete(node.type), engine.textBlocks = textBlocks, engine.onChange();
|
|
16482
|
+
return;
|
|
16483
|
+
}
|
|
16484
|
+
if (node.kind === "span") {
|
|
16485
|
+
const spans = new Map(engine.spans);
|
|
16486
|
+
spans.delete(node.type), engine.spans = spans, engine.onChange();
|
|
16487
|
+
return;
|
|
16488
|
+
}
|
|
16489
|
+
if (node.kind === "blockObject") {
|
|
16490
|
+
const blockObjects = new Map(engine.blockObjects);
|
|
16491
|
+
blockObjects.delete(node.type), engine.blockObjects = blockObjects, engine.onChange();
|
|
16492
|
+
return;
|
|
16493
|
+
}
|
|
16494
|
+
const inlineObjects = new Map(engine.inlineObjects);
|
|
16495
|
+
inlineObjects.delete(node.type), engine.inlineObjects = inlineObjects, engine.onChange();
|
|
16496
|
+
}
|
|
16336
16497
|
function rerouteExternalBehaviorEvent({
|
|
16337
16498
|
event,
|
|
16338
16499
|
editorEngine
|
|
@@ -16397,105 +16558,38 @@ const editorMachine = setup({
|
|
|
16397
16558
|
event
|
|
16398
16559
|
}) => event.type === "add editor engine" ? event.editor : context.editorEngine
|
|
16399
16560
|
}),
|
|
16400
|
-
register:
|
|
16561
|
+
register: ({
|
|
16401
16562
|
context,
|
|
16402
16563
|
event
|
|
16403
16564
|
}) => {
|
|
16404
|
-
assertEvent(event, "register")
|
|
16405
|
-
|
|
16406
|
-
|
|
16407
|
-
if (isTypeAlreadyRegistered(context, "container", node.type))
|
|
16408
|
-
return {};
|
|
16409
|
-
const containerConfig = resolveNestedContainer(context.schema, node);
|
|
16410
|
-
if (!containerConfig)
|
|
16411
|
-
return {};
|
|
16412
|
-
const containers = new Map(context.containers);
|
|
16413
|
-
return containers.set(node.type, containerConfig), context.editorEngine && (context.editorEngine.containers = containers, context.editorEngine.publicContainers = buildPublicContainers(containers), normalize(context.editorEngine, {
|
|
16414
|
-
force: !0
|
|
16415
|
-
}), context.editorEngine.onChange()), {
|
|
16416
|
-
containers
|
|
16417
|
-
};
|
|
16418
|
-
}
|
|
16419
|
-
if (node.kind === "textBlock") {
|
|
16420
|
-
if (isTypeAlreadyRegistered(context, "textBlock", node.type))
|
|
16421
|
-
return {};
|
|
16422
|
-
const textBlocks = new Map(context.textBlocks);
|
|
16423
|
-
return textBlocks.set(node.type, resolveTextBlockConfig(node)), context.editorEngine && (context.editorEngine.textBlocks = textBlocks, context.editorEngine.onChange()), {
|
|
16424
|
-
textBlocks
|
|
16425
|
-
};
|
|
16426
|
-
}
|
|
16427
|
-
if (node.kind === "span") {
|
|
16428
|
-
if (isTypeAlreadyRegistered(context, "span", node.type))
|
|
16429
|
-
return {};
|
|
16430
|
-
const spans = new Map(context.spans);
|
|
16431
|
-
return spans.set(node.type, {
|
|
16432
|
-
span: node
|
|
16433
|
-
}), context.editorEngine && (context.editorEngine.spans = spans, context.editorEngine.onChange()), {
|
|
16434
|
-
spans
|
|
16435
|
-
};
|
|
16436
|
-
}
|
|
16437
|
-
if (node.kind === "blockObject") {
|
|
16438
|
-
if (isTypeAlreadyRegistered(context, "blockObject", node.type))
|
|
16439
|
-
return {};
|
|
16440
|
-
const blockObjects = new Map(context.blockObjects);
|
|
16441
|
-
return blockObjects.set(node.type, {
|
|
16442
|
-
blockObject: node
|
|
16443
|
-
}), context.editorEngine && (context.editorEngine.blockObjects = blockObjects, context.editorEngine.onChange()), {
|
|
16444
|
-
blockObjects
|
|
16445
|
-
};
|
|
16565
|
+
if (assertEvent(event, "register"), !context.editorEngine) {
|
|
16566
|
+
context.pendingRegistrations.push(event.node);
|
|
16567
|
+
return;
|
|
16446
16568
|
}
|
|
16447
|
-
|
|
16448
|
-
|
|
16449
|
-
|
|
16450
|
-
return inlineObjects.set(node.type, {
|
|
16451
|
-
inlineObject: node
|
|
16452
|
-
}), context.editorEngine && (context.editorEngine.inlineObjects = inlineObjects, context.editorEngine.onChange()), {
|
|
16453
|
-
inlineObjects
|
|
16454
|
-
};
|
|
16455
|
-
}),
|
|
16456
|
-
unregister: assign(({
|
|
16569
|
+
registerNodeOnEngine(context.editorEngine, event.node);
|
|
16570
|
+
},
|
|
16571
|
+
unregister: ({
|
|
16457
16572
|
context,
|
|
16458
16573
|
event
|
|
16459
16574
|
}) => {
|
|
16460
|
-
assertEvent(event, "unregister")
|
|
16461
|
-
|
|
16462
|
-
|
|
16463
|
-
|
|
16464
|
-
return containers.delete(node.type), context.editorEngine && (context.editorEngine.containers = containers, context.editorEngine.publicContainers = buildPublicContainers(containers), normalize(context.editorEngine, {
|
|
16465
|
-
force: !0
|
|
16466
|
-
}), context.editorEngine.onChange()), {
|
|
16467
|
-
containers
|
|
16468
|
-
};
|
|
16469
|
-
}
|
|
16470
|
-
if (node.kind === "textBlock") {
|
|
16471
|
-
const textBlocks = new Map(context.textBlocks);
|
|
16472
|
-
return textBlocks.delete(node.type), context.editorEngine && (context.editorEngine.textBlocks = textBlocks, context.editorEngine.onChange()), {
|
|
16473
|
-
textBlocks
|
|
16474
|
-
};
|
|
16475
|
-
}
|
|
16476
|
-
if (node.kind === "span") {
|
|
16477
|
-
const spans = new Map(context.spans);
|
|
16478
|
-
return spans.delete(node.type), context.editorEngine && (context.editorEngine.spans = spans, context.editorEngine.onChange()), {
|
|
16479
|
-
spans
|
|
16480
|
-
};
|
|
16481
|
-
}
|
|
16482
|
-
if (node.kind === "blockObject") {
|
|
16483
|
-
const blockObjects = new Map(context.blockObjects);
|
|
16484
|
-
return blockObjects.delete(node.type), context.editorEngine && (context.editorEngine.blockObjects = blockObjects, context.editorEngine.onChange()), {
|
|
16485
|
-
blockObjects
|
|
16486
|
-
};
|
|
16575
|
+
if (assertEvent(event, "unregister"), !context.editorEngine) {
|
|
16576
|
+
const index = context.pendingRegistrations.indexOf(event.node);
|
|
16577
|
+
index >= 0 && context.pendingRegistrations.splice(index, 1);
|
|
16578
|
+
return;
|
|
16487
16579
|
}
|
|
16488
|
-
|
|
16489
|
-
|
|
16490
|
-
inlineObjects
|
|
16491
|
-
};
|
|
16492
|
-
}),
|
|
16580
|
+
unregisterNodeOnEngine(context.editorEngine, event.node);
|
|
16581
|
+
},
|
|
16493
16582
|
"attach maps to editor engine": ({
|
|
16494
16583
|
context
|
|
16495
16584
|
}) => {
|
|
16496
|
-
|
|
16585
|
+
if (!context.editorEngine)
|
|
16586
|
+
return;
|
|
16587
|
+
const engine = context.editorEngine;
|
|
16588
|
+
for (const node of context.pendingRegistrations)
|
|
16589
|
+
registerNodeOnEngine(engine, node);
|
|
16590
|
+
context.pendingRegistrations.length = 0, normalize(engine, {
|
|
16497
16591
|
force: !0
|
|
16498
|
-
}),
|
|
16592
|
+
}), engine.onChange();
|
|
16499
16593
|
},
|
|
16500
16594
|
"emit patch event": emit(({
|
|
16501
16595
|
event
|
|
@@ -16503,11 +16597,21 @@ const editorMachine = setup({
|
|
|
16503
16597
|
"emit mutation event": emit(({
|
|
16504
16598
|
event
|
|
16505
16599
|
}) => (assertEvent(event, "mutation"), event)),
|
|
16506
|
-
"emit read only":
|
|
16507
|
-
|
|
16600
|
+
"emit read only": enqueueActions(({
|
|
16601
|
+
context,
|
|
16602
|
+
enqueue
|
|
16603
|
+
}) => {
|
|
16604
|
+
context.editorEngine && (context.editorEngine.readOnly = !0, context.editorEngine.onChange()), enqueue.emit({
|
|
16605
|
+
type: "read only"
|
|
16606
|
+
});
|
|
16508
16607
|
}),
|
|
16509
|
-
"emit editable":
|
|
16510
|
-
|
|
16608
|
+
"emit editable": enqueueActions(({
|
|
16609
|
+
context,
|
|
16610
|
+
enqueue
|
|
16611
|
+
}) => {
|
|
16612
|
+
context.editorEngine && (context.editorEngine.readOnly = !1, context.editorEngine.onChange()), enqueue.emit({
|
|
16613
|
+
type: "editable"
|
|
16614
|
+
});
|
|
16511
16615
|
}),
|
|
16512
16616
|
"defer event": assign({
|
|
16513
16617
|
pendingEvents: ({
|
|
@@ -16597,12 +16701,10 @@ const editorMachine = setup({
|
|
|
16597
16701
|
remainingEventBehaviors: behaviors,
|
|
16598
16702
|
event: event.behaviorEvent,
|
|
16599
16703
|
editor: event.editor,
|
|
16600
|
-
converters:
|
|
16601
|
-
keyGenerator:
|
|
16602
|
-
schema:
|
|
16603
|
-
readOnly:
|
|
16604
|
-
"edit mode": "read only"
|
|
16605
|
-
}),
|
|
16704
|
+
converters: event.editor.converters,
|
|
16705
|
+
keyGenerator: event.editor.keyGenerator,
|
|
16706
|
+
schema: event.editor.schema,
|
|
16707
|
+
readOnly: event.editor.readOnly,
|
|
16606
16708
|
nativeEvent: event.nativeEvent,
|
|
16607
16709
|
sendBack: (eventSentBack) => {
|
|
16608
16710
|
if (eventSentBack.type === "set drag ghost") {
|
|
@@ -16641,17 +16743,12 @@ const editorMachine = setup({
|
|
|
16641
16743
|
}) => ({
|
|
16642
16744
|
behaviors: new Set(coreBehaviorsConfig),
|
|
16643
16745
|
behaviorsSorted: !1,
|
|
16644
|
-
|
|
16645
|
-
blockObjects: /* @__PURE__ */ new Map(),
|
|
16646
|
-
inlineObjects: /* @__PURE__ */ new Map(),
|
|
16647
|
-
spans: /* @__PURE__ */ new Map(),
|
|
16648
|
-
textBlocks: /* @__PURE__ */ new Map(),
|
|
16649
|
-
converters: input.converters ?? [],
|
|
16746
|
+
initialConverters: input.converters ?? [],
|
|
16650
16747
|
keyGenerator: input.keyGenerator,
|
|
16651
16748
|
pendingEvents: [],
|
|
16652
16749
|
pendingIncomingPatchesEvents: [],
|
|
16750
|
+
pendingRegistrations: [],
|
|
16653
16751
|
schema: input.schema,
|
|
16654
|
-
selection: null,
|
|
16655
16752
|
initialReadOnly: input.readOnly ?? !1,
|
|
16656
16753
|
initialValue: input.initialValue
|
|
16657
16754
|
}),
|
|
@@ -16672,11 +16769,7 @@ const editorMachine = setup({
|
|
|
16672
16769
|
actions: ["unregister"]
|
|
16673
16770
|
},
|
|
16674
16771
|
"update selection": {
|
|
16675
|
-
actions: [
|
|
16676
|
-
selection: ({
|
|
16677
|
-
event
|
|
16678
|
-
}) => event.selection
|
|
16679
|
-
}), emit(({
|
|
16772
|
+
actions: [emit(({
|
|
16680
16773
|
event
|
|
16681
16774
|
}) => ({
|
|
16682
16775
|
...event,
|
|
@@ -18284,10 +18377,7 @@ function createInternalEditor(config) {
|
|
|
18284
18377
|
subscriptions
|
|
18285
18378
|
}), editor = {
|
|
18286
18379
|
dom: createEditorDom((event) => editorActor.send(event), editorEngine),
|
|
18287
|
-
getSnapshot: () =>
|
|
18288
|
-
editorActorSnapshot: editorActor.getSnapshot(),
|
|
18289
|
-
editorEngineInstance: editorEngine
|
|
18290
|
-
}),
|
|
18380
|
+
getSnapshot: () => editorEngine.snapshot,
|
|
18291
18381
|
registerBehavior: (behaviorConfig) => {
|
|
18292
18382
|
const priority = createEditorPriority({
|
|
18293
18383
|
name: "custom",
|
|
@@ -18914,12 +19004,9 @@ function EditorProvider(props) {
|
|
|
18914
19004
|
return $[23] !== internalEditor_0.editor || $[24] !== t7 ? (t8 = /* @__PURE__ */ jsx(EditorContext$1.Provider, { value: internalEditor_0.editor, children: t7 }), $[23] = internalEditor_0.editor, $[24] = t7, $[25] = t8) : t8 = $[25], t8;
|
|
18915
19005
|
}
|
|
18916
19006
|
const usePortableTextEditorSelection = () => {
|
|
18917
|
-
const $ = c(
|
|
18918
|
-
let t0;
|
|
18919
|
-
$[0] !== editorActor ? (t0 =
|
|
18920
|
-
const [selection, setSelection2] = useState(t0.context.selection);
|
|
18921
|
-
let t1, t2;
|
|
18922
|
-
return $[2] !== editorActor ? (t1 = () => {
|
|
19007
|
+
const $ = c(3), editorActor = useContext(EditorActorContext), editorEngine = useEngineStatic(), [selection, setSelection2] = useState(editorEngine.selection);
|
|
19008
|
+
let t0, t1;
|
|
19009
|
+
return $[0] !== editorActor ? (t0 = () => {
|
|
18923
19010
|
const subscription = editorActor.on("selection", (event) => {
|
|
18924
19011
|
startTransition(() => {
|
|
18925
19012
|
setSelection2(event.selection);
|
|
@@ -18928,7 +19015,7 @@ const usePortableTextEditorSelection = () => {
|
|
|
18928
19015
|
return () => {
|
|
18929
19016
|
subscription.unsubscribe();
|
|
18930
19017
|
};
|
|
18931
|
-
},
|
|
19018
|
+
}, t1 = [editorActor], $[0] = editorActor, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), useEffect(t0, t1), selection;
|
|
18932
19019
|
};
|
|
18933
19020
|
function defineContainer(config) {
|
|
18934
19021
|
return {
|