mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-25 08:11:53 +02:00
swap to isFocused for consistency
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -83,9 +83,9 @@ class Content extends React.Component {
|
|||||||
let { selection } = state
|
let { selection } = state
|
||||||
const native = window.getSelection()
|
const native = window.getSelection()
|
||||||
|
|
||||||
// No selection is active, so unset `hasFocus`.
|
// No selection is active, so unset `isFocused`.
|
||||||
if (!native.rangeCount && selection.hasFocus) {
|
if (!native.rangeCount && selection.isFocused) {
|
||||||
selection = selection.set('hasFocus', false)
|
selection = selection.set('isFocused', false)
|
||||||
state = state.set('selection', selection)
|
state = state.set('selection', selection)
|
||||||
this.onChange(state)
|
this.onChange(state)
|
||||||
return
|
return
|
||||||
@@ -116,7 +116,7 @@ class Content extends React.Component {
|
|||||||
selection = selection.set('focusKey', focus.key)
|
selection = selection.set('focusKey', focus.key)
|
||||||
selection = selection.set('focusOffset', focus.offset)
|
selection = selection.set('focusOffset', focus.offset)
|
||||||
selection = selection.set('isBackward', isBackward)
|
selection = selection.set('isBackward', isBackward)
|
||||||
selection = selection.set('hasFocus', true)
|
selection = selection.set('isFocused', true)
|
||||||
state = state.set('selection', selection)
|
state = state.set('selection', selection)
|
||||||
this.onChange(state)
|
this.onChange(state)
|
||||||
return
|
return
|
||||||
|
@@ -29,7 +29,7 @@ class LeafNode extends React.Component {
|
|||||||
const { selection } = state
|
const { selection } = state
|
||||||
|
|
||||||
// If the selection is not focused we have nothing to do.
|
// If the selection is not focused we have nothing to do.
|
||||||
if (!selection.hasFocus) return
|
if (!selection.isFocused) return
|
||||||
|
|
||||||
const { anchorKey, anchorOffset, focusKey, focusOffset } = selection
|
const { anchorKey, anchorOffset, focusKey, focusOffset } = selection
|
||||||
const { node, range } = this.props
|
const { node, range } = this.props
|
||||||
|
@@ -11,7 +11,7 @@ const SelectionRecord = new Record({
|
|||||||
focusKey: null,
|
focusKey: null,
|
||||||
focusOffset: 0,
|
focusOffset: 0,
|
||||||
isBackward: false,
|
isBackward: false,
|
||||||
hasFocus: false
|
isFocused: false
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user