diff --git a/packages/block-editor/src/components/rich-text/use-undo-automatic-change.js b/packages/block-editor/src/components/rich-text/use-undo-automatic-change.js index 890746cec74a35..819f2935806263 100644 --- a/packages/block-editor/src/components/rich-text/use-undo-automatic-change.js +++ b/packages/block-editor/src/components/rich-text/use-undo-automatic-change.js @@ -28,12 +28,18 @@ export function useUndoAutomaticChange() { return; } + const { __experimentalUndo } = getSettings(); + + if ( ! __experimentalUndo ) { + return; + } + if ( ! didAutomaticChange() ) { return; } event.preventDefault(); - getSettings().__experimentalUndo(); + __experimentalUndo(); } element.addEventListener( 'keydown', onKeyDown );