remove object.fromEntries (#933)
This commit is contained in:
parent
f393486eed
commit
450a024f5c
@ -7,9 +7,10 @@ export const actionSelectAll = register({
|
|||||||
return {
|
return {
|
||||||
appState: {
|
appState: {
|
||||||
...appState,
|
...appState,
|
||||||
selectedElementIds: Object.fromEntries(
|
selectedElementIds: elements.reduce((map, element) => {
|
||||||
elements.map(element => [element.id, true]),
|
map[element.id] = true;
|
||||||
),
|
return map;
|
||||||
|
}, {} as any),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -1872,9 +1872,10 @@ export class App extends React.Component<any, AppState> {
|
|||||||
this.setState(prevState => ({
|
this.setState(prevState => ({
|
||||||
selectedElementIds: {
|
selectedElementIds: {
|
||||||
...prevState.selectedElementIds,
|
...prevState.selectedElementIds,
|
||||||
...Object.fromEntries(
|
...elementsWithinSelection.reduce((map, element) => {
|
||||||
elementsWithinSelection.map(element => [element.id, true]),
|
map[element.id] = true;
|
||||||
),
|
return map;
|
||||||
|
}, {} as any),
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -2088,9 +2089,10 @@ export class App extends React.Component<any, AppState> {
|
|||||||
elements = [...elements, ...newElements];
|
elements = [...elements, ...newElements];
|
||||||
history.resumeRecording();
|
history.resumeRecording();
|
||||||
this.setState({
|
this.setState({
|
||||||
selectedElementIds: Object.fromEntries(
|
selectedElementIds: newElements.reduce((map, element) => {
|
||||||
newElements.map(element => [element.id, true]),
|
map[element.id] = true;
|
||||||
),
|
return map;
|
||||||
|
}, {} as any),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -98,7 +98,9 @@ function _duplicateElement(val: any, depth: number = 0) {
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function duplicateElement(element: ReturnType<typeof newElement>) {
|
export function duplicateElement(
|
||||||
|
element: ReturnType<typeof newElement>,
|
||||||
|
): ReturnType<typeof newElement> {
|
||||||
const copy = _duplicateElement(element);
|
const copy = _duplicateElement(element);
|
||||||
copy.id = nanoid();
|
copy.id = nanoid();
|
||||||
copy.seed = randomSeed();
|
copy.seed = randomSeed();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user