mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-18 05:01:17 +02:00
Warn during normalization when range offsets are not numbers. (#1578)
This commit is contained in:
committed by
Ian Storm Taylor
parent
85b4f2f495
commit
c044d048ad
@@ -675,6 +675,12 @@ class Range extends Record(DEFAULTS) {
|
||||
const range = this
|
||||
let { anchorKey, anchorOffset, focusKey, focusOffset, isBackward } = range
|
||||
|
||||
const anchorOffsetType = typeof anchorOffset
|
||||
const focusOffsetType = typeof focusOffset
|
||||
if (anchorOffsetType != 'number' || focusOffsetType != 'number') {
|
||||
logger.warn(`The range offsets should be numbers, but they were of type "${anchorOffsetType}" and "${focusOffsetType}".`)
|
||||
}
|
||||
|
||||
// If the range is unset, make sure it is properly zeroed out.
|
||||
if (anchorKey == null || focusKey == null) {
|
||||
return range.merge({
|
||||
|
Reference in New Issue
Block a user