From 08e519035e193f0c16ed0ec96f8448a40112857a Mon Sep 17 00:00:00 2001 From: Ben Briggs Date: Tue, 29 May 2018 14:44:59 -0400 Subject: [PATCH] allow zero-length result for getEntitySelection --- src/plugins/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/utils.js b/src/plugins/utils.js index 2868d93..b82b2fb 100644 --- a/src/plugins/utils.js +++ b/src/plugins/utils.js @@ -59,10 +59,10 @@ export default { ); }); invariant( - selections.length === 1, + selections.length <= 1, 'getEntitySelection: More than one range with the same entityKey. Please use unique entity instances' ); - return selections[0]; + return selections.length > 0 ? selections[0] : null; }, insertBlockAtCursor(editorState, block) {