mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-02 11:42:53 +02:00
fix deprecate node access without key
This commit is contained in:
@@ -188,7 +188,7 @@ class RichText extends React.Component {
|
|||||||
else {
|
else {
|
||||||
const isList = this.hasBlock('list-item')
|
const isList = this.hasBlock('list-item')
|
||||||
const isType = state.blocks.some((block) => {
|
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) {
|
if (isList && isType) {
|
||||||
|
@@ -104,8 +104,8 @@ class Tables extends React.Component {
|
|||||||
const startNode = document.getDescendant(startKey)
|
const startNode = document.getDescendant(startKey)
|
||||||
|
|
||||||
if (selection.isAtStartOf(startNode)) {
|
if (selection.isAtStartOf(startNode)) {
|
||||||
const previous = document.getPreviousText(startNode)
|
const previous = document.getPreviousText(startNode.key)
|
||||||
const prevBlock = document.getClosestBlock(previous)
|
const prevBlock = document.getClosestBlock(previous.key)
|
||||||
|
|
||||||
if (prevBlock.type == 'table-cell') {
|
if (prevBlock.type == 'table-cell') {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
@@ -492,14 +492,14 @@ function Plugin(options = {}) {
|
|||||||
if (data.isOpt) return
|
if (data.isOpt) return
|
||||||
if (state.isExpanded) return
|
if (state.isExpanded) return
|
||||||
|
|
||||||
const { document, startText } = state
|
const { document, startKey, startText } = state
|
||||||
const hasVoidParent = document.hasVoidParent(startText.key)
|
const hasVoidParent = document.hasVoidParent(startKey)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
startText.text == '' ||
|
startText.text == '' ||
|
||||||
hasVoidParent
|
hasVoidParent
|
||||||
) {
|
) {
|
||||||
const previousText = document.getPreviousText(startText.key)
|
const previousText = document.getPreviousText(startKey)
|
||||||
if (!previousText) return
|
if (!previousText) return
|
||||||
|
|
||||||
debug('onKeyDownLeft', { data })
|
debug('onKeyDownLeft', { data })
|
||||||
@@ -530,14 +530,14 @@ function Plugin(options = {}) {
|
|||||||
if (data.isOpt) return
|
if (data.isOpt) return
|
||||||
if (state.isExpanded) return
|
if (state.isExpanded) return
|
||||||
|
|
||||||
const { document, startText } = state
|
const { document, startKey, startText } = state
|
||||||
const hasVoidParent = document.hasVoidParent(startText)
|
const hasVoidParent = document.hasVoidParent(startKey)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
startText.text == '' ||
|
startText.text == '' ||
|
||||||
hasVoidParent
|
hasVoidParent
|
||||||
) {
|
) {
|
||||||
const nextText = document.getNextText(startText)
|
const nextText = document.getNextText(startKey)
|
||||||
if (!nextText) return state
|
if (!nextText) return state
|
||||||
|
|
||||||
debug('onKeyDownRight', { data })
|
debug('onKeyDownRight', { data })
|
||||||
|
Reference in New Issue
Block a user