slate-react 0.112.0 → 0.112.1
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 +19 -4
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/slate-react.js +18 -5
- package/dist/slate-react.min.js +1 -1
- package/package.json +1 -1
package/dist/slate-react.js
CHANGED
|
@@ -5602,12 +5602,25 @@
|
|
|
5602
5602
|
}, [onDOMSelectionChange, scheduleOnDOMSelectionChange, editor, onDOMBeforeInput, forwardedRef]);
|
|
5603
5603
|
useIsomorphicLayoutEffect(function () {
|
|
5604
5604
|
var window = ReactEditor.getWindow(editor);
|
|
5605
|
+
// COMPAT: In Chrome, `selectionchange` events can fire when <input> and
|
|
5606
|
+
// <textarea> elements are appended to the DOM, causing
|
|
5607
|
+
// `editor.selection` to be overwritten in some circumstances.
|
|
5608
|
+
// (2025/01/16) https://issues.chromium.org/issues/389368412
|
|
5609
|
+
var onSelectionChange = function onSelectionChange(_ref) {
|
|
5610
|
+
var target = _ref.target;
|
|
5611
|
+
var targetElement = target instanceof HTMLElement ? target : null;
|
|
5612
|
+
var targetTagName = targetElement === null || targetElement === void 0 ? void 0 : targetElement.tagName;
|
|
5613
|
+
if (targetTagName === 'INPUT' || targetTagName === 'TEXTAREA') {
|
|
5614
|
+
return;
|
|
5615
|
+
}
|
|
5616
|
+
scheduleOnDOMSelectionChange();
|
|
5617
|
+
};
|
|
5605
5618
|
// Attach a native DOM event handler for `selectionchange`, because React's
|
|
5606
5619
|
// built-in `onSelect` handler doesn't fire for all selection changes. It's
|
|
5607
5620
|
// a leaky polyfill that only fires on keypresses or clicks. Instead, we
|
|
5608
5621
|
// want to fire for any change to the selection inside the editor.
|
|
5609
5622
|
// (2019/11/04) https://github.com/facebook/react/issues/5785
|
|
5610
|
-
window.document.addEventListener('selectionchange',
|
|
5623
|
+
window.document.addEventListener('selectionchange', onSelectionChange);
|
|
5611
5624
|
// Listen for dragend and drop globally. In Firefox, if a drop handler
|
|
5612
5625
|
// initiates an operation that causes the originally dragged element to
|
|
5613
5626
|
// unmount, that element will not emit a dragend event. (2024/06/21)
|
|
@@ -5617,7 +5630,7 @@
|
|
|
5617
5630
|
window.document.addEventListener('dragend', stoppedDragging);
|
|
5618
5631
|
window.document.addEventListener('drop', stoppedDragging);
|
|
5619
5632
|
return function () {
|
|
5620
|
-
window.document.removeEventListener('selectionchange',
|
|
5633
|
+
window.document.removeEventListener('selectionchange', onSelectionChange);
|
|
5621
5634
|
window.document.removeEventListener('dragend', stoppedDragging);
|
|
5622
5635
|
window.document.removeEventListener('drop', stoppedDragging);
|
|
5623
5636
|
};
|
|
@@ -6287,9 +6300,9 @@
|
|
|
6287
6300
|
/**
|
|
6288
6301
|
* The default placeholder element
|
|
6289
6302
|
*/
|
|
6290
|
-
var DefaultPlaceholder = function DefaultPlaceholder(
|
|
6291
|
-
var attributes =
|
|
6292
|
-
children =
|
|
6303
|
+
var DefaultPlaceholder = function DefaultPlaceholder(_ref2) {
|
|
6304
|
+
var attributes = _ref2.attributes,
|
|
6305
|
+
children = _ref2.children;
|
|
6293
6306
|
return (
|
|
6294
6307
|
/*#__PURE__*/
|
|
6295
6308
|
// COMPAT: Artificially add a line-break to the end on the placeholder element
|