slate-react 0.116.0 → 0.117.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 +12 -0
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/slate-react.js +12 -0
- package/dist/slate-react.min.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4205,6 +4205,18 @@ var defaultScrollSelectionIntoView = function defaultScrollSelectionIntoView(edi
|
|
|
4205
4205
|
// so enabled only if the selection has been collapsed.
|
|
4206
4206
|
if (domRange.getBoundingClientRect && (!editor.selection || editor.selection && slate.Range.isCollapsed(editor.selection))) {
|
|
4207
4207
|
var leafEl = domRange.startContainer.parentElement;
|
|
4208
|
+
// COMPAT: In Chrome, domRange.getBoundingClientRect() can return zero dimensions for valid ranges (e.g. line breaks).
|
|
4209
|
+
// When this happens, do not scroll like most editors do.
|
|
4210
|
+
var domRect = domRange.getBoundingClientRect();
|
|
4211
|
+
var isZeroDimensionRect = domRect.width === 0 && domRect.height === 0 && domRect.x === 0 && domRect.y === 0;
|
|
4212
|
+
if (isZeroDimensionRect) {
|
|
4213
|
+
var leafRect = leafEl.getBoundingClientRect();
|
|
4214
|
+
var leafHasDimensions = leafRect.width > 0 || leafRect.height > 0;
|
|
4215
|
+
if (leafHasDimensions) {
|
|
4216
|
+
return;
|
|
4217
|
+
}
|
|
4218
|
+
}
|
|
4219
|
+
// Default behavior: use domRange's getBoundingClientRect
|
|
4208
4220
|
leafEl.getBoundingClientRect = domRange.getBoundingClientRect.bind(domRange);
|
|
4209
4221
|
scrollIntoView(leafEl, {
|
|
4210
4222
|
scrollMode: 'if-needed'
|