mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 14:27:02 +08:00
fix(editor): replace checkVisibility (#9481)
This commit is contained in:
@@ -14,7 +14,8 @@ import { DropFlags, type DroppingType, type DropResult } from './types.js';
|
|||||||
function getVisiblePreviousElementSibling(element: Element | null) {
|
function getVisiblePreviousElementSibling(element: Element | null) {
|
||||||
if (!element) return null;
|
if (!element) return null;
|
||||||
let prev = element.previousElementSibling;
|
let prev = element.previousElementSibling;
|
||||||
while (prev && !prev.checkVisibility()) {
|
// https://stackoverflow.com/questions/19669786/check-if-element-is-visible-in-dom
|
||||||
|
while (prev instanceof HTMLElement && prev.offsetParent === null) {
|
||||||
prev = prev.previousElementSibling;
|
prev = prev.previousElementSibling;
|
||||||
}
|
}
|
||||||
return prev;
|
return prev;
|
||||||
@@ -23,7 +24,7 @@ function getVisiblePreviousElementSibling(element: Element | null) {
|
|||||||
function getVisibleNextElementSibling(element: Element | null) {
|
function getVisibleNextElementSibling(element: Element | null) {
|
||||||
if (!element) return null;
|
if (!element) return null;
|
||||||
let next = element.nextElementSibling;
|
let next = element.nextElementSibling;
|
||||||
while (next && !next.checkVisibility()) {
|
while (next instanceof HTMLElement && next.offsetParent === null) {
|
||||||
next = next.nextElementSibling;
|
next = next.nextElementSibling;
|
||||||
}
|
}
|
||||||
return next;
|
return next;
|
||||||
|
|||||||
Reference in New Issue
Block a user