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.
Fixes several issues related to pinned tab restoration and
favicon display:
- Ensures pinned tabs are not loaded in private windows.
- Improves favicon caching and setting for pinned tabs.
- Fixes an issue where the tab state was not properly
restored, leading to incorrect icons and titles.
- Uses base64 encoded favicon data to prevent issues with
favicon loading and updates the favicon loading logic to
be more robust.
- Adds a call to `gBrowser._updateTabBarForPinnedTabs` to
ensure the tab bar is updated correctly after restoring
pinned tabs, which fixes a UI issue where the tab bar
wouldn't refresh properly until interacted with.
- Improves tab initialization by explicitly calling
`newTab.initialize()` after restoring a pinned tab. This
fixes an issue with tabs not rendering
icon and label after being restored.
The changes improve the reliability of pinned tab
restoration and ensure that favicons are displayed
correctly.
Add to Essentials is displayed before Pin tab context menu item so it follows the order in which the tabs are displayed in the sidebar as essentials are above pinned tabs.
If there are no pinned tabs in the database on startup,
assume it's a migration from an older version and save all
currently pinned tabs to the database. Previously, Zen
would remove any pinned tabs that didn't have a `zen-pin-id`
attribute, which would occur during migration. This change
ensures that pinned tabs are preserved during upgrades.
This commit fixes an issue where the user context ID was not being parsed correctly when pinning tabs.
Previously, the user context ID was being stored as a string, which could lead to unexpected behavior. This commit ensures that the user context ID is parsed as an integer, which is the correct data type.
This change will ensure that pinned tabs are stored and retrieved correctly.