NoteDeep
SelectionState是ImmutableJs里的record。代表了编辑器中选中的区域。
http://facebook.github.io/immutable-js/docs/#/Record/Record

编辑器当前的SelectionState
EditorState.getSelection()

anchor point
The anchor of a selection is the beginning point of the selection。鼠标最初在文档中按下的时候
focus point
the of a selection is the end point of the selection. 鼠标在文档中释放时
所以anchor point以及focus point和你选择时的方向有关。

selection.isCollapsed()
当光标处于闪烁状态,即没有选中任何range的时候,为true
当选中了一片range时,为false

getStartKey() 获取左边的block key,和选择的方向无关。无论是从左往右选还是从右往做选,都是拿到左边的block key

getStartOffset() 获取左边的offset,和选择的方向无关。无论是从左往右选还是从右往做选,都是拿到左边的offset值

getEndKey() 获取右边的block key,和选择的方向无关。
getEndOffset() 获取右边的offset,和选择的方向无关。








评论列表