contentful / field-editors

React components and extensions for building Contentful entry editor
https://contentful-field-editors.netlify.app/
MIT License
149 stars 114 forks source link

fix: fixing custom app rich text dnd [TOL-1742] #1599

Closed aodhagan-cf closed 5 months ago

aodhagan-cf commented 5 months ago

image

Error being throw when dragging and dropping with custom rich text editor.

Todo

EDIT

Because we push a new undo as an empty array this condition doesn't short-circuit and the operations doesn't exist on the empty array. I'm not sure why this is only a problem for the App SDK and hasn't been happening the regular web app Rich Text 🤔

const lastOp =
lastBatch && lastBatch.operations[lastBatch.operations.length - 1]

https://github.com/ianstormtaylor/slate/blob/cd93871ae69721f7361e17e8b28feab004a9c855/packages/slate-history/src/with-history.ts#L72C5-L74C73