diff --git a/src/js/gutenberg-plugins/content-resizing-plugin.js b/src/js/gutenberg-plugins/content-resizing-plugin.js index e99c95e60..7753a86d3 100644 --- a/src/js/gutenberg-plugins/content-resizing-plugin.js +++ b/src/js/gutenberg-plugins/content-resizing-plugin.js @@ -222,7 +222,11 @@ const ContentResizingPlugin = () => { * * @param {string} updateWith The content that will be used to replace the selection. */ - function updateContent( updateWith ) { + async function updateContent( updateWith ) { + const isDirty = await select( 'core/editor' ).isEditedPostDirty(); + const postId = select( 'core/editor' ).getCurrentPostId(); + const postType = select( 'core/editor' ).getCurrentPostType(); + dispatch( blockEditorStore ).updateBlockAttributes( selectedBlock.clientId, { @@ -237,6 +241,15 @@ const ContentResizingPlugin = () => { updateWith.length ); resetStates(); + + // If no edited values in post trigger save. + if ( ! isDirty ) { + await dispatch( 'core' ).saveEditedEntityRecord( + 'postType', + postType, + postId + ); + } } // We don't want to use the reszing feature when multiple blocks are selected. diff --git a/src/js/gutenberg-plugins/post-status-info.js b/src/js/gutenberg-plugins/post-status-info.js index 4c9e380f4..5fa351685 100644 --- a/src/js/gutenberg-plugins/post-status-info.js +++ b/src/js/gutenberg-plugins/post-status-info.js @@ -37,6 +37,7 @@ const PostStatusInfo = () => { } const postId = select( 'core/editor' ).getCurrentPostId(); + const postType = select( 'core/editor' ).getCurrentPostType(); const postContent = select( 'core/editor' ).getEditedPostAttribute( 'content' ); const openModal = () => setOpen( true ); @@ -85,11 +86,24 @@ const PostStatusInfo = () => {