-
Notifications
You must be signed in to change notification settings - Fork 1
Update view mode #113
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
base: trunk
Are you sure you want to change the base?
Update view mode #113
Conversation
…tion into add/view-mode-part-2
| // Manage sidebar interaction. | ||
| useEffect( () => { | ||
| const sidebarElement = document.querySelector( '.editor-sidebar' ); | ||
| const headerSettingsElement = document.querySelector( '.editor-header__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.
I did try locking post saving, and auto saving instead of doing this. That is not the best solution because if the pre-publish panel is enabled, then any changes made there result in UI quirks. This could include a tag not saving for example which wouldn't be the best experience.
The thought I had is that, we can slowly remove each CSS tweak as we make changes within Gutenberg to allow native "read only" modes everywhere.
src/store/settings-store.ts
Outdated
| [ Setting.USER_ENTER_NOTIFICATION ]: true, | ||
| [ Setting.USER_EXIT_NOTIFICATION ]: false, | ||
| [ Setting.COLLABORATION_MODE_PICKER ]: false, | ||
| [ Setting.COLLABORATION_MODE_PICKER ]: isDevelopment() ? true : false, |
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.
This is not accounting for what happens when the value is stored in settings and re-used.
Ideally, it'd be better to just have this be hardcoded in code instead.
| case 'SET_SETTING': { | ||
| // ToDo: Delete COLLABORATION_MODE_PICKER once we complete the feature. | ||
| // Skip saving COLLABORATION_MODE_PICKER as it's computed dynamically | ||
| if ( action.payload.setting === Setting.COLLABORATION_MODE_PICKER ) { |
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.
@chriszarate - This should rectify the bug that you were seeing.
I'm dynamically computing the value for COLLABORATION_MODE_PICKER, wherein it's true in development and false otherwise. Considering we are developing this feature locally, it should always be on so it's easy to work on. We would get rid of this setting, and it's code once the feature is live.
IMO, we should do the same for debug tools as well so it's always on in development.
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.
If you have an alternate approach that you prefer lemme know. I didn't want to overtly complicate this, because this code will be deleted soon.
Description
I've moved the collaborator mode to GB, within the core-data store. The dropdown and it's related functionality will now be powered by that new property.
Also, I've set the collaborator mode dropdown to be on by default when in development otherwise its off. That way, we don't need a separate toggle just for turning this on and off locally.
There are 3 view functionalities offered by our plugin:
What I haven't been able to do
Try to allow blocks to be interacted with, but not change any properties of it while also syncing the UIs. Right now, the UI doesn't sync which creates a very bad experience.
Screencast
view-mode.mp4