-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Editor: Cleanup default editor mode handling #56819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Size Change: -10 B (0%) Total Size: 1.72 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 20aeed2. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7115004931
|
| // Sets the right rendering mode when loading the editor. | ||
| useEffect( () => { | ||
| setRenderingMode( settings.defaultRenderingMode ?? 'post-only' ); | ||
| }, [ settings.defaultRenderingMode, setRenderingMode ] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does setRenderingMode exist? Why not reuse settings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it can be changed within the editor itself. the "settings" are something an external user of the EditorProvider component provides.
Follow-up to #56778
What?
Just a small cleanup function, now that we have a setting that indicates the "default editor mode". I believe the "EditorProvider" should set that mode when the setting changes. This allows us to remove some effects from the initialization code of both post and site editors.
Testing instructions
Just ensure that opening the edit templates, template parts, pages... in the site editor lands you in the right mode (you can only edit the right things)