-
Notifications
You must be signed in to change notification settings - Fork 116
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
fix: fixing custom app rich text dnd [TOL-1742] #1599
Conversation
@@ -48,7 +49,10 @@ export function createDragAndDropPlugin(): PlatePlugin { | |||
if (!dropDisallowed) { | |||
// Move the drop event to a new undo batch mitigating the bug where undo not only moves it back, | |||
// but also undoes a previous action: https://github.com/ianstormtaylor/slate/issues/4694 | |||
editor.history.undos.push([]); | |||
(editor as unknown as HistoryEditor).history.undos.push({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slate-history behind the scenes got refactored to use batch objects with operations instead of an array of arrays
@@ -67,7 +67,7 @@ | |||
"is-plain-obj": "^3.0.0", | |||
"react-popper": "^2.3.0", | |||
"slate": "0.94.1", | |||
"slate-history": "0.66.0", | |||
"slate-history": "0.100.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a tiny bump 🙄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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 🤔
https://github.com/ianstormtaylor/slate/blob/cd93871ae69721f7361e17e8b28feab004a9c855/packages/slate-history/src/with-history.ts#L72C5-L74C73