mirror of
https://github.com/marktext/marktext.git
synced 2025-05-03 02:41:23 +08:00
fix: paragraphCtrl cursor may be null (#855)
This commit is contained in:
parent
30a1423d02
commit
b0ae437ba4
@ -18,6 +18,10 @@ const getCurrentLevel = type => {
|
||||
const paragraphCtrl = ContentState => {
|
||||
ContentState.prototype.selectionChange = function (cursor) {
|
||||
const { start, end } = cursor || selection.getCursorRange()
|
||||
if (!start || !end) {
|
||||
// TODO: Throw an exception and try to fix this later (GH#848).
|
||||
throw new Error('selectionChange: expected cursor but cursor is null.')
|
||||
}
|
||||
const cursorCoords = selection.getCursorCoords()
|
||||
const startBlock = this.getBlock(start.key)
|
||||
const endBlock = this.getBlock(end.key)
|
||||
|
Loading…
Reference in New Issue
Block a user