This commit addresses an issue where edited pinned tab titles were not consistently updated across all windows and in storage.
The following changes were made:
- **ZenUIManager.mjs:** Removed redundant `pinId` variable and directly checked `zen-pin-id` attribute.
- **ZenPinnedTabsStorage.mjs:** Added `edited_title` column to the `zen_pins` table to track if a pin's title has been manually edited. Also, the `updatePinTitle` function now accepts an `isEdited` flag (defaults to true) and updates the `edited_title` column accordingly.
- **ZenPinnedTabManager.mjs:** The `updatePinTitle` function was added to handle the update of pin titles. It updates the title in storage using `ZenPinnedTabsStorage.updatePinTitle`, refreshes the pinned tabs, and then iterates through all browser windows to update the labels of corresponding pinned tabs. Also, a check was added to `_initializePinnedTabs` to set the `zen-has-static-label` attribute on tabs with `editedTitle` set to `true`.
- **ZenWorkspaces.mjs:** Added a null check for `activeWorkspaceStrip` to avoid errors when it's not available.
These changes ensure that when a pinned tab title is edited, the updated title is correctly persisted in storage and reflected across all open windows. The `edited_title` flag allows distinguishing between default titles and custom ones.
This commit enhances the drag-and-drop functionality in Zen, allowing users to seamlessly reorder tabs between the pinned tabs, essential tabs, and regular tab containers. The changes include:
- Added `moveToAnotherTabContainerIfNecessary` and `applyDragoverClass` methods to `ZenPinnedTabManager` to handle tab movement and visual feedback during drag-and-drop.
- Updated `tabs.js` to integrate with the new methods, correctly handling tab pinning and unpinning, and essential tab toggling during reordering.
- Added CSS classes and styles to visually indicate the drop position (before or after) a target tab during the drag operation. This improves user experience and clarity.
Refactor workspace switching logic to correctly handle
essential tabs and introduce container-specific essentials.
This change addresses issues with essential tabs not being
handled correctly during workspace switches.
The `changeWorkspace` function is refactored to improve
clarity and maintainability. The logic for showing and
hiding tabs is streamlined, and tab selection is handled
more robustly. A new `_shouldShowTab` function is
introduced to centralize the logic for determining tab
visibility based on workspace and container settings. The
logic also handles pinned essential tabs in the different workspace types.
The pinned tab manager is updated to support container-
specific essentials and to refresh pinned tabs on workspace
changes. The `_shouldShowPin` function is introduced to
manage visibility of pinned tabs in different workspaces
considering essential tabs, pinned tabs and containers.
This change also fixes a bug where the selected tab would
sometimes be changed unexpectedly when switching
workspaces.
When a new pinned tab is opened and it does not belong to the
currently active workspace and is not marked as essential, it
will now be hidden. This prevents pinned tabs from cluttering
the tab bar when switching between workspaces.
The global variable for the pinned tab manager has also been
renamed from `gZenPinnedTabManager` to
`_initializePinnedTabs`.
This change modifies the pinned tab initialization logic to restore
pinned tabs to their original pinned URLs when the browser starts.
Previously, pinned tabs would open to their last visited URL, even if the option for restoring them to the pinned URL was checked.
Previously, if you had multiple windows opened and you closed one, it could trigger TabClose event and delete the pins from zen_pins table. With this change the pins are deleted only on explicit tab closing from tab context menu.