slate-react 0.82.1 → 0.82.2-202281032115
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/components/element.d.ts.map +1 -1
- package/dist/index.es.js +22 -17
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +21 -16
- package/dist/index.js.map +1 -1
- package/dist/slate-react.js +21 -16
- package/dist/slate-react.min.js +1 -1
- package/package.json +1 -1
package/dist/slate-react.js
CHANGED
|
@@ -2254,11 +2254,23 @@
|
|
|
2254
2254
|
renderPlaceholder = props.renderPlaceholder,
|
|
2255
2255
|
renderLeaf = props.renderLeaf,
|
|
2256
2256
|
selection = props.selection;
|
|
2257
|
-
var ref = React.useRef(null);
|
|
2258
2257
|
var editor = useSlateStatic();
|
|
2259
2258
|
var readOnly = useReadOnly();
|
|
2260
2259
|
var isInline = editor.isInline(element);
|
|
2261
2260
|
var key = ReactEditor.findKey(editor, element);
|
|
2261
|
+
var ref = React.useCallback(function (ref) {
|
|
2262
|
+
// Update element-related weak maps with the DOM element ref.
|
|
2263
|
+
var KEY_TO_ELEMENT = EDITOR_TO_KEY_TO_ELEMENT.get(editor);
|
|
2264
|
+
|
|
2265
|
+
if (ref) {
|
|
2266
|
+
KEY_TO_ELEMENT === null || KEY_TO_ELEMENT === void 0 ? void 0 : KEY_TO_ELEMENT.set(key, ref);
|
|
2267
|
+
NODE_TO_ELEMENT.set(element, ref);
|
|
2268
|
+
ELEMENT_TO_NODE.set(ref, element);
|
|
2269
|
+
} else {
|
|
2270
|
+
KEY_TO_ELEMENT === null || KEY_TO_ELEMENT === void 0 ? void 0 : KEY_TO_ELEMENT["delete"](key);
|
|
2271
|
+
NODE_TO_ELEMENT["delete"](element);
|
|
2272
|
+
}
|
|
2273
|
+
}, [editor, key, element]);
|
|
2262
2274
|
var children = useChildren({
|
|
2263
2275
|
decorations: decorations,
|
|
2264
2276
|
node: element,
|
|
@@ -2321,21 +2333,8 @@
|
|
|
2321
2333
|
}));
|
|
2322
2334
|
NODE_TO_INDEX.set(_text, 0);
|
|
2323
2335
|
NODE_TO_PARENT.set(_text, element);
|
|
2324
|
-
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
useIsomorphicLayoutEffect(function () {
|
|
2328
|
-
var KEY_TO_ELEMENT = EDITOR_TO_KEY_TO_ELEMENT.get(editor);
|
|
2336
|
+
}
|
|
2329
2337
|
|
|
2330
|
-
if (ref.current) {
|
|
2331
|
-
KEY_TO_ELEMENT === null || KEY_TO_ELEMENT === void 0 ? void 0 : KEY_TO_ELEMENT.set(key, ref.current);
|
|
2332
|
-
NODE_TO_ELEMENT.set(element, ref.current);
|
|
2333
|
-
ELEMENT_TO_NODE.set(ref.current, element);
|
|
2334
|
-
} else {
|
|
2335
|
-
KEY_TO_ELEMENT === null || KEY_TO_ELEMENT === void 0 ? void 0 : KEY_TO_ELEMENT["delete"](key);
|
|
2336
|
-
NODE_TO_ELEMENT["delete"](element);
|
|
2337
|
-
}
|
|
2338
|
-
});
|
|
2339
2338
|
return renderElement({
|
|
2340
2339
|
attributes: attributes,
|
|
2341
2340
|
children: children,
|
|
@@ -4507,6 +4506,11 @@
|
|
|
4507
4506
|
androidInputManager === null || androidInputManager === void 0 ? void 0 : androidInputManager.handleUserSelect(range);
|
|
4508
4507
|
}
|
|
4509
4508
|
}
|
|
4509
|
+
} // Deselect the editor if the dom selection is not selectable in readonly mode
|
|
4510
|
+
|
|
4511
|
+
|
|
4512
|
+
if (readOnly && (!anchorNodeSelectable || !focusNodeSelectable)) {
|
|
4513
|
+
slate.Transforms.deselect(editor);
|
|
4510
4514
|
}
|
|
4511
4515
|
}
|
|
4512
4516
|
}, 100), [readOnly]);
|
|
@@ -5037,7 +5041,8 @@
|
|
|
5037
5041
|
node: ref,
|
|
5038
5042
|
receivedUserInput: receivedUserInput
|
|
5039
5043
|
}, /*#__PURE__*/React__default['default'].createElement(Component, Object.assign({
|
|
5040
|
-
role: readOnly ? undefined : 'textbox'
|
|
5044
|
+
role: readOnly ? undefined : 'textbox',
|
|
5045
|
+
"aria-multiline": readOnly ? undefined : true
|
|
5041
5046
|
}, attributes, {
|
|
5042
5047
|
// COMPAT: Certain browsers don't support the `beforeinput` event, so we'd
|
|
5043
5048
|
// have to use hacks to make these replacement-based features work.
|