SelectionState是ImmutableJs里的record。代表了编辑器中选中的区域。
http://facebook.github.io/immutable-js/docs/#/Record/Record
EditorState.getSelection()
The anchor of a selection is the beginning point of the selection。鼠标最初在文档中按下的时候
the of a selection is the end point of the selection. 鼠标在文档中释放时
所以anchor point以及focus point和你选择时的方向有关。
当光标处于闪烁状态,即没有选中任何range的时候,为true
getStartKey() 获取左边的block key,和选择的方向无关。无论是从左往右选还是从右往做选,都是拿到左边的block key
getStartOffset() 获取左边的offset,和选择的方向无关。无论是从左往右选还是从右往做选,都是拿到左边的offset值
getEndKey() 获取右边的block key,和选择的方向无关。
getEndOffset() 获取右边的offset,和选择的方向无关。