Open JoryHogeveen opened 1 month ago
Updated Version Numbers
The version numbers in pods-blocks-api.min.asset.json
and pods-dfv.min.asset.json
files have been updated. These changes ensure that we're always working with the latest version of the software components.
Improved Saving Process in Block Editor
A new function (useEffect
) has been added to the FieldWrapper
component to better manage saving in the Block Editor. This utilizes a newly created tool called useBlockEditor
. This makes things better by providing a smoother saving process for your data in the Block Editor.
More Precise Validation State Checks
Validation checks in FieldWrapper
have been made more explicit to avoid any ambiguity.
New Custom Editor Hook
A new hook (useBlockEditor.js
) has been introduced to manage custom editor behavior. This includes saving, locking, and displaying notices, which enhances the overall user experience while using the editor tool.
Integration of the New Hook
The new useBlockEditor
hook has been integrated into the app.js
component. This means the initial settings of the editor now account for the new tools and features provided by the useBlockEditor
hook, making the editor easier and more effective to use.
Description
This PR adds a useBlockEditor React Hook which will initialize by overriding the default savePost function of WordPress core. Based on the code by ACF. The order of overriding should not matter as we are returning the previous value if no validation errors occur, therefore we should be compatible with ACF and other plugins using the same method.
The hook is further used within the field wrapper component which handles validation. Through this component I can set the valid state and pass any error messages.
This PR will not add extra validation on the current system but will be compatible with any extras we add to the useValidation hook as it is merely using it's response messages.
It should create error messages at the top if you click save and will auto-trigger that message to show on the field itself as well. After validation it will also disable the save button until you've made the required changes.
Related GitHub issue(s)
Fixes #7343
Testing instructions
Just create a Pod with some required fields and test around by trying to save the post.
Screenshots / screencast
Changelog text for these changes
PR checklist