Skip to content

Commit

Permalink
Add a comment about the future extensibility
Browse files Browse the repository at this point in the history
  • Loading branch information
okmttdhr committed Dec 8, 2023
1 parent f01589b commit 055dcaf
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions packages/edit-site/src/components/save-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ export default function SaveButton( {

const { setIsSaveViewOpened } = useDispatch( editSiteStore );

const onClick = useCallback( () => {
const callback = applyFilters( 'edit-site.SaveButton.onClick', () =>
setIsSaveViewOpened( true )
);
callback();
}, [ setIsSaveViewOpened ] );

const activateSaveEnabled = isPreviewingTheme() || isDirty;
const disabled = isSaving || ! activateSaveEnabled;

Expand All @@ -88,6 +81,18 @@ export default function SaveButton( {
}
return __( 'Save' );
};

/**
* We focus on adding the customization to the SaveButton's `onClick` and `label` for now.
* We will provide the customization to the other entry points (e.g., SavePanel, SaveHub) in the future if needed.
* @see https://github.com/WordPress/gutenberg/pull/56807
*/
const onClick = useCallback( () => {
const callback = applyFilters( 'edit-site.SaveButton.onClick', () =>
setIsSaveViewOpened( true )
);
callback();
}, [ setIsSaveViewOpened ] );
const label = useMemo( () => {
return applyFilters( 'edit-site.SaveButton.label', getLabel(), {
isSaving,
Expand Down

0 comments on commit 055dcaf

Please sign in to comment.