slate-react 0.99.0 → 0.100.0-2023920121024
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/slate.d.ts +3 -1
- package/dist/components/slate.d.ts.map +1 -1
- package/dist/index.es.js +17 -4
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +17 -4
- package/dist/index.js.map +1 -1
- package/dist/slate-react.js +17 -4
- package/dist/slate-react.min.js +1 -1
- package/dist/utils/weak-maps.d.ts +27 -1
- package/dist/utils/weak-maps.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/slate-react.js
CHANGED
|
@@ -6683,7 +6683,7 @@
|
|
|
6683
6683
|
};
|
|
6684
6684
|
}
|
|
6685
6685
|
|
|
6686
|
-
var _excluded = ["editor", "children", "onChange", "initialValue"];
|
|
6686
|
+
var _excluded = ["editor", "children", "onChange", "onSelectionChange", "onValueChange", "initialValue"];
|
|
6687
6687
|
/**
|
|
6688
6688
|
* A wrapper around the provider to handle `onChange` events, because the editor
|
|
6689
6689
|
* is a mutable singleton so it won't ever register as "changed" otherwise.
|
|
@@ -6693,6 +6693,8 @@
|
|
|
6693
6693
|
var editor = props.editor,
|
|
6694
6694
|
children = props.children,
|
|
6695
6695
|
onChange = props.onChange,
|
|
6696
|
+
onSelectionChange = props.onSelectionChange,
|
|
6697
|
+
onValueChange = props.onValueChange,
|
|
6696
6698
|
initialValue = props.initialValue,
|
|
6697
6699
|
rest = _objectWithoutProperties(props, _excluded);
|
|
6698
6700
|
|
|
@@ -6720,11 +6722,22 @@
|
|
|
6720
6722
|
selectorContext = _useSelectorContext.selectorContext,
|
|
6721
6723
|
handleSelectorChange = _useSelectorContext.onChange;
|
|
6722
6724
|
|
|
6723
|
-
var onContextChange = React.useCallback(function () {
|
|
6725
|
+
var onContextChange = React.useCallback(function (options) {
|
|
6726
|
+
var _options$operation;
|
|
6727
|
+
|
|
6724
6728
|
if (onChange) {
|
|
6725
6729
|
onChange(editor.children);
|
|
6726
6730
|
}
|
|
6727
6731
|
|
|
6732
|
+
switch (options === null || options === void 0 ? void 0 : (_options$operation = options.operation) === null || _options$operation === void 0 ? void 0 : _options$operation.type) {
|
|
6733
|
+
case 'set_selection':
|
|
6734
|
+
onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(editor.selection);
|
|
6735
|
+
break;
|
|
6736
|
+
|
|
6737
|
+
default:
|
|
6738
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(editor.children);
|
|
6739
|
+
}
|
|
6740
|
+
|
|
6728
6741
|
setContext(function (prevContext) {
|
|
6729
6742
|
return {
|
|
6730
6743
|
v: prevContext.v + 1,
|
|
@@ -6732,7 +6745,7 @@
|
|
|
6732
6745
|
};
|
|
6733
6746
|
});
|
|
6734
6747
|
handleSelectorChange(editor);
|
|
6735
|
-
}, [editor, handleSelectorChange, onChange]);
|
|
6748
|
+
}, [editor, handleSelectorChange, onChange, onSelectionChange, onValueChange]);
|
|
6736
6749
|
React.useEffect(function () {
|
|
6737
6750
|
EDITOR_TO_ON_CHANGE.set(editor, onContextChange);
|
|
6738
6751
|
return function () {
|
|
@@ -34654,7 +34667,7 @@
|
|
|
34654
34667
|
var onContextChange = EDITOR_TO_ON_CHANGE.get(e);
|
|
34655
34668
|
|
|
34656
34669
|
if (onContextChange) {
|
|
34657
|
-
onContextChange();
|
|
34670
|
+
onContextChange(options);
|
|
34658
34671
|
}
|
|
34659
34672
|
|
|
34660
34673
|
onChange(options);
|