diff --git a/examples/rich-text/index.js b/examples/rich-text/index.js index c1d9bc636..d0bad01b8 100644 --- a/examples/rich-text/index.js +++ b/examples/rich-text/index.js @@ -188,7 +188,7 @@ class RichText extends React.Component { else { const isList = this.hasBlock('list-item') const isType = state.blocks.some((block) => { - return !!document.getClosest(block, parent => parent.type == type) + return !!document.getClosest(block.key, parent => parent.type == type) }) if (isList && isType) { diff --git a/examples/tables/index.js b/examples/tables/index.js index 44399cc26..b14471367 100644 --- a/examples/tables/index.js +++ b/examples/tables/index.js @@ -104,8 +104,8 @@ class Tables extends React.Component { const startNode = document.getDescendant(startKey) if (selection.isAtStartOf(startNode)) { - const previous = document.getPreviousText(startNode) - const prevBlock = document.getClosestBlock(previous) + const previous = document.getPreviousText(startNode.key) + const prevBlock = document.getClosestBlock(previous.key) if (prevBlock.type == 'table-cell') { e.preventDefault() diff --git a/src/plugins/core.js b/src/plugins/core.js index 45a660f18..6d0404433 100644 --- a/src/plugins/core.js +++ b/src/plugins/core.js @@ -492,14 +492,14 @@ function Plugin(options = {}) { if (data.isOpt) return if (state.isExpanded) return - const { document, startText } = state - const hasVoidParent = document.hasVoidParent(startText.key) + const { document, startKey, startText } = state + const hasVoidParent = document.hasVoidParent(startKey) if ( startText.text == '' || hasVoidParent ) { - const previousText = document.getPreviousText(startText.key) + const previousText = document.getPreviousText(startKey) if (!previousText) return debug('onKeyDownLeft', { data }) @@ -530,14 +530,14 @@ function Plugin(options = {}) { if (data.isOpt) return if (state.isExpanded) return - const { document, startText } = state - const hasVoidParent = document.hasVoidParent(startText) + const { document, startKey, startText } = state + const hasVoidParent = document.hasVoidParent(startKey) if ( startText.text == '' || hasVoidParent ) { - const nextText = document.getNextText(startText) + const nextText = document.getNextText(startKey) if (!nextText) return state debug('onKeyDownRight', { data })