|
|
@ -69,8 +69,20 @@ export const actionDuplicateSelection = register({
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const nextState = duplicateElements(elements, appState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (app.props.onDuplicate && nextState.elements) {
|
|
|
|
|
|
|
|
const mappedElements = app.props.onDuplicate(
|
|
|
|
|
|
|
|
nextState.elements,
|
|
|
|
|
|
|
|
elements,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
if (mappedElements) {
|
|
|
|
|
|
|
|
nextState.elements = mappedElements;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
...duplicateElements(elements, appState),
|
|
|
|
...nextState,
|
|
|
|
storeAction: StoreAction.CAPTURE,
|
|
|
|
storeAction: StoreAction.CAPTURE,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -92,7 +104,7 @@ export const actionDuplicateSelection = register({
|
|
|
|
const duplicateElements = (
|
|
|
|
const duplicateElements = (
|
|
|
|
elements: readonly ExcalidrawElement[],
|
|
|
|
elements: readonly ExcalidrawElement[],
|
|
|
|
appState: AppState,
|
|
|
|
appState: AppState,
|
|
|
|
): Partial<ActionResult> => {
|
|
|
|
): Partial<Exclude<ActionResult, false>> => {
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
const groupIdMap = new Map();
|
|
|
|
const groupIdMap = new Map();
|
|
|
|