@portabletext/editor 2.13.2 → 2.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_chunks-cjs/{selector.is-selection-expanded.cjs → selector.get-selection-text.cjs} +25 -25
- package/lib/_chunks-cjs/selector.get-selection-text.cjs.map +1 -0
- package/lib/_chunks-cjs/selector.get-text-before.cjs +4 -4
- package/lib/_chunks-cjs/selector.get-text-before.cjs.map +1 -1
- package/lib/_chunks-cjs/{selector.is-selecting-entire-blocks.cjs → selector.is-active-style.cjs} +408 -399
- package/lib/_chunks-cjs/selector.is-active-style.cjs.map +1 -0
- package/lib/_chunks-cjs/util.child-selection-point-to-block-offset.cjs +3 -3
- package/lib/_chunks-cjs/util.child-selection-point-to-block-offset.cjs.map +1 -1
- package/lib/_chunks-cjs/{util.slice-blocks.cjs → util.get-text-block-text.cjs} +25 -26
- package/lib/_chunks-cjs/util.get-text-block-text.cjs.map +1 -0
- package/lib/_chunks-cjs/{util.is-selection-collapsed.cjs → util.is-empty-text-block.cjs} +9 -9
- package/lib/_chunks-cjs/util.is-empty-text-block.cjs.map +1 -0
- package/lib/_chunks-cjs/util.merge-text-blocks.cjs +2 -2
- package/lib/_chunks-cjs/util.merge-text-blocks.cjs.map +1 -1
- package/lib/_chunks-cjs/util.slice-text-block.cjs +5 -5
- package/lib/_chunks-cjs/util.slice-text-block.cjs.map +1 -1
- package/lib/_chunks-dts/behavior.types.action.d.cts +270 -270
- package/lib/_chunks-dts/behavior.types.action.d.ts +273 -273
- package/lib/_chunks-es/{selector.is-selection-expanded.js → selector.get-selection-text.js} +20 -20
- package/lib/_chunks-es/selector.get-selection-text.js.map +1 -0
- package/lib/_chunks-es/selector.get-text-before.js +2 -2
- package/lib/_chunks-es/selector.get-text-before.js.map +1 -1
- package/lib/_chunks-es/{selector.is-selecting-entire-blocks.js → selector.is-active-style.js} +385 -376
- package/lib/_chunks-es/selector.is-active-style.js.map +1 -0
- package/lib/_chunks-es/util.child-selection-point-to-block-offset.js +1 -1
- package/lib/_chunks-es/util.child-selection-point-to-block-offset.js.map +1 -1
- package/lib/_chunks-es/{util.slice-blocks.js → util.get-text-block-text.js} +25 -26
- package/lib/_chunks-es/util.get-text-block-text.js.map +1 -0
- package/lib/_chunks-es/{util.is-selection-collapsed.js → util.is-empty-text-block.js} +8 -8
- package/lib/_chunks-es/util.is-empty-text-block.js.map +1 -0
- package/lib/_chunks-es/util.merge-text-blocks.js +1 -1
- package/lib/_chunks-es/util.merge-text-blocks.js.map +1 -1
- package/lib/_chunks-es/util.slice-text-block.js +1 -1
- package/lib/_chunks-es/util.slice-text-block.js.map +1 -1
- package/lib/index.cjs +429 -363
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +225 -159
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.cjs +21 -21
- package/lib/plugins/index.cjs.map +1 -1
- package/lib/plugins/index.d.cts +4 -4
- package/lib/plugins/index.d.ts +4 -4
- package/lib/plugins/index.js +3 -3
- package/lib/plugins/index.js.map +1 -1
- package/lib/selectors/index.cjs +52 -52
- package/lib/selectors/index.cjs.map +1 -1
- package/lib/selectors/index.d.cts +4 -1
- package/lib/selectors/index.d.ts +4 -1
- package/lib/selectors/index.js +5 -5
- package/lib/selectors/index.js.map +1 -1
- package/lib/utils/index.cjs +14 -14
- package/lib/utils/index.cjs.map +1 -1
- package/lib/utils/index.d.ts +2 -2
- package/lib/utils/index.js +3 -3
- package/lib/utils/index.js.map +1 -1
- package/package.json +12 -12
- package/src/behaviors/behavior.abstract.annotation.ts +3 -3
- package/src/behaviors/behavior.abstract.decorator.ts +2 -2
- package/src/behaviors/behavior.abstract.delete.ts +25 -16
- package/src/behaviors/behavior.abstract.deserialize.ts +4 -3
- package/src/behaviors/behavior.abstract.insert.ts +6 -7
- package/src/behaviors/behavior.abstract.keyboard.ts +7 -8
- package/src/behaviors/behavior.abstract.list-item.ts +2 -1
- package/src/behaviors/behavior.abstract.move.ts +2 -1
- package/src/behaviors/behavior.abstract.select.ts +4 -2
- package/src/behaviors/behavior.abstract.split.ts +33 -24
- package/src/behaviors/behavior.abstract.style.ts +2 -1
- package/src/behaviors/behavior.abstract.ts +8 -7
- package/src/behaviors/behavior.core.annotations.ts +8 -7
- package/src/behaviors/behavior.core.block-element.ts +7 -5
- package/src/behaviors/behavior.core.block-objects.ts +25 -27
- package/src/behaviors/behavior.core.dnd.ts +10 -8
- package/src/behaviors/behavior.core.insert-break.ts +45 -36
- package/src/behaviors/behavior.core.lists.ts +31 -25
- package/src/behaviors/behavior.decorator-pair.ts +26 -23
- package/src/behaviors/behavior.markdown.ts +26 -21
- package/src/converters/converter.portable-text.ts +3 -3
- package/src/converters/converter.text-html.serialize.test.ts +1 -1
- package/src/converters/converter.text-html.ts +3 -3
- package/src/converters/converter.text-plain.test.ts +1 -1
- package/src/converters/converter.text-plain.ts +3 -3
- package/src/editor/Editable.tsx +18 -78
- package/src/editor/components/render-span.tsx +3 -5
- package/src/editor/create-editor.ts +2 -2
- package/src/editor/create-slate-editor.tsx +1 -4
- package/src/editor/editor-dom.ts +2 -2
- package/src/editor/plugins/createWithEditableAPI.ts +5 -10
- package/src/editor/plugins/createWithMaxBlocks.ts +2 -2
- package/src/editor/plugins/createWithObjectKeys.ts +2 -2
- package/src/editor/plugins/createWithPatches.ts +3 -10
- package/src/editor/plugins/createWithPlaceholderBlock.ts +2 -2
- package/src/editor/plugins/createWithPortableTextMarkModel.ts +2 -2
- package/src/editor/plugins/createWithSchemaTypes.ts +1 -1
- package/src/editor/plugins/createWithUndoRedo.ts +6 -6
- package/src/editor/plugins/slate-plugin.update-selection.ts +1 -1
- package/src/editor/sync-machine.ts +2 -5
- package/src/editor/validate-selection-machine.test.ts +47 -0
- package/src/editor/validate-selection-machine.ts +149 -0
- package/src/{internal-utils → editor}/weakMaps.ts +1 -1
- package/src/editor/with-undo-step.ts +1 -1
- package/src/index.ts +1 -1
- package/src/internal-utils/applyPatch.ts +2 -2
- package/src/internal-utils/build-index-maps.test.ts +1 -1
- package/src/internal-utils/create-test-snapshot.ts +1 -1
- package/src/internal-utils/event-position.ts +11 -9
- package/src/internal-utils/operation-to-patches.test.ts +1 -1
- package/src/internal-utils/portable-text-node.ts +1 -1
- package/src/internal-utils/selection-block-keys.ts +1 -1
- package/src/internal-utils/selection-focus-text.ts +1 -1
- package/src/internal-utils/to-slate-range.ts +4 -4
- package/src/operations/behavior.operation.annotation.add.ts +1 -1
- package/src/operations/behavior.operation.block.set.ts +1 -1
- package/src/operations/behavior.operation.block.unset.ts +2 -2
- package/src/operations/behavior.operation.decorator.add.ts +11 -9
- package/src/operations/behavior.operation.delete.ts +1 -1
- package/src/operations/behavior.operation.insert.block.ts +2 -2
- package/src/operations/behavior.operation.insert.child.ts +1 -1
- package/src/operations/behavior.operation.move.block.ts +1 -1
- package/src/plugins/plugin.behavior.tsx +1 -1
- package/src/plugins/plugin.decorator-shortcut.ts +3 -3
- package/src/plugins/plugin.internal.auto-close-brackets.ts +2 -1
- package/src/plugins/plugin.one-line.tsx +11 -11
- package/src/priority/priority.types.ts +1 -1
- package/src/{internal-utils → selectors}/drag-selection.test.ts +1 -1
- package/src/{internal-utils → selectors}/drag-selection.ts +26 -19
- package/src/selectors/index.ts +1 -1
- package/src/selectors/selector.get-anchor-block.ts +1 -1
- package/src/selectors/selector.get-anchor-child.ts +1 -1
- package/src/selectors/selector.get-block-offsets.ts +3 -3
- package/src/selectors/selector.get-caret-word-selection.test.ts +1 -1
- package/src/selectors/selector.get-focus-block.ts +1 -1
- package/src/selectors/selector.get-focus-child.ts +1 -1
- package/src/selectors/selector.get-focus-list-block.ts +1 -1
- package/src/selectors/selector.get-list-state.test.ts +1 -1
- package/src/selectors/selector.get-mark-state.ts +4 -1
- package/src/selectors/selector.get-next-inline-object.ts +1 -1
- package/src/selectors/selector.get-next-span.ts +1 -1
- package/src/selectors/selector.get-previous-inline-object.ts +1 -1
- package/src/selectors/selector.get-previous-span.ts +1 -1
- package/src/selectors/selector.get-selected-blocks.ts +1 -1
- package/src/selectors/selector.get-selected-spans.test.ts +1 -1
- package/src/selectors/selector.get-selected-spans.ts +2 -2
- package/src/selectors/selector.get-selected-text-blocks.ts +3 -2
- package/src/selectors/selector.get-selected-value.test.ts +87 -1
- package/src/selectors/selector.get-selected-value.ts +4 -6
- package/src/selectors/selector.get-selection-end-point.ts +1 -1
- package/src/selectors/selector.get-selection-start-point.ts +1 -1
- package/src/selectors/selector.get-selection-text.test.ts +1 -1
- package/src/selectors/selector.get-selection.ts +1 -1
- package/src/selectors/selector.get-text-before.ts +1 -1
- package/src/selectors/selector.get-trimmed-selection.test.ts +1 -1
- package/src/selectors/selector.get-trimmed-selection.ts +5 -7
- package/src/selectors/selector.is-active-decorator.test.ts +2 -1
- package/src/selectors/selector.is-at-the-end-of-block.ts +4 -3
- package/src/selectors/selector.is-at-the-start-of-block.ts +4 -3
- package/src/selectors/selector.is-overlapping-selection.test.ts +1 -1
- package/src/selectors/selector.is-overlapping-selection.ts +1 -1
- package/src/selectors/selector.is-point-after-selection.ts +3 -3
- package/src/selectors/selector.is-point-before-selection.ts +3 -3
- package/src/selectors/selector.is-selecting-entire-blocks.ts +7 -5
- package/src/test/gherkin-parameter-types.ts +1 -1
- package/src/test/vitest/step-definitions.tsx +19 -9
- package/src/types/paths.ts +4 -1
- package/src/utils/util.at-the-beginning-of-block.ts +1 -1
- package/src/utils/util.block-offset.ts +4 -4
- package/src/utils/util.block-offsets-to-selection.ts +1 -1
- package/src/utils/util.child-selection-point-to-block-offset.ts +3 -3
- package/src/utils/util.get-selection-end-point.ts +1 -1
- package/src/utils/util.get-selection-start-point.ts +1 -1
- package/src/utils/util.merge-text-blocks.ts +2 -2
- package/src/utils/util.selection-point-to-block-offset.ts +1 -1
- package/src/{selection/selection-point.ts → utils/util.selection-point.ts} +1 -1
- package/src/utils/util.slice-blocks.ts +6 -6
- package/src/utils/util.slice-text-block.test.ts +3 -1
- package/src/utils/util.slice-text-block.ts +3 -3
- package/src/utils/util.split-text-block.ts +1 -1
- package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs.map +0 -1
- package/lib/_chunks-cjs/selector.is-selection-expanded.cjs.map +0 -1
- package/lib/_chunks-cjs/util.is-selection-collapsed.cjs.map +0 -1
- package/lib/_chunks-cjs/util.slice-blocks.cjs.map +0 -1
- package/lib/_chunks-es/selector.is-selecting-entire-blocks.js.map +0 -1
- package/lib/_chunks-es/selector.is-selection-expanded.js.map +0 -1
- package/lib/_chunks-es/util.is-selection-collapsed.js.map +0 -1
- package/lib/_chunks-es/util.slice-blocks.js.map +0 -1
- /package/src/{internal-utils → editor}/withChanges.ts +0 -0
- /package/src/{internal-utils → editor}/withUndoRedo.ts +0 -0
- /package/src/{internal-utils → editor}/withoutPatching.ts +0 -0
- /package/src/{internal-utils → utils}/asserters.ts +0 -0
- /package/src/{editor → utils}/key-generator.ts +0 -0
- /package/src/{internal-utils → utils}/parse-blocks.test.ts +0 -0
- /package/src/{internal-utils → utils}/parse-blocks.ts +0 -0
package/lib/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var reactCompilerRuntime = require("react-compiler-runtime"), React = require("react"), useEditor = require("./_chunks-cjs/use-editor.cjs"), jsxRuntime = require("react/jsx-runtime"), react = require("@xstate/react"), noop = require("lodash/noop.js"), slate = require("slate"), slateReact = require("slate-react"), debug$
|
|
3
|
+
var reactCompilerRuntime = require("react-compiler-runtime"), React = require("react"), useEditor = require("./_chunks-cjs/use-editor.cjs"), jsxRuntime = require("react/jsx-runtime"), react = require("@xstate/react"), noop = require("lodash/noop.js"), slate = require("slate"), slateReact = require("slate-react"), debug$g = require("debug"), slateDom = require("slate-dom"), util_isEmptyTextBlock = require("./_chunks-cjs/util.is-empty-text-block.cjs"), util_getTextBlockText = require("./_chunks-cjs/util.get-text-block-text.cjs"), isEqual = require("lodash/isEqual.js"), schema = require("@portabletext/schema"), selector_isActiveStyle = require("./_chunks-cjs/selector.is-active-style.cjs"), selector_getSelectionText = require("./_chunks-cjs/selector.get-selection-text.cjs"), behaviors_index = require("./behaviors/index.cjs"), uniq = require("lodash/uniq.js"), xstate = require("xstate"), sanityBridge = require("@portabletext/sanity-bridge"), blockTools = require("@portabletext/block-tools"), toHtml = require("@portabletext/to-html"), schema$1 = require("@sanity/schema"), flatten = require("lodash/flatten.js"), omit = require("lodash/omit.js"), patches = require("@portabletext/patches"), util_childSelectionPointToBlockOffset = require("./_chunks-cjs/util.child-selection-point-to-block-offset.cjs"), util_sliceTextBlock = require("./_chunks-cjs/util.slice-text-block.cjs"), get = require("lodash/get.js"), isUndefined = require("lodash/isUndefined.js"), omitBy = require("lodash/omitBy.js"), immer = require("immer"), keyboardShortcuts = require("@portabletext/keyboard-shortcuts"), isPlainObject = require("lodash/isPlainObject.js"), rxjs = require("rxjs");
|
|
4
4
|
function _interopDefaultCompat(e) {
|
|
5
5
|
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
6
6
|
}
|
|
7
|
-
var noop__default = /* @__PURE__ */ _interopDefaultCompat(noop), debug__default = /* @__PURE__ */ _interopDefaultCompat(debug$
|
|
7
|
+
var noop__default = /* @__PURE__ */ _interopDefaultCompat(noop), debug__default = /* @__PURE__ */ _interopDefaultCompat(debug$g), isEqual__default = /* @__PURE__ */ _interopDefaultCompat(isEqual), uniq__default = /* @__PURE__ */ _interopDefaultCompat(uniq), flatten__default = /* @__PURE__ */ _interopDefaultCompat(flatten), omit__default = /* @__PURE__ */ _interopDefaultCompat(omit), get__default = /* @__PURE__ */ _interopDefaultCompat(get), isUndefined__default = /* @__PURE__ */ _interopDefaultCompat(isUndefined), omitBy__default = /* @__PURE__ */ _interopDefaultCompat(omitBy), isPlainObject__default = /* @__PURE__ */ _interopDefaultCompat(isPlainObject);
|
|
8
8
|
function EditorEventListener(props) {
|
|
9
9
|
const $ = reactCompilerRuntime.c(4), editor = useEditor.useEditor();
|
|
10
10
|
let t0, t1;
|
|
@@ -387,7 +387,7 @@ function getEventPosition({
|
|
|
387
387
|
block: eventPositionBlock,
|
|
388
388
|
isEditor: !1,
|
|
389
389
|
selection: {
|
|
390
|
-
anchor:
|
|
390
|
+
anchor: util_getTextBlockText.getBlockStartPoint({
|
|
391
391
|
context: editorActor.getSnapshot().context,
|
|
392
392
|
block: {
|
|
393
393
|
node: eventBlock,
|
|
@@ -396,7 +396,7 @@ function getEventPosition({
|
|
|
396
396
|
}]
|
|
397
397
|
}
|
|
398
398
|
}),
|
|
399
|
-
focus:
|
|
399
|
+
focus: util_isEmptyTextBlock.getBlockEndPoint({
|
|
400
400
|
context: editorActor.getSnapshot().context,
|
|
401
401
|
block: {
|
|
402
402
|
node: eventBlock,
|
|
@@ -409,13 +409,13 @@ function getEventPosition({
|
|
|
409
409
|
};
|
|
410
410
|
if (!eventPositionBlock || !eventSelection)
|
|
411
411
|
return;
|
|
412
|
-
const eventSelectionFocusBlockKey =
|
|
412
|
+
const eventSelectionFocusBlockKey = util_getTextBlockText.getBlockKeyFromSelectionPoint(eventSelection.focus);
|
|
413
413
|
if (eventSelectionFocusBlockKey !== void 0)
|
|
414
|
-
return
|
|
414
|
+
return util_isEmptyTextBlock.isSelectionCollapsed(eventSelection) && eventBlock && eventSelectionFocusBlockKey !== eventBlock._key ? {
|
|
415
415
|
block: eventPositionBlock,
|
|
416
416
|
isEditor: !1,
|
|
417
417
|
selection: {
|
|
418
|
-
anchor:
|
|
418
|
+
anchor: util_getTextBlockText.getBlockStartPoint({
|
|
419
419
|
context: editorActor.getSnapshot().context,
|
|
420
420
|
block: {
|
|
421
421
|
node: eventBlock,
|
|
@@ -424,7 +424,7 @@ function getEventPosition({
|
|
|
424
424
|
}]
|
|
425
425
|
}
|
|
426
426
|
}),
|
|
427
|
-
focus:
|
|
427
|
+
focus: util_isEmptyTextBlock.getBlockEndPoint({
|
|
428
428
|
context: editorActor.getSnapshot().context,
|
|
429
429
|
block: {
|
|
430
430
|
node: eventBlock,
|
|
@@ -562,7 +562,7 @@ function normalizeSelection(selection, value) {
|
|
|
562
562
|
function toSlateRange(snapshot) {
|
|
563
563
|
if (!snapshot.context.selection)
|
|
564
564
|
return null;
|
|
565
|
-
if (
|
|
565
|
+
if (util_isEmptyTextBlock.isEqualSelectionPoints(snapshot.context.selection.anchor, snapshot.context.selection.focus)) {
|
|
566
566
|
const anchorPoint2 = toSlateSelectionPoint(snapshot, snapshot.context.selection.anchor, snapshot.context.selection.backward ? "forward" : "backward");
|
|
567
567
|
return anchorPoint2 ? {
|
|
568
568
|
anchor: anchorPoint2,
|
|
@@ -576,7 +576,7 @@ function toSlateRange(snapshot) {
|
|
|
576
576
|
};
|
|
577
577
|
}
|
|
578
578
|
function toSlateSelectionPoint(snapshot, selectionPoint, direction) {
|
|
579
|
-
const blockKey =
|
|
579
|
+
const blockKey = util_getTextBlockText.getBlockKeyFromSelectionPoint(selectionPoint);
|
|
580
580
|
if (!blockKey)
|
|
581
581
|
return;
|
|
582
582
|
const blockIndex = snapshot.blockIndexMap.get(blockKey);
|
|
@@ -590,10 +590,10 @@ function toSlateSelectionPoint(snapshot, selectionPoint, direction) {
|
|
|
590
590
|
path: [blockIndex, 0],
|
|
591
591
|
offset: 0
|
|
592
592
|
};
|
|
593
|
-
let childKey =
|
|
593
|
+
let childKey = util_getTextBlockText.getChildKeyFromSelectionPoint({
|
|
594
594
|
path: selectionPoint.path
|
|
595
595
|
});
|
|
596
|
-
const spanSelectionPoint = childKey ? void 0 :
|
|
596
|
+
const spanSelectionPoint = childKey ? void 0 : util_getTextBlockText.blockOffsetToSpanSelectionPoint({
|
|
597
597
|
context: {
|
|
598
598
|
schema: snapshot.context.schema,
|
|
599
599
|
value: [block]
|
|
@@ -606,7 +606,7 @@ function toSlateSelectionPoint(snapshot, selectionPoint, direction) {
|
|
|
606
606
|
},
|
|
607
607
|
direction
|
|
608
608
|
});
|
|
609
|
-
if (childKey = spanSelectionPoint ?
|
|
609
|
+
if (childKey = spanSelectionPoint ? util_getTextBlockText.getChildKeyFromSelectionPoint(spanSelectionPoint) : childKey, !childKey)
|
|
610
610
|
return {
|
|
611
611
|
path: [blockIndex, 0],
|
|
612
612
|
offset: 0
|
|
@@ -625,7 +625,7 @@ function toSlateSelectionPoint(snapshot, selectionPoint, direction) {
|
|
|
625
625
|
offset: schema.isSpan(snapshot.context, pathChild) ? Math.min(pathChild.text.length, offset) : offset
|
|
626
626
|
};
|
|
627
627
|
}
|
|
628
|
-
const
|
|
628
|
+
const EditorActorContext = React.createContext({});
|
|
629
629
|
function DropIndicator() {
|
|
630
630
|
const $ = reactCompilerRuntime.c(1);
|
|
631
631
|
let t0;
|
|
@@ -667,12 +667,22 @@ function RenderDefaultInlineObject(props) {
|
|
|
667
667
|
"]"
|
|
668
668
|
] }), $[1] = props.inlineObject._key, $[2] = props.inlineObject._type, $[3] = t1) : t1 = $[3], t1;
|
|
669
669
|
}
|
|
670
|
+
function createEditorPriority(config) {
|
|
671
|
+
return {
|
|
672
|
+
id: util_getTextBlockText.defaultKeyGenerator(),
|
|
673
|
+
name: config?.name,
|
|
674
|
+
reference: config?.reference
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
const corePriority = createEditorPriority({
|
|
678
|
+
name: "core"
|
|
679
|
+
});
|
|
670
680
|
function getDragSelection({
|
|
671
681
|
eventSelection,
|
|
672
682
|
snapshot
|
|
673
683
|
}) {
|
|
674
684
|
let dragSelection = eventSelection;
|
|
675
|
-
if (
|
|
685
|
+
if (selector_isActiveStyle.getFocusInlineObject({
|
|
676
686
|
...snapshot,
|
|
677
687
|
context: {
|
|
678
688
|
...snapshot.context,
|
|
@@ -680,18 +690,18 @@ function getDragSelection({
|
|
|
680
690
|
}
|
|
681
691
|
}))
|
|
682
692
|
return dragSelection;
|
|
683
|
-
const draggingCollapsedSelection =
|
|
693
|
+
const draggingCollapsedSelection = selector_getSelectionText.isSelectionCollapsed({
|
|
684
694
|
context: {
|
|
685
695
|
...snapshot.context,
|
|
686
696
|
selection: eventSelection
|
|
687
697
|
}
|
|
688
|
-
}), draggedTextBlock =
|
|
698
|
+
}), draggedTextBlock = selector_getSelectionText.getFocusTextBlock({
|
|
689
699
|
...snapshot,
|
|
690
700
|
context: {
|
|
691
701
|
...snapshot.context,
|
|
692
702
|
selection: eventSelection
|
|
693
703
|
}
|
|
694
|
-
}), draggedSpan =
|
|
704
|
+
}), draggedSpan = selector_getSelectionText.getFocusSpan({
|
|
695
705
|
...snapshot,
|
|
696
706
|
context: {
|
|
697
707
|
...snapshot.context,
|
|
@@ -699,28 +709,28 @@ function getDragSelection({
|
|
|
699
709
|
}
|
|
700
710
|
});
|
|
701
711
|
draggingCollapsedSelection && draggedTextBlock && draggedSpan && (dragSelection = {
|
|
702
|
-
anchor:
|
|
712
|
+
anchor: util_getTextBlockText.getBlockStartPoint({
|
|
703
713
|
context: snapshot.context,
|
|
704
714
|
block: draggedTextBlock
|
|
705
715
|
}),
|
|
706
|
-
focus:
|
|
716
|
+
focus: util_isEmptyTextBlock.getBlockEndPoint({
|
|
707
717
|
context: snapshot.context,
|
|
708
718
|
block: draggedTextBlock
|
|
709
719
|
})
|
|
710
720
|
});
|
|
711
|
-
const selectedBlocks =
|
|
712
|
-
if (snapshot.context.selection &&
|
|
713
|
-
const selectionStartBlock =
|
|
721
|
+
const selectedBlocks = selector_isActiveStyle.getSelectedBlocks(snapshot);
|
|
722
|
+
if (snapshot.context.selection && selector_getSelectionText.isSelectionExpanded(snapshot) && selectedBlocks.length > 1) {
|
|
723
|
+
const selectionStartBlock = selector_isActiveStyle.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isActiveStyle.getSelectionEndBlock(snapshot);
|
|
714
724
|
if (!selectionStartBlock || !selectionEndBlock)
|
|
715
725
|
return dragSelection;
|
|
716
|
-
const selectionStartPoint =
|
|
726
|
+
const selectionStartPoint = util_getTextBlockText.getBlockStartPoint({
|
|
717
727
|
context: snapshot.context,
|
|
718
728
|
block: selectionStartBlock
|
|
719
|
-
}), selectionEndPoint =
|
|
729
|
+
}), selectionEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
|
|
720
730
|
context: snapshot.context,
|
|
721
731
|
block: selectionEndBlock
|
|
722
732
|
});
|
|
723
|
-
|
|
733
|
+
selector_isActiveStyle.isOverlappingSelection(eventSelection)({
|
|
724
734
|
...snapshot,
|
|
725
735
|
context: {
|
|
726
736
|
...snapshot.context,
|
|
@@ -736,16 +746,6 @@ function getDragSelection({
|
|
|
736
746
|
}
|
|
737
747
|
return dragSelection;
|
|
738
748
|
}
|
|
739
|
-
function createEditorPriority(config) {
|
|
740
|
-
return {
|
|
741
|
-
id: util_sliceBlocks.defaultKeyGenerator(),
|
|
742
|
-
name: config?.name,
|
|
743
|
-
reference: config?.reference
|
|
744
|
-
};
|
|
745
|
-
}
|
|
746
|
-
const corePriority = createEditorPriority({
|
|
747
|
-
name: "core"
|
|
748
|
-
});
|
|
749
749
|
function createCoreBlockElementBehaviorsConfig({
|
|
750
750
|
key,
|
|
751
751
|
onSetDragPositionBlock
|
|
@@ -757,7 +757,7 @@ function createCoreBlockElementBehaviorsConfig({
|
|
|
757
757
|
snapshot,
|
|
758
758
|
event
|
|
759
759
|
}) => {
|
|
760
|
-
const dropFocusBlock =
|
|
760
|
+
const dropFocusBlock = selector_getSelectionText.getFocusBlock({
|
|
761
761
|
...snapshot,
|
|
762
762
|
context: {
|
|
763
763
|
...snapshot.context,
|
|
@@ -773,13 +773,13 @@ function createCoreBlockElementBehaviorsConfig({
|
|
|
773
773
|
eventSelection: dragOrigin.selection,
|
|
774
774
|
snapshot
|
|
775
775
|
});
|
|
776
|
-
return
|
|
776
|
+
return selector_isActiveStyle.getSelectedBlocks({
|
|
777
777
|
...snapshot,
|
|
778
778
|
context: {
|
|
779
779
|
...snapshot.context,
|
|
780
780
|
selection: dragSelection
|
|
781
781
|
}
|
|
782
|
-
}).some((draggedBlock) => draggedBlock.node._key === key) ? !1 :
|
|
782
|
+
}).some((draggedBlock) => draggedBlock.node._key === key) ? !1 : selector_isActiveStyle.isSelectingEntireBlocks({
|
|
783
783
|
...snapshot,
|
|
784
784
|
context: {
|
|
785
785
|
...snapshot.context,
|
|
@@ -1226,9 +1226,9 @@ function RenderSpan(props) {
|
|
|
1226
1226
|
editorActorSnapshot,
|
|
1227
1227
|
slateEditorInstance: slateEditor
|
|
1228
1228
|
});
|
|
1229
|
-
if (!snapshot.context.selection || !
|
|
1229
|
+
if (!snapshot.context.selection || !selector_getSelectionText.isSelectionCollapsed(snapshot))
|
|
1230
1230
|
return !1;
|
|
1231
|
-
const focusedSpan =
|
|
1231
|
+
const focusedSpan = selector_getSelectionText.getFocusSpan(snapshot);
|
|
1232
1232
|
return focusedSpan ? focusedSpan.node._key === props.leaf._key : !1;
|
|
1233
1233
|
}, $[0] = props.leaf._key, $[1] = slateEditor, $[2] = t0) : t0 = $[2];
|
|
1234
1234
|
const focused = react.useSelector(editorActor, t0);
|
|
@@ -1258,7 +1258,7 @@ function RenderSpan(props) {
|
|
|
1258
1258
|
offset: props.leaf.text.length
|
|
1259
1259
|
}
|
|
1260
1260
|
} : null;
|
|
1261
|
-
return
|
|
1261
|
+
return selector_isActiveStyle.isOverlappingSelection(spanSelection)(snapshot_0);
|
|
1262
1262
|
}, $[3] = props.children.props.parent, $[4] = props.leaf._key, $[5] = props.leaf.text, $[6] = slateEditor, $[7] = t1) : t1 = $[7];
|
|
1263
1263
|
const selected = react.useSelector(editorActor, t1), parent_0 = props.children.props.parent, block_0 = parent_0 && slateEditor.isTextBlock(parent_0) ? parent_0 : void 0;
|
|
1264
1264
|
let t2;
|
|
@@ -1539,7 +1539,7 @@ function toKeyName(name) {
|
|
|
1539
1539
|
const keyName = name.toLowerCase();
|
|
1540
1540
|
return aliases[keyName] ?? keyName;
|
|
1541
1541
|
}
|
|
1542
|
-
const debug$
|
|
1542
|
+
const debug$f = debugWithName("plugin:withHotKeys");
|
|
1543
1543
|
function createWithHotkeys(editorActor, portableTextEditor, hotkeysFromOptions) {
|
|
1544
1544
|
const reservedHotkeys = ["enter", "tab", "shift", "delete", "end"], activeHotkeys = hotkeysFromOptions ?? {};
|
|
1545
1545
|
return function(editor) {
|
|
@@ -1554,7 +1554,7 @@ function createWithHotkeys(editorActor, portableTextEditor, hotkeysFromOptions)
|
|
|
1554
1554
|
const possibleMark = activeHotkeys[cat];
|
|
1555
1555
|
if (possibleMark) {
|
|
1556
1556
|
const mark = possibleMark[hotkey];
|
|
1557
|
-
debug$
|
|
1557
|
+
debug$f(`HotKey ${hotkey} to toggle ${mark}`), editorActor.send({
|
|
1558
1558
|
type: "behavior event",
|
|
1559
1559
|
behaviorEvent: {
|
|
1560
1560
|
type: "decorator.toggle",
|
|
@@ -1883,8 +1883,85 @@ function createDecorate(schema2, slateEditor) {
|
|
|
1883
1883
|
}) || slate.Range.includes(decoratedRange, path));
|
|
1884
1884
|
};
|
|
1885
1885
|
}
|
|
1886
|
-
const RelayActorContext = React.createContext({}), debug$
|
|
1887
|
-
|
|
1886
|
+
const RelayActorContext = React.createContext({}), debug$e = debugWithName("validate selection machine"), validateSelectionSetup = xstate.setup({
|
|
1887
|
+
types: {
|
|
1888
|
+
context: {},
|
|
1889
|
+
input: {},
|
|
1890
|
+
events: {}
|
|
1891
|
+
},
|
|
1892
|
+
guards: {
|
|
1893
|
+
"pending operations": ({
|
|
1894
|
+
context
|
|
1895
|
+
}) => context.slateEditor.operations.length > 0
|
|
1896
|
+
}
|
|
1897
|
+
}), validateSelectionAction = validateSelectionSetup.createAction(({
|
|
1898
|
+
context,
|
|
1899
|
+
event
|
|
1900
|
+
}) => {
|
|
1901
|
+
validateSelection(context.slateEditor, event.editorElement);
|
|
1902
|
+
}), validateSelectionMachine = validateSelectionSetup.createMachine({
|
|
1903
|
+
id: "validate selection",
|
|
1904
|
+
context: ({
|
|
1905
|
+
input
|
|
1906
|
+
}) => ({
|
|
1907
|
+
slateEditor: input.slateEditor
|
|
1908
|
+
}),
|
|
1909
|
+
initial: "idle",
|
|
1910
|
+
states: {
|
|
1911
|
+
idle: {
|
|
1912
|
+
on: {
|
|
1913
|
+
"validate selection": [{
|
|
1914
|
+
guard: "pending operations",
|
|
1915
|
+
target: "waiting"
|
|
1916
|
+
}, {
|
|
1917
|
+
actions: [validateSelectionAction],
|
|
1918
|
+
target: "idle"
|
|
1919
|
+
}]
|
|
1920
|
+
}
|
|
1921
|
+
},
|
|
1922
|
+
waiting: {
|
|
1923
|
+
after: {
|
|
1924
|
+
0: [{
|
|
1925
|
+
guard: "pending operations",
|
|
1926
|
+
target: ".",
|
|
1927
|
+
reenter: !0
|
|
1928
|
+
}, {
|
|
1929
|
+
target: "idle",
|
|
1930
|
+
actions: [validateSelectionAction]
|
|
1931
|
+
}]
|
|
1932
|
+
},
|
|
1933
|
+
on: {
|
|
1934
|
+
"validate selection": {
|
|
1935
|
+
target: ".",
|
|
1936
|
+
reenter: !0
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
});
|
|
1942
|
+
function validateSelection(slateEditor, editorElement) {
|
|
1943
|
+
if (!slateEditor.selection)
|
|
1944
|
+
return;
|
|
1945
|
+
let root;
|
|
1946
|
+
try {
|
|
1947
|
+
root = slateReact.ReactEditor.findDocumentOrShadowRoot(slateEditor);
|
|
1948
|
+
} catch {
|
|
1949
|
+
}
|
|
1950
|
+
if (!root || editorElement !== root.activeElement)
|
|
1951
|
+
return;
|
|
1952
|
+
const domSelection = slateReact.ReactEditor.getWindow(slateEditor).getSelection();
|
|
1953
|
+
if (!domSelection || domSelection.rangeCount === 0)
|
|
1954
|
+
return;
|
|
1955
|
+
const existingDOMRange = domSelection.getRangeAt(0);
|
|
1956
|
+
try {
|
|
1957
|
+
const newDOMRange = slateReact.ReactEditor.toDOMRange(slateEditor, slateEditor.selection);
|
|
1958
|
+
(newDOMRange.startOffset !== existingDOMRange.startOffset || newDOMRange.endOffset !== existingDOMRange.endOffset) && (debug$e("DOM range out of sync, validating selection"), domSelection?.removeAllRanges(), domSelection.addRange(newDOMRange));
|
|
1959
|
+
} catch {
|
|
1960
|
+
debug$e("Could not resolve selection, selecting top document"), slate.Transforms.deselect(slateEditor), slateEditor.children.length > 0 && slate.Transforms.select(slateEditor, slate.Editor.start(slateEditor, [])), slateEditor.onChange();
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
const IS_PROCESSING_REMOTE_CHANGES = /* @__PURE__ */ new WeakMap(), KEY_TO_SLATE_ELEMENT = /* @__PURE__ */ new WeakMap(), KEY_TO_VALUE_ELEMENT = /* @__PURE__ */ new WeakMap(), SLATE_TO_PORTABLE_TEXT_RANGE = /* @__PURE__ */ new WeakMap(), debug$d = debugWithName("component:Editable"), PortableTextEditable = React.forwardRef(function(props, forwardedRef) {
|
|
1964
|
+
const $ = reactCompilerRuntime.c(174);
|
|
1888
1965
|
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, spellCheck;
|
|
1889
1966
|
$[0] !== props ? ({
|
|
1890
1967
|
hotkeys,
|
|
@@ -1917,50 +1994,57 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
1917
1994
|
} = 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, $[27] = spellCheck) : (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], spellCheck = $[27]);
|
|
1918
1995
|
const portableTextEditor = usePortableTextEditor(), [hasInvalidValue, setHasInvalidValue] = React.useState(!1), editorActor = React.useContext(EditorActorContext), relayActor = React.useContext(RelayActorContext), readOnly = react.useSelector(editorActor, _temp), slateEditor = slateReact.useSlate();
|
|
1919
1996
|
let t0;
|
|
1920
|
-
$[28] !==
|
|
1997
|
+
$[28] !== slateEditor ? (t0 = {
|
|
1998
|
+
input: {
|
|
1999
|
+
slateEditor
|
|
2000
|
+
}
|
|
2001
|
+
}, $[28] = slateEditor, $[29] = t0) : t0 = $[29];
|
|
2002
|
+
const validateSelectionActor = react.useActorRef(validateSelectionMachine, t0);
|
|
1921
2003
|
let t1;
|
|
1922
|
-
$[30] !==
|
|
1923
|
-
|
|
2004
|
+
$[30] !== rangeDecorations ? (t1 = rangeDecorations ?? [], $[30] = rangeDecorations, $[31] = t1) : t1 = $[31];
|
|
2005
|
+
let t2;
|
|
2006
|
+
$[32] !== editorActor ? (t2 = editorActor.getSnapshot(), $[32] = editorActor, $[33] = t2) : t2 = $[33];
|
|
2007
|
+
const t3 = !editorActor.getSnapshot().matches({
|
|
1924
2008
|
setup: "setting up"
|
|
1925
2009
|
});
|
|
1926
|
-
let
|
|
1927
|
-
$[
|
|
2010
|
+
let t4;
|
|
2011
|
+
$[34] !== readOnly || $[35] !== slateEditor || $[36] !== t1 || $[37] !== t2.context.schema || $[38] !== t3 ? (t4 = {
|
|
1928
2012
|
input: {
|
|
1929
|
-
rangeDecorations:
|
|
2013
|
+
rangeDecorations: t1,
|
|
1930
2014
|
readOnly,
|
|
1931
|
-
schema:
|
|
2015
|
+
schema: t2.context.schema,
|
|
1932
2016
|
slateEditor,
|
|
1933
|
-
skipSetup:
|
|
2017
|
+
skipSetup: t3
|
|
1934
2018
|
}
|
|
1935
|
-
}, $[
|
|
1936
|
-
const rangeDecorationsActor = react.useActorRef(rangeDecorationsMachine,
|
|
1937
|
-
let
|
|
1938
|
-
$[
|
|
2019
|
+
}, $[34] = readOnly, $[35] = slateEditor, $[36] = t1, $[37] = t2.context.schema, $[38] = t3, $[39] = t4) : t4 = $[39];
|
|
2020
|
+
const rangeDecorationsActor = react.useActorRef(rangeDecorationsMachine, t4), decorate = react.useSelector(rangeDecorationsActor, _temp2);
|
|
2021
|
+
let t5, t6;
|
|
2022
|
+
$[40] !== rangeDecorationsActor || $[41] !== readOnly ? (t5 = () => {
|
|
1939
2023
|
rangeDecorationsActor.send({
|
|
1940
2024
|
type: "update read only",
|
|
1941
2025
|
readOnly
|
|
1942
2026
|
});
|
|
1943
|
-
},
|
|
1944
|
-
let
|
|
1945
|
-
$[
|
|
2027
|
+
}, t6 = [rangeDecorationsActor, readOnly], $[40] = rangeDecorationsActor, $[41] = readOnly, $[42] = t5, $[43] = t6) : (t5 = $[42], t6 = $[43]), React.useEffect(t5, t6);
|
|
2028
|
+
let t7, t8;
|
|
2029
|
+
$[44] !== rangeDecorations || $[45] !== rangeDecorationsActor ? (t7 = () => {
|
|
1946
2030
|
rangeDecorationsActor.send({
|
|
1947
2031
|
type: "range decorations updated",
|
|
1948
2032
|
rangeDecorations: rangeDecorations ?? []
|
|
1949
2033
|
});
|
|
1950
|
-
},
|
|
2034
|
+
}, t8 = [rangeDecorationsActor, rangeDecorations], $[44] = rangeDecorations, $[45] = rangeDecorationsActor, $[46] = t7, $[47] = t8) : (t7 = $[46], t8 = $[47]), React.useEffect(t7, t8);
|
|
1951
2035
|
bb0: {
|
|
1952
2036
|
if (readOnly)
|
|
1953
2037
|
break bb0;
|
|
1954
2038
|
createWithHotkeys(editorActor, portableTextEditor, hotkeys)(slateEditor);
|
|
1955
2039
|
}
|
|
1956
|
-
let t9;
|
|
1957
|
-
$[46] !== readOnly || $[47] !== renderBlock || $[48] !== renderChild || $[49] !== renderListItem || $[50] !== renderStyle || $[51] !== spellCheck ? (t9 = (eProps) => /* @__PURE__ */ jsxRuntime.jsx(RenderElement, { ...eProps, readOnly, renderBlock, renderChild, renderListItem, renderStyle, spellCheck }), $[46] = readOnly, $[47] = renderBlock, $[48] = renderChild, $[49] = renderListItem, $[50] = renderStyle, $[51] = spellCheck, $[52] = t9) : t9 = $[52];
|
|
1958
|
-
const renderElement = t9;
|
|
1959
2040
|
let t10;
|
|
1960
|
-
$[
|
|
1961
|
-
const
|
|
2041
|
+
$[48] !== readOnly || $[49] !== renderBlock || $[50] !== renderChild || $[51] !== renderListItem || $[52] !== renderStyle || $[53] !== spellCheck ? (t10 = (eProps) => /* @__PURE__ */ jsxRuntime.jsx(RenderElement, { ...eProps, readOnly, renderBlock, renderChild, renderListItem, renderStyle, spellCheck }), $[48] = readOnly, $[49] = renderBlock, $[50] = renderChild, $[51] = renderListItem, $[52] = renderStyle, $[53] = spellCheck, $[54] = t10) : t10 = $[54];
|
|
2042
|
+
const renderElement = t10;
|
|
1962
2043
|
let t11;
|
|
1963
|
-
$[
|
|
2044
|
+
$[55] !== readOnly || $[56] !== renderAnnotation || $[57] !== renderChild || $[58] !== renderDecorator || $[59] !== renderPlaceholder ? (t11 = (leafProps) => /* @__PURE__ */ jsxRuntime.jsx(RenderLeaf, { ...leafProps, readOnly, renderAnnotation, renderChild, renderDecorator, renderPlaceholder }), $[55] = readOnly, $[56] = renderAnnotation, $[57] = renderChild, $[58] = renderDecorator, $[59] = renderPlaceholder, $[60] = t11) : t11 = $[60];
|
|
2045
|
+
const renderLeaf = t11, renderText = _temp3;
|
|
2046
|
+
let t12;
|
|
2047
|
+
$[61] !== editorActor || $[62] !== propsSelection || $[63] !== slateEditor ? (t12 = () => {
|
|
1964
2048
|
if (propsSelection) {
|
|
1965
2049
|
debug$d(`Selection from props ${JSON.stringify(propsSelection)}`);
|
|
1966
2050
|
const normalizedSelection = normalizeSelection(propsSelection, fromSlateValue(slateEditor.children, editorActor.getSnapshot().context.schema.block.name));
|
|
@@ -1980,10 +2064,10 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
1980
2064
|
}), slateEditor.onChange());
|
|
1981
2065
|
}
|
|
1982
2066
|
}
|
|
1983
|
-
}, $[
|
|
1984
|
-
const restoreSelectionFromProps =
|
|
1985
|
-
let
|
|
1986
|
-
$[
|
|
2067
|
+
}, $[61] = editorActor, $[62] = propsSelection, $[63] = slateEditor, $[64] = t12) : t12 = $[64];
|
|
2068
|
+
const restoreSelectionFromProps = t12;
|
|
2069
|
+
let t13, t14;
|
|
2070
|
+
$[65] !== editorActor || $[66] !== rangeDecorationsActor || $[67] !== restoreSelectionFromProps ? (t13 = () => {
|
|
1987
2071
|
const onReady = editorActor.on("ready", () => {
|
|
1988
2072
|
rangeDecorationsActor.send({
|
|
1989
2073
|
type: "ready"
|
|
@@ -1996,13 +2080,13 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
1996
2080
|
return () => {
|
|
1997
2081
|
onReady.unsubscribe(), onInvalidValue.unsubscribe(), onValueChanged.unsubscribe();
|
|
1998
2082
|
};
|
|
1999
|
-
},
|
|
2000
|
-
let
|
|
2001
|
-
$[
|
|
2083
|
+
}, t14 = [rangeDecorationsActor, editorActor, restoreSelectionFromProps], $[65] = editorActor, $[66] = rangeDecorationsActor, $[67] = restoreSelectionFromProps, $[68] = t13, $[69] = t14) : (t13 = $[68], t14 = $[69]), React.useEffect(t13, t14);
|
|
2084
|
+
let t15, t16;
|
|
2085
|
+
$[70] !== hasInvalidValue || $[71] !== propsSelection || $[72] !== restoreSelectionFromProps ? (t15 = () => {
|
|
2002
2086
|
propsSelection && !hasInvalidValue && restoreSelectionFromProps();
|
|
2003
|
-
},
|
|
2004
|
-
let
|
|
2005
|
-
$[
|
|
2087
|
+
}, t16 = [hasInvalidValue, propsSelection, restoreSelectionFromProps], $[70] = hasInvalidValue, $[71] = propsSelection, $[72] = restoreSelectionFromProps, $[73] = t15, $[74] = t16) : (t15 = $[73], t16 = $[74]), React.useEffect(t15, t16);
|
|
2088
|
+
let t17;
|
|
2089
|
+
$[75] !== editorActor || $[76] !== onCopy || $[77] !== slateEditor ? (t17 = (event) => {
|
|
2006
2090
|
if (onCopy)
|
|
2007
2091
|
onCopy(event) !== void 0 && event.preventDefault();
|
|
2008
2092
|
else if (event.nativeEvent.clipboardData) {
|
|
@@ -2031,10 +2115,10 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
2031
2115
|
nativeEvent: event
|
|
2032
2116
|
});
|
|
2033
2117
|
}
|
|
2034
|
-
}, $[
|
|
2035
|
-
const handleCopy =
|
|
2036
|
-
let
|
|
2037
|
-
$[
|
|
2118
|
+
}, $[75] = editorActor, $[76] = onCopy, $[77] = slateEditor, $[78] = t17) : t17 = $[78];
|
|
2119
|
+
const handleCopy = t17;
|
|
2120
|
+
let t18;
|
|
2121
|
+
$[79] !== editorActor || $[80] !== onCut || $[81] !== slateEditor ? (t18 = (event_0) => {
|
|
2038
2122
|
if (onCut)
|
|
2039
2123
|
onCut(event_0) !== void 0 && event_0.preventDefault();
|
|
2040
2124
|
else if (event_0.nativeEvent.clipboardData) {
|
|
@@ -2059,10 +2143,10 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
2059
2143
|
nativeEvent: event_0
|
|
2060
2144
|
});
|
|
2061
2145
|
}
|
|
2062
|
-
}, $[
|
|
2063
|
-
const handleCut =
|
|
2064
|
-
let
|
|
2065
|
-
$[
|
|
2146
|
+
}, $[79] = editorActor, $[80] = onCut, $[81] = slateEditor, $[82] = t18) : t18 = $[82];
|
|
2147
|
+
const handleCut = t18;
|
|
2148
|
+
let t19;
|
|
2149
|
+
$[83] !== editorActor || $[84] !== onPaste || $[85] !== portableTextEditor || $[86] !== relayActor || $[87] !== slateEditor ? (t19 = (event_1) => {
|
|
2066
2150
|
const value = fromSlateValue(slateEditor.children, editorActor.getSnapshot().context.schema.block.name, KEY_TO_VALUE_ELEMENT.get(slateEditor)), path = (slateEditor.selection ? slateRangeToSelection({
|
|
2067
2151
|
schema: editorActor.getSnapshot().context.schema,
|
|
2068
2152
|
editor: slateEditor,
|
|
@@ -2103,7 +2187,7 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
2103
2187
|
type: "behavior event",
|
|
2104
2188
|
behaviorEvent: {
|
|
2105
2189
|
type: "insert.blocks",
|
|
2106
|
-
blocks:
|
|
2190
|
+
blocks: util_getTextBlockText.parseBlocks({
|
|
2107
2191
|
context: {
|
|
2108
2192
|
keyGenerator: editorActor.getSnapshot().context.keyGenerator,
|
|
2109
2193
|
schema: editorActor.getSnapshot().context.schema
|
|
@@ -2146,18 +2230,18 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
2146
2230
|
});
|
|
2147
2231
|
}
|
|
2148
2232
|
debug$d("No result from custom paste handler, pasting normally");
|
|
2149
|
-
}, $[
|
|
2150
|
-
const handlePaste =
|
|
2151
|
-
let
|
|
2152
|
-
$[
|
|
2233
|
+
}, $[83] = editorActor, $[84] = onPaste, $[85] = portableTextEditor, $[86] = relayActor, $[87] = slateEditor, $[88] = t19) : t19 = $[88];
|
|
2234
|
+
const handlePaste = t19;
|
|
2235
|
+
let t20;
|
|
2236
|
+
$[89] !== editorActor || $[90] !== onFocus || $[91] !== relayActor || $[92] !== slateEditor ? (t20 = (event_2) => {
|
|
2153
2237
|
onFocus && onFocus(event_2), event_2.isDefaultPrevented() || (relayActor.send({
|
|
2154
2238
|
type: "focused",
|
|
2155
2239
|
event: event_2
|
|
2156
2240
|
}), !slateEditor.selection && isEqualToEmptyEditor(slateEditor.children, editorActor.getSnapshot().context.schema) && (slate.Transforms.select(slateEditor, slate.Editor.start(slateEditor, [])), slateEditor.onChange()));
|
|
2157
|
-
}, $[
|
|
2158
|
-
const handleOnFocus =
|
|
2159
|
-
let
|
|
2160
|
-
$[
|
|
2241
|
+
}, $[89] = editorActor, $[90] = onFocus, $[91] = relayActor, $[92] = slateEditor, $[93] = t20) : t20 = $[93];
|
|
2242
|
+
const handleOnFocus = t20;
|
|
2243
|
+
let t21;
|
|
2244
|
+
$[94] !== editorActor || $[95] !== onClick || $[96] !== slateEditor ? (t21 = (event_3) => {
|
|
2161
2245
|
if (onClick && onClick(event_3), event_3.isDefaultPrevented() || event_3.isPropagationStopped())
|
|
2162
2246
|
return;
|
|
2163
2247
|
const position_3 = getEventPosition({
|
|
@@ -2174,23 +2258,23 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
2174
2258
|
editor: slateEditor,
|
|
2175
2259
|
nativeEvent: event_3
|
|
2176
2260
|
});
|
|
2177
|
-
}, $[
|
|
2178
|
-
const handleClick =
|
|
2179
|
-
let
|
|
2180
|
-
$[
|
|
2261
|
+
}, $[94] = editorActor, $[95] = onClick, $[96] = slateEditor, $[97] = t21) : t21 = $[97];
|
|
2262
|
+
const handleClick = t21;
|
|
2263
|
+
let t22;
|
|
2264
|
+
$[98] !== onBlur || $[99] !== relayActor ? (t22 = (event_4) => {
|
|
2181
2265
|
onBlur && onBlur(event_4), event_4.isPropagationStopped() || relayActor.send({
|
|
2182
2266
|
type: "blurred",
|
|
2183
2267
|
event: event_4
|
|
2184
2268
|
});
|
|
2185
|
-
}, $[
|
|
2186
|
-
const handleOnBlur =
|
|
2187
|
-
let t22;
|
|
2188
|
-
$[99] !== onBeforeInput ? (t22 = (event_5) => {
|
|
2189
|
-
onBeforeInput && onBeforeInput(event_5);
|
|
2190
|
-
}, $[99] = onBeforeInput, $[100] = t22) : t22 = $[100];
|
|
2191
|
-
const handleOnBeforeInput = t22;
|
|
2269
|
+
}, $[98] = onBlur, $[99] = relayActor, $[100] = t22) : t22 = $[100];
|
|
2270
|
+
const handleOnBlur = t22;
|
|
2192
2271
|
let t23;
|
|
2193
|
-
$[101] !==
|
|
2272
|
+
$[101] !== onBeforeInput ? (t23 = (event_5) => {
|
|
2273
|
+
onBeforeInput && onBeforeInput(event_5);
|
|
2274
|
+
}, $[101] = onBeforeInput, $[102] = t23) : t23 = $[102];
|
|
2275
|
+
const handleOnBeforeInput = t23;
|
|
2276
|
+
let t24;
|
|
2277
|
+
$[103] !== editorActor || $[104] !== props || $[105] !== slateEditor ? (t24 = (event_6) => {
|
|
2194
2278
|
props.onKeyDown && props.onKeyDown(event_6), event_6.isDefaultPrevented() || slateEditor.pteWithHotKeys(event_6), event_6.isDefaultPrevented() || editorActor.send({
|
|
2195
2279
|
type: "behavior event",
|
|
2196
2280
|
behaviorEvent: {
|
|
@@ -2207,10 +2291,10 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
2207
2291
|
editor: slateEditor,
|
|
2208
2292
|
nativeEvent: event_6
|
|
2209
2293
|
});
|
|
2210
|
-
}, $[
|
|
2211
|
-
const handleKeyDown =
|
|
2212
|
-
let
|
|
2213
|
-
$[
|
|
2294
|
+
}, $[103] = editorActor, $[104] = props, $[105] = slateEditor, $[106] = t24) : t24 = $[106];
|
|
2295
|
+
const handleKeyDown = t24;
|
|
2296
|
+
let t25;
|
|
2297
|
+
$[107] !== editorActor || $[108] !== props || $[109] !== slateEditor ? (t25 = (event_7) => {
|
|
2214
2298
|
props.onKeyUp && props.onKeyUp(event_7), event_7.isDefaultPrevented() || editorActor.send({
|
|
2215
2299
|
type: "behavior event",
|
|
2216
2300
|
behaviorEvent: {
|
|
@@ -2227,26 +2311,26 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
2227
2311
|
editor: slateEditor,
|
|
2228
2312
|
nativeEvent: event_7
|
|
2229
2313
|
});
|
|
2230
|
-
}, $[
|
|
2231
|
-
const handleKeyUp =
|
|
2232
|
-
let
|
|
2314
|
+
}, $[107] = editorActor, $[108] = props, $[109] = slateEditor, $[110] = t25) : t25 = $[110];
|
|
2315
|
+
const handleKeyUp = t25;
|
|
2316
|
+
let t26;
|
|
2233
2317
|
bb1: {
|
|
2234
2318
|
if (scrollSelectionIntoView === void 0) {
|
|
2235
|
-
|
|
2319
|
+
t26 = void 0;
|
|
2236
2320
|
break bb1;
|
|
2237
2321
|
}
|
|
2238
2322
|
if (scrollSelectionIntoView === null) {
|
|
2239
|
-
|
|
2323
|
+
t26 = noop__default.default;
|
|
2240
2324
|
break bb1;
|
|
2241
2325
|
}
|
|
2242
|
-
let
|
|
2243
|
-
$[
|
|
2326
|
+
let t272;
|
|
2327
|
+
$[111] !== portableTextEditor || $[112] !== scrollSelectionIntoView ? (t272 = (_editor, domRange) => {
|
|
2244
2328
|
scrollSelectionIntoView(portableTextEditor, domRange);
|
|
2245
|
-
}, $[
|
|
2329
|
+
}, $[111] = portableTextEditor, $[112] = scrollSelectionIntoView, $[113] = t272) : t272 = $[113], t26 = t272;
|
|
2246
2330
|
}
|
|
2247
|
-
const scrollSelectionIntoViewToSlate =
|
|
2248
|
-
let
|
|
2249
|
-
$[
|
|
2331
|
+
const scrollSelectionIntoViewToSlate = t26;
|
|
2332
|
+
let t27, t28;
|
|
2333
|
+
$[114] !== editorActor || $[115] !== slateEditor ? (t27 = () => {
|
|
2250
2334
|
const window2 = slateReact.ReactEditor.getWindow(slateEditor), onDragEnd_0 = () => {
|
|
2251
2335
|
editorActor.send({
|
|
2252
2336
|
type: "dragend"
|
|
@@ -2259,9 +2343,9 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
2259
2343
|
return window2.document.addEventListener("dragend", onDragEnd_0), window2.document.addEventListener("drop", onDrop_0), () => {
|
|
2260
2344
|
window2.document.removeEventListener("dragend", onDragEnd_0), window2.document.removeEventListener("drop", onDrop_0);
|
|
2261
2345
|
};
|
|
2262
|
-
},
|
|
2263
|
-
let
|
|
2264
|
-
$[
|
|
2346
|
+
}, t28 = [slateEditor, editorActor], $[114] = editorActor, $[115] = slateEditor, $[116] = t27, $[117] = t28) : (t27 = $[116], t28 = $[117]), React.useEffect(t27, t28);
|
|
2347
|
+
let t29;
|
|
2348
|
+
$[118] !== editorActor || $[119] !== onDragStart || $[120] !== slateEditor ? (t29 = (event_8) => {
|
|
2265
2349
|
if (onDragStart?.(event_8), event_8.isDefaultPrevented() || event_8.isPropagationStopped())
|
|
2266
2350
|
return;
|
|
2267
2351
|
const position_4 = getEventPosition({
|
|
@@ -2289,10 +2373,10 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
2289
2373
|
},
|
|
2290
2374
|
editor: slateEditor
|
|
2291
2375
|
}), !0;
|
|
2292
|
-
}, $[
|
|
2293
|
-
const handleDragStart =
|
|
2294
|
-
let
|
|
2295
|
-
$[
|
|
2376
|
+
}, $[118] = editorActor, $[119] = onDragStart, $[120] = slateEditor, $[121] = t29) : t29 = $[121];
|
|
2377
|
+
const handleDragStart = t29;
|
|
2378
|
+
let t30;
|
|
2379
|
+
$[122] !== editorActor || $[123] !== onDrag || $[124] !== slateEditor ? (t30 = (event_9) => {
|
|
2296
2380
|
if (onDrag?.(event_9), !(event_9.isDefaultPrevented() || event_9.isPropagationStopped() || !getEventPosition({
|
|
2297
2381
|
editorActor,
|
|
2298
2382
|
slateEditor,
|
|
@@ -2308,10 +2392,10 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
2308
2392
|
},
|
|
2309
2393
|
editor: slateEditor
|
|
2310
2394
|
}), !0;
|
|
2311
|
-
}, $[
|
|
2312
|
-
const handleDrag =
|
|
2313
|
-
let
|
|
2314
|
-
$[
|
|
2395
|
+
}, $[122] = editorActor, $[123] = onDrag, $[124] = slateEditor, $[125] = t30) : t30 = $[125];
|
|
2396
|
+
const handleDrag = t30;
|
|
2397
|
+
let t31;
|
|
2398
|
+
$[126] !== editorActor || $[127] !== onDragEnd || $[128] !== slateEditor ? (t31 = (event_10) => {
|
|
2315
2399
|
if (onDragEnd?.(event_10), !(event_10.isDefaultPrevented() || event_10.isPropagationStopped()))
|
|
2316
2400
|
return editorActor.send({
|
|
2317
2401
|
type: "behavior event",
|
|
@@ -2323,10 +2407,10 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
2323
2407
|
},
|
|
2324
2408
|
editor: slateEditor
|
|
2325
2409
|
}), !0;
|
|
2326
|
-
}, $[
|
|
2327
|
-
const handleDragEnd =
|
|
2328
|
-
let
|
|
2329
|
-
$[
|
|
2410
|
+
}, $[126] = editorActor, $[127] = onDragEnd, $[128] = slateEditor, $[129] = t31) : t31 = $[129];
|
|
2411
|
+
const handleDragEnd = t31;
|
|
2412
|
+
let t32;
|
|
2413
|
+
$[130] !== editorActor || $[131] !== onDragEnter || $[132] !== slateEditor ? (t32 = (event_11) => {
|
|
2330
2414
|
if (onDragEnter?.(event_11), event_11.isDefaultPrevented() || event_11.isPropagationStopped())
|
|
2331
2415
|
return;
|
|
2332
2416
|
const position_6 = getEventPosition({
|
|
@@ -2346,10 +2430,10 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
2346
2430
|
},
|
|
2347
2431
|
editor: slateEditor
|
|
2348
2432
|
}), !0;
|
|
2349
|
-
}, $[
|
|
2350
|
-
const handleDragEnter =
|
|
2351
|
-
let
|
|
2352
|
-
$[
|
|
2433
|
+
}, $[130] = editorActor, $[131] = onDragEnter, $[132] = slateEditor, $[133] = t32) : t32 = $[133];
|
|
2434
|
+
const handleDragEnter = t32;
|
|
2435
|
+
let t33;
|
|
2436
|
+
$[134] !== editorActor || $[135] !== onDragOver || $[136] !== slateEditor ? (t33 = (event_12) => {
|
|
2353
2437
|
if (onDragOver?.(event_12), event_12.isDefaultPrevented() || event_12.isPropagationStopped())
|
|
2354
2438
|
return;
|
|
2355
2439
|
const position_7 = getEventPosition({
|
|
@@ -2371,10 +2455,10 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
2371
2455
|
editor: slateEditor,
|
|
2372
2456
|
nativeEvent: event_12
|
|
2373
2457
|
}), !0;
|
|
2374
|
-
}, $[
|
|
2375
|
-
const handleDragOver =
|
|
2376
|
-
let
|
|
2377
|
-
$[
|
|
2458
|
+
}, $[134] = editorActor, $[135] = onDragOver, $[136] = slateEditor, $[137] = t33) : t33 = $[137];
|
|
2459
|
+
const handleDragOver = t33;
|
|
2460
|
+
let t34;
|
|
2461
|
+
$[138] !== editorActor || $[139] !== onDrop || $[140] !== slateEditor ? (t34 = (event_13) => {
|
|
2378
2462
|
if (onDrop?.(event_13), event_13.isDefaultPrevented() || event_13.isPropagationStopped())
|
|
2379
2463
|
return;
|
|
2380
2464
|
const position_8 = getEventPosition({
|
|
@@ -2399,10 +2483,10 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
2399
2483
|
editor: slateEditor,
|
|
2400
2484
|
nativeEvent: event_13
|
|
2401
2485
|
}), !0;
|
|
2402
|
-
}, $[
|
|
2403
|
-
const handleDrop =
|
|
2404
|
-
let
|
|
2405
|
-
$[
|
|
2486
|
+
}, $[138] = editorActor, $[139] = onDrop, $[140] = slateEditor, $[141] = t34) : t34 = $[141];
|
|
2487
|
+
const handleDrop = t34;
|
|
2488
|
+
let t35;
|
|
2489
|
+
$[142] !== editorActor || $[143] !== onDragLeave || $[144] !== slateEditor ? (t35 = (event_14) => {
|
|
2406
2490
|
if (onDragLeave?.(event_14), !(event_14.isDefaultPrevented() || event_14.isPropagationStopped() || !getEventPosition({
|
|
2407
2491
|
editorActor,
|
|
2408
2492
|
slateEditor,
|
|
@@ -2418,15 +2502,18 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
2418
2502
|
},
|
|
2419
2503
|
editor: slateEditor
|
|
2420
2504
|
}), !0;
|
|
2421
|
-
}, $[
|
|
2422
|
-
const handleDragLeave =
|
|
2423
|
-
let
|
|
2424
|
-
$[
|
|
2425
|
-
if (typeof forwardedRef == "function" ? forwardedRef(
|
|
2505
|
+
}, $[142] = editorActor, $[143] = onDragLeave, $[144] = slateEditor, $[145] = t35) : t35 = $[145];
|
|
2506
|
+
const handleDragLeave = t35;
|
|
2507
|
+
let t36;
|
|
2508
|
+
$[146] !== forwardedRef || $[147] !== validateSelectionActor ? (t36 = (editorElement) => {
|
|
2509
|
+
if (typeof forwardedRef == "function" ? forwardedRef(editorElement) : forwardedRef && (forwardedRef.current = editorElement), editorElement) {
|
|
2426
2510
|
const mutationObserver = new MutationObserver(() => {
|
|
2427
|
-
|
|
2511
|
+
validateSelectionActor.send({
|
|
2512
|
+
type: "validate selection",
|
|
2513
|
+
editorElement
|
|
2514
|
+
});
|
|
2428
2515
|
});
|
|
2429
|
-
return mutationObserver.observe(
|
|
2516
|
+
return mutationObserver.observe(editorElement, {
|
|
2430
2517
|
attributeOldValue: !1,
|
|
2431
2518
|
attributes: !1,
|
|
2432
2519
|
characterData: !1,
|
|
@@ -2436,35 +2523,14 @@ const RelayActorContext = React.createContext({}), debug$d = debugWithName("comp
|
|
|
2436
2523
|
mutationObserver.disconnect();
|
|
2437
2524
|
};
|
|
2438
2525
|
}
|
|
2439
|
-
}, $[
|
|
2440
|
-
const callbackRef =
|
|
2526
|
+
}, $[146] = forwardedRef, $[147] = validateSelectionActor, $[148] = t36) : t36 = $[148];
|
|
2527
|
+
const callbackRef = t36;
|
|
2441
2528
|
if (!portableTextEditor)
|
|
2442
2529
|
return null;
|
|
2443
|
-
let
|
|
2444
|
-
return $[
|
|
2530
|
+
let t37;
|
|
2531
|
+
return $[149] !== callbackRef || $[150] !== decorate || $[151] !== handleClick || $[152] !== handleCopy || $[153] !== handleCut || $[154] !== handleDrag || $[155] !== handleDragEnd || $[156] !== handleDragEnter || $[157] !== handleDragLeave || $[158] !== handleDragOver || $[159] !== handleDragStart || $[160] !== handleDrop || $[161] !== handleKeyDown || $[162] !== handleKeyUp || $[163] !== handleOnBeforeInput || $[164] !== handleOnBlur || $[165] !== handleOnFocus || $[166] !== handlePaste || $[167] !== hasInvalidValue || $[168] !== readOnly || $[169] !== renderElement || $[170] !== renderLeaf || $[171] !== restProps || $[172] !== scrollSelectionIntoViewToSlate ? (t37 = hasInvalidValue ? null : /* @__PURE__ */ jsxRuntime.jsx(slateReact.Editable, { ...restProps, ref: callbackRef, "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, renderPlaceholder: void 0, renderElement, renderLeaf, renderText, scrollSelectionIntoView: scrollSelectionIntoViewToSlate }), $[149] = callbackRef, $[150] = decorate, $[151] = handleClick, $[152] = handleCopy, $[153] = handleCut, $[154] = handleDrag, $[155] = handleDragEnd, $[156] = handleDragEnter, $[157] = handleDragLeave, $[158] = handleDragOver, $[159] = handleDragStart, $[160] = handleDrop, $[161] = handleKeyDown, $[162] = handleKeyUp, $[163] = handleOnBeforeInput, $[164] = handleOnBlur, $[165] = handleOnFocus, $[166] = handlePaste, $[167] = hasInvalidValue, $[168] = readOnly, $[169] = renderElement, $[170] = renderLeaf, $[171] = restProps, $[172] = scrollSelectionIntoViewToSlate, $[173] = t37) : t37 = $[173], t37;
|
|
2445
2532
|
});
|
|
2446
2533
|
PortableTextEditable.displayName = "ForwardRef(PortableTextEditable)";
|
|
2447
|
-
function validateSelection(slateEditor, activeElement) {
|
|
2448
|
-
if (!slateEditor.selection)
|
|
2449
|
-
return;
|
|
2450
|
-
let root;
|
|
2451
|
-
try {
|
|
2452
|
-
root = slateReact.ReactEditor.findDocumentOrShadowRoot(slateEditor);
|
|
2453
|
-
} catch {
|
|
2454
|
-
}
|
|
2455
|
-
if (!root || activeElement !== root.activeElement)
|
|
2456
|
-
return;
|
|
2457
|
-
const domSelection = slateReact.ReactEditor.getWindow(slateEditor).getSelection();
|
|
2458
|
-
if (!domSelection || domSelection.rangeCount === 0)
|
|
2459
|
-
return;
|
|
2460
|
-
const existingDOMRange = domSelection.getRangeAt(0);
|
|
2461
|
-
try {
|
|
2462
|
-
const newDOMRange = slateReact.ReactEditor.toDOMRange(slateEditor, slateEditor.selection);
|
|
2463
|
-
(newDOMRange.startOffset !== existingDOMRange.startOffset || newDOMRange.endOffset !== existingDOMRange.endOffset) && (debug$d("DOM range out of sync, validating selection"), domSelection?.removeAllRanges(), domSelection.addRange(newDOMRange));
|
|
2464
|
-
} catch {
|
|
2465
|
-
debug$d("Could not resolve selection, selecting top document"), slate.Transforms.deselect(slateEditor), slateEditor.children.length > 0 && slate.Transforms.select(slateEditor, [0, 0]), slateEditor.onChange();
|
|
2466
|
-
}
|
|
2467
|
-
}
|
|
2468
2534
|
function _temp(s) {
|
|
2469
2535
|
return s.matches({
|
|
2470
2536
|
"edit mode": "read only"
|
|
@@ -2550,7 +2616,7 @@ const converterJson = {
|
|
|
2550
2616
|
originEvent: event.originEvent,
|
|
2551
2617
|
reason: "No selection"
|
|
2552
2618
|
};
|
|
2553
|
-
const blocks =
|
|
2619
|
+
const blocks = selector_getSelectionText.getSelectedValue(snapshot);
|
|
2554
2620
|
return blocks.length === 0 ? {
|
|
2555
2621
|
type: "serialization.failure",
|
|
2556
2622
|
mimeType: "application/x-portable-text",
|
|
@@ -2575,7 +2641,7 @@ const converterJson = {
|
|
|
2575
2641
|
reason: "Data is not an array"
|
|
2576
2642
|
};
|
|
2577
2643
|
const parsedBlocks = blocks.flatMap((block) => {
|
|
2578
|
-
const parsedBlock =
|
|
2644
|
+
const parsedBlock = util_getTextBlockText.parseBlock({
|
|
2579
2645
|
context: snapshot.context,
|
|
2580
2646
|
block,
|
|
2581
2647
|
options: {
|
|
@@ -2610,7 +2676,7 @@ function createConverterTextHtml(legacySchema) {
|
|
|
2610
2676
|
originEvent: event.originEvent,
|
|
2611
2677
|
reason: "No selection"
|
|
2612
2678
|
};
|
|
2613
|
-
const blocks =
|
|
2679
|
+
const blocks = selector_getSelectionText.getSelectedValue(snapshot), html = toHtml.toHTML(blocks, {
|
|
2614
2680
|
onMissingComponent: !1,
|
|
2615
2681
|
components: {
|
|
2616
2682
|
unknownType: ({
|
|
@@ -2638,7 +2704,7 @@ function createConverterTextHtml(legacySchema) {
|
|
|
2638
2704
|
keyGenerator: snapshot.context.keyGenerator,
|
|
2639
2705
|
unstable_whitespaceOnPasteMode: legacySchema.block.options.unstable_whitespaceOnPasteMode
|
|
2640
2706
|
}).flatMap((block) => {
|
|
2641
|
-
const parsedBlock =
|
|
2707
|
+
const parsedBlock = util_getTextBlockText.parseBlock({
|
|
2642
2708
|
context: snapshot.context,
|
|
2643
2709
|
block,
|
|
2644
2710
|
options: {
|
|
@@ -2668,7 +2734,7 @@ function createConverterTextPlain(legacySchema) {
|
|
|
2668
2734
|
event
|
|
2669
2735
|
}) => snapshot.context.selection ? {
|
|
2670
2736
|
type: "serialization.success",
|
|
2671
|
-
data:
|
|
2737
|
+
data: selector_getSelectionText.getSelectedValue(snapshot).map((block) => schema.isTextBlock(snapshot.context, block) ? block.children.map((child) => child._type === snapshot.context.schema.span.name ? child.text : event.originEvent === "drag.dragstart" ? `[${snapshot.context.schema.inlineObjects.find((inlineObjectType) => inlineObjectType.name === child._type)?.title ?? "Object"}]` : "").join("") : event.originEvent === "drag.dragstart" ? `[${snapshot.context.schema.blockObjects.find((blockObjectType) => blockObjectType.name === block._type)?.title ?? "Object"}]` : "").filter((block) => block !== "").join(`
|
|
2672
2738
|
|
|
2673
2739
|
`),
|
|
2674
2740
|
mimeType: "text/plain",
|
|
@@ -2686,7 +2752,7 @@ function createConverterTextPlain(legacySchema) {
|
|
|
2686
2752
|
const textToHtml = `<html><body>${escapeHtml(event.data).split(/\n{2,}/).map((line) => line ? `<p>${line.replace(/(?:\r\n|\r|\n)/g, "<br/>")}</p>` : "<p></p>").join("")}</body></html>`, parsedBlocks = blockTools.htmlToBlocks(textToHtml, legacySchema.portableText, {
|
|
2687
2753
|
keyGenerator: snapshot.context.keyGenerator
|
|
2688
2754
|
}).flatMap((block) => {
|
|
2689
|
-
const parsedBlock =
|
|
2755
|
+
const parsedBlock = util_getTextBlockText.parseBlock({
|
|
2690
2756
|
context: snapshot.context,
|
|
2691
2757
|
block,
|
|
2692
2758
|
options: {
|
|
@@ -3067,7 +3133,7 @@ function createWithPortableTextMarkModel(editorActor) {
|
|
|
3067
3133
|
const snapshot = getEditorSnapshot({
|
|
3068
3134
|
editorActorSnapshot: editorActor.getSnapshot(),
|
|
3069
3135
|
slateEditorInstance: editor
|
|
3070
|
-
}), markState =
|
|
3136
|
+
}), markState = selector_isActiveStyle.getMarkState(snapshot);
|
|
3071
3137
|
if (!markState) {
|
|
3072
3138
|
apply2(op);
|
|
3073
3139
|
return;
|
|
@@ -3117,7 +3183,7 @@ function createWithPortableTextMarkModel(editorActor) {
|
|
|
3117
3183
|
});
|
|
3118
3184
|
slate.Editor.withoutNormalizing(editor, () => {
|
|
3119
3185
|
apply2(op), slate.Transforms.setNodes(editor, {
|
|
3120
|
-
marks:
|
|
3186
|
+
marks: selector_isActiveStyle.getActiveDecorators(snapshot)
|
|
3121
3187
|
}, {
|
|
3122
3188
|
at: op.path
|
|
3123
3189
|
});
|
|
@@ -3833,7 +3899,7 @@ function getCurrentUndoStepId(editor) {
|
|
|
3833
3899
|
}
|
|
3834
3900
|
function createUndoStep(editor) {
|
|
3835
3901
|
CURRENT_UNDO_STEP.set(editor, {
|
|
3836
|
-
undoStepId:
|
|
3902
|
+
undoStepId: util_getTextBlockText.defaultKeyGenerator()
|
|
3837
3903
|
});
|
|
3838
3904
|
}
|
|
3839
3905
|
function clearUndoStep(editor) {
|
|
@@ -4104,7 +4170,7 @@ const addAnnotationOperationImplementation = ({
|
|
|
4104
4170
|
context,
|
|
4105
4171
|
operation
|
|
4106
4172
|
}) => {
|
|
4107
|
-
const parsedAnnotation =
|
|
4173
|
+
const parsedAnnotation = util_getTextBlockText.parseAnnotation({
|
|
4108
4174
|
annotation: {
|
|
4109
4175
|
_type: operation.annotation.name,
|
|
4110
4176
|
...operation.annotation.value
|
|
@@ -4234,7 +4300,7 @@ const addAnnotationOperationImplementation = ({
|
|
|
4234
4300
|
} = operation.props, updatedBlock = {
|
|
4235
4301
|
...block,
|
|
4236
4302
|
...filteredProps
|
|
4237
|
-
}, parsedBlock =
|
|
4303
|
+
}, parsedBlock = util_getTextBlockText.parseBlock({
|
|
4238
4304
|
context,
|
|
4239
4305
|
block: updatedBlock,
|
|
4240
4306
|
options: {
|
|
@@ -4284,7 +4350,7 @@ const addAnnotationOperationImplementation = ({
|
|
|
4284
4350
|
if (!parsedBlock)
|
|
4285
4351
|
throw new Error(`Unable to parse block at ${JSON.stringify(operation.at)}`);
|
|
4286
4352
|
if (schema.isTextBlock(context, parsedBlock)) {
|
|
4287
|
-
const propsToRemove = operation.props.filter((prop) => prop !== "_type"), updatedTextBlock =
|
|
4353
|
+
const propsToRemove = operation.props.filter((prop) => prop !== "_type"), updatedTextBlock = util_getTextBlockText.parseBlock({
|
|
4288
4354
|
context,
|
|
4289
4355
|
block: omit__default.default(parsedBlock, propsToRemove),
|
|
4290
4356
|
options: {
|
|
@@ -4302,7 +4368,7 @@ const addAnnotationOperationImplementation = ({
|
|
|
4302
4368
|
});
|
|
4303
4369
|
return;
|
|
4304
4370
|
}
|
|
4305
|
-
const updatedBlockObject =
|
|
4371
|
+
const updatedBlockObject = util_getTextBlockText.parseBlock({
|
|
4306
4372
|
context,
|
|
4307
4373
|
block: omit__default.default(parsedBlock, operation.props.filter((prop) => prop !== "_type")),
|
|
4308
4374
|
options: {
|
|
@@ -4468,14 +4534,14 @@ const addAnnotationOperationImplementation = ({
|
|
|
4468
4534
|
context,
|
|
4469
4535
|
operation
|
|
4470
4536
|
}) => {
|
|
4471
|
-
const editor = operation.editor, mark = operation.decorator, value = fromSlateValue(editor.children, context.schema.block.name, KEY_TO_VALUE_ELEMENT.get(editor)), manualAnchor = operation.at?.anchor ?
|
|
4537
|
+
const editor = operation.editor, mark = operation.decorator, value = fromSlateValue(editor.children, context.schema.block.name, KEY_TO_VALUE_ELEMENT.get(editor)), manualAnchor = operation.at?.anchor ? util_getTextBlockText.blockOffsetToSpanSelectionPoint({
|
|
4472
4538
|
context: {
|
|
4473
4539
|
...context,
|
|
4474
4540
|
value
|
|
4475
4541
|
},
|
|
4476
4542
|
blockOffset: operation.at.anchor,
|
|
4477
4543
|
direction: "backward"
|
|
4478
|
-
}) : void 0, manualFocus = operation.at?.focus ?
|
|
4544
|
+
}) : void 0, manualFocus = operation.at?.focus ? util_getTextBlockText.blockOffsetToSpanSelectionPoint({
|
|
4479
4545
|
context: {
|
|
4480
4546
|
...context,
|
|
4481
4547
|
value
|
|
@@ -4531,7 +4597,7 @@ const addAnnotationOperationImplementation = ({
|
|
|
4531
4597
|
focus: focusOffset
|
|
4532
4598
|
},
|
|
4533
4599
|
backward: editorSelection?.backward
|
|
4534
|
-
}), trimmedSelection =
|
|
4600
|
+
}), trimmedSelection = selector_isActiveStyle.getTrimmedSelection({
|
|
4535
4601
|
blockIndexMap: editor.blockIndexMap,
|
|
4536
4602
|
context: {
|
|
4537
4603
|
converters: [],
|
|
@@ -4600,7 +4666,7 @@ const addAnnotationOperationImplementation = ({
|
|
|
4600
4666
|
context,
|
|
4601
4667
|
operation
|
|
4602
4668
|
}) => {
|
|
4603
|
-
const anchorBlockKey =
|
|
4669
|
+
const anchorBlockKey = util_getTextBlockText.getBlockKeyFromSelectionPoint(operation.at.anchor), focusBlockKey = util_getTextBlockText.getBlockKeyFromSelectionPoint(operation.at.focus), startBlockKey = operation.at.backward ? focusBlockKey : anchorBlockKey, endBlockKey = operation.at.backward ? anchorBlockKey : focusBlockKey, endOffset = operation.at.backward ? operation.at.focus.offset : operation.at.anchor.offset;
|
|
4604
4670
|
if (!startBlockKey)
|
|
4605
4671
|
throw new Error("Failed to get start block key");
|
|
4606
4672
|
if (!endBlockKey)
|
|
@@ -4694,7 +4760,7 @@ const insertBlockOperationImplementation = ({
|
|
|
4694
4760
|
context,
|
|
4695
4761
|
operation
|
|
4696
4762
|
}) => {
|
|
4697
|
-
const parsedBlock =
|
|
4763
|
+
const parsedBlock = util_getTextBlockText.parseBlock({
|
|
4698
4764
|
block: operation.block,
|
|
4699
4765
|
context,
|
|
4700
4766
|
options: {
|
|
@@ -4861,7 +4927,7 @@ function insertBlock({
|
|
|
4861
4927
|
slate.Transforms.insertNodes(editor, [block], {
|
|
4862
4928
|
at: endBlockPath,
|
|
4863
4929
|
select: !1
|
|
4864
|
-
}), (select === "start" || select === "end") && slate.Transforms.select(editor, slate.Editor.start(editor, endBlockPath)),
|
|
4930
|
+
}), (select === "start" || select === "end") && slate.Transforms.select(editor, slate.Editor.start(editor, endBlockPath)), util_isEmptyTextBlock.isEmptyTextBlock(context, endBlock) && slate.Transforms.removeNodes(editor, {
|
|
4865
4931
|
at: slate.Path.next(endBlockPath)
|
|
4866
4932
|
});
|
|
4867
4933
|
else if (slate.Range.isCollapsed(currentSelection) && slate.Point.equals(selectionEndPoint, endBlockEndPoint2)) {
|
|
@@ -4926,7 +4992,7 @@ const insertChildOperationImplementation = ({
|
|
|
4926
4992
|
const markDefs = focusBlock.markDefs ?? [], markDefKeyMap = /* @__PURE__ */ new Map();
|
|
4927
4993
|
for (const markDef of markDefs)
|
|
4928
4994
|
markDefKeyMap.set(markDef._key, markDef._key);
|
|
4929
|
-
const span =
|
|
4995
|
+
const span = util_getTextBlockText.parseSpan({
|
|
4930
4996
|
span: operation.child,
|
|
4931
4997
|
context,
|
|
4932
4998
|
markDefKeyMap,
|
|
@@ -4947,7 +5013,7 @@ const insertChildOperationImplementation = ({
|
|
|
4947
5013
|
}), slateDom.EDITOR_TO_PENDING_SELECTION.set(operation.editor, operation.editor.selection);
|
|
4948
5014
|
return;
|
|
4949
5015
|
}
|
|
4950
|
-
const inlineObject =
|
|
5016
|
+
const inlineObject = util_getTextBlockText.parseInlineObject({
|
|
4951
5017
|
inlineObject: operation.child,
|
|
4952
5018
|
context,
|
|
4953
5019
|
options: {
|
|
@@ -4993,7 +5059,7 @@ const insertChildOperationImplementation = ({
|
|
|
4993
5059
|
}, moveBlockOperationImplementation = ({
|
|
4994
5060
|
operation
|
|
4995
5061
|
}) => {
|
|
4996
|
-
const originKey =
|
|
5062
|
+
const originKey = util_getTextBlockText.getBlockKeyFromSelectionPoint({
|
|
4997
5063
|
path: operation.at
|
|
4998
5064
|
});
|
|
4999
5065
|
if (!originKey)
|
|
@@ -5001,7 +5067,7 @@ const insertChildOperationImplementation = ({
|
|
|
5001
5067
|
const originBlockIndex = operation.editor.blockIndexMap.get(originKey);
|
|
5002
5068
|
if (originBlockIndex === void 0)
|
|
5003
5069
|
throw new Error("Failed to get block index from block key");
|
|
5004
|
-
const destinationKey =
|
|
5070
|
+
const destinationKey = util_getTextBlockText.getBlockKeyFromSelectionPoint({
|
|
5005
5071
|
path: operation.to
|
|
5006
5072
|
});
|
|
5007
5073
|
if (!destinationKey)
|
|
@@ -5841,7 +5907,7 @@ function unsetPatch(editor, patch) {
|
|
|
5841
5907
|
function findBlock(children, path) {
|
|
5842
5908
|
let blockIndex = -1;
|
|
5843
5909
|
const block = children.find((node, index) => {
|
|
5844
|
-
const isMatch =
|
|
5910
|
+
const isMatch = util_getTextBlockText.isKeyedSegment(path[0]) ? node._key === path[0]._key : index === path[0];
|
|
5845
5911
|
return isMatch && (blockIndex = index), isMatch;
|
|
5846
5912
|
});
|
|
5847
5913
|
if (block)
|
|
@@ -5856,7 +5922,7 @@ function findBlockChild(block, path) {
|
|
|
5856
5922
|
return;
|
|
5857
5923
|
let childIndex = -1;
|
|
5858
5924
|
const child = blockNode.children.find((node, index) => {
|
|
5859
|
-
const isMatch =
|
|
5925
|
+
const isMatch = util_getTextBlockText.isKeyedSegment(path[2]) ? node._key === path[2]._key : index === path[2];
|
|
5860
5926
|
return isMatch && (childIndex = index), isMatch;
|
|
5861
5927
|
});
|
|
5862
5928
|
if (child)
|
|
@@ -6257,7 +6323,7 @@ function createWithSchemaTypes({
|
|
|
6257
6323
|
editorActor
|
|
6258
6324
|
}) {
|
|
6259
6325
|
return function(editor) {
|
|
6260
|
-
editor.isTextBlock = (value) => slate.Editor.isEditor(value) ? !1 : schema.isTextBlock(editorActor.getSnapshot().context, value), editor.isTextSpan = (value) => slate.Editor.isEditor(value) ? !1 : schema.isSpan(editorActor.getSnapshot().context, value), editor.isListBlock = (value) => slate.Editor.isEditor(value) ? !1 :
|
|
6326
|
+
editor.isTextBlock = (value) => slate.Editor.isEditor(value) ? !1 : schema.isTextBlock(editorActor.getSnapshot().context, value), editor.isTextSpan = (value) => slate.Editor.isEditor(value) ? !1 : schema.isSpan(editorActor.getSnapshot().context, value), editor.isListBlock = (value) => slate.Editor.isEditor(value) ? !1 : util_getTextBlockText.isListBlock(editorActor.getSnapshot().context, value), editor.isVoid = (element) => slate.Editor.isEditor(element) ? !1 : editorActor.getSnapshot().context.schema.block.name !== element._type && (editorActor.getSnapshot().context.schema.blockObjects.map((obj) => obj.name).includes(element._type) || editorActor.getSnapshot().context.schema.inlineObjects.map((obj) => obj.name).includes(element._type)), editor.isInline = (element) => slate.Editor.isEditor(element) ? !1 : editorActor.getSnapshot().context.schema.inlineObjects.map((obj) => obj.name).includes(element._type) && "__inline" in element && element.__inline === !0;
|
|
6261
6327
|
const {
|
|
6262
6328
|
normalizeNode
|
|
6263
6329
|
} = editor;
|
|
@@ -6366,7 +6432,7 @@ function isEditorNode(node) {
|
|
|
6366
6432
|
return typeof node == "object" && node !== null ? !("_type" in node) && "children" in node && Array.isArray(node.children) : !1;
|
|
6367
6433
|
}
|
|
6368
6434
|
function isTextBlockNode(context, node) {
|
|
6369
|
-
return
|
|
6435
|
+
return util_getTextBlockText.isTypedObject(node) && node._type === context.schema.block.name;
|
|
6370
6436
|
}
|
|
6371
6437
|
function isSpanNode(context, node) {
|
|
6372
6438
|
return typeof node != "object" || node === null || "children" in node ? !1 : "_type" in node ? node._type === context.schema.span.name : "text" in node;
|
|
@@ -6758,10 +6824,10 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
|
|
|
6758
6824
|
guard: ({
|
|
6759
6825
|
snapshot
|
|
6760
6826
|
}) => {
|
|
6761
|
-
if (!
|
|
6827
|
+
if (!selector_getSelectionText.isSelectionCollapsed(snapshot))
|
|
6762
6828
|
return !1;
|
|
6763
|
-
const caretWordSelection =
|
|
6764
|
-
return !caretWordSelection || !
|
|
6829
|
+
const caretWordSelection = selector_isActiveStyle.getCaretWordSelection(snapshot);
|
|
6830
|
+
return !caretWordSelection || !selector_getSelectionText.isSelectionExpanded({
|
|
6765
6831
|
context: {
|
|
6766
6832
|
...snapshot.context,
|
|
6767
6833
|
selection: caretWordSelection
|
|
@@ -6788,7 +6854,7 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
|
|
|
6788
6854
|
guard: ({
|
|
6789
6855
|
snapshot,
|
|
6790
6856
|
event
|
|
6791
|
-
}) =>
|
|
6857
|
+
}) => selector_isActiveStyle.isActiveAnnotation(event.annotation.name, {
|
|
6792
6858
|
mode: "partial"
|
|
6793
6859
|
})(snapshot),
|
|
6794
6860
|
// Then the existing annotation is removed
|
|
@@ -6881,9 +6947,9 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
|
|
|
6881
6947
|
snapshot,
|
|
6882
6948
|
event
|
|
6883
6949
|
}) => {
|
|
6884
|
-
if (!defaultKeyboardShortcuts.arrowDown.guard(event.originEvent) || !
|
|
6950
|
+
if (!defaultKeyboardShortcuts.arrowDown.guard(event.originEvent) || !selector_getSelectionText.isSelectionCollapsed(snapshot))
|
|
6885
6951
|
return !1;
|
|
6886
|
-
const focusBlockObject =
|
|
6952
|
+
const focusBlockObject = selector_isActiveStyle.getFocusBlockObject(snapshot), nextBlock = selector_isActiveStyle.getNextBlock(snapshot);
|
|
6887
6953
|
return focusBlockObject && !nextBlock;
|
|
6888
6954
|
},
|
|
6889
6955
|
actions: [({
|
|
@@ -6901,9 +6967,9 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
|
|
|
6901
6967
|
snapshot,
|
|
6902
6968
|
event
|
|
6903
6969
|
}) => {
|
|
6904
|
-
if (!defaultKeyboardShortcuts.arrowUp.guard(event.originEvent) || !
|
|
6970
|
+
if (!defaultKeyboardShortcuts.arrowUp.guard(event.originEvent) || !selector_getSelectionText.isSelectionCollapsed(snapshot))
|
|
6905
6971
|
return !1;
|
|
6906
|
-
const focusBlockObject =
|
|
6972
|
+
const focusBlockObject = selector_isActiveStyle.getFocusBlockObject(snapshot), previousBlock = selector_isActiveStyle.getPreviousBlock(snapshot);
|
|
6907
6973
|
return focusBlockObject && !previousBlock;
|
|
6908
6974
|
},
|
|
6909
6975
|
actions: [({
|
|
@@ -6920,8 +6986,8 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
|
|
|
6920
6986
|
guard: ({
|
|
6921
6987
|
snapshot
|
|
6922
6988
|
}) => {
|
|
6923
|
-
const focusBlockObject =
|
|
6924
|
-
return
|
|
6989
|
+
const focusBlockObject = selector_isActiveStyle.getFocusBlockObject(snapshot);
|
|
6990
|
+
return selector_getSelectionText.isSelectionCollapsed(snapshot) && focusBlockObject !== void 0;
|
|
6925
6991
|
},
|
|
6926
6992
|
actions: [({
|
|
6927
6993
|
snapshot
|
|
@@ -6938,15 +7004,15 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
|
|
|
6938
7004
|
snapshot,
|
|
6939
7005
|
event
|
|
6940
7006
|
}) => {
|
|
6941
|
-
if (snapshot.context.readOnly || snapshot.context.selection && !
|
|
7007
|
+
if (snapshot.context.readOnly || snapshot.context.selection && !selector_getSelectionText.isSelectionCollapsed(snapshot))
|
|
6942
7008
|
return !1;
|
|
6943
|
-
const focusBlockObject =
|
|
7009
|
+
const focusBlockObject = selector_isActiveStyle.getFocusBlockObject({
|
|
6944
7010
|
...snapshot,
|
|
6945
7011
|
context: {
|
|
6946
7012
|
...snapshot.context,
|
|
6947
7013
|
selection: event.position.selection
|
|
6948
7014
|
}
|
|
6949
|
-
}), previousBlock =
|
|
7015
|
+
}), previousBlock = selector_isActiveStyle.getPreviousBlock({
|
|
6950
7016
|
...snapshot,
|
|
6951
7017
|
context: {
|
|
6952
7018
|
...snapshot.context,
|
|
@@ -6975,15 +7041,15 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
|
|
|
6975
7041
|
snapshot,
|
|
6976
7042
|
event
|
|
6977
7043
|
}) => {
|
|
6978
|
-
if (snapshot.context.readOnly || snapshot.context.selection && !
|
|
7044
|
+
if (snapshot.context.readOnly || snapshot.context.selection && !selector_getSelectionText.isSelectionCollapsed(snapshot))
|
|
6979
7045
|
return !1;
|
|
6980
|
-
const focusBlockObject =
|
|
7046
|
+
const focusBlockObject = selector_isActiveStyle.getFocusBlockObject({
|
|
6981
7047
|
...snapshot,
|
|
6982
7048
|
context: {
|
|
6983
7049
|
...snapshot.context,
|
|
6984
7050
|
selection: event.position.selection
|
|
6985
7051
|
}
|
|
6986
|
-
}), nextBlock =
|
|
7052
|
+
}), nextBlock = selector_isActiveStyle.getNextBlock({
|
|
6987
7053
|
...snapshot,
|
|
6988
7054
|
context: {
|
|
6989
7055
|
...snapshot.context,
|
|
@@ -7011,8 +7077,8 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
|
|
|
7011
7077
|
guard: ({
|
|
7012
7078
|
snapshot
|
|
7013
7079
|
}) => {
|
|
7014
|
-
const focusTextBlock =
|
|
7015
|
-
return !focusTextBlock || !selectionCollapsed || !previousBlock ? !1 :
|
|
7080
|
+
const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), previousBlock = selector_isActiveStyle.getPreviousBlock(snapshot);
|
|
7081
|
+
return !focusTextBlock || !selectionCollapsed || !previousBlock ? !1 : util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusTextBlock.node) && !schema.isTextBlock(snapshot.context, previousBlock.node) ? {
|
|
7016
7082
|
focusTextBlock,
|
|
7017
7083
|
previousBlock
|
|
7018
7084
|
} : !1;
|
|
@@ -7041,8 +7107,8 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
|
|
|
7041
7107
|
guard: ({
|
|
7042
7108
|
snapshot
|
|
7043
7109
|
}) => {
|
|
7044
|
-
const focusTextBlock =
|
|
7045
|
-
return !focusTextBlock || !selectionCollapsed || !nextBlock ? !1 :
|
|
7110
|
+
const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), nextBlock = selector_isActiveStyle.getNextBlock(snapshot);
|
|
7111
|
+
return !focusTextBlock || !selectionCollapsed || !nextBlock ? !1 : util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusTextBlock.node) && !schema.isTextBlock(snapshot.context, nextBlock.node) ? {
|
|
7046
7112
|
focusTextBlock,
|
|
7047
7113
|
nextBlock
|
|
7048
7114
|
} : !1;
|
|
@@ -7150,7 +7216,7 @@ const coreDndBehaviors = [
|
|
|
7150
7216
|
const dragSelection = getDragSelection({
|
|
7151
7217
|
snapshot,
|
|
7152
7218
|
eventSelection: event.position.selection
|
|
7153
|
-
}), selectingEntireBlocks =
|
|
7219
|
+
}), selectingEntireBlocks = selector_isActiveStyle.isSelectingEntireBlocks({
|
|
7154
7220
|
...snapshot,
|
|
7155
7221
|
context: {
|
|
7156
7222
|
...snapshot.context,
|
|
@@ -7256,7 +7322,7 @@ const coreDndBehaviors = [
|
|
|
7256
7322
|
event
|
|
7257
7323
|
}) => {
|
|
7258
7324
|
const dragOrigin = event.dragOrigin;
|
|
7259
|
-
return dragOrigin ?
|
|
7325
|
+
return dragOrigin ? selector_isActiveStyle.isOverlappingSelection(event.position.selection)({
|
|
7260
7326
|
...snapshot,
|
|
7261
7327
|
context: {
|
|
7262
7328
|
...snapshot.context,
|
|
@@ -7277,7 +7343,7 @@ const coreDndBehaviors = [
|
|
|
7277
7343
|
event
|
|
7278
7344
|
}) => {
|
|
7279
7345
|
const dragOrigin = event.dragOrigin, dropPosition = event.position.selection;
|
|
7280
|
-
return dragOrigin ?
|
|
7346
|
+
return dragOrigin ? selector_isActiveStyle.isOverlappingSelection(dropPosition)({
|
|
7281
7347
|
...snapshot,
|
|
7282
7348
|
context: {
|
|
7283
7349
|
...snapshot.context,
|
|
@@ -7333,19 +7399,19 @@ const coreDndBehaviors = [
|
|
|
7333
7399
|
const dragOrigin = event.originEvent.dragOrigin, dragSelection = getDragSelection({
|
|
7334
7400
|
eventSelection: dragOrigin.selection,
|
|
7335
7401
|
snapshot
|
|
7336
|
-
}), dropPosition = event.originEvent.position.selection, droppingOnDragOrigin = dragOrigin ?
|
|
7402
|
+
}), dropPosition = event.originEvent.position.selection, droppingOnDragOrigin = dragOrigin ? selector_isActiveStyle.isOverlappingSelection(dropPosition)({
|
|
7337
7403
|
...snapshot,
|
|
7338
7404
|
context: {
|
|
7339
7405
|
...snapshot.context,
|
|
7340
7406
|
selection: dragSelection
|
|
7341
7407
|
}
|
|
7342
|
-
}) : !1, draggingEntireBlocks =
|
|
7408
|
+
}) : !1, draggingEntireBlocks = selector_isActiveStyle.isSelectingEntireBlocks({
|
|
7343
7409
|
...snapshot,
|
|
7344
7410
|
context: {
|
|
7345
7411
|
...snapshot.context,
|
|
7346
7412
|
selection: dragSelection
|
|
7347
7413
|
}
|
|
7348
|
-
}), draggedBlocks =
|
|
7414
|
+
}), draggedBlocks = selector_isActiveStyle.getSelectedBlocks({
|
|
7349
7415
|
...snapshot,
|
|
7350
7416
|
context: {
|
|
7351
7417
|
...snapshot.context,
|
|
@@ -7388,9 +7454,9 @@ const coreDndBehaviors = [
|
|
|
7388
7454
|
guard: ({
|
|
7389
7455
|
snapshot
|
|
7390
7456
|
}) => {
|
|
7391
|
-
if (!
|
|
7457
|
+
if (!selector_getSelectionText.getFocusSpan(snapshot))
|
|
7392
7458
|
return !1;
|
|
7393
|
-
const markState =
|
|
7459
|
+
const markState = selector_isActiveStyle.getMarkState(snapshot), activeDecorators = selector_isActiveStyle.getActiveDecorators(snapshot), activeAnnotations = selector_isActiveStyle.getActiveAnnotationsMarks(snapshot);
|
|
7394
7460
|
if (markState && markState.state === "unchanged") {
|
|
7395
7461
|
const markStateDecorators = (markState.marks ?? []).filter((mark) => snapshot.context.schema.decorators.map((decorator) => decorator.name).includes(mark));
|
|
7396
7462
|
if (markStateDecorators.length === activeDecorators.length && markStateDecorators.every((mark) => activeDecorators.includes(mark)))
|
|
@@ -7420,10 +7486,10 @@ const coreDndBehaviors = [
|
|
|
7420
7486
|
guard: ({
|
|
7421
7487
|
snapshot
|
|
7422
7488
|
}) => {
|
|
7423
|
-
const focusTextBlock =
|
|
7489
|
+
const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot);
|
|
7424
7490
|
if (!snapshot.context.selection || !focusTextBlock || !selectionCollapsed)
|
|
7425
7491
|
return !1;
|
|
7426
|
-
const atTheEndOfBlock =
|
|
7492
|
+
const atTheEndOfBlock = selector_isActiveStyle.isAtTheEndOfBlock(focusTextBlock)(snapshot), focusListItem = focusTextBlock.node.listItem, focusLevel = focusTextBlock.node.level;
|
|
7427
7493
|
return atTheEndOfBlock ? {
|
|
7428
7494
|
focusListItem,
|
|
7429
7495
|
focusLevel
|
|
@@ -7455,11 +7521,11 @@ const coreDndBehaviors = [
|
|
|
7455
7521
|
guard: ({
|
|
7456
7522
|
snapshot
|
|
7457
7523
|
}) => {
|
|
7458
|
-
const focusTextBlock =
|
|
7524
|
+
const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot);
|
|
7459
7525
|
if (!snapshot.context.selection || !focusTextBlock || !selectionCollapsed)
|
|
7460
7526
|
return !1;
|
|
7461
|
-
const focusSpan =
|
|
7462
|
-
return
|
|
7527
|
+
const focusSpan = selector_getSelectionText.getFocusSpan(snapshot), focusDecorators = focusSpan?.node.marks?.filter((mark) => snapshot.context.schema.decorators.some((decorator) => decorator.name === mark) ?? []), focusAnnotations = focusSpan?.node.marks?.filter((mark) => !snapshot.context.schema.decorators.some((decorator) => decorator.name === mark)) ?? [], focusListItem = focusTextBlock.node.listItem, focusLevel = focusTextBlock.node.level;
|
|
7528
|
+
return selector_isActiveStyle.isAtTheStartOfBlock(focusTextBlock)(snapshot) ? {
|
|
7463
7529
|
focusAnnotations,
|
|
7464
7530
|
focusDecorators,
|
|
7465
7531
|
focusListItem,
|
|
@@ -7494,19 +7560,19 @@ const coreDndBehaviors = [
|
|
|
7494
7560
|
guard: ({
|
|
7495
7561
|
snapshot
|
|
7496
7562
|
}) => {
|
|
7497
|
-
if (!snapshot.context.selection || !
|
|
7563
|
+
if (!snapshot.context.selection || !selector_getSelectionText.isSelectionExpanded(snapshot))
|
|
7498
7564
|
return !1;
|
|
7499
|
-
const firstBlock =
|
|
7565
|
+
const firstBlock = selector_isActiveStyle.getFirstBlock(snapshot), lastBlock = selector_isActiveStyle.getLastBlock(snapshot);
|
|
7500
7566
|
if (!firstBlock || !lastBlock)
|
|
7501
7567
|
return !1;
|
|
7502
|
-
const firstBlockStartPoint =
|
|
7568
|
+
const firstBlockStartPoint = util_getTextBlockText.getBlockStartPoint({
|
|
7503
7569
|
context: snapshot.context,
|
|
7504
7570
|
block: firstBlock
|
|
7505
|
-
}), selectionStartPoint =
|
|
7571
|
+
}), selectionStartPoint = util_getTextBlockText.getSelectionStartPoint(snapshot.context.selection), lastBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
|
|
7506
7572
|
context: snapshot.context,
|
|
7507
7573
|
block: lastBlock
|
|
7508
|
-
}), selectionEndPoint =
|
|
7509
|
-
return
|
|
7574
|
+
}), selectionEndPoint = util_getTextBlockText.getSelectionEndPoint(snapshot.context.selection);
|
|
7575
|
+
return util_isEmptyTextBlock.isEqualSelectionPoints(firstBlockStartPoint, selectionStartPoint) && util_isEmptyTextBlock.isEqualSelectionPoints(lastBlockEndPoint, selectionEndPoint) ? {
|
|
7510
7576
|
selection: snapshot.context.selection
|
|
7511
7577
|
} : !1;
|
|
7512
7578
|
},
|
|
@@ -7521,19 +7587,19 @@ const coreDndBehaviors = [
|
|
|
7521
7587
|
guard: ({
|
|
7522
7588
|
snapshot
|
|
7523
7589
|
}) => {
|
|
7524
|
-
if (!snapshot.context.selection || !
|
|
7590
|
+
if (!snapshot.context.selection || !selector_getSelectionText.isSelectionExpanded(snapshot))
|
|
7525
7591
|
return !1;
|
|
7526
|
-
const selectedBlocks =
|
|
7592
|
+
const selectedBlocks = selector_isActiveStyle.getSelectedBlocks(snapshot), selectionStartBlock = selector_isActiveStyle.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isActiveStyle.getSelectionEndBlock(snapshot);
|
|
7527
7593
|
if (!selectionStartBlock || !selectionEndBlock)
|
|
7528
7594
|
return !1;
|
|
7529
|
-
const startBlockStartPoint =
|
|
7595
|
+
const startBlockStartPoint = util_getTextBlockText.getBlockStartPoint({
|
|
7530
7596
|
context: snapshot.context,
|
|
7531
7597
|
block: selectionStartBlock
|
|
7532
|
-
}), selectionStartPoint =
|
|
7598
|
+
}), selectionStartPoint = util_getTextBlockText.getSelectionStartPoint(snapshot.context.selection), endBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
|
|
7533
7599
|
context: snapshot.context,
|
|
7534
7600
|
block: selectionEndBlock
|
|
7535
|
-
}), selectionEndPoint =
|
|
7536
|
-
return
|
|
7601
|
+
}), selectionEndPoint = util_getTextBlockText.getSelectionEndPoint(snapshot.context.selection);
|
|
7602
|
+
return util_isEmptyTextBlock.isEqualSelectionPoints(selectionStartPoint, startBlockStartPoint) && util_isEmptyTextBlock.isEqualSelectionPoints(selectionEndPoint, endBlockEndPoint) ? {
|
|
7537
7603
|
selectedBlocks
|
|
7538
7604
|
} : !1;
|
|
7539
7605
|
},
|
|
@@ -7562,7 +7628,7 @@ const coreDndBehaviors = [
|
|
|
7562
7628
|
guard: ({
|
|
7563
7629
|
snapshot
|
|
7564
7630
|
}) => {
|
|
7565
|
-
const selectionCollapsed =
|
|
7631
|
+
const selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), focusInlineObject = selector_isActiveStyle.getFocusInlineObject(snapshot);
|
|
7566
7632
|
return selectionCollapsed && focusInlineObject;
|
|
7567
7633
|
},
|
|
7568
7634
|
actions: [() => [behaviors_index.raise({
|
|
@@ -7582,14 +7648,14 @@ function isAtTheBeginningOfBlock({
|
|
|
7582
7648
|
context,
|
|
7583
7649
|
block
|
|
7584
7650
|
}) {
|
|
7585
|
-
return !schema.isTextBlock(context, block) || !context.selection || !
|
|
7651
|
+
return !schema.isTextBlock(context, block) || !context.selection || !util_isEmptyTextBlock.isSelectionCollapsed(context.selection) ? !1 : util_getTextBlockText.getChildKeyFromSelectionPoint(context.selection.focus) === block.children[0]._key && context.selection.focus.offset === 0;
|
|
7586
7652
|
}
|
|
7587
7653
|
const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior({
|
|
7588
7654
|
on: "delete.backward",
|
|
7589
7655
|
guard: ({
|
|
7590
7656
|
snapshot
|
|
7591
7657
|
}) => {
|
|
7592
|
-
const focusTextBlock =
|
|
7658
|
+
const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
|
|
7593
7659
|
return !focusTextBlock || focusTextBlock.node.level !== 1 || !isAtTheBeginningOfBlock({
|
|
7594
7660
|
context: snapshot.context,
|
|
7595
7661
|
block: focusTextBlock.node
|
|
@@ -7609,7 +7675,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7609
7675
|
guard: ({
|
|
7610
7676
|
snapshot
|
|
7611
7677
|
}) => {
|
|
7612
|
-
const selectionCollapsed =
|
|
7678
|
+
const selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), focusSpan = selector_getSelectionText.getFocusSpan(snapshot);
|
|
7613
7679
|
return !selectionCollapsed || !focusTextBlock || !focusSpan ? !1 : focusTextBlock.node.children[0]._key === focusSpan.node._key && snapshot.context.selection?.focus.offset === 0 && focusTextBlock.node.level !== void 0 && focusTextBlock.node.level > 1 ? {
|
|
7614
7680
|
focusTextBlock,
|
|
7615
7681
|
level: focusTextBlock.node.level - 1
|
|
@@ -7630,8 +7696,8 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7630
7696
|
guard: ({
|
|
7631
7697
|
snapshot
|
|
7632
7698
|
}) => {
|
|
7633
|
-
const focusListBlock =
|
|
7634
|
-
return !focusListBlock || !nextBlock || !schema.isTextBlock(snapshot.context, nextBlock.node) || !
|
|
7699
|
+
const focusListBlock = selector_isActiveStyle.getFocusListBlock(snapshot), nextBlock = selector_isActiveStyle.getNextBlock(snapshot);
|
|
7700
|
+
return !focusListBlock || !nextBlock || !schema.isTextBlock(snapshot.context, nextBlock.node) || !util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusListBlock.node) ? !1 : {
|
|
7635
7701
|
focusListBlock,
|
|
7636
7702
|
nextBlock
|
|
7637
7703
|
};
|
|
@@ -7652,13 +7718,13 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7652
7718
|
guard: ({
|
|
7653
7719
|
snapshot
|
|
7654
7720
|
}) => {
|
|
7655
|
-
const focusTextBlock =
|
|
7721
|
+
const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), previousBlock = selector_isActiveStyle.getPreviousBlock(snapshot);
|
|
7656
7722
|
if (!focusTextBlock || !previousBlock || !isAtTheBeginningOfBlock({
|
|
7657
7723
|
context: snapshot.context,
|
|
7658
7724
|
block: focusTextBlock.node
|
|
7659
|
-
}) || !
|
|
7725
|
+
}) || !util_getTextBlockText.isListBlock(snapshot.context, previousBlock.node) || !util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, previousBlock.node))
|
|
7660
7726
|
return !1;
|
|
7661
|
-
const previousBlockEndPoint =
|
|
7727
|
+
const previousBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
|
|
7662
7728
|
context: snapshot.context,
|
|
7663
7729
|
block: previousBlock
|
|
7664
7730
|
});
|
|
@@ -7691,7 +7757,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7691
7757
|
snapshot,
|
|
7692
7758
|
event
|
|
7693
7759
|
}) => {
|
|
7694
|
-
const blocksToDelete =
|
|
7760
|
+
const blocksToDelete = selector_isActiveStyle.getSelectedBlocks({
|
|
7695
7761
|
...snapshot,
|
|
7696
7762
|
context: {
|
|
7697
7763
|
...snapshot.context,
|
|
@@ -7701,14 +7767,14 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7701
7767
|
if (blocksToDelete.length < 2)
|
|
7702
7768
|
return !1;
|
|
7703
7769
|
const startBlock = blocksToDelete.at(0)?.node, middleBlocks = blocksToDelete.slice(1, -1), endBlock = blocksToDelete.at(-1)?.node;
|
|
7704
|
-
if (!
|
|
7770
|
+
if (!util_getTextBlockText.isListBlock(snapshot.context, startBlock) || !util_getTextBlockText.isListBlock(snapshot.context, endBlock))
|
|
7705
7771
|
return !1;
|
|
7706
|
-
const deleteStartPoint =
|
|
7772
|
+
const deleteStartPoint = selector_getSelectionText.getSelectionStartPoint({
|
|
7707
7773
|
context: {
|
|
7708
7774
|
...snapshot.context,
|
|
7709
7775
|
selection: event.at
|
|
7710
7776
|
}
|
|
7711
|
-
}), deleteEndPoint =
|
|
7777
|
+
}), deleteEndPoint = selector_isActiveStyle.getSelectionEndPoint({
|
|
7712
7778
|
context: {
|
|
7713
7779
|
...snapshot.context,
|
|
7714
7780
|
selection: event.at
|
|
@@ -7716,7 +7782,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7716
7782
|
});
|
|
7717
7783
|
if (!deleteStartPoint || !deleteEndPoint)
|
|
7718
7784
|
return !1;
|
|
7719
|
-
const startBlockStartPoint =
|
|
7785
|
+
const startBlockStartPoint = util_getTextBlockText.getBlockStartPoint({
|
|
7720
7786
|
context: snapshot.context,
|
|
7721
7787
|
block: {
|
|
7722
7788
|
node: startBlock,
|
|
@@ -7725,9 +7791,9 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7725
7791
|
}]
|
|
7726
7792
|
}
|
|
7727
7793
|
});
|
|
7728
|
-
if (!
|
|
7794
|
+
if (!util_isEmptyTextBlock.isEqualSelectionPoints(deleteStartPoint, startBlockStartPoint))
|
|
7729
7795
|
return !1;
|
|
7730
|
-
const startBlockEndPoint =
|
|
7796
|
+
const startBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
|
|
7731
7797
|
context: snapshot.context,
|
|
7732
7798
|
block: {
|
|
7733
7799
|
node: startBlock,
|
|
@@ -7735,7 +7801,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7735
7801
|
_key: startBlock._key
|
|
7736
7802
|
}]
|
|
7737
7803
|
}
|
|
7738
|
-
}), endBlockEndPoint =
|
|
7804
|
+
}), endBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
|
|
7739
7805
|
context: snapshot.context,
|
|
7740
7806
|
block: {
|
|
7741
7807
|
node: endBlock,
|
|
@@ -7810,8 +7876,8 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7810
7876
|
guard: ({
|
|
7811
7877
|
snapshot
|
|
7812
7878
|
}) => {
|
|
7813
|
-
const selectionCollapsed =
|
|
7814
|
-
return !selectionCollapsed || !focusListBlock || !
|
|
7879
|
+
const selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), focusListBlock = selector_isActiveStyle.getFocusListBlock(snapshot);
|
|
7880
|
+
return !selectionCollapsed || !focusListBlock || !util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusListBlock.node) ? !1 : {
|
|
7815
7881
|
focusListBlock
|
|
7816
7882
|
};
|
|
7817
7883
|
},
|
|
@@ -7830,7 +7896,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7830
7896
|
}) => {
|
|
7831
7897
|
if (!defaultKeyboardShortcuts.tab.guard(event.originEvent))
|
|
7832
7898
|
return !1;
|
|
7833
|
-
const selectedBlocks =
|
|
7899
|
+
const selectedBlocks = selector_isActiveStyle.getSelectedBlocks(snapshot), selectedListBlocks = selectedBlocks.flatMap((block) => util_getTextBlockText.isListBlock(snapshot.context, block.node) ? [{
|
|
7834
7900
|
node: block.node,
|
|
7835
7901
|
path: block.path
|
|
7836
7902
|
}] : []);
|
|
@@ -7855,7 +7921,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7855
7921
|
}) => {
|
|
7856
7922
|
if (!defaultKeyboardShortcuts.shiftTab.guard(event.originEvent))
|
|
7857
7923
|
return !1;
|
|
7858
|
-
const selectedBlocks =
|
|
7924
|
+
const selectedBlocks = selector_isActiveStyle.getSelectedBlocks(snapshot), selectedListBlocks = selectedBlocks.flatMap((block) => util_getTextBlockText.isListBlock(snapshot.context, block.node) ? [{
|
|
7859
7925
|
node: block.node,
|
|
7860
7926
|
path: block.path
|
|
7861
7927
|
}] : []);
|
|
@@ -7878,10 +7944,10 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7878
7944
|
snapshot,
|
|
7879
7945
|
event
|
|
7880
7946
|
}) => {
|
|
7881
|
-
const focusListBlock =
|
|
7947
|
+
const focusListBlock = selector_isActiveStyle.getFocusListBlock(snapshot);
|
|
7882
7948
|
if (!focusListBlock)
|
|
7883
7949
|
return !1;
|
|
7884
|
-
const firstInsertedBlock = event.blocks.at(0), secondInsertedBlock = event.blocks.at(1), insertedListBlock =
|
|
7950
|
+
const firstInsertedBlock = event.blocks.at(0), secondInsertedBlock = event.blocks.at(1), insertedListBlock = util_getTextBlockText.isListBlock(snapshot.context, firstInsertedBlock) ? firstInsertedBlock : util_getTextBlockText.isListBlock(snapshot.context, secondInsertedBlock) ? secondInsertedBlock : void 0;
|
|
7885
7951
|
if (!insertedListBlock)
|
|
7886
7952
|
return !1;
|
|
7887
7953
|
const levelDifference = focusListBlock.node.level - insertedListBlock.level;
|
|
@@ -7900,7 +7966,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7900
7966
|
let adjustLevel = !0, listStartBlockFound = !1;
|
|
7901
7967
|
return [behaviors_index.raise({
|
|
7902
7968
|
...event,
|
|
7903
|
-
blocks: event.blocks.map((block) => (block._key === insertedListBlock._key && (listStartBlockFound = !0), adjustLevel ? listStartBlockFound && adjustLevel &&
|
|
7969
|
+
blocks: event.blocks.map((block) => (block._key === insertedListBlock._key && (listStartBlockFound = !0), adjustLevel ? listStartBlockFound && adjustLevel && util_getTextBlockText.isListBlock(snapshot.context, block) ? {
|
|
7904
7970
|
...block,
|
|
7905
7971
|
level: Math.min(MAX_LIST_LEVEL, Math.max(1, block.level + levelDifference))
|
|
7906
7972
|
} : (listStartBlockFound && (adjustLevel = !1), block) : block))
|
|
@@ -7912,10 +7978,10 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7912
7978
|
snapshot,
|
|
7913
7979
|
event
|
|
7914
7980
|
}) => {
|
|
7915
|
-
const focusListBlock =
|
|
7916
|
-
if (!focusListBlock ||
|
|
7981
|
+
const focusListBlock = selector_isActiveStyle.getFocusListBlock(snapshot);
|
|
7982
|
+
if (!focusListBlock || util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusListBlock.node))
|
|
7917
7983
|
return !1;
|
|
7918
|
-
const firstInsertedBlock = event.blocks.at(0), secondInsertedBlock = event.blocks.at(1), insertedListBlock =
|
|
7984
|
+
const firstInsertedBlock = event.blocks.at(0), secondInsertedBlock = event.blocks.at(1), insertedListBlock = util_getTextBlockText.isListBlock(snapshot.context, firstInsertedBlock) ? firstInsertedBlock : util_getTextBlockText.isListBlock(snapshot.context, secondInsertedBlock) ? secondInsertedBlock : void 0;
|
|
7919
7985
|
return !insertedListBlock || focusListBlock.node.level !== insertedListBlock.level || focusListBlock.node.listItem === insertedListBlock.listItem ? !1 : {
|
|
7920
7986
|
listItem: focusListBlock.node.listItem,
|
|
7921
7987
|
insertedListBlock
|
|
@@ -7931,7 +7997,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7931
7997
|
let adjustListItem = !0, listStartBlockFound = !1;
|
|
7932
7998
|
return [behaviors_index.raise({
|
|
7933
7999
|
...event,
|
|
7934
|
-
blocks: event.blocks.map((block) => (block._key === insertedListBlock._key && (listStartBlockFound = !0), adjustListItem ? listStartBlockFound && adjustListItem &&
|
|
8000
|
+
blocks: event.blocks.map((block) => (block._key === insertedListBlock._key && (listStartBlockFound = !0), adjustListItem ? listStartBlockFound && adjustListItem && util_getTextBlockText.isListBlock(snapshot.context, block) ? {
|
|
7935
8001
|
...block,
|
|
7936
8002
|
listItem: block.level === insertedListBlock.level ? listItem : block.listItem
|
|
7937
8003
|
} : (listStartBlockFound && (adjustListItem = !1), block) : block))
|
|
@@ -7945,8 +8011,8 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7945
8011
|
}) => {
|
|
7946
8012
|
if (event.placement !== "auto" || event.block._type !== snapshot.context.schema.block.name || event.block.listItem !== void 0)
|
|
7947
8013
|
return !1;
|
|
7948
|
-
const focusListBlock =
|
|
7949
|
-
return !focusListBlock || !
|
|
8014
|
+
const focusListBlock = selector_isActiveStyle.getFocusListBlock(snapshot);
|
|
8015
|
+
return !focusListBlock || !util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusListBlock.node) ? !1 : {
|
|
7950
8016
|
level: focusListBlock.node.level,
|
|
7951
8017
|
listItem: focusListBlock.node.listItem
|
|
7952
8018
|
};
|
|
@@ -7989,7 +8055,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
7989
8055
|
snapshot,
|
|
7990
8056
|
event
|
|
7991
8057
|
}) => {
|
|
7992
|
-
const blockKey = event.at[0]._key, markDefKey = event.at[2]._key, block =
|
|
8058
|
+
const blockKey = event.at[0]._key, markDefKey = event.at[2]._key, block = selector_getSelectionText.getFocusTextBlock({
|
|
7993
8059
|
...snapshot,
|
|
7994
8060
|
context: {
|
|
7995
8061
|
...snapshot.context,
|
|
@@ -8037,7 +8103,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8037
8103
|
guard: ({
|
|
8038
8104
|
snapshot,
|
|
8039
8105
|
event
|
|
8040
|
-
}) =>
|
|
8106
|
+
}) => selector_isActiveStyle.isActiveAnnotation(event.annotation.name)(snapshot),
|
|
8041
8107
|
actions: [({
|
|
8042
8108
|
event
|
|
8043
8109
|
}) => [behaviors_index.raise({
|
|
@@ -8049,7 +8115,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8049
8115
|
guard: ({
|
|
8050
8116
|
snapshot,
|
|
8051
8117
|
event
|
|
8052
|
-
}) => !
|
|
8118
|
+
}) => !selector_isActiveStyle.isActiveAnnotation(event.annotation.name)(snapshot),
|
|
8053
8119
|
actions: [({
|
|
8054
8120
|
event
|
|
8055
8121
|
}) => [behaviors_index.raise({
|
|
@@ -8061,7 +8127,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8061
8127
|
guard: ({
|
|
8062
8128
|
snapshot,
|
|
8063
8129
|
event
|
|
8064
|
-
}) =>
|
|
8130
|
+
}) => selector_isActiveStyle.isActiveDecorator(event.decorator)(snapshot),
|
|
8065
8131
|
actions: [({
|
|
8066
8132
|
event
|
|
8067
8133
|
}) => [behaviors_index.raise({
|
|
@@ -8078,13 +8144,13 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8078
8144
|
context: snapshot.context,
|
|
8079
8145
|
offsets: event.at
|
|
8080
8146
|
}) : null;
|
|
8081
|
-
return manualSelection ? !
|
|
8147
|
+
return manualSelection ? !selector_isActiveStyle.isActiveDecorator(event.decorator)({
|
|
8082
8148
|
...snapshot,
|
|
8083
8149
|
context: {
|
|
8084
8150
|
...snapshot.context,
|
|
8085
8151
|
selection: manualSelection
|
|
8086
8152
|
}
|
|
8087
|
-
}) : !
|
|
8153
|
+
}) : !selector_isActiveStyle.isActiveDecorator(event.decorator)(snapshot);
|
|
8088
8154
|
},
|
|
8089
8155
|
actions: [({
|
|
8090
8156
|
event
|
|
@@ -8117,10 +8183,10 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8117
8183
|
}) => {
|
|
8118
8184
|
if (event.direction !== "backward")
|
|
8119
8185
|
return !1;
|
|
8120
|
-
const previousBlock =
|
|
8121
|
-
if (!previousBlock || !focusTextBlock || !
|
|
8186
|
+
const previousBlock = selector_isActiveStyle.getPreviousBlock(snapshot), focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
|
|
8187
|
+
if (!previousBlock || !focusTextBlock || !selector_isActiveStyle.isAtTheStartOfBlock(focusTextBlock)(snapshot))
|
|
8122
8188
|
return !1;
|
|
8123
|
-
const previousBlockEndPoint =
|
|
8189
|
+
const previousBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
|
|
8124
8190
|
context: snapshot.context,
|
|
8125
8191
|
block: previousBlock
|
|
8126
8192
|
});
|
|
@@ -8172,22 +8238,22 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8172
8238
|
}) => {
|
|
8173
8239
|
if (event.direction !== "forward")
|
|
8174
8240
|
return !1;
|
|
8175
|
-
const nextBlock =
|
|
8241
|
+
const nextBlock = selector_isActiveStyle.getNextBlock({
|
|
8176
8242
|
...snapshot,
|
|
8177
8243
|
context: {
|
|
8178
8244
|
...snapshot.context,
|
|
8179
8245
|
selection: event.at
|
|
8180
8246
|
}
|
|
8181
|
-
}), focusTextBlock =
|
|
8247
|
+
}), focusTextBlock = selector_getSelectionText.getFocusTextBlock({
|
|
8182
8248
|
...snapshot,
|
|
8183
8249
|
context: {
|
|
8184
8250
|
...snapshot.context,
|
|
8185
8251
|
selection: event.at
|
|
8186
8252
|
}
|
|
8187
8253
|
});
|
|
8188
|
-
if (!nextBlock || !focusTextBlock || !
|
|
8254
|
+
if (!nextBlock || !focusTextBlock || !util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusTextBlock.node))
|
|
8189
8255
|
return !1;
|
|
8190
|
-
const nextBlockStartPoint =
|
|
8256
|
+
const nextBlockStartPoint = util_getTextBlockText.getBlockStartPoint({
|
|
8191
8257
|
context: snapshot.context,
|
|
8192
8258
|
block: nextBlock
|
|
8193
8259
|
});
|
|
@@ -8217,8 +8283,8 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8217
8283
|
}) => {
|
|
8218
8284
|
if (event.direction !== "forward")
|
|
8219
8285
|
return !1;
|
|
8220
|
-
const nextBlock =
|
|
8221
|
-
return !nextBlock || !focusTextBlock || !
|
|
8286
|
+
const nextBlock = selector_isActiveStyle.getNextBlock(snapshot), focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
|
|
8287
|
+
return !nextBlock || !focusTextBlock || !selector_isActiveStyle.isAtTheEndOfBlock(focusTextBlock)(snapshot) || !schema.isTextBlock(snapshot.context, nextBlock.node) ? !1 : {
|
|
8222
8288
|
nextBlock
|
|
8223
8289
|
};
|
|
8224
8290
|
},
|
|
@@ -8257,7 +8323,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8257
8323
|
snapshot,
|
|
8258
8324
|
event
|
|
8259
8325
|
}) => {
|
|
8260
|
-
const focusChild =
|
|
8326
|
+
const focusChild = selector_getSelectionText.getFocusChild({
|
|
8261
8327
|
...snapshot,
|
|
8262
8328
|
context: {
|
|
8263
8329
|
...snapshot.context,
|
|
@@ -8315,7 +8381,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8315
8381
|
});
|
|
8316
8382
|
if (!selection)
|
|
8317
8383
|
return !1;
|
|
8318
|
-
const trimmedSelection =
|
|
8384
|
+
const trimmedSelection = selector_isActiveStyle.getTrimmedSelection({
|
|
8319
8385
|
...snapshot,
|
|
8320
8386
|
context: {
|
|
8321
8387
|
...snapshot.context,
|
|
@@ -8417,12 +8483,12 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8417
8483
|
snapshot,
|
|
8418
8484
|
event
|
|
8419
8485
|
}) => {
|
|
8420
|
-
if (
|
|
8421
|
-
const activeDecorators =
|
|
8486
|
+
if (selector_getSelectionText.getFocusTextBlock(snapshot) && event.mimeType === "text/plain" && event.originEvent.type === "clipboard.paste") {
|
|
8487
|
+
const activeDecorators = selector_isActiveStyle.getActiveDecorators(snapshot);
|
|
8422
8488
|
return {
|
|
8423
|
-
activeAnnotations:
|
|
8489
|
+
activeAnnotations: selector_isActiveStyle.getActiveAnnotations(snapshot),
|
|
8424
8490
|
activeDecorators,
|
|
8425
|
-
textRuns: event.data.flatMap((block) => schema.isTextBlock(snapshot.context, block) ? [
|
|
8491
|
+
textRuns: event.data.flatMap((block) => schema.isTextBlock(snapshot.context, block) ? [util_getTextBlockText.getTextBlockText(block)] : [])
|
|
8426
8492
|
};
|
|
8427
8493
|
}
|
|
8428
8494
|
return !1;
|
|
@@ -8629,8 +8695,8 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8629
8695
|
}) => {
|
|
8630
8696
|
if (event.placement !== "auto")
|
|
8631
8697
|
return !1;
|
|
8632
|
-
const focusTextBlock =
|
|
8633
|
-
if (!focusTextBlock || !
|
|
8698
|
+
const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
|
|
8699
|
+
if (!focusTextBlock || !util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusTextBlock.node))
|
|
8634
8700
|
return !1;
|
|
8635
8701
|
const firstBlockKey = event.blocks.at(0)?._key ?? snapshot.context.keyGenerator(), lastBlockKey = event.blocks.at(-1)?._key ?? snapshot.context.keyGenerator();
|
|
8636
8702
|
return {
|
|
@@ -8670,13 +8736,13 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8670
8736
|
}) => {
|
|
8671
8737
|
if (event.placement !== "auto")
|
|
8672
8738
|
return !1;
|
|
8673
|
-
const focusTextBlock =
|
|
8739
|
+
const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
|
|
8674
8740
|
if (!focusTextBlock || !snapshot.context.selection)
|
|
8675
8741
|
return !1;
|
|
8676
|
-
const focusBlockStartPoint =
|
|
8742
|
+
const focusBlockStartPoint = util_getTextBlockText.getBlockStartPoint({
|
|
8677
8743
|
context: snapshot.context,
|
|
8678
8744
|
block: focusTextBlock
|
|
8679
|
-
}), focusBlockEndPoint =
|
|
8745
|
+
}), focusBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
|
|
8680
8746
|
context: snapshot.context,
|
|
8681
8747
|
block: focusTextBlock
|
|
8682
8748
|
}), focusTextBlockAfter = util_sliceTextBlock.sliceTextBlock({
|
|
@@ -8705,7 +8771,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8705
8771
|
selection,
|
|
8706
8772
|
firstBlockKey,
|
|
8707
8773
|
focusBlockStartPoint
|
|
8708
|
-
}) => [...event.blocks.flatMap((block, index) => index === 0 ? [...
|
|
8774
|
+
}) => [...event.blocks.flatMap((block, index) => index === 0 ? [...util_isEmptyTextBlock.isEqualSelectionPoints(selection.focus, focusBlockEndPoint) ? [] : [behaviors_index.raise({
|
|
8709
8775
|
type: "delete",
|
|
8710
8776
|
at: {
|
|
8711
8777
|
anchor: selection.focus,
|
|
@@ -8734,7 +8800,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8734
8800
|
})]), ...event.select === "none" ? [behaviors_index.raise({
|
|
8735
8801
|
type: "select",
|
|
8736
8802
|
at: selection
|
|
8737
|
-
})] : event.select === "start" ? [
|
|
8803
|
+
})] : event.select === "start" ? [util_isEmptyTextBlock.isEqualSelectionPoints(selection.focus, focusBlockStartPoint) ? behaviors_index.raise({
|
|
8738
8804
|
type: "select.block",
|
|
8739
8805
|
at: [{
|
|
8740
8806
|
_key: firstBlockKey
|
|
@@ -8770,9 +8836,9 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8770
8836
|
guard: ({
|
|
8771
8837
|
snapshot
|
|
8772
8838
|
}) => {
|
|
8773
|
-
const lastBlock =
|
|
8839
|
+
const lastBlock = selector_isActiveStyle.getLastBlock(snapshot);
|
|
8774
8840
|
return !lastBlock || snapshot.context.selection ? !1 : {
|
|
8775
|
-
lastBlockEndPoint:
|
|
8841
|
+
lastBlockEndPoint: util_isEmptyTextBlock.getBlockEndPoint({
|
|
8776
8842
|
context: snapshot.context,
|
|
8777
8843
|
block: lastBlock
|
|
8778
8844
|
})
|
|
@@ -8794,7 +8860,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8794
8860
|
guard: ({
|
|
8795
8861
|
snapshot
|
|
8796
8862
|
}) => {
|
|
8797
|
-
const focusTextBlock =
|
|
8863
|
+
const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
|
|
8798
8864
|
return snapshot.context.selection && !focusTextBlock;
|
|
8799
8865
|
},
|
|
8800
8866
|
actions: [({
|
|
@@ -8835,7 +8901,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8835
8901
|
on: "insert.span",
|
|
8836
8902
|
guard: ({
|
|
8837
8903
|
snapshot
|
|
8838
|
-
}) => !
|
|
8904
|
+
}) => !selector_getSelectionText.getFocusTextBlock(snapshot),
|
|
8839
8905
|
actions: [({
|
|
8840
8906
|
snapshot,
|
|
8841
8907
|
event
|
|
@@ -8858,7 +8924,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8858
8924
|
snapshot,
|
|
8859
8925
|
event
|
|
8860
8926
|
}) => {
|
|
8861
|
-
const focusTextBlock =
|
|
8927
|
+
const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
|
|
8862
8928
|
return {
|
|
8863
8929
|
markDefs: event.annotations?.map((annotation) => ({
|
|
8864
8930
|
_type: annotation.name,
|
|
@@ -8907,7 +8973,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8907
8973
|
guard: ({
|
|
8908
8974
|
snapshot,
|
|
8909
8975
|
event
|
|
8910
|
-
}) => defaultKeyboardShortcuts.backspace.guard(event.originEvent) &&
|
|
8976
|
+
}) => defaultKeyboardShortcuts.backspace.guard(event.originEvent) && selector_getSelectionText.isSelectionCollapsed(snapshot) && selector_isActiveStyle.getFocusInlineObject(snapshot),
|
|
8911
8977
|
actions: [() => [behaviors_index.raise({
|
|
8912
8978
|
type: "delete.backward",
|
|
8913
8979
|
unit: "character"
|
|
@@ -8923,7 +8989,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8923
8989
|
guard: ({
|
|
8924
8990
|
snapshot,
|
|
8925
8991
|
event
|
|
8926
|
-
}) => defaultKeyboardShortcuts.delete.guard(event.originEvent) &&
|
|
8992
|
+
}) => defaultKeyboardShortcuts.delete.guard(event.originEvent) && selector_getSelectionText.isSelectionCollapsed(snapshot) && selector_isActiveStyle.getFocusInlineObject(snapshot),
|
|
8927
8993
|
actions: [() => [behaviors_index.raise({
|
|
8928
8994
|
type: "delete.forward",
|
|
8929
8995
|
unit: "character"
|
|
@@ -8938,7 +9004,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8938
9004
|
guard: ({
|
|
8939
9005
|
snapshot,
|
|
8940
9006
|
event
|
|
8941
|
-
}) => defaultKeyboardShortcuts.break.guard(event.originEvent) &&
|
|
9007
|
+
}) => defaultKeyboardShortcuts.break.guard(event.originEvent) && selector_getSelectionText.isSelectionCollapsed(snapshot) && selector_isActiveStyle.getFocusInlineObject(snapshot),
|
|
8942
9008
|
actions: [() => [behaviors_index.raise({
|
|
8943
9009
|
type: "insert.break"
|
|
8944
9010
|
})]]
|
|
@@ -8952,7 +9018,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8952
9018
|
guard: ({
|
|
8953
9019
|
snapshot,
|
|
8954
9020
|
event
|
|
8955
|
-
}) => defaultKeyboardShortcuts.break.guard(event.originEvent) &&
|
|
9021
|
+
}) => defaultKeyboardShortcuts.break.guard(event.originEvent) && selector_getSelectionText.isSelectionExpanded(snapshot),
|
|
8956
9022
|
actions: [() => [behaviors_index.raise({
|
|
8957
9023
|
type: "insert.break"
|
|
8958
9024
|
})]]
|
|
@@ -9007,10 +9073,10 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9007
9073
|
}) => {
|
|
9008
9074
|
if (!snapshot.context.selection || !shiftLeft.guard(event.originEvent))
|
|
9009
9075
|
return !1;
|
|
9010
|
-
const focusBlock =
|
|
9076
|
+
const focusBlock = selector_getSelectionText.getFocusBlock(snapshot);
|
|
9011
9077
|
if (!focusBlock)
|
|
9012
9078
|
return !1;
|
|
9013
|
-
const previousBlock =
|
|
9079
|
+
const previousBlock = selector_isActiveStyle.getPreviousBlock({
|
|
9014
9080
|
...snapshot,
|
|
9015
9081
|
context: {
|
|
9016
9082
|
...snapshot.context,
|
|
@@ -9026,7 +9092,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9026
9092
|
}
|
|
9027
9093
|
}
|
|
9028
9094
|
});
|
|
9029
|
-
return previousBlock && schema.isTextBlock(snapshot.context, focusBlock.node) && snapshot.context.selection.focus.offset === 0 &&
|
|
9095
|
+
return previousBlock && schema.isTextBlock(snapshot.context, focusBlock.node) && snapshot.context.selection.focus.offset === 0 && util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusBlock.node) ? {
|
|
9030
9096
|
previousBlock,
|
|
9031
9097
|
selection: snapshot.context.selection
|
|
9032
9098
|
} : !1;
|
|
@@ -9040,7 +9106,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9040
9106
|
type: "select",
|
|
9041
9107
|
at: {
|
|
9042
9108
|
anchor: selection.anchor,
|
|
9043
|
-
focus:
|
|
9109
|
+
focus: util_isEmptyTextBlock.getBlockEndPoint({
|
|
9044
9110
|
context: snapshot.context,
|
|
9045
9111
|
block: previousBlock
|
|
9046
9112
|
})
|
|
@@ -9053,7 +9119,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9053
9119
|
snapshot,
|
|
9054
9120
|
event
|
|
9055
9121
|
}) => snapshot.context.schema.lists.some((list) => list.name === event.listItem) ? {
|
|
9056
|
-
selectedTextBlocks:
|
|
9122
|
+
selectedTextBlocks: selector_isActiveStyle.getSelectedTextBlocks(snapshot)
|
|
9057
9123
|
} : !1,
|
|
9058
9124
|
actions: [({
|
|
9059
9125
|
event
|
|
@@ -9072,7 +9138,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9072
9138
|
guard: ({
|
|
9073
9139
|
snapshot
|
|
9074
9140
|
}) => ({
|
|
9075
|
-
selectedTextBlocks:
|
|
9141
|
+
selectedTextBlocks: selector_isActiveStyle.getSelectedTextBlocks(snapshot)
|
|
9076
9142
|
}),
|
|
9077
9143
|
actions: [(_, {
|
|
9078
9144
|
selectedTextBlocks
|
|
@@ -9086,7 +9152,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9086
9152
|
guard: ({
|
|
9087
9153
|
snapshot,
|
|
9088
9154
|
event
|
|
9089
|
-
}) =>
|
|
9155
|
+
}) => selector_isActiveStyle.isActiveListItem(event.listItem)(snapshot),
|
|
9090
9156
|
actions: [({
|
|
9091
9157
|
event
|
|
9092
9158
|
}) => [behaviors_index.raise({
|
|
@@ -9098,7 +9164,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9098
9164
|
guard: ({
|
|
9099
9165
|
snapshot,
|
|
9100
9166
|
event
|
|
9101
|
-
}) => !
|
|
9167
|
+
}) => !selector_isActiveStyle.isActiveListItem(event.listItem)(snapshot),
|
|
9102
9168
|
actions: [({
|
|
9103
9169
|
event
|
|
9104
9170
|
}) => [behaviors_index.raise({
|
|
@@ -9111,7 +9177,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9111
9177
|
snapshot,
|
|
9112
9178
|
event
|
|
9113
9179
|
}) => {
|
|
9114
|
-
const previousBlock =
|
|
9180
|
+
const previousBlock = selector_isActiveStyle.getPreviousBlock({
|
|
9115
9181
|
...snapshot,
|
|
9116
9182
|
context: {
|
|
9117
9183
|
...snapshot.context,
|
|
@@ -9146,7 +9212,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9146
9212
|
snapshot,
|
|
9147
9213
|
event
|
|
9148
9214
|
}) => {
|
|
9149
|
-
const nextBlock =
|
|
9215
|
+
const nextBlock = selector_isActiveStyle.getNextBlock({
|
|
9150
9216
|
...snapshot,
|
|
9151
9217
|
context: {
|
|
9152
9218
|
...snapshot.context,
|
|
@@ -9183,7 +9249,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9183
9249
|
}) => {
|
|
9184
9250
|
if (event.select !== "end")
|
|
9185
9251
|
return !1;
|
|
9186
|
-
const block =
|
|
9252
|
+
const block = selector_getSelectionText.getFocusBlock({
|
|
9187
9253
|
...snapshot,
|
|
9188
9254
|
context: {
|
|
9189
9255
|
...snapshot.context,
|
|
@@ -9200,7 +9266,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9200
9266
|
}
|
|
9201
9267
|
});
|
|
9202
9268
|
return block ? {
|
|
9203
|
-
blockEndPoint:
|
|
9269
|
+
blockEndPoint: util_isEmptyTextBlock.getBlockEndPoint({
|
|
9204
9270
|
context: snapshot.context,
|
|
9205
9271
|
block
|
|
9206
9272
|
})
|
|
@@ -9237,7 +9303,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9237
9303
|
guard: ({
|
|
9238
9304
|
snapshot
|
|
9239
9305
|
}) => {
|
|
9240
|
-
const previousBlock =
|
|
9306
|
+
const previousBlock = selector_isActiveStyle.getPreviousBlock(snapshot);
|
|
9241
9307
|
return previousBlock ? {
|
|
9242
9308
|
previousBlock
|
|
9243
9309
|
} : !1;
|
|
@@ -9256,7 +9322,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9256
9322
|
guard: ({
|
|
9257
9323
|
snapshot
|
|
9258
9324
|
}) => {
|
|
9259
|
-
const nextBlock =
|
|
9325
|
+
const nextBlock = selector_isActiveStyle.getNextBlock(snapshot);
|
|
9260
9326
|
return nextBlock ? {
|
|
9261
9327
|
nextBlock
|
|
9262
9328
|
} : !1;
|
|
@@ -9340,7 +9406,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9340
9406
|
on: "split",
|
|
9341
9407
|
guard: ({
|
|
9342
9408
|
snapshot
|
|
9343
|
-
}) =>
|
|
9409
|
+
}) => util_isEmptyTextBlock.isSelectionCollapsed(snapshot.context.selection) && selector_isActiveStyle.getFocusInlineObject(snapshot),
|
|
9344
9410
|
actions: []
|
|
9345
9411
|
}),
|
|
9346
9412
|
/**
|
|
@@ -9350,7 +9416,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9350
9416
|
on: "split",
|
|
9351
9417
|
guard: ({
|
|
9352
9418
|
snapshot
|
|
9353
|
-
}) =>
|
|
9419
|
+
}) => util_isEmptyTextBlock.isSelectionCollapsed(snapshot.context.selection) && selector_isActiveStyle.getFocusBlockObject(snapshot),
|
|
9354
9420
|
actions: []
|
|
9355
9421
|
}),
|
|
9356
9422
|
behaviors_index.defineBehavior({
|
|
@@ -9359,9 +9425,9 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9359
9425
|
snapshot
|
|
9360
9426
|
}) => {
|
|
9361
9427
|
const selection = snapshot.context.selection;
|
|
9362
|
-
if (!selection ||
|
|
9428
|
+
if (!selection || util_isEmptyTextBlock.isSelectionCollapsed(selection))
|
|
9363
9429
|
return !1;
|
|
9364
|
-
const selectionStartBlock =
|
|
9430
|
+
const selectionStartBlock = selector_isActiveStyle.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isActiveStyle.getSelectionEndBlock(snapshot);
|
|
9365
9431
|
return !selectionStartBlock || !selectionEndBlock ? !1 : !schema.isTextBlock(snapshot.context, selectionStartBlock.node) && schema.isTextBlock(snapshot.context, selectionEndBlock.node) ? {
|
|
9366
9432
|
selection
|
|
9367
9433
|
} : !1;
|
|
@@ -9379,18 +9445,18 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9379
9445
|
snapshot
|
|
9380
9446
|
}) => {
|
|
9381
9447
|
const selection = snapshot.context.selection;
|
|
9382
|
-
if (!selection ||
|
|
9448
|
+
if (!selection || util_isEmptyTextBlock.isSelectionCollapsed(selection))
|
|
9383
9449
|
return !1;
|
|
9384
|
-
const selectionStartBlock =
|
|
9450
|
+
const selectionStartBlock = selector_isActiveStyle.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isActiveStyle.getSelectionEndBlock(snapshot);
|
|
9385
9451
|
if (!selectionStartBlock || !selectionEndBlock || selectionStartBlock.node._key === selectionEndBlock.node._key)
|
|
9386
9452
|
return !1;
|
|
9387
|
-
const startPoint =
|
|
9453
|
+
const startPoint = util_getTextBlockText.getSelectionStartPoint(selection), startBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
|
|
9388
9454
|
context: snapshot.context,
|
|
9389
9455
|
block: selectionStartBlock
|
|
9390
|
-
}), endPoint =
|
|
9456
|
+
}), endPoint = util_getTextBlockText.getSelectionEndPoint(selection), endBlockStartPoint = util_getTextBlockText.getBlockStartPoint({
|
|
9391
9457
|
context: snapshot.context,
|
|
9392
9458
|
block: selectionEndBlock
|
|
9393
|
-
}), blocksInBetween =
|
|
9459
|
+
}), blocksInBetween = selector_getSelectionText.getSelectedValue(snapshot).filter((block) => block._key !== selectionStartBlock.node._key && block._key !== selectionEndBlock.node._key);
|
|
9394
9460
|
return {
|
|
9395
9461
|
startPoint,
|
|
9396
9462
|
startBlockEndPoint,
|
|
@@ -9430,7 +9496,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9430
9496
|
snapshot
|
|
9431
9497
|
}) => {
|
|
9432
9498
|
const selection = snapshot.context.selection;
|
|
9433
|
-
return !selection ||
|
|
9499
|
+
return !selection || util_isEmptyTextBlock.isSelectionCollapsed(selection) ? !1 : {
|
|
9434
9500
|
selection
|
|
9435
9501
|
};
|
|
9436
9502
|
},
|
|
@@ -9449,18 +9515,18 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9449
9515
|
snapshot
|
|
9450
9516
|
}) => {
|
|
9451
9517
|
const selection = snapshot.context.selection;
|
|
9452
|
-
if (!selection || !
|
|
9518
|
+
if (!selection || !util_isEmptyTextBlock.isSelectionCollapsed(selection))
|
|
9453
9519
|
return !1;
|
|
9454
|
-
const selectionStartPoint =
|
|
9520
|
+
const selectionStartPoint = util_getTextBlockText.getSelectionStartPoint(selection), focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
|
|
9455
9521
|
if (!focusTextBlock)
|
|
9456
9522
|
return !1;
|
|
9457
|
-
const blockEndPoint =
|
|
9523
|
+
const blockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
|
|
9458
9524
|
context: snapshot.context,
|
|
9459
9525
|
block: focusTextBlock
|
|
9460
9526
|
}), newTextBlockSelection = {
|
|
9461
9527
|
anchor: selectionStartPoint,
|
|
9462
9528
|
focus: blockEndPoint
|
|
9463
|
-
}, newTextBlock =
|
|
9529
|
+
}, newTextBlock = util_getTextBlockText.parseBlock({
|
|
9464
9530
|
block: util_sliceTextBlock.sliceTextBlock({
|
|
9465
9531
|
context: {
|
|
9466
9532
|
...snapshot.context,
|
|
@@ -9482,7 +9548,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9482
9548
|
actions: [(_, {
|
|
9483
9549
|
newTextBlock,
|
|
9484
9550
|
newTextBlockSelection
|
|
9485
|
-
}) =>
|
|
9551
|
+
}) => util_isEmptyTextBlock.isSelectionCollapsed(newTextBlockSelection) ? [behaviors_index.raise({
|
|
9486
9552
|
type: "insert.block",
|
|
9487
9553
|
block: newTextBlock,
|
|
9488
9554
|
placement: "after",
|
|
@@ -9502,7 +9568,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9502
9568
|
guard: ({
|
|
9503
9569
|
snapshot
|
|
9504
9570
|
}) => ({
|
|
9505
|
-
selectedTextBlocks:
|
|
9571
|
+
selectedTextBlocks: selector_isActiveStyle.getSelectedTextBlocks(snapshot)
|
|
9506
9572
|
}),
|
|
9507
9573
|
actions: [({
|
|
9508
9574
|
event
|
|
@@ -9520,7 +9586,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9520
9586
|
guard: ({
|
|
9521
9587
|
snapshot
|
|
9522
9588
|
}) => ({
|
|
9523
|
-
selectedTextBlocks:
|
|
9589
|
+
selectedTextBlocks: selector_isActiveStyle.getSelectedTextBlocks(snapshot)
|
|
9524
9590
|
}),
|
|
9525
9591
|
actions: [(_, {
|
|
9526
9592
|
selectedTextBlocks
|
|
@@ -9534,7 +9600,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9534
9600
|
guard: ({
|
|
9535
9601
|
snapshot,
|
|
9536
9602
|
event
|
|
9537
|
-
}) =>
|
|
9603
|
+
}) => selector_isActiveStyle.isActiveStyle(event.style)(snapshot),
|
|
9538
9604
|
actions: [({
|
|
9539
9605
|
event
|
|
9540
9606
|
}) => [behaviors_index.raise({
|
|
@@ -9546,7 +9612,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9546
9612
|
guard: ({
|
|
9547
9613
|
snapshot,
|
|
9548
9614
|
event
|
|
9549
|
-
}) => !
|
|
9615
|
+
}) => !selector_isActiveStyle.isActiveStyle(event.style)(snapshot),
|
|
9550
9616
|
actions: [({
|
|
9551
9617
|
event
|
|
9552
9618
|
}) => [behaviors_index.raise({
|
|
@@ -9558,7 +9624,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9558
9624
|
guard: ({
|
|
9559
9625
|
snapshot
|
|
9560
9626
|
}) => {
|
|
9561
|
-
const focusSpan =
|
|
9627
|
+
const focusSpan = selector_getSelectionText.getFocusSpan(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot);
|
|
9562
9628
|
return focusSpan && selectionCollapsed;
|
|
9563
9629
|
},
|
|
9564
9630
|
actions: []
|
|
@@ -9575,7 +9641,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9575
9641
|
guard: ({
|
|
9576
9642
|
snapshot
|
|
9577
9643
|
}) => {
|
|
9578
|
-
const focusSpan =
|
|
9644
|
+
const focusSpan = selector_getSelectionText.getFocusSpan(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot);
|
|
9579
9645
|
return focusSpan && selectionCollapsed;
|
|
9580
9646
|
},
|
|
9581
9647
|
actions: []
|
|
@@ -9609,7 +9675,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
9609
9675
|
on: "clipboard.paste",
|
|
9610
9676
|
guard: ({
|
|
9611
9677
|
snapshot
|
|
9612
|
-
}) => snapshot.context.selection &&
|
|
9678
|
+
}) => snapshot.context.selection && selector_getSelectionText.isSelectionExpanded(snapshot) ? {
|
|
9613
9679
|
selection: snapshot.context.selection
|
|
9614
9680
|
} : !1,
|
|
9615
9681
|
actions: [({
|
|
@@ -10693,13 +10759,13 @@ function createEditableAPI(editor, editorActor) {
|
|
|
10693
10759
|
editorActorSnapshot: editorActor.getSnapshot(),
|
|
10694
10760
|
slateEditorInstance: editor
|
|
10695
10761
|
});
|
|
10696
|
-
return
|
|
10762
|
+
return selector_isActiveStyle.getActiveDecorators(snapshot).includes(mark);
|
|
10697
10763
|
},
|
|
10698
10764
|
marks: () => {
|
|
10699
10765
|
const snapshot = getEditorSnapshot({
|
|
10700
10766
|
editorActorSnapshot: editorActor.getSnapshot(),
|
|
10701
10767
|
slateEditorInstance: editor
|
|
10702
|
-
}), activeAnnotations =
|
|
10768
|
+
}), activeAnnotations = selector_isActiveStyle.getActiveAnnotationsMarks(snapshot), activeDecorators = selector_isActiveStyle.getActiveDecorators(snapshot);
|
|
10703
10769
|
return [...activeAnnotations, ...activeDecorators];
|
|
10704
10770
|
},
|
|
10705
10771
|
undo: () => {
|
|
@@ -10909,13 +10975,13 @@ function createEditableAPI(editor, editorActor) {
|
|
|
10909
10975
|
editorActorSnapshot: editorActor.getSnapshot(),
|
|
10910
10976
|
slateEditorInstance: editor
|
|
10911
10977
|
});
|
|
10912
|
-
return
|
|
10978
|
+
return selector_isActiveStyle.isActiveAnnotation(annotationType)(snapshot);
|
|
10913
10979
|
},
|
|
10914
10980
|
addAnnotation: (type, value) => {
|
|
10915
10981
|
const snapshotBefore = getEditorSnapshot({
|
|
10916
10982
|
editorActorSnapshot: editorActor.getSnapshot(),
|
|
10917
10983
|
slateEditorInstance: editor
|
|
10918
|
-
}), selectedValueBefore =
|
|
10984
|
+
}), selectedValueBefore = selector_getSelectionText.getSelectedValue(snapshotBefore), focusSpanBefore = selector_getSelectionText.getFocusSpan(snapshotBefore), markDefsBefore = selectedValueBefore.flatMap((block) => schema.isTextBlock(snapshotBefore.context, block) ? block.markDefs ?? [] : []);
|
|
10919
10985
|
editorActor.send({
|
|
10920
10986
|
type: "behavior event",
|
|
10921
10987
|
behaviorEvent: {
|
|
@@ -10930,7 +10996,7 @@ function createEditableAPI(editor, editorActor) {
|
|
|
10930
10996
|
const snapshotAfter = getEditorSnapshot({
|
|
10931
10997
|
editorActorSnapshot: editorActor.getSnapshot(),
|
|
10932
10998
|
slateEditorInstance: editor
|
|
10933
|
-
}), selectedValueAfter =
|
|
10999
|
+
}), selectedValueAfter = selector_getSelectionText.getSelectedValue(snapshotAfter), focusBlockAfter = selector_getSelectionText.getFocusBlock(snapshotAfter), focusSpanAfter = selector_getSelectionText.getFocusSpan(snapshotAfter), newMarkDefKeysOnFocusSpan = focusSpanAfter?.node.marks?.filter((mark) => !focusSpanBefore?.node.marks?.includes(mark) && !snapshotAfter.context.schema.decorators.map((decorator) => decorator.name).includes(mark)), markDefs = selectedValueAfter.flatMap((block) => schema.isTextBlock(snapshotAfter.context, block) ? block.markDefs?.map((markDef2) => ({
|
|
10934
11000
|
markDef: markDef2,
|
|
10935
11001
|
path: [{
|
|
10936
11002
|
_key: block._key
|
|
@@ -12033,7 +12099,7 @@ function editorConfigToMachineInput(config) {
|
|
|
12033
12099
|
return {
|
|
12034
12100
|
converters: createCoreConverters(legacySchema),
|
|
12035
12101
|
getLegacySchema: () => legacySchema,
|
|
12036
|
-
keyGenerator: config.keyGenerator ??
|
|
12102
|
+
keyGenerator: config.keyGenerator ?? util_getTextBlockText.defaultKeyGenerator,
|
|
12037
12103
|
maxBlocks: config.maxBlocks,
|
|
12038
12104
|
readOnly: config.readOnly,
|
|
12039
12105
|
schema: schema2,
|
|
@@ -12699,7 +12765,7 @@ const usePortableTextEditorSelection = () => {
|
|
|
12699
12765
|
}, t1 = [editorActor], $[0] = editorActor, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), React.useEffect(t0, t1), selection;
|
|
12700
12766
|
};
|
|
12701
12767
|
exports.useEditor = useEditor.useEditor;
|
|
12702
|
-
exports.keyGenerator =
|
|
12768
|
+
exports.keyGenerator = util_getTextBlockText.defaultKeyGenerator;
|
|
12703
12769
|
Object.defineProperty(exports, "defineSchema", {
|
|
12704
12770
|
enumerable: !0,
|
|
12705
12771
|
get: function() {
|