From e0fa49315a19840403d3a7ffa467f09b9ab3ff13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E6=B2=85=E9=91=AB?= Date: Sat, 9 Mar 2019 01:04:54 +0800 Subject: [PATCH] Fix examples/tables variable "previous" is null when select text and delete all (#2638) --- examples/tables/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/tables/index.js b/examples/tables/index.js index d9a437f46..619934aba 100644 --- a/examples/tables/index.js +++ b/examples/tables/index.js @@ -163,6 +163,11 @@ class Tables extends React.Component { if (isCollapsed && start.isAtStartOfNode(startNode)) { const previous = document.getPreviousText(startNode.key) + + if (!previous) { + return next() + } + const prevBlock = document.getClosestBlock(previous.key) if (prevBlock.type === 'table-cell') {