Skip to content

Conversation

@ingeniumed
Copy link
Contributor

@ingeniumed ingeniumed commented Nov 21, 2025

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:

  • The code editor is read only in view mode, and in production. It's enabled in edit mode.
  • Editing any blocks is disabled, including interacting with any properties of it.
  • Disable interaction with anything in the sidebar

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

@ingeniumed ingeniumed marked this pull request as ready for review December 2, 2025 01:29
@ingeniumed ingeniumed requested a review from a team as a code owner December 2, 2025 01:29
@ingeniumed ingeniumed requested review from a team and shekharnwagh and removed request for a team December 2, 2025 01:29
// Manage sidebar interaction.
useEffect( () => {
const sidebarElement = document.querySelector( '.editor-sidebar' );
const headerSettingsElement = document.querySelector( '.editor-header__settings' );
Copy link
Contributor Author

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.

[ Setting.USER_ENTER_NOTIFICATION ]: true,
[ Setting.USER_EXIT_NOTIFICATION ]: false,
[ Setting.COLLABORATION_MODE_PICKER ]: false,
[ Setting.COLLABORATION_MODE_PICKER ]: isDevelopment() ? true : false,
Copy link
Contributor Author

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 ) {
Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants