slate-react 0.76.0 → 0.76.1-2022231112432
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 +0 -4
- package/dist/components/editable.d.ts.map +1 -1
- package/dist/index.es.js +27 -0
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin/with-react.d.ts.map +1 -1
- package/dist/slate-react.js +27 -0
- package/dist/slate-react.min.js +1 -1
- package/dist/utils/weak-maps.d.ts +2 -1
- package/dist/utils/weak-maps.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-react.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/plugin/with-react.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"with-react.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/plugin/with-react.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAe5C;;;;;;;GAOG;AAEH,eAAO,MAAM,SAAS,uDAyOrB,CAAA"}
|
package/dist/slate-react.js
CHANGED
|
@@ -1071,6 +1071,7 @@
|
|
|
1071
1071
|
var IS_FOCUSED = new WeakMap();
|
|
1072
1072
|
var IS_COMPOSING = new WeakMap();
|
|
1073
1073
|
var IS_ON_COMPOSITION_END = new WeakMap();
|
|
1074
|
+
var EDITOR_TO_USER_SELECTION = new WeakMap();
|
|
1074
1075
|
/**
|
|
1075
1076
|
* Weak maps for saving text on composition stage.
|
|
1076
1077
|
*/
|
|
@@ -2335,6 +2336,8 @@
|
|
|
2335
2336
|
|
|
2336
2337
|
var onDOMBeforeInput = React.useCallback(function (event) {
|
|
2337
2338
|
if (!readOnly && hasEditableTarget(editor, event.target) && !isDOMEventHandled(event, propsOnDOMBeforeInput)) {
|
|
2339
|
+
var _EDITOR_TO_USER_SELEC;
|
|
2340
|
+
|
|
2338
2341
|
// Some IMEs/Chrome extensions like e.g. Grammarly set the selection immediately before
|
|
2339
2342
|
// triggering a `beforeinput` expecting the change to be applied to the immediately before
|
|
2340
2343
|
// set selection.
|
|
@@ -2405,7 +2408,12 @@
|
|
|
2405
2408
|
});
|
|
2406
2409
|
|
|
2407
2410
|
if (!selection || !slate.Range.equals(selection, range)) {
|
|
2411
|
+
var selectionRef = editor.selection && slate.Editor.rangeRef(editor, editor.selection);
|
|
2408
2412
|
slate.Transforms.select(editor, range);
|
|
2413
|
+
|
|
2414
|
+
if (selectionRef) {
|
|
2415
|
+
EDITOR_TO_USER_SELECTION.set(editor, selectionRef);
|
|
2416
|
+
}
|
|
2409
2417
|
}
|
|
2410
2418
|
}
|
|
2411
2419
|
} // COMPAT: If the selection is expanded, even if the command seems like
|
|
@@ -2555,6 +2563,14 @@
|
|
|
2555
2563
|
|
|
2556
2564
|
break;
|
|
2557
2565
|
}
|
|
2566
|
+
} // Restore the actual user section if nothing manually set it.
|
|
2567
|
+
|
|
2568
|
+
|
|
2569
|
+
var toRestore = (_EDITOR_TO_USER_SELEC = EDITOR_TO_USER_SELECTION.get(editor)) === null || _EDITOR_TO_USER_SELEC === void 0 ? void 0 : _EDITOR_TO_USER_SELEC.unref();
|
|
2570
|
+
EDITOR_TO_USER_SELECTION["delete"](editor);
|
|
2571
|
+
|
|
2572
|
+
if (toRestore && (!editor.selection || !slate.Range.equals(editor.selection, toRestore))) {
|
|
2573
|
+
slate.Transforms.select(editor, toRestore);
|
|
2558
2574
|
}
|
|
2559
2575
|
}
|
|
2560
2576
|
}, [readOnly, propsOnDOMBeforeInput]); // Attach a native DOM event handler for `beforeinput` events, because React's
|
|
@@ -3279,6 +3295,7 @@
|
|
|
3279
3295
|
* Check if the target is in the editor.
|
|
3280
3296
|
*/
|
|
3281
3297
|
|
|
3298
|
+
|
|
3282
3299
|
var hasTarget = function hasTarget(editor, target) {
|
|
3283
3300
|
return isDOMNode(target) && ReactEditor.hasDOMNode(editor, target);
|
|
3284
3301
|
};
|
|
@@ -32849,6 +32866,16 @@
|
|
|
32849
32866
|
break;
|
|
32850
32867
|
}
|
|
32851
32868
|
|
|
32869
|
+
case 'set_selection':
|
|
32870
|
+
{
|
|
32871
|
+
var _EDITOR_TO_USER_SELEC;
|
|
32872
|
+
|
|
32873
|
+
// Selection was manually set, don't restore the user selection after the change.
|
|
32874
|
+
(_EDITOR_TO_USER_SELEC = EDITOR_TO_USER_SELECTION.get(editor)) === null || _EDITOR_TO_USER_SELEC === void 0 ? void 0 : _EDITOR_TO_USER_SELEC.unref();
|
|
32875
|
+
EDITOR_TO_USER_SELECTION["delete"](editor);
|
|
32876
|
+
break;
|
|
32877
|
+
}
|
|
32878
|
+
|
|
32852
32879
|
case 'insert_node':
|
|
32853
32880
|
case 'remove_node':
|
|
32854
32881
|
{
|