mirror of
https://github.com/marktext/marktext.git
synced 2025-05-04 03:51:01 +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 => {
|
const paragraphCtrl = ContentState => {
|
||||||
ContentState.prototype.selectionChange = function (cursor) {
|
ContentState.prototype.selectionChange = function (cursor) {
|
||||||
const { start, end } = cursor || selection.getCursorRange()
|
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 cursorCoords = selection.getCursorCoords()
|
||||||
const startBlock = this.getBlock(start.key)
|
const startBlock = this.getBlock(start.key)
|
||||||
const endBlock = this.getBlock(end.key)
|
const endBlock = this.getBlock(end.key)
|
||||||
|
Loading…
Reference in New Issue
Block a user