mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-10-07 08:10:00 +02:00
feat: multiplayer undo / redo (#7348)
This commit is contained in:
@@ -32,6 +32,7 @@ import {
|
||||
getSelectedElements,
|
||||
} from "../scene/selection";
|
||||
import { syncMovedIndices } from "../fractionalIndex";
|
||||
import { StoreAction } from "../store";
|
||||
|
||||
export const actionDuplicateSelection = register({
|
||||
name: "duplicateSelection",
|
||||
@@ -54,13 +55,13 @@ export const actionDuplicateSelection = register({
|
||||
return {
|
||||
elements,
|
||||
appState: ret.appState,
|
||||
commitToHistory: true,
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
...duplicateElements(elements, appState),
|
||||
commitToHistory: true,
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
};
|
||||
},
|
||||
keyTest: (event) => event[KEYS.CTRL_OR_CMD] && event.key === KEYS.D,
|
||||
@@ -241,9 +242,10 @@ const duplicateElements = (
|
||||
}
|
||||
|
||||
// step (3)
|
||||
const finalElements = finalElementsReversed.reverse();
|
||||
|
||||
syncMovedIndices(finalElements, arrayToMap([...oldElements, ...newElements]));
|
||||
const finalElements = syncMovedIndices(
|
||||
finalElementsReversed.reverse(),
|
||||
arrayToMap(newElements),
|
||||
);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
Reference in New Issue
Block a user