slate-react 0.83.2 → 0.86.0-20221017162519
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/dist/components/editable.d.ts +1 -13
- package/dist/components/editable.d.ts.map +1 -1
- package/dist/index.es.js +53 -46
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +53 -46
- package/dist/index.js.map +1 -1
- package/dist/plugin/react-editor.d.ts +20 -0
- package/dist/plugin/react-editor.d.ts.map +1 -1
- package/dist/slate-react.js +53 -46
- package/dist/slate-react.min.js +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Element, NodeEntry, Range, Text } from 'slate';
|
|
3
3
|
import { ReactEditor } from '../plugin/react-editor';
|
|
4
|
-
import {
|
|
4
|
+
import { DOMRange } from '../utils/dom';
|
|
5
5
|
/**
|
|
6
6
|
* `RenderElementProps` are passed to the `renderElement` handler.
|
|
7
7
|
*/
|
|
@@ -68,18 +68,6 @@ export declare const DefaultPlaceholder: ({ attributes, children, }: RenderPlace
|
|
|
68
68
|
* A default memoized decorate function.
|
|
69
69
|
*/
|
|
70
70
|
export declare const defaultDecorate: (entry: NodeEntry) => Range[];
|
|
71
|
-
/**
|
|
72
|
-
* Check if the target is in the editor.
|
|
73
|
-
*/
|
|
74
|
-
export declare const hasTarget: (editor: ReactEditor, target: EventTarget | null) => target is DOMNode;
|
|
75
|
-
/**
|
|
76
|
-
* Check if the target is editable and in the editor.
|
|
77
|
-
*/
|
|
78
|
-
export declare const hasEditableTarget: (editor: ReactEditor, target: EventTarget | null) => target is DOMNode;
|
|
79
|
-
/**
|
|
80
|
-
* Check if the target is inside void and in an non-readonly editor.
|
|
81
|
-
*/
|
|
82
|
-
export declare const isTargetInsideNonReadonlyVoid: (editor: ReactEditor, target: EventTarget | null) => boolean;
|
|
83
71
|
/**
|
|
84
72
|
* Check if an event is overrided by a handler.
|
|
85
73
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editable.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/components/editable.tsx"],"names":[],"mappings":"AAGA,OAAO,KAON,MAAM,OAAO,CAAA;AAEd,OAAO,EAEL,OAAO,EAEP,SAAS,EAET,KAAK,EACL,IAAI,EAEL,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAOpD,OAAO,
|
|
1
|
+
{"version":3,"file":"editable.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/components/editable.tsx"],"names":[],"mappings":"AAGA,OAAO,KAON,MAAM,OAAO,CAAA;AAEd,OAAO,EAEL,OAAO,EAEP,SAAS,EAET,KAAK,EACL,IAAI,EAEL,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAOpD,OAAO,EAGL,QAAQ,EAMT,MAAM,cAAc,CAAA;AAwCrB;;GAEG;AAEH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,GAAG,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE;QACV,iBAAiB,EAAE,SAAS,CAAA;QAC5B,mBAAmB,CAAC,EAAE,IAAI,CAAA;QAC1B,iBAAiB,CAAC,EAAE,IAAI,CAAA;QACxB,GAAG,CAAC,EAAE,KAAK,CAAA;QACX,GAAG,EAAE,GAAG,CAAA;KACT,CAAA;CACF;AAED;;GAEG;AAEH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,GAAG,CAAA;IACb,IAAI,EAAE,IAAI,CAAA;IACV,IAAI,EAAE,IAAI,CAAA;IACV,UAAU,EAAE;QACV,iBAAiB,EAAE,IAAI,CAAA;KACxB,CAAA;CACF;AAED;;GAEG;AAEH,oBAAY,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,KAAK,EAAE,CAAA;IACxC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,GAAG,CAAC,OAAO,CAAA;IAC1D,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,GAAG,CAAC,OAAO,CAAA;IACpD,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,GAAG,CAAC,OAAO,CAAA;IAClE,uBAAuB,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAA;IAC3E,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;CACvB,GAAG,KAAK,CAAC,sBAAsB,CAAC,cAAc,CAAC,CAAA;AAEhD;;GAEG;AAEH,eAAO,MAAM,QAAQ,UAAW,aAAa,gBAy8C5C,CAAA;AAED;;GAEG;AACH,oBAAY,sBAAsB,GAAG;IACnC,QAAQ,EAAE,GAAG,CAAA;IACb,UAAU,EAAE;QACV,wBAAwB,EAAE,OAAO,CAAA;QACjC,GAAG,CAAC,EAAE,KAAK,CAAA;QACX,eAAe,EAAE,OAAO,CAAA;QACxB,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;QACzB,KAAK,EAAE,KAAK,CAAC,aAAa,CAAA;KAC3B,CAAA;CACF,CAAA;AAED;;GAEG;AAEH,eAAO,MAAM,kBAAkB,8BAG5B,sBAAsB,gBAOxB,CAAA;AAED;;GAEG;AAEH,eAAO,MAAM,eAAe,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,KAAK,EAAa,CAAA;AA2BtE;;GAEG;AAEH,eAAO,MAAM,cAAc,gHAIO,IAAI,GAAG,OAAO,yBAc/C,CAAA;AAED;;GAEG;AAEH,eAAO,MAAM,iBAAiB,uDAEJ,IAAI,GAAG,OAAO,yBAevC,CAAA"}
|
package/dist/index.es.js
CHANGED
|
@@ -1012,6 +1012,38 @@ var ReactEditor = {
|
|
|
1012
1012
|
return Editor.hasPath(editor, anchor.path) && Editor.hasPath(editor, focus.path);
|
|
1013
1013
|
},
|
|
1014
1014
|
|
|
1015
|
+
/**
|
|
1016
|
+
* Check if the target is in the editor.
|
|
1017
|
+
*/
|
|
1018
|
+
hasTarget(editor, target) {
|
|
1019
|
+
return isDOMNode(target) && ReactEditor.hasDOMNode(editor, target);
|
|
1020
|
+
},
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
* Check if the target is editable and in the editor.
|
|
1024
|
+
*/
|
|
1025
|
+
hasEditableTarget(editor, target) {
|
|
1026
|
+
return isDOMNode(target) && ReactEditor.hasDOMNode(editor, target, {
|
|
1027
|
+
editable: true
|
|
1028
|
+
});
|
|
1029
|
+
},
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
* Check if the target can be selectable
|
|
1033
|
+
*/
|
|
1034
|
+
hasSelectableTarget(editor, target) {
|
|
1035
|
+
return ReactEditor.hasEditableTarget(editor, target) || ReactEditor.isTargetInsideNonReadonlyVoid(editor, target);
|
|
1036
|
+
},
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* Check if the target is inside void and in an non-readonly editor.
|
|
1040
|
+
*/
|
|
1041
|
+
isTargetInsideNonReadonlyVoid(editor, target) {
|
|
1042
|
+
if (IS_READ_ONLY.get(editor)) return false;
|
|
1043
|
+
var slateNode = ReactEditor.hasTarget(editor, target) && ReactEditor.toSlateNode(editor, target);
|
|
1044
|
+
return Editor.isVoid(editor, slateNode);
|
|
1045
|
+
},
|
|
1046
|
+
|
|
1015
1047
|
/**
|
|
1016
1048
|
* Experimental and android specific: Flush all pending diffs and cancel composition at the next possible time.
|
|
1017
1049
|
*/
|
|
@@ -3104,8 +3136,8 @@ var Editable = props => {
|
|
|
3104
3136
|
anchorNode,
|
|
3105
3137
|
focusNode
|
|
3106
3138
|
} = domSelection;
|
|
3107
|
-
var anchorNodeSelectable = hasEditableTarget(editor, anchorNode) || isTargetInsideNonReadonlyVoid(editor, anchorNode);
|
|
3108
|
-
var focusNodeSelectable = hasEditableTarget(editor, focusNode) || isTargetInsideNonReadonlyVoid(editor, focusNode);
|
|
3139
|
+
var anchorNodeSelectable = ReactEditor.hasEditableTarget(editor, anchorNode) || ReactEditor.isTargetInsideNonReadonlyVoid(editor, anchorNode);
|
|
3140
|
+
var focusNodeSelectable = ReactEditor.hasEditableTarget(editor, focusNode) || ReactEditor.isTargetInsideNonReadonlyVoid(editor, focusNode);
|
|
3109
3141
|
|
|
3110
3142
|
if (anchorNodeSelectable && focusNodeSelectable) {
|
|
3111
3143
|
var range = ReactEditor.toSlateRange(editor, domSelection, {
|
|
@@ -3289,7 +3321,7 @@ var Editable = props => {
|
|
|
3289
3321
|
var onDOMBeforeInput = useCallback(event => {
|
|
3290
3322
|
onUserInput();
|
|
3291
3323
|
|
|
3292
|
-
if (!readOnly && hasEditableTarget(editor, event.target) && !isDOMEventHandled(event, propsOnDOMBeforeInput)) {
|
|
3324
|
+
if (!readOnly && ReactEditor.hasEditableTarget(editor, event.target) && !isDOMEventHandled(event, propsOnDOMBeforeInput)) {
|
|
3293
3325
|
var _EDITOR_TO_USER_SELEC;
|
|
3294
3326
|
|
|
3295
3327
|
// COMPAT: BeforeInput events aren't cancelable on android, so we have to handle them differently using the android input manager.
|
|
@@ -3691,7 +3723,7 @@ var Editable = props => {
|
|
|
3691
3723
|
// COMPAT: Certain browsers don't support the `beforeinput` event, so we
|
|
3692
3724
|
// fall back to React's leaky polyfill instead just for it. It
|
|
3693
3725
|
// only works for the `insertText` input type.
|
|
3694
|
-
if (!HAS_BEFORE_INPUT_SUPPORT && !readOnly && !isEventHandled(event, attributes.onBeforeInput) &&
|
|
3726
|
+
if (!HAS_BEFORE_INPUT_SUPPORT && !readOnly && !isEventHandled(event, attributes.onBeforeInput) && ReactEditor.hasSelectableTarget(editor, event.target)) {
|
|
3695
3727
|
event.preventDefault();
|
|
3696
3728
|
|
|
3697
3729
|
if (!ReactEditor.isComposing(editor)) {
|
|
@@ -3717,7 +3749,7 @@ var Editable = props => {
|
|
|
3717
3749
|
deferredOperations.current = [];
|
|
3718
3750
|
}, []),
|
|
3719
3751
|
onBlur: useCallback(event => {
|
|
3720
|
-
if (readOnly || state.isUpdatingSelection || !
|
|
3752
|
+
if (readOnly || state.isUpdatingSelection || !ReactEditor.hasSelectableTarget(editor, event.target) || isEventHandled(event, attributes.onBlur)) {
|
|
3721
3753
|
return;
|
|
3722
3754
|
} // COMPAT: If the current `activeElement` is still the previous
|
|
3723
3755
|
// one, this is due to the window being blurred when the tab
|
|
@@ -3770,7 +3802,7 @@ var Editable = props => {
|
|
|
3770
3802
|
IS_FOCUSED.delete(editor);
|
|
3771
3803
|
}, [readOnly, attributes.onBlur]),
|
|
3772
3804
|
onClick: useCallback(event => {
|
|
3773
|
-
if (hasTarget(editor, event.target) && !isEventHandled(event, attributes.onClick) && isDOMNode(event.target)) {
|
|
3805
|
+
if (ReactEditor.hasTarget(editor, event.target) && !isEventHandled(event, attributes.onClick) && isDOMNode(event.target)) {
|
|
3774
3806
|
var node = ReactEditor.toSlateNode(editor, event.target);
|
|
3775
3807
|
var path = ReactEditor.findPath(editor, node); // At this time, the Slate document may be arbitrarily different,
|
|
3776
3808
|
// because onClick handlers can change the document before we get here.
|
|
@@ -3821,7 +3853,7 @@ var Editable = props => {
|
|
|
3821
3853
|
}
|
|
3822
3854
|
}, [readOnly, attributes.onClick]),
|
|
3823
3855
|
onCompositionEnd: useCallback(event => {
|
|
3824
|
-
if (
|
|
3856
|
+
if (ReactEditor.hasSelectableTarget(editor, event.target)) {
|
|
3825
3857
|
if (ReactEditor.isComposing(editor)) {
|
|
3826
3858
|
setIsComposing(false);
|
|
3827
3859
|
IS_COMPOSING.set(editor, false);
|
|
@@ -3857,7 +3889,7 @@ var Editable = props => {
|
|
|
3857
3889
|
}
|
|
3858
3890
|
}, [attributes.onCompositionEnd]),
|
|
3859
3891
|
onCompositionUpdate: useCallback(event => {
|
|
3860
|
-
if (
|
|
3892
|
+
if (ReactEditor.hasSelectableTarget(editor, event.target) && !isEventHandled(event, attributes.onCompositionUpdate)) {
|
|
3861
3893
|
if (!ReactEditor.isComposing(editor)) {
|
|
3862
3894
|
setIsComposing(true);
|
|
3863
3895
|
IS_COMPOSING.set(editor, true);
|
|
@@ -3865,7 +3897,7 @@ var Editable = props => {
|
|
|
3865
3897
|
}
|
|
3866
3898
|
}, [attributes.onCompositionUpdate]),
|
|
3867
3899
|
onCompositionStart: useCallback(event => {
|
|
3868
|
-
if (
|
|
3900
|
+
if (ReactEditor.hasSelectableTarget(editor, event.target)) {
|
|
3869
3901
|
androidInputManager === null || androidInputManager === void 0 ? void 0 : androidInputManager.handleCompositionStart(event);
|
|
3870
3902
|
|
|
3871
3903
|
if (isEventHandled(event, attributes.onCompositionStart) || IS_ANDROID) {
|
|
@@ -3903,13 +3935,13 @@ var Editable = props => {
|
|
|
3903
3935
|
}
|
|
3904
3936
|
}, [attributes.onCompositionStart]),
|
|
3905
3937
|
onCopy: useCallback(event => {
|
|
3906
|
-
if (
|
|
3938
|
+
if (ReactEditor.hasSelectableTarget(editor, event.target) && !isEventHandled(event, attributes.onCopy)) {
|
|
3907
3939
|
event.preventDefault();
|
|
3908
3940
|
ReactEditor.setFragmentData(editor, event.clipboardData, 'copy');
|
|
3909
3941
|
}
|
|
3910
3942
|
}, [attributes.onCopy]),
|
|
3911
3943
|
onCut: useCallback(event => {
|
|
3912
|
-
if (!readOnly &&
|
|
3944
|
+
if (!readOnly && ReactEditor.hasSelectableTarget(editor, event.target) && !isEventHandled(event, attributes.onCut)) {
|
|
3913
3945
|
event.preventDefault();
|
|
3914
3946
|
ReactEditor.setFragmentData(editor, event.clipboardData, 'cut');
|
|
3915
3947
|
var {
|
|
@@ -3930,7 +3962,7 @@ var Editable = props => {
|
|
|
3930
3962
|
}
|
|
3931
3963
|
}, [readOnly, attributes.onCut]),
|
|
3932
3964
|
onDragOver: useCallback(event => {
|
|
3933
|
-
if (hasTarget(editor, event.target) && !isEventHandled(event, attributes.onDragOver)) {
|
|
3965
|
+
if (ReactEditor.hasTarget(editor, event.target) && !isEventHandled(event, attributes.onDragOver)) {
|
|
3934
3966
|
// Only when the target is void, call `preventDefault` to signal
|
|
3935
3967
|
// that drops are allowed. Editable content is droppable by
|
|
3936
3968
|
// default, and calling `preventDefault` hides the cursor.
|
|
@@ -3942,7 +3974,7 @@ var Editable = props => {
|
|
|
3942
3974
|
}
|
|
3943
3975
|
}, [attributes.onDragOver]),
|
|
3944
3976
|
onDragStart: useCallback(event => {
|
|
3945
|
-
if (!readOnly && hasTarget(editor, event.target) && !isEventHandled(event, attributes.onDragStart)) {
|
|
3977
|
+
if (!readOnly && ReactEditor.hasTarget(editor, event.target) && !isEventHandled(event, attributes.onDragStart)) {
|
|
3946
3978
|
var node = ReactEditor.toSlateNode(editor, event.target);
|
|
3947
3979
|
var path = ReactEditor.findPath(editor, node);
|
|
3948
3980
|
var voidMatch = Editor.isVoid(editor, node) || Editor.void(editor, {
|
|
@@ -3961,7 +3993,7 @@ var Editable = props => {
|
|
|
3961
3993
|
}
|
|
3962
3994
|
}, [readOnly, attributes.onDragStart]),
|
|
3963
3995
|
onDrop: useCallback(event => {
|
|
3964
|
-
if (!readOnly && hasTarget(editor, event.target) && !isEventHandled(event, attributes.onDrop)) {
|
|
3996
|
+
if (!readOnly && ReactEditor.hasTarget(editor, event.target) && !isEventHandled(event, attributes.onDrop)) {
|
|
3965
3997
|
event.preventDefault(); // Keep a reference to the dragged range before updating selection
|
|
3966
3998
|
|
|
3967
3999
|
var draggedRange = editor.selection; // Find the range where the drop happened
|
|
@@ -3992,7 +4024,7 @@ var Editable = props => {
|
|
|
3992
4024
|
state.isDraggingInternally = false;
|
|
3993
4025
|
}, [readOnly, attributes.onDrop]),
|
|
3994
4026
|
onDragEnd: useCallback(event => {
|
|
3995
|
-
if (!readOnly && state.isDraggingInternally && attributes.onDragEnd && hasTarget(editor, event.target)) {
|
|
4027
|
+
if (!readOnly && state.isDraggingInternally && attributes.onDragEnd && ReactEditor.hasTarget(editor, event.target)) {
|
|
3996
4028
|
attributes.onDragEnd(event);
|
|
3997
4029
|
} // When dropping on a different droppable element than the current editor,
|
|
3998
4030
|
// `onDrop` is not called. So we need to clean up in `onDragEnd` instead.
|
|
@@ -4002,7 +4034,7 @@ var Editable = props => {
|
|
|
4002
4034
|
state.isDraggingInternally = false;
|
|
4003
4035
|
}, [readOnly, attributes.onDragEnd]),
|
|
4004
4036
|
onFocus: useCallback(event => {
|
|
4005
|
-
if (!readOnly && !state.isUpdatingSelection &&
|
|
4037
|
+
if (!readOnly && !state.isUpdatingSelection && ReactEditor.hasSelectableTarget(editor, event.target) && !isEventHandled(event, attributes.onFocus)) {
|
|
4006
4038
|
var el = ReactEditor.toDOMNode(editor, editor);
|
|
4007
4039
|
var root = ReactEditor.findDocumentOrShadowRoot(editor);
|
|
4008
4040
|
state.latestElement = root.activeElement; // COMPAT: If the editor has nested editable elements, the focus
|
|
@@ -4018,7 +4050,7 @@ var Editable = props => {
|
|
|
4018
4050
|
}
|
|
4019
4051
|
}, [readOnly, attributes.onFocus]),
|
|
4020
4052
|
onKeyDown: useCallback(event => {
|
|
4021
|
-
if (!readOnly && hasEditableTarget(editor, event.target)) {
|
|
4053
|
+
if (!readOnly && ReactEditor.hasEditableTarget(editor, event.target)) {
|
|
4022
4054
|
androidInputManager === null || androidInputManager === void 0 ? void 0 : androidInputManager.handleKeyDown(event);
|
|
4023
4055
|
var {
|
|
4024
4056
|
nativeEvent
|
|
@@ -4309,7 +4341,7 @@ var Editable = props => {
|
|
|
4309
4341
|
}
|
|
4310
4342
|
}, [readOnly, attributes.onKeyDown]),
|
|
4311
4343
|
onPaste: useCallback(event => {
|
|
4312
|
-
if (!readOnly &&
|
|
4344
|
+
if (!readOnly && ReactEditor.hasSelectableTarget(editor, event.target) && !isEventHandled(event, attributes.onPaste)) {
|
|
4313
4345
|
// COMPAT: Certain browsers don't support the `beforeinput` event, so we
|
|
4314
4346
|
// fall back to React's `onPaste` here instead.
|
|
4315
4347
|
// COMPAT: Firefox, Chrome and Safari don't emit `beforeinput` events
|
|
@@ -4367,36 +4399,11 @@ var defaultScrollSelectionIntoView = (editor, domRange) => {
|
|
|
4367
4399
|
delete leafEl.getBoundingClientRect;
|
|
4368
4400
|
}
|
|
4369
4401
|
};
|
|
4370
|
-
/**
|
|
4371
|
-
* Check if the target is in the editor.
|
|
4372
|
-
*/
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
var hasTarget = (editor, target) => {
|
|
4376
|
-
return isDOMNode(target) && ReactEditor.hasDOMNode(editor, target);
|
|
4377
|
-
};
|
|
4378
|
-
/**
|
|
4379
|
-
* Check if the target is editable and in the editor.
|
|
4380
|
-
*/
|
|
4381
|
-
|
|
4382
|
-
var hasEditableTarget = (editor, target) => {
|
|
4383
|
-
return isDOMNode(target) && ReactEditor.hasDOMNode(editor, target, {
|
|
4384
|
-
editable: true
|
|
4385
|
-
});
|
|
4386
|
-
};
|
|
4387
|
-
/**
|
|
4388
|
-
* Check if the target is inside void and in an non-readonly editor.
|
|
4389
|
-
*/
|
|
4390
|
-
|
|
4391
|
-
var isTargetInsideNonReadonlyVoid = (editor, target) => {
|
|
4392
|
-
if (IS_READ_ONLY.get(editor)) return false;
|
|
4393
|
-
var slateNode = hasTarget(editor, target) && ReactEditor.toSlateNode(editor, target);
|
|
4394
|
-
return Editor.isVoid(editor, slateNode);
|
|
4395
|
-
};
|
|
4396
4402
|
/**
|
|
4397
4403
|
* Check if an event is overrided by a handler.
|
|
4398
4404
|
*/
|
|
4399
4405
|
|
|
4406
|
+
|
|
4400
4407
|
var isEventHandled = (event, handler) => {
|
|
4401
4408
|
if (!handler) {
|
|
4402
4409
|
return false;
|
|
@@ -4580,11 +4587,11 @@ var Slate = props => {
|
|
|
4580
4587
|
var unmountRef = useRef(false);
|
|
4581
4588
|
var [context, setContext] = React.useState(() => {
|
|
4582
4589
|
if (!Node.isNodeList(value)) {
|
|
4583
|
-
throw new Error("[Slate] value is invalid! Expected a list of elements
|
|
4590
|
+
throw new Error("[Slate] value is invalid! Expected a list of elements but got: ".concat(Scrubber.stringify(value)));
|
|
4584
4591
|
}
|
|
4585
4592
|
|
|
4586
4593
|
if (!Editor.isEditor(editor)) {
|
|
4587
|
-
throw new Error("[Slate] editor is invalid!
|
|
4594
|
+
throw new Error("[Slate] editor is invalid! You passed: ".concat(Scrubber.stringify(editor)));
|
|
4588
4595
|
}
|
|
4589
4596
|
|
|
4590
4597
|
editor.children = value;
|