Repository navigation
feat(presentation): open object links in a new Huly tab on Ctrl/Cmd+click and middle click - #11136
Open
MichaelUray wants to merge 1 commit into
Open
MichaelUray wants to merge 1 commit into
MichaelUray wants to merge 1 commit into
Conversation
…lick and middle click Object links rendered through NavLink only handled plain clicks in-app. Ctrl/Cmd+click and middle click were left to the browser, so they opened a new browser tab instead of a Huly workbench tab, unlike the "Open in new tab" action which already uses workbench tabs. NavLink now detects the new-tab gesture (Ctrl/Cmd + left click or middle click via auxclick) and, for links pointing to an internal Huly route, opens the location with the existing workbench OpenInNewTab function. External links, setups without workbench tabs and Shift/Alt combinations (e.g. Ctrl+Shift+click) keep the browser default, and the browser context menu still offers a real browser tab. Plain clicks are unchanged. The gesture check is a small pure helper (isNewTabClick) with unit tests. @hcengineering/workbench is added as a dependency of @hcengineering/presentation. configuration.ts now imports createQuery and addTxListener from ./utils instead of the package index: NavLink (loaded early by the index) uses hasResource, and importing the index from configuration.ts would otherwise run createQuery before it is defined. Fixes hcengineering#7021 Signed-off-by: Michael Uray <michaeluray@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7021
Problem and change
Object links rendered through NavLink only handled plain clicks in-app. Ctrl/Cmd+click and middle click were left to the browser, so they opened a new browser tab instead of a Huly workbench tab, unlike the "Open in new tab" action which already uses workbench tabs.
NavLink now detects the new-tab gesture (Ctrl/Cmd + left click or middle click via auxclick) and, for links pointing to an internal Huly route, opens the location with the existing workbench OpenInNewTab function. External links, setups without workbench tabs and Shift/Alt combinations (e.g. Ctrl+Shift+click) keep the browser default, and the browser context menu still offers a real browser tab. Plain clicks are unchanged.
The gesture check is a small pure helper (isNewTabClick) with unit tests. @hcengineering/workbench is added as a dependency of @hcengineering/presentation.
configuration.ts now imports createQuery and addTxListener from ./utils instead of the
package index: NavLink (loaded early by the index) uses hasResource, and importing the
index from configuration.ts would otherwise run createQuery before it is defined.
Tests
New unit tests
packages/presentation/src/___tests___/linkClick.test.ts. Checked manually on a self-hosted instance: Ctrl/Cmd+click and middle-click on an issue link open a new workbench tab and keep the current view; Ctrl+Shift+click still opens a browser tab; a plain click behaves as before.Notes
@hcengineering/presentationnow depends on@hcengineering/workbench(no cycle: workbench does not depend on presentation).