TL;DR
PayloadCMS v3.0.0-beta.40 brings significant improvements to the rich text editor with a configurable fixed toolbar, better performance, and design enhancements. It also fixes critical bugs in database adapters, form builder functionality, and migration processes. The update includes important dependency fixes, pinning ajv to version 8.14.0 to avoid issues with the broken 8.15.0 release.
Highlight of the Release
- Configurable fixed toolbar for the Lexical rich text editor
- Improved environment variable loading to match Next.js behavior
- Fixed critical bugs in PostgreSQL database adapter
- Enhanced performance of LexicalProvider
- Fixed form builder plugin field overrides logic
Migration Guide
Breaking Changes
Rich Text Editor Context Changes
The useEditorFocusProvider hook has been removed and merged with useEditorConfigContext. If you were using useEditorFocusProvider in your code, you'll need to update it to use useEditorConfigContext instead.
// Before
import { useEditorFocusProvider } from '@payloadcms/richtext-lexical';
const MyComponent = () => {
const { focusedEditor } = useEditorFocusProvider();
// ...
}
// After
import { useEditorConfigContext } from '@payloadcms/richtext-lexical';
const MyComponent = () => {
const { focusedEditor, parentEditors, childEditors } = useEditorConfigContext();
// ...
}
You can now find information about the focused editor, parent editors, and child editors within the useEditorConfigContext hook.
Upgrade Recommendations
This beta release contains important bug fixes and performance improvements, making it recommended for developers currently using the v3.0.0 beta series. The breaking change to the rich text editor context API is relatively minor and should be straightforward to implement.
If you're using the rich text editor with custom components that rely on useEditorFocusProvider, you'll need to update your code to use useEditorConfigContext instead.
To upgrade:
-
Update your dependencies:
npm install [email protected]
# or
yarn add [email protected]
# or
pnpm add [email protected]
-
If you're using the rich text editor with custom components, update any instances of useEditorFocusProvider to use useEditorConfigContext.
-
Test your application thoroughly, especially if you're using PostgreSQL as your database or the form builder plugin.
Bug Fixes
Critical Fixes
- Dependency Issues: Pinned ajv to version 8.14.0 to avoid issues with the broken 8.15.0 release
- Migration Errors: Fixed critical dependency error in
getPredefinedMigration function
- PostgreSQL Type Issues: Resolved type issues in
migratePostgresV2toV3 call when TypeScript strict mode is enabled
Rich Text Editor Fixes
- Client Features Loading: Fixed issue where client features were not loaded properly in rich text editors
- Slate Cell Component: Fixed non-functional Slate cell component
- Design Improvements: Implemented minor design improvements to the Lexical rich text editor
Plugin Fixes
- Form Builder: Fixed bug with optional chain operator in field overrides logic
New Features
Rich Text Editor Improvements
- Configurable Fixed Toolbar: Added ability to configure a fixed toolbar in the Lexical rich text editor, enhancing the editing experience
- Improved Editor Context: Merged
useEditorFocusProvider with useEditorConfigContext, providing better access to information about focused editors, parent editors, and child editors
- Enhanced Rich Text Adapter Support: Added support for rich text adapter Cell React Server Components
Environment Variable Handling
- Next.js-Compatible Environment Loading: Updated environment variable loading behavior in bin scripts and
importConfig to match Next.js behavior
- Package Management: Cleaned up installed packages and fixed mismatching package versions
Security Updates
No specific security fixes were mentioned in this release.
Performance Improvements
Rich Text Editor Performance
- LexicalProvider Optimization: Improved performance of the LexicalProvider component, resulting in smoother editing experience
- Better Client Feature Loading: Enhanced the way client features are loaded in rich text editors, improving overall responsiveness
Package Management
- Dependency Cleanup: Cleaned up installed packages and fixed mismatching package versions, reducing potential overhead and conflicts
Impact Summary
This beta release brings significant improvements to the rich text editing experience in PayloadCMS with a configurable fixed toolbar and better performance. It addresses several critical bugs, including issues with PostgreSQL database adapter, form builder functionality, and dependency problems.
The most notable change is the merging of useEditorFocusProvider with useEditorConfigContext, which provides a more streamlined API for accessing editor state information. This is a breaking change but should be straightforward to implement.
Environment variable loading has been improved to match Next.js behavior, making it more consistent for developers working with both technologies. The release also includes important dependency fixes, particularly pinning ajv to version 8.14.0 to avoid issues with the broken 8.15.0 release.
For content editors, the improved rich text editor with configurable fixed toolbar and design enhancements will provide a better content creation experience. Developers will benefit from the fixed critical bugs and improved performance, though they'll need to update any code that uses the deprecated useEditorFocusProvider hook.
Full Release Notes
Features
- match next.js env file loading behavior in bin scripts & importConfig, clean up installed packages & mismatching package versions (#6601) (59cde0d)
- richtext-lexical: configurable fixed toolbar (#6560) (f41bb05)
Bug Fixes
- pin ajv to 8.14.0, as 8.15.0 is broken (#6606) (45b02d8)
- plugin-form-builder: fix bug with optional chain operator in field overrides logic (#6602) (1aece39)
- db-postgres: type issue in migratePostgresV2toV3 call if ts strict mode is enabled (#6585) (c3589de)
- richtext-lexical: minor design improvements (#6575) (c7fbd76)
- critical getPredefinedMigration dependency error (#6578) (6b9c796)
- richtext-*: fix client features were not loaded properly, improve performance of LexicalProvider, slate cell component was non-functional, support richtext adapter Cell RSCs (#6573) (5cb49c3)
BREAKING CHANGES
- richtext-lexical: configurable fixed toolbar (#6560) (f41bb05)
BREAKING: useEditorFocusProvider has been removed and merged with
useEditorConfigContext. You can now find information about the focused
editor, parent editors and child editors within useEditorConfigContext
Contributors