Skip to content

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
hcengineering:developfrom
MichaelUray:feat/link-modifier-click-tab
Open

MichaelUray wants to merge 1 commit into
hcengineering:developfrom
MichaelUray:feat/link-modifier-click-tab

Conversation

@MichaelUray

Copy link
Copy Markdown
Contributor

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/presentation now depends on @hcengineering/workbench (no cycle: workbench does not depend on presentation).

…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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add click modifiers to open object in the new tab

1 participant