Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor.start / Editor.end broke when migrating from slate 0.93.0 -> 0.94.0 #5548

Open
gajus opened this issue Oct 31, 2023 · 1 comment
Open
Labels

Comments

@gajus
Copy link

gajus commented Oct 31, 2023

Description

Receiving an error:

Error: Cannot find a descendant at path [0] in node: {"children":[],"operations":[],"selection":null,"marks":null}

Prior to this update was receiving:

{ path: [ 0, 0 ], offset: 0 }

Steps

Editor.start(editor)

I noticed that the editor instance changed between these versions:

0.93.0

{
  children: [
    { type: 'paragraph', children: [ { text: '' } ] }
  ],
  operations: [],
  selection: {
    anchor: { path: [ 0, 0 ], offset: 0 },
    focus: { path: [ 0, 0 ], offset: 0 }
  },
  marks: null,
  id: 2,
  isInline: [Function (anonymous)],
  isVoid: [Function (anonymous)],
  markableVoid: [Function: markableVoid],
  onChange: [Function: onChange],
  apply: [Function: apply],
  addMark: [Function: addMark],
  deleteBackward: [Function: deleteBackward],
  deleteForward: [Function: deleteForward],
  deleteFragment: [Function: deleteFragment],
  getFragment: [Function: getFragment],
  insertBreak: [Function: insertBreak],
  insertSoftBreak: [Function: insertSoftBreak],
  insertFragment: [Function: insertFragment],
  insertNode: [Function: insertNode],
  insertText: [Function: insertText],
  normalizeNode: [Function: normalizeNode],
  removeMark: [Function: removeMark],
  getDirtyPaths: [Function: getDirtyPaths],
  insertData: [Function (anonymous)]
}

0.94.0

{
  children: [
    { type: 'paragraph', children: [ { text: '' } ] }
  ],
  operations: [],
  selection: {
    anchor: { path: [ 0, 0 ], offset: 0 },
    focus: { path: [ 0, 0 ], offset: 0 }
  },
  marks: null,
  isElementReadOnly: [Function: isElementReadOnly],
  isInline: [Function (anonymous)],
  isSelectable: [Function: isSelectable],
  isVoid: [Function (anonymous)],
  markableVoid: [Function: markableVoid],
  onChange: [Function: onChange],
  apply: [Function: apply$1],
  addMark: [Function: addMark$1],
  deleteBackward: [Function: deleteBackward$1],
  deleteForward: [Function: deleteForward$1],
  deleteFragment: [Function: deleteFragment$1],
  getFragment: [Function: getFragment$1],
  insertBreak: [Function: insertBreak$1],
  insertSoftBreak: [Function: insertSoftBreak$1],
  insertFragment: [Function: insertFragment$1],
  insertNode: [Function: insertNode$1],
  insertText: [Function: insertText$1],
  normalizeNode: [Function: normalizeNode$1],
  removeMark: [Function: removeMark$1],
  getDirtyPaths: [Function: getDirtyPaths$1],
  shouldNormalize: [Function: shouldNormalize$1],
  above: [Function: above$1],
  after: [Function: after$1],
  before: [Function: before$1],
  collapse: [Function: collapse$1],
  delete: [Function: _delete],
  deselect: [Function: deselect$1],
  edges: [Function: edges$1],
  elementReadOnly: [Function: elementReadOnly$1],
  end: [Function: end$1],
  first: [Function: first$1],
  fragment: [Function: fragment$1],
  getMarks: [Function: getMarks],
  hasBlocks: [Function: hasBlocks$1],
  hasInlines: [Function: hasInlines$1],
  hasPath: [Function: hasPath$1],
  hasTexts: [Function: hasTexts$1],
  insertNodes: [Function: insertNodes$1],
  isBlock: [Function: isBlock$1],
  isEdge: [Function: isEdge$1],
  isEmpty: [Function: isEmpty$1],
  isEnd: [Function: isEnd$1],
  isNormalizing: [Function: isNormalizing$1],
  isStart: [Function: isStart$1],
  last: [Function: last$1],
  leaf: [Function: leaf$1],
  levels: [Function: levels$1],
  liftNodes: [Function: liftNodes$1],
  mergeNodes: [Function: mergeNodes$1],
  move: [Function: move$1],
  moveNodes: [Function: moveNodes$1],
  next: [Function: next$1],
  node: [Function: node$1],
  nodes: [Function: nodes$1],
  normalize: [Function: normalize$1],
  parent: [Function: parent$1],
  path: [Function: path$1],
  pathRef: [Function: pathRef$1],
  pathRefs: [Function: pathRefs$1],
  point: [Function: point$1],
  pointRef: [Function: pointRef$1],
  pointRefs: [Function: pointRefs$1],
  positions: [Function: positions$1],
  previous: [Function: previous$1],
  range: [Function: range$1],
  rangeRef: [Function: rangeRef$1],
  rangeRefs: [Function: rangeRefs$1],
  removeNodes: [Function: removeNodes$1],
  select: [Function: select$1],
  setNodes: [Function: setNodes$1],
  setNormalizing: [Function: setNormalizing$1],
  setPoint: [Function: setPoint$1],
  setSelection: [Function: setSelection$1],
  splitNodes: [Function: splitNodes$1],
  start: [Function: start$1],
  string: [Function: string$1],
  unhangRange: [Function: unhangRange$1],
  unsetNodes: [Function: unsetNodes$1],
  unwrapNodes: [Function: unwrapNodes$1],
  void: [Function: _void],
  withoutNormalizing: [Function: withoutNormalizing$1],
  wrapNodes: [Function: wrapNodes$1],
  insertData: [Function (anonymous)]
}

Expectation

Previous behavior or migration path.

@gajus gajus added the bug label Oct 31, 2023
@azvoncov-smartling
Copy link

Editor.start(editor, [])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants