-
Notifications
You must be signed in to change notification settings - Fork 953
Add permission mode dropdown for view/edit mode switching #13843
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: main
Are you sure you want to change the base?
Add permission mode dropdown for view/edit mode switching #13843
Conversation
e8a88b9 to
8153eac
Compare
8153eac to
e4e2aa6
Compare
| hiddenTabs: { [key: string]: boolean } = {}; | ||
| permissionViewMode: any = null; | ||
| // Add a flag to track initialization | ||
| private isUIInitialized: boolean = 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.
What exactly is initialized when this flag is true? Does it happen always in all modes?
FYI we track the state in many places I fear so it's harder and harder to know what is happening. We need very detailed description.
There is a vector of initialized components in https://github.com/CollaboraOnline/online/blob/main/browser/src/map/handler/Map.WOPI.js#L49 (with entry for full ui init)
There are particular UI steps tracked in https://github.com/CollaboraOnline/online/blob/main/browser/src/app/ServerConnectionService.ts#L68
What if we reconnect? after save as, lost connection ? we also switch mode to readonly in that case, I don't think we reset isUIInitialized anywhere?
e4e2aa6 to
97d2414
Compare
| dropdownText = _('Viewing'); | ||
| } | ||
|
|
||
| if (showReadonly) { |
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.
we could use JSDialog action here too:
| this.builder.executeAction(this.parentContainer, { |
11199a3 to
3fbffd8
Compare
Adds a new dropdown widget in the notebookbar that allows users to switch between Viewing and Editing modes. This provides a user-friendly way to toggle document permissions without using the external share dialog. - Dropdown button showing current mode (Viewing/Editing) - Menu with two options: Viewing Mode and Editing Mode - Automatically shows/hides based on user permissions - Integrates with existing permission system Signed-off-by: Darshan-upadhyay1110 <[email protected]> Change-Id: I9e27314adf55ffee4b0b71b74719b893f04fc3ee
Implements logic to hide unnecessary menu separators that appear when menu items are hidden due to permission restrictions in view mode. - Hides leading separators at the start of menus - Collapses adjacent/double separators into single ones - Hides trailing separators at the end of menus This ensures menus look clean even when many edit options are hidden in view-only mode. Signed-off-by: Darshan-upadhyay1110 <[email protected]> Change-Id: Ic83c476d988f0ed543430bf346d06b70b37c5f45
Refactors the permission-based UI switching to use existing robust methods (addClassicUI/addNotebookbarUI) and adds sidebar visibility state management across mode switches. UIManager: - Refactored onUpdatePermission to use addClassicUI/addNotebookbarUI - Added safety checks to prevent duplicate component creation - Added sidebar visibility management (show in edit, hide in readonly) SidebarBase: - Added showSidebar() method to restore sidebar visibility client-side - Complements existing closeSidebar() for clean state management This ensures: - Consistent UI initialization (fixes TopToolbar and style dropdowns) - Sidebar state is preserved across mode switches - Robust handling of duplicate calls and edge cases Signed-off-by: Darshan-upadhyay1110 <[email protected]> Change-Id: I61b71cc4c3a68cce77dc198631fb6600dbb6a0de
3fbffd8 to
6554b03
Compare
Summary
TODO
Checklist
make prettier-writeand formatted the code.make checkmake runand manually verified that everything looks okay