mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-19 05:31:56 +02:00
fix lint
This commit is contained in:
@@ -24,7 +24,7 @@ function findScrollContainer(el) {
|
|||||||
const window = getWindow(el)
|
const window = getWindow(el)
|
||||||
let parent = el.parentNode
|
let parent = el.parentNode
|
||||||
let scroller = window
|
let scroller = window
|
||||||
|
|
||||||
while (!scroller) {
|
while (!scroller) {
|
||||||
if (!parent.parentNode) break
|
if (!parent.parentNode) break
|
||||||
const style = window.getComputedStyle(parent)
|
const style = window.getComputedStyle(parent)
|
||||||
@@ -34,10 +34,10 @@ function findScrollContainer(el) {
|
|||||||
scroller = parent
|
scroller = parent
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
parent = parent.parentNode
|
parent = parent.parentNode
|
||||||
}
|
}
|
||||||
|
|
||||||
return scroller
|
return scroller
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ function scrollToSelection(selection) {
|
|||||||
let height
|
let height
|
||||||
let yOffset
|
let yOffset
|
||||||
let xOffset
|
let xOffset
|
||||||
|
|
||||||
if (isWindow) {
|
if (isWindow) {
|
||||||
const { innerWidth, innerHeight, pageYOffset, pageXOffset } = scroller
|
const { innerWidth, innerHeight, pageYOffset, pageXOffset } = scroller
|
||||||
width = innerWidth
|
width = innerWidth
|
||||||
@@ -74,10 +74,10 @@ function scrollToSelection(selection) {
|
|||||||
yOffset = scrollTop
|
yOffset = scrollTop
|
||||||
xOffset = scrollLeft
|
xOffset = scrollLeft
|
||||||
}
|
}
|
||||||
|
|
||||||
const top = (backward ? rect.top : rect.bottom) + yOffset
|
const top = (backward ? rect.top : rect.bottom) + yOffset
|
||||||
const left = (backward ? rect.left : rect.right) + xOffset
|
const left = (backward ? rect.left : rect.right) + xOffset
|
||||||
|
|
||||||
const x = left < yOffset || innerWidth + xOffset < left
|
const x = left < yOffset || innerWidth + xOffset < left
|
||||||
? left - width / 2
|
? left - width / 2
|
||||||
: xOffset
|
: xOffset
|
||||||
|
Reference in New Issue
Block a user