Skip to content

Commit

Permalink
chore: save detection for form in FSE
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Sep 11, 2023
1 parent d551791 commit e77fe2d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/blocks/blocks/form/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const Edit = ({
* @param {import('../../common').SyncAttrs<import('./type').FormAttrs>} field
* @returns
*/
const getSyncValue = field =>{
const getSyncValue = field => {
if ( attributes?.isSynced?.includes( field ) ) {
return getDefaultValueByField({ name, field, defaultAttributes, attributes });
}
Expand Down Expand Up @@ -210,9 +210,10 @@ const Edit = ({
const isPublishingPost = select( 'core/editor' )?.isPublishingPost();
const isAutosaving = select( 'core/editor' )?.isAutosavingPost();
const widgetSaving = select( 'core/edit-widgets' )?.isSavingWidgetAreas();
const nonPostEntitySaving = select( 'core/editor' )?.isSavingNonPostEntityChanges();

return {
canSaveData: ( ! isAutosaving && ( isSavingPost || isPublishingPost ) ) || widgetSaving
canSaveData: ( ! isAutosaving && ( isSavingPost || isPublishingPost || nonPostEntitySaving ) ) || widgetSaving
};
});

Expand Down

0 comments on commit e77fe2d

Please sign in to comment.