@portabletext/editor 2.11.0 → 2.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_chunks-dts/behavior.types.action.d.ts +10 -10
- package/lib/index.cjs +98 -41
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +99 -42
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.ts +3 -3
- package/package.json +9 -3
- package/src/behaviors/behavior.abstract.keyboard.ts +87 -3
- package/src/behaviors/behavior.core.insert.ts +52 -0
- package/src/behaviors/behavior.core.ts +2 -0
- package/src/behaviors/behavior.perform-event.ts +4 -0
- package/src/internal-utils/slate-utils.test.tsx +1 -1
- package/src/operations/behavior.operation.insert.child.ts +8 -0
- package/src/operations/behavior.operation.insert.text.ts +2 -70
- package/src/plugins/plugin.internal.auto-close-brackets.test.tsx +1 -1
- package/src/plugins/plugin.markdown.test.tsx +1 -1
- package/src/test/_exports/index.ts +1 -0
- package/src/test/gherkin-parameter-types.ts +102 -0
- package/src/test/index.ts +1 -0
- package/src/test/vitest/_exports/index.ts +1 -0
- package/src/test/vitest/index.ts +3 -0
- package/src/test/vitest/step-context.ts +11 -0
- package/src/test/vitest/step-definitions.tsx +776 -0
- package/src/{internal-utils → test/vitest}/test-editor.tsx +8 -5
|
@@ -6,7 +6,7 @@ import { AnnotationDefinition, AnnotationSchemaType, BaseDefinition, BlockObject
|
|
|
6
6
|
import * as xstate227 from "xstate";
|
|
7
7
|
import { ActorRef, ActorRefFrom, EventObject, Snapshot } from "xstate";
|
|
8
8
|
import { BaseRange, Descendant, Operation } from "slate";
|
|
9
|
-
import * as
|
|
9
|
+
import * as react20 from "react";
|
|
10
10
|
import React$1, { BaseSyntheticEvent, ClipboardEvent, Component, FocusEvent, JSX, KeyboardEvent as KeyboardEvent$1, MutableRefObject, PropsWithChildren, ReactElement, RefObject, TextareaHTMLAttributes } from "react";
|
|
11
11
|
import * as xstate_guards12 from "xstate/guards";
|
|
12
12
|
import { Observable, Subject } from "rxjs";
|
|
@@ -202,7 +202,7 @@ declare class PortableTextEditor extends Component<PortableTextEditorProps<Inter
|
|
|
202
202
|
componentDidUpdate(prevProps: PortableTextEditorProps): void;
|
|
203
203
|
componentWillUnmount(): void;
|
|
204
204
|
setEditable: (editable: EditableAPI) => void;
|
|
205
|
-
render():
|
|
205
|
+
render(): react20.JSX.Element;
|
|
206
206
|
/**
|
|
207
207
|
* @deprecated
|
|
208
208
|
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
@@ -597,7 +597,7 @@ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'o
|
|
|
597
597
|
* ```
|
|
598
598
|
* @group Components
|
|
599
599
|
*/
|
|
600
|
-
declare const PortableTextEditable:
|
|
600
|
+
declare const PortableTextEditable: react20.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react20.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
|
|
601
601
|
type DecoratedRange = BaseRange & {
|
|
602
602
|
rangeDecoration: RangeDecoration;
|
|
603
603
|
};
|
|
@@ -1339,7 +1339,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1339
1339
|
initialValue?: Array<PortableTextBlock>;
|
|
1340
1340
|
}, xstate227.NonReducibleUnknown, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
1341
1341
|
type: "blurred";
|
|
1342
|
-
event:
|
|
1342
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
1343
1343
|
} | {
|
|
1344
1344
|
type: "done loading";
|
|
1345
1345
|
} | {
|
|
@@ -1351,7 +1351,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1351
1351
|
data: unknown;
|
|
1352
1352
|
} | {
|
|
1353
1353
|
type: "focused";
|
|
1354
|
-
event:
|
|
1354
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
1355
1355
|
} | {
|
|
1356
1356
|
type: "invalid value";
|
|
1357
1357
|
resolution: InvalidValueResolution | null;
|
|
@@ -1506,7 +1506,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1506
1506
|
}, xstate227.AnyEventObject>;
|
|
1507
1507
|
}) => {
|
|
1508
1508
|
behaviors: Set<{
|
|
1509
|
-
behavior: Behavior<"*" | "split" | `custom.${string}` | "annotation.add" | "annotation.remove" | "block.set" | "block.unset" | "child.set" | "child.unset" | "decorator.add" | "decorator.remove" | "delete" | "history.redo" | "history.undo" | "insert.block" | "insert.child" | "insert.text" | "move.backward" | "move.block" | "move.forward" | "select" | "annotation.set" | "annotation.toggle" | "decorator.toggle" | "delete.backward" | "delete.block" | "delete.child" | "delete.forward" | "delete.text" | "deserialize" | "deserialize.data" | "deserialization.success" | "deserialization.failure" | "insert.blocks" | "insert.break" | "insert.inline object" | "insert.soft break" | "insert.span" | "list item.add" | "list item.remove" | "list item.toggle" | "move.block down" | "move.block up" | "select.block" | "select.previous block" | "select.next block" | "serialize" | "serialize.data" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle" | "clipboard.copy" | "clipboard.cut" | "clipboard.paste" | "drag.dragstart" | "drag.drag" | "drag.dragend" | "drag.dragenter" | "drag.dragover" | "drag.dragleave" | "drag.drop" | "input.*" | "keyboard.keydown" | "keyboard.keyup" | "mouse.click" | "history.*" | "split.*" | "delete.*" | "select.*" | "deserialize.*" | "serialize.*" | "annotation.*" | "block.*" | "child.*" | "decorator.*" | "insert.*" | "move.*" | "deserialization.*" | "list item.*" | "serialization.*" | "
|
|
1509
|
+
behavior: Behavior<"*" | "split" | `custom.${string}` | "annotation.add" | "annotation.remove" | "block.set" | "block.unset" | "child.set" | "child.unset" | "decorator.add" | "decorator.remove" | "delete" | "history.redo" | "history.undo" | "insert.block" | "insert.child" | "insert.text" | "move.backward" | "move.block" | "move.forward" | "select" | "annotation.set" | "annotation.toggle" | "decorator.toggle" | "delete.backward" | "delete.block" | "delete.child" | "delete.forward" | "delete.text" | "deserialize" | "deserialize.data" | "deserialization.success" | "deserialization.failure" | "insert.blocks" | "insert.break" | "insert.inline object" | "insert.soft break" | "insert.span" | "list item.add" | "list item.remove" | "list item.toggle" | "move.block down" | "move.block up" | "select.block" | "select.previous block" | "select.next block" | "serialize" | "serialize.data" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle" | "clipboard.copy" | "clipboard.cut" | "clipboard.paste" | "drag.dragstart" | "drag.drag" | "drag.dragend" | "drag.dragenter" | "drag.dragover" | "drag.dragleave" | "drag.drop" | "input.*" | "keyboard.keydown" | "keyboard.keyup" | "mouse.click" | "style.*" | "history.*" | "split.*" | "delete.*" | "select.*" | "deserialize.*" | "serialize.*" | "annotation.*" | "block.*" | "child.*" | "decorator.*" | "insert.*" | "move.*" | "deserialization.*" | "list item.*" | "serialization.*" | "clipboard.*" | "drag.*" | "keyboard.*" | "mouse.*", true, {
|
|
1510
1510
|
type: StrictExtract<"split" | "annotation.add" | "annotation.remove" | "block.set" | "block.unset" | "child.set" | "child.unset" | "decorator.add" | "decorator.remove" | "delete" | "history.redo" | "history.undo" | "insert.block" | "insert.child" | "insert.text" | "move.backward" | "move.block" | "move.forward" | "select" | "annotation.set" | "annotation.toggle" | "decorator.toggle" | "delete.backward" | "delete.block" | "delete.child" | "delete.forward" | "delete.text" | "deserialize" | "deserialize.data" | "deserialization.success" | "deserialization.failure" | "insert.blocks" | "insert.break" | "insert.inline object" | "insert.soft break" | "insert.span" | "list item.add" | "list item.remove" | "list item.toggle" | "move.block down" | "move.block up" | "select.block" | "select.previous block" | "select.next block" | "serialize" | "serialize.data" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "annotation.add">;
|
|
1511
1511
|
annotation: {
|
|
1512
1512
|
name: string;
|
|
@@ -2014,7 +2014,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2014
2014
|
type: "drop";
|
|
2015
2015
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
2016
2016
|
type: "blurred";
|
|
2017
|
-
event:
|
|
2017
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2018
2018
|
} | {
|
|
2019
2019
|
type: "done loading";
|
|
2020
2020
|
} | {
|
|
@@ -2026,7 +2026,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2026
2026
|
data: unknown;
|
|
2027
2027
|
} | {
|
|
2028
2028
|
type: "focused";
|
|
2029
|
-
event:
|
|
2029
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2030
2030
|
} | {
|
|
2031
2031
|
type: "invalid value";
|
|
2032
2032
|
resolution: InvalidValueResolution | null;
|
|
@@ -2897,7 +2897,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2897
2897
|
type: "drop";
|
|
2898
2898
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
2899
2899
|
type: "blurred";
|
|
2900
|
-
event:
|
|
2900
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2901
2901
|
} | {
|
|
2902
2902
|
type: "done loading";
|
|
2903
2903
|
} | {
|
|
@@ -2909,7 +2909,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2909
2909
|
data: unknown;
|
|
2910
2910
|
} | {
|
|
2911
2911
|
type: "focused";
|
|
2912
|
-
event:
|
|
2912
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2913
2913
|
} | {
|
|
2914
2914
|
type: "invalid value";
|
|
2915
2915
|
resolution: InvalidValueResolution | null;
|
package/lib/index.cjs
CHANGED
|
@@ -4762,7 +4762,7 @@ const insertChildOperationImplementation = ({
|
|
|
4762
4762
|
}) : slate.Transforms.insertNodes(operation.editor, span, {
|
|
4763
4763
|
at: [focusBlockIndex, focusChildIndex + 1],
|
|
4764
4764
|
select: !0
|
|
4765
|
-
});
|
|
4765
|
+
}), slateDom.EDITOR_TO_PENDING_SELECTION.set(operation.editor, operation.editor.selection);
|
|
4766
4766
|
return;
|
|
4767
4767
|
}
|
|
4768
4768
|
const inlineObject = util_sliceBlocks.parseInlineObject({
|
|
@@ -4797,44 +4797,9 @@ const insertChildOperationImplementation = ({
|
|
|
4797
4797
|
}
|
|
4798
4798
|
throw new Error("Unable to parse child");
|
|
4799
4799
|
}, insertTextOperationImplementation = ({
|
|
4800
|
-
context,
|
|
4801
4800
|
operation
|
|
4802
4801
|
}) => {
|
|
4803
|
-
|
|
4804
|
-
blockIndexMap: operation.editor.blockIndexMap,
|
|
4805
|
-
context: {
|
|
4806
|
-
value: operation.editor.value,
|
|
4807
|
-
selection: operation.editor.selection ? slateRangeToSelection({
|
|
4808
|
-
schema: context.schema,
|
|
4809
|
-
editor: operation.editor,
|
|
4810
|
-
range: operation.editor.selection
|
|
4811
|
-
}) : null,
|
|
4812
|
-
schema: context.schema,
|
|
4813
|
-
keyGenerator: context.keyGenerator,
|
|
4814
|
-
converters: [],
|
|
4815
|
-
readOnly: !1
|
|
4816
|
-
},
|
|
4817
|
-
decoratorState: operation.editor.decoratorState
|
|
4818
|
-
}, markState = selector_isSelectingEntireBlocks.getMarkState(snapshot), activeDecorators = selector_isSelectingEntireBlocks.getActiveDecorators(snapshot), activeAnnotations = selector_isSelectingEntireBlocks.getActiveAnnotationsMarks(snapshot), [focusSpan] = getFocusSpan({
|
|
4819
|
-
editor: operation.editor
|
|
4820
|
-
});
|
|
4821
|
-
if (!focusSpan) {
|
|
4822
|
-
slate.Transforms.insertText(operation.editor, operation.text);
|
|
4823
|
-
return;
|
|
4824
|
-
}
|
|
4825
|
-
if (markState && markState.state === "unchanged") {
|
|
4826
|
-
const markStateDecorators = (markState.marks ?? []).filter((mark) => context.schema.decorators.map((decorator) => decorator.name).includes(mark));
|
|
4827
|
-
if (markStateDecorators.length === activeDecorators.length && markStateDecorators.every((mark) => activeDecorators.includes(mark))) {
|
|
4828
|
-
slate.Transforms.insertText(operation.editor, operation.text);
|
|
4829
|
-
return;
|
|
4830
|
-
}
|
|
4831
|
-
}
|
|
4832
|
-
slate.Transforms.insertNodes(operation.editor, {
|
|
4833
|
-
_type: focusSpan._type,
|
|
4834
|
-
_key: context.keyGenerator(),
|
|
4835
|
-
text: operation.text,
|
|
4836
|
-
marks: [...activeDecorators, ...activeAnnotations]
|
|
4837
|
-
}), slateDom.EDITOR_TO_PENDING_SELECTION.set(operation.editor, operation.editor.selection), operation.editor.decoratorState = {};
|
|
4802
|
+
slate.Transforms.insertText(operation.editor, operation.text);
|
|
4838
4803
|
}, moveBackwardOperationImplementation = ({
|
|
4839
4804
|
operation
|
|
4840
4805
|
}) => {
|
|
@@ -7218,7 +7183,39 @@ const coreDndBehaviors = [
|
|
|
7218
7183
|
placement: draggingEntireBlocks ? originEvent.position.block === "start" ? "before" : originEvent.position.block === "end" ? "after" : "auto" : "auto"
|
|
7219
7184
|
})]]
|
|
7220
7185
|
})
|
|
7221
|
-
],
|
|
7186
|
+
], coreInsertBehaviors = [behaviors_index.defineBehavior({
|
|
7187
|
+
on: "insert.text",
|
|
7188
|
+
guard: ({
|
|
7189
|
+
snapshot
|
|
7190
|
+
}) => {
|
|
7191
|
+
if (!selector_isSelectionExpanded.getFocusSpan(snapshot))
|
|
7192
|
+
return !1;
|
|
7193
|
+
const markState = selector_isSelectingEntireBlocks.getMarkState(snapshot), activeDecorators = selector_isSelectingEntireBlocks.getActiveDecorators(snapshot), activeAnnotations = selector_isSelectingEntireBlocks.getActiveAnnotationsMarks(snapshot);
|
|
7194
|
+
if (markState && markState.state === "unchanged") {
|
|
7195
|
+
const markStateDecorators = (markState.marks ?? []).filter((mark) => snapshot.context.schema.decorators.map((decorator) => decorator.name).includes(mark));
|
|
7196
|
+
if (markStateDecorators.length === activeDecorators.length && markStateDecorators.every((mark) => activeDecorators.includes(mark)))
|
|
7197
|
+
return !1;
|
|
7198
|
+
}
|
|
7199
|
+
return {
|
|
7200
|
+
activeDecorators,
|
|
7201
|
+
activeAnnotations
|
|
7202
|
+
};
|
|
7203
|
+
},
|
|
7204
|
+
actions: [({
|
|
7205
|
+
snapshot,
|
|
7206
|
+
event
|
|
7207
|
+
}, {
|
|
7208
|
+
activeDecorators,
|
|
7209
|
+
activeAnnotations
|
|
7210
|
+
}) => [behaviors_index.raise({
|
|
7211
|
+
type: "insert.child",
|
|
7212
|
+
child: {
|
|
7213
|
+
_type: snapshot.context.schema.span.name,
|
|
7214
|
+
text: event.text,
|
|
7215
|
+
marks: [...activeDecorators, ...activeAnnotations]
|
|
7216
|
+
}
|
|
7217
|
+
})]]
|
|
7218
|
+
})], breakingAtTheEndOfTextBlock = behaviors_index.defineBehavior({
|
|
7222
7219
|
on: "insert.break",
|
|
7223
7220
|
guard: ({
|
|
7224
7221
|
snapshot
|
|
@@ -7779,7 +7776,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
|
|
|
7779
7776
|
inheritListLevel,
|
|
7780
7777
|
inheritListItem,
|
|
7781
7778
|
inheritListProperties
|
|
7782
|
-
}, coreBehaviorsConfig = [...coreAnnotationBehaviors, coreDecoratorBehaviors.strongShortcut, coreDecoratorBehaviors.emShortcut, coreDecoratorBehaviors.underlineShortcut, coreDecoratorBehaviors.codeShortcut, ...coreDndBehaviors, coreBlockObjectBehaviors.clickingAboveLonelyBlockObject, coreBlockObjectBehaviors.clickingBelowLonelyBlockObject, coreBlockObjectBehaviors.arrowDownOnLonelyBlockObject, coreBlockObjectBehaviors.arrowUpOnLonelyBlockObject, coreBlockObjectBehaviors.breakingBlockObject, coreBlockObjectBehaviors.deletingEmptyTextBlockAfterBlockObject, coreBlockObjectBehaviors.deletingEmptyTextBlockBeforeBlockObject, coreListBehaviors.clearListOnBackspace, coreListBehaviors.unindentListOnBackspace, coreListBehaviors.mergeTextIntoListOnDelete, coreListBehaviors.mergeTextIntoListOnBackspace, coreListBehaviors.deletingListFromStart, coreListBehaviors.clearListOnEnter, coreListBehaviors.indentListOnTab, coreListBehaviors.unindentListOnShiftTab, coreListBehaviors.inheritListLevel, coreListBehaviors.inheritListItem, coreListBehaviors.inheritListProperties, coreInsertBreakBehaviors.breakingAtTheEndOfTextBlock, coreInsertBreakBehaviors.breakingAtTheStartOfTextBlock, coreInsertBreakBehaviors.breakingEntireDocument, coreInsertBreakBehaviors.breakingEntireBlocks, coreInsertBreakBehaviors.breakingInlineObject].map((behavior) => ({
|
|
7779
|
+
}, coreBehaviorsConfig = [...coreAnnotationBehaviors, coreDecoratorBehaviors.strongShortcut, coreDecoratorBehaviors.emShortcut, coreDecoratorBehaviors.underlineShortcut, coreDecoratorBehaviors.codeShortcut, ...coreDndBehaviors, coreBlockObjectBehaviors.clickingAboveLonelyBlockObject, coreBlockObjectBehaviors.clickingBelowLonelyBlockObject, coreBlockObjectBehaviors.arrowDownOnLonelyBlockObject, coreBlockObjectBehaviors.arrowUpOnLonelyBlockObject, coreBlockObjectBehaviors.breakingBlockObject, coreBlockObjectBehaviors.deletingEmptyTextBlockAfterBlockObject, coreBlockObjectBehaviors.deletingEmptyTextBlockBeforeBlockObject, ...coreInsertBehaviors, coreListBehaviors.clearListOnBackspace, coreListBehaviors.unindentListOnBackspace, coreListBehaviors.mergeTextIntoListOnDelete, coreListBehaviors.mergeTextIntoListOnBackspace, coreListBehaviors.deletingListFromStart, coreListBehaviors.clearListOnEnter, coreListBehaviors.indentListOnTab, coreListBehaviors.unindentListOnShiftTab, coreListBehaviors.inheritListLevel, coreListBehaviors.inheritListItem, coreListBehaviors.inheritListProperties, coreInsertBreakBehaviors.breakingAtTheEndOfTextBlock, coreInsertBreakBehaviors.breakingAtTheStartOfTextBlock, coreInsertBreakBehaviors.breakingEntireDocument, coreInsertBreakBehaviors.breakingEntireBlocks, coreInsertBreakBehaviors.breakingInlineObject].map((behavior) => ({
|
|
7783
7780
|
behavior,
|
|
7784
7781
|
priority: corePriority
|
|
7785
7782
|
}));
|
|
@@ -8690,7 +8687,15 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8690
8687
|
marks: [...event.decorators ?? [], ...markDefs.map((markDef) => markDef._key)]
|
|
8691
8688
|
}
|
|
8692
8689
|
})]]
|
|
8693
|
-
})],
|
|
8690
|
+
})], shiftLeft = keyboardShortcuts.createKeyboardShortcut({
|
|
8691
|
+
default: [{
|
|
8692
|
+
key: "ArrowLeft",
|
|
8693
|
+
shift: !0,
|
|
8694
|
+
meta: !1,
|
|
8695
|
+
ctrl: !1,
|
|
8696
|
+
alt: !1
|
|
8697
|
+
}]
|
|
8698
|
+
}), abstractKeyboardBehaviors = [
|
|
8694
8699
|
/**
|
|
8695
8700
|
* Allow raising an `insert.break` event when pressing Enter on an inline
|
|
8696
8701
|
* object.
|
|
@@ -8742,6 +8747,58 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
|
|
|
8742
8747
|
actions: [() => [behaviors_index.raise({
|
|
8743
8748
|
type: "history.redo"
|
|
8744
8749
|
})]]
|
|
8750
|
+
}),
|
|
8751
|
+
/**
|
|
8752
|
+
* Fix edge case where Shift+ArrowLeft didn't reduce a selection hanging
|
|
8753
|
+
* onto an empty text block.
|
|
8754
|
+
*/
|
|
8755
|
+
behaviors_index.defineBehavior({
|
|
8756
|
+
on: "keyboard.keydown",
|
|
8757
|
+
guard: ({
|
|
8758
|
+
snapshot,
|
|
8759
|
+
event
|
|
8760
|
+
}) => {
|
|
8761
|
+
if (!snapshot.context.selection || !shiftLeft.guard(event.originEvent))
|
|
8762
|
+
return !1;
|
|
8763
|
+
const focusBlock = selector_isSelectionExpanded.getFocusBlock(snapshot);
|
|
8764
|
+
if (!focusBlock)
|
|
8765
|
+
return !1;
|
|
8766
|
+
const previousBlock = selector_isSelectingEntireBlocks.getPreviousBlock({
|
|
8767
|
+
...snapshot,
|
|
8768
|
+
context: {
|
|
8769
|
+
...snapshot.context,
|
|
8770
|
+
selection: {
|
|
8771
|
+
anchor: {
|
|
8772
|
+
path: focusBlock.path,
|
|
8773
|
+
offset: 0
|
|
8774
|
+
},
|
|
8775
|
+
focus: {
|
|
8776
|
+
path: focusBlock.path,
|
|
8777
|
+
offset: 0
|
|
8778
|
+
}
|
|
8779
|
+
}
|
|
8780
|
+
}
|
|
8781
|
+
});
|
|
8782
|
+
return previousBlock && schema.isTextBlock(snapshot.context, focusBlock.node) && snapshot.context.selection.focus.offset === 0 && util_isSelectionCollapsed.isEmptyTextBlock(snapshot.context, focusBlock.node) ? {
|
|
8783
|
+
previousBlock,
|
|
8784
|
+
selection: snapshot.context.selection
|
|
8785
|
+
} : !1;
|
|
8786
|
+
},
|
|
8787
|
+
actions: [({
|
|
8788
|
+
snapshot
|
|
8789
|
+
}, {
|
|
8790
|
+
previousBlock,
|
|
8791
|
+
selection
|
|
8792
|
+
}) => [behaviors_index.raise({
|
|
8793
|
+
type: "select",
|
|
8794
|
+
at: {
|
|
8795
|
+
anchor: selection.anchor,
|
|
8796
|
+
focus: util_isSelectionCollapsed.getBlockEndPoint({
|
|
8797
|
+
context: snapshot.context,
|
|
8798
|
+
block: previousBlock
|
|
8799
|
+
})
|
|
8800
|
+
}
|
|
8801
|
+
})]]
|
|
8745
8802
|
})
|
|
8746
8803
|
], abstractListItemBehaviors = [behaviors_index.defineBehavior({
|
|
8747
8804
|
on: "list item.add",
|
|
@@ -9403,7 +9460,7 @@ function performEvent({
|
|
|
9403
9460
|
console.error(new Error(`Evaluating guard for "${event.type}" failed due to: ${error.message}`));
|
|
9404
9461
|
}
|
|
9405
9462
|
if (shouldRun) {
|
|
9406
|
-
defaultBehaviorOverwritten = !0;
|
|
9463
|
+
defaultBehaviorOverwritten = !0, eventBehavior.actions.length === 0 && (nativeEventPrevented = !0);
|
|
9407
9464
|
for (const actionSet of eventBehavior.actions) {
|
|
9408
9465
|
const actionsSnapshot = getSnapshot();
|
|
9409
9466
|
let actions = [];
|