Fixes Sidebar and Event/Venue Panels opening by default#935
Merged
mauteri merged 2 commits intoGatherPress:mainfrom Oct 4, 2024
Merged
Fixes Sidebar and Event/Venue Panels opening by default#935mauteri merged 2 commits intoGatherPress:mainfrom
mauteri merged 2 commits intoGatherPress:mainfrom
Conversation
* Removes the initialOpen property from PluginDocumentSettingPanel, this slotfill does not allow the property * Updates the dependency the PluginDocumentSettingPanel is loaded from. It was moved to '@wordpress/editor' * Updates the function to ensure the Event and Venue settings are opened by default. Uses a domReady and first checks if the panel is open, and if it is not then dispatches a toggleEditorPanelOpened() to open the panel. * Updates the main domReady in the editor.js file. Removes the duplicate opening of the event settings panel and only checks and opens the general sidebar.
Contributor
Preview changes with PlaygroundYou can preview the recent changes for PR#935 with the following PHP versions: PHP Version 8.3
PHP Version 7.4
Download Made with 💙 from GatherPress & a little bit of WordPress Playground. Changes will not persist between sessions. |
mauteri
approved these changes
Oct 4, 2024
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Change
This PR updates the scrips that register the PluginDocumentSettingPanel slotfills for Events and Venues and ensures the General Sidebar, the Events Settings Panel, and the Venue Settings Panel all open by default.
The
initialOpenproperty was added to both event and venue slotfills, however the PluginDocumentSettingPanel slotfill does not accept the property. It uses a useSelect to detect weather the panel is opened and passes that to the<Panel>. The opened property overrides the initialOpen which could be why that property isn't allowed.The dependency for the PluginDocumentSettingPanel was moved to '@wordpress/editor' and there were deprecation warnings showing in the browser console. I updated the dependency.
In the event-settings and venue-settings panel registration there was a dispatch to toggle the settings panel open. One issue with toggling is when the panel is already open, it would be closed. To fix this I first check if the panel is open before toggling. I wrapped these in a domReady() to make sure the DOM was fully loaded, then use the 'core/edit-post' select to see if the panel is open.
The toggling of the panels was also moved, so I updated the use of the
toggleEditorPanelOpened()functions to use the 'core/editor' dispatch. instead of 'core/edit-post'.In the
editor.jsfile there was a domReady that was making sure the main sidebar was open, but it also was duplicating the work of opening the event sidebar. I removed the duplicate functionality and just use this script to make sure the general sidebar is open.Closes #891
How to test the Change
This also works for the Venue Settings Panel
Changelog Entry
Credits
Props @ajskelton
Checklist: