slate-react 0.133.8-20261012214647 → 0.133.8
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.map +1 -1
- package/dist/index.es.js +14 -8
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +14 -8
- package/dist/index.js.map +1 -1
- package/dist/slate-react.js +14 -8
- package/dist/slate-react.min.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editable.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/components/editable.tsx"],"names":[],"mappings":"AAGA,OAAO,KASN,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAE3B,OAAO,EAEL,OAAO,EAEP,SAAS,EAIT,IAAI,EAEJ,cAAc,EACd,YAAY,EACb,MAAM,OAAO,CAAA;AAWd,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAGpD,OAAO,EAGL,QAAQ,EAQT,MAAM,WAAW,CAAA;AA0DlB;;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;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,GAAG,CAAA;IACb,UAAU,EAAE;QACV,kBAAkB,EAAE,IAAI,CAAA;KACzB,CAAA;CACF;AAED;;GAEG;AAEH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAA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8B,WACjC,WAAW,YACT,QAAQ,SAwCnB,CAAA;AAED;;GAEG;AAEH,eAAO,MAAM,cAAc,gHAIO,IAAI,GAAG,OAAO,yBAc/C,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,yFAUjC,CAAA;AAED;;GAEG;AAEH,eAAO,MAAM,iBAAiB,uDAEJ,IAAI,GAAG,OAAO,yBAevC,CAAA"}
|
package/dist/index.es.js
CHANGED
|
@@ -2841,6 +2841,9 @@ const Editable = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
2841
2841
|
// Rerender editor when composition status changed
|
|
2842
2842
|
const [isComposing, setIsComposing] = useState(false);
|
|
2843
2843
|
const ref = useRef(null);
|
|
2844
|
+
const previousChildren = useRef(editor.children);
|
|
2845
|
+
const previousSelection = useRef(editor.selection);
|
|
2846
|
+
const pendingInputScroll = useRef(false);
|
|
2844
2847
|
const deferredOperations = useRef([]);
|
|
2845
2848
|
const [placeholderHeight, setPlaceholderHeight] = useState();
|
|
2846
2849
|
const processing = useRef(false);
|
|
@@ -2988,6 +2991,11 @@ const Editable = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
2988
2991
|
const {
|
|
2989
2992
|
selection
|
|
2990
2993
|
} = editor;
|
|
2994
|
+
const scrollForInput = pendingInputScroll.current;
|
|
2995
|
+
pendingInputScroll.current = false;
|
|
2996
|
+
const selectionChangedByEdit = scrollForInput && previousChildren.current !== editor.children && !!selection && (!previousSelection.current || !Range.equals(previousSelection.current, selection));
|
|
2997
|
+
previousChildren.current = editor.children;
|
|
2998
|
+
previousSelection.current = selection;
|
|
2991
2999
|
const root = ReactEditor.findDocumentOrShadowRoot(editor);
|
|
2992
3000
|
const domSelection = getSelection(root);
|
|
2993
3001
|
if (!domSelection || !ReactEditor.isFocused(editor) || (_androidInputManagerR = androidInputManagerRef.current) !== null && _androidInputManagerR !== void 0 && _androidInputManagerR.hasPendingAction()) {
|
|
@@ -3025,21 +3033,18 @@ const Editable = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
3025
3033
|
}
|
|
3026
3034
|
// If the DOM selection is in the editor and the editor selection is already correct, we're done.
|
|
3027
3035
|
if (hasDomSelection && hasDomSelectionInEditor && selection && !forceChange) {
|
|
3036
|
+
var _anchorNode;
|
|
3028
3037
|
const slateRange = ReactEditor.toSlateRange(editor, domSelection, {
|
|
3029
3038
|
exactMatch: true,
|
|
3030
3039
|
// domSelection is not necessarily a valid Slate range
|
|
3031
3040
|
// (e.g. when clicking on contentEditable:false element)
|
|
3032
3041
|
suppressThrow: true
|
|
3033
3042
|
});
|
|
3034
|
-
if (slateRange && Range.equals(slateRange, selection)) {
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
return;
|
|
3038
|
-
}
|
|
3039
|
-
// Ensure selection is inside the mark placeholder
|
|
3040
|
-
if ((_anchorNode = anchorNode) !== null && _anchorNode !== void 0 && (_anchorNode = _anchorNode.parentElement) !== null && _anchorNode !== void 0 && _anchorNode.hasAttribute('data-slate-mark-placeholder')) {
|
|
3041
|
-
return;
|
|
3043
|
+
if (slateRange && Range.equals(slateRange, selection) && (!state.hasMarkPlaceholder || (_anchorNode = anchorNode) !== null && _anchorNode !== void 0 && (_anchorNode = _anchorNode.parentElement) !== null && _anchorNode !== void 0 && _anchorNode.hasAttribute('data-slate-mark-placeholder'))) {
|
|
3044
|
+
if (selectionChangedByEdit) {
|
|
3045
|
+
scrollSelectionIntoView(editor, domSelection.getRangeAt(0));
|
|
3042
3046
|
}
|
|
3047
|
+
return;
|
|
3043
3048
|
}
|
|
3044
3049
|
}
|
|
3045
3050
|
// when <Editable/> is being controlled through external value
|
|
@@ -3157,6 +3162,7 @@ const Editable = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
3157
3162
|
return;
|
|
3158
3163
|
}
|
|
3159
3164
|
onUserInput();
|
|
3165
|
+
pendingInputScroll.current = true;
|
|
3160
3166
|
if (!readOnly && !isDOMEventHandled(event, propsOnDOMBeforeInput)) {
|
|
3161
3167
|
var _EDITOR_TO_USER_SELEC;
|
|
3162
3168
|
// COMPAT: BeforeInput events aren't cancelable on android, so we have to handle them differently using the android input manager.
|