mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
Fix some iframe edge cases (#13650)
Should fix #13648 by fallback on `window` when `document.defaultView` does not exists anymore
This commit is contained in:
committed by
Dan Abramov
parent
d76bf0d21a
commit
2e515d67a0
+1
-1
@@ -152,7 +152,7 @@ export function getModernOffsetsFromPoints(
|
||||
*/
|
||||
export function setOffsets(node, offsets) {
|
||||
const doc = node.ownerDocument || document;
|
||||
const win = doc ? doc.defaultView : window;
|
||||
const win = (doc && doc.defaultView) || window;
|
||||
const selection = win.getSelection();
|
||||
const length = node.textContent.length;
|
||||
let start = Math.min(offsets.start, length);
|
||||
|
||||
Reference in New Issue
Block a user