From fbbc529041a140863bc344451b8a458aae79524a Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Tue, 26 Nov 2024 17:24:09 +0400 Subject: [PATCH] Block Editor: Add notice action to revert image to original after cropping --- .../src/components/image-editor/use-save-image.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/block-editor/src/components/image-editor/use-save-image.js b/packages/block-editor/src/components/image-editor/use-save-image.js index 676f74b9ab6a6..980ac9b8b1123 100644 --- a/packages/block-editor/src/components/image-editor/use-save-image.js +++ b/packages/block-editor/src/components/image-editor/use-save-image.js @@ -83,6 +83,17 @@ export default function useSaveImage( { } ); createSuccessNotice( messages[ modifierType ], { type: 'snackbar', + actions: [ + { + label: __( 'Undo' ), + onClick: () => { + onSaveImage( { + id, + url, + } ); + }, + }, + ], } ); } ) .catch( ( error ) => {