From 4b761ac74d7f20c49755bd9af4de78309298d13f Mon Sep 17 00:00:00 2001 From: Rostislav Wolny Date: Thu, 5 Dec 2024 10:34:14 +0100 Subject: [PATCH] Cleanup SaveEmailButton to work only with email [MAILPOET-6342] --- .../components/header/save-email-button.tsx | 39 +------------------ 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/packages/js/email-editor/src/components/header/save-email-button.tsx b/packages/js/email-editor/src/components/header/save-email-button.tsx index 85b51ce5ce..2de1604a0a 100644 --- a/packages/js/email-editor/src/components/header/save-email-button.tsx +++ b/packages/js/email-editor/src/components/header/save-email-button.tsx @@ -1,11 +1,4 @@ -import { useRef } from '@wordpress/element'; -import { Button, Dropdown } from '@wordpress/components'; -import { - // @ts-expect-error No types available for useEntitiesSavedStatesIsDirty - useEntitiesSavedStatesIsDirty, - // @ts-expect-error Our current version of packages doesn't have EntitiesSavedStates export - EntitiesSavedStates, -} from '@wordpress/editor'; +import { Button } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { useDispatch, useSelect } from '@wordpress/data'; import { check, cloud, Icon } from '@wordpress/icons'; @@ -14,8 +7,6 @@ import { storeName } from '../../store'; export function SaveEmailButton() { const { saveEditedEmail } = useDispatch( storeName ); - const { dirtyEntityRecords } = useEntitiesSavedStatesIsDirty(); - const { hasEdits, isEmpty, isSaving } = useSelect( ( select ) => ( { hasEdits: select( storeName ).hasEdits(), @@ -25,12 +16,6 @@ export function SaveEmailButton() { [] ); - const buttonRef = useRef( null ); - - const hasNonEmailEdits = dirtyEntityRecords.some( - ( entity ) => entity.name !== 'mailpoet_email' - ); - const isSaved = ! isEmpty && ! isSaving && ! hasEdits; const isDisabled = isEmpty || isSaving || isSaved; @@ -41,27 +26,7 @@ export function SaveEmailButton() { label = __( 'Saving', 'mailpoet' ); } - return hasNonEmailEdits ? ( -
- ( - - ) } - renderContent={ ( { onToggle } ) => ( - - ) } - /> -
- ) : ( + return (