Skip to content

Conversation

@Darshan-upadhyay1110
Copy link
Contributor

  • Resolves: #
  • Target version: master

Summary

TODO

  • ...

Checklist

  • I have run make prettier-write and formatted the code.
  • All commits have Change-Id
  • I have run tests with make check
  • I have issued make run and manually verified that everything looks okay
  • Documentation (manuals or wiki) has been updated or is not required

@Darshan-upadhyay1110 Darshan-upadhyay1110 marked this pull request as ready for review December 18, 2025 10:37
@Darshan-upadhyay1110 Darshan-upadhyay1110 force-pushed the private/darshan/add-new-permission-mode-dropdown branch 15 times, most recently from e8a88b9 to 8153eac Compare December 29, 2025 07:25
@Darshan-upadhyay1110 Darshan-upadhyay1110 force-pushed the private/darshan/add-new-permission-mode-dropdown branch from 8153eac to e4e2aa6 Compare December 29, 2025 07:58
hiddenTabs: { [key: string]: boolean } = {};
permissionViewMode: any = null;
// Add a flag to track initialization
private isUIInitialized: boolean = false;
Copy link
Contributor

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?

@eszkadev eszkadev added the draft label Dec 30, 2025
@Darshan-upadhyay1110 Darshan-upadhyay1110 force-pushed the private/darshan/add-new-permission-mode-dropdown branch from e4e2aa6 to 97d2414 Compare January 6, 2026 10:04
dropdownText = _('Viewing');
}

if (showReadonly) {
Copy link
Contributor

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, {

@Darshan-upadhyay1110 Darshan-upadhyay1110 force-pushed the private/darshan/add-new-permission-mode-dropdown branch 5 times, most recently from 11199a3 to 3fbffd8 Compare January 7, 2026 14:58
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
@Darshan-upadhyay1110 Darshan-upadhyay1110 force-pushed the private/darshan/add-new-permission-mode-dropdown branch from 3fbffd8 to 6554b03 Compare January 7, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: To Review

Development

Successfully merging this pull request may close these issues.

2 participants