Skip to content

Commit

Permalink
fix: fixing custom app rich text dnd [TOL-1742] (#1599)
Browse files Browse the repository at this point in the history
  • Loading branch information
aodhagan-cf authored Feb 2, 2024
1 parent 2e5ab48 commit 43c17ca
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/rich-text/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"slate-hyperscript": "0.77.0",
"slate-react": "0.98.3"
},
Expand Down
6 changes: 5 additions & 1 deletion packages/rich-text/src/plugins/DragAndDrop/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BLOCKS, INLINES } from '@contentful/rich-text-types';
import { HistoryEditor } from 'slate-history';

import { getNodeEntries } from '../../internal/queries';
import { PlatePlugin } from '../../internal/types';
Expand Down Expand Up @@ -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({
operations: [],
selectionBefore: null,
});
}

return dropDisallowed;
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26804,7 +26804,14 @@ slash@^4.0.0:
resolved "https://registry.yarnpkg.com/slash/-/slash-4.0.0.tgz#2422372176c4c6c5addb5e2ada885af984b396a7"
integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==

[email protected], slate-history@^0.66.0:
[email protected]:
version "0.100.0"
resolved "https://registry.yarnpkg.com/slate-history/-/slate-history-0.100.0.tgz#a8549af61182a18db2dfedff6ebab7452c841666"
integrity sha512-x5rUuWLNtH97hs9PrFovGgt3Qc5zkTm/5mcUB+0NR/TK923eLax4HsL6xACLHMs245nI6aJElyM1y6hN0y5W/Q==
dependencies:
is-plain-object "^5.0.0"

slate-history@^0.66.0:
version "0.66.0"
resolved "https://registry.yarnpkg.com/slate-history/-/slate-history-0.66.0.tgz#ac63fddb903098ceb4c944433e3f75fe63acf940"
integrity sha512-6MWpxGQZiMvSINlCbMW43E2YBSVMCMCIwQfBzGssjWw4kb0qfvj0pIdblWNRQZD0hR6WHP+dHHgGSeVdMWzfng==
Expand Down

0 comments on commit 43c17ca

Please sign in to comment.