diff --git a/src/actions/actionCanvas.tsx b/src/actions/actionCanvas.tsx index b5e54df9..182da736 100644 --- a/src/actions/actionCanvas.tsx +++ b/src/actions/actionCanvas.tsx @@ -14,7 +14,10 @@ import { newElementWith } from "../element/mutateElement"; export const actionChangeViewBackgroundColor = register({ name: "changeViewBackgroundColor", perform: (_, appState, value) => { - return { appState: { ...appState, viewBackgroundColor: value } }; + return { + appState: { ...appState, viewBackgroundColor: value }, + commitToHistory: true, + }; }, PanelComponent: ({ appState, updateData }) => { return ( @@ -28,18 +31,17 @@ export const actionChangeViewBackgroundColor = register({ ); }, - commitToHistory: () => true, }); export const actionClearCanvas = register({ name: "clearCanvas", - commitToHistory: () => true, perform: elements => { return { elements: elements.map(element => newElementWith(element, { isDeleted: true }), ), appState: getDefaultAppState(), + commitToHistory: true, }; }, PanelComponent: ({ updateData }) => ( @@ -81,6 +83,7 @@ export const actionZoomIn = register({ ...appState, zoom: getNormalizedZoom(appState.zoom + ZOOM_STEP), }, + commitToHistory: false, }; }, PanelComponent: ({ updateData }) => ( @@ -107,6 +110,7 @@ export const actionZoomOut = register({ ...appState, zoom: getNormalizedZoom(appState.zoom - ZOOM_STEP), }, + commitToHistory: false, }; }, PanelComponent: ({ updateData }) => ( @@ -133,6 +137,7 @@ export const actionResetZoom = register({ ...appState, zoom: 1, }, + commitToHistory: false, }; }, PanelComponent: ({ updateData }) => ( diff --git a/src/actions/actionDeleteSelected.tsx b/src/actions/actionDeleteSelected.tsx index e8979274..dcf84341 100644 --- a/src/actions/actionDeleteSelected.tsx +++ b/src/actions/actionDeleteSelected.tsx @@ -20,12 +20,11 @@ export const actionDeleteSelected = register({ elementType: "selection", multiElement: null, }, + commitToHistory: isSomeElementSelected(elements, appState), }; }, contextItemLabel: "labels.delete", contextMenuOrder: 3, - commitToHistory: (appState, elements) => - isSomeElementSelected(elements, appState), keyTest: event => event.key === KEYS.BACKSPACE || event.key === KEYS.DELETE, PanelComponent: ({ elements, appState, updateData }) => ( { - return { appState: { ...appState, name: value } }; + return { appState: { ...appState, name: value }, commitToHistory: false }; }, PanelComponent: ({ appState, updateData }) => ( { - return { appState: { ...appState, exportBackground: value } }; + return { + appState: { ...appState, exportBackground: value }, + commitToHistory: false, + }; }, PanelComponent: ({ appState, updateData }) => (