diff --git a/src/muya/lib/contentState/paragraphCtrl.js b/src/muya/lib/contentState/paragraphCtrl.js index b7726677..843814f4 100644 --- a/src/muya/lib/contentState/paragraphCtrl.js +++ b/src/muya/lib/contentState/paragraphCtrl.js @@ -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)