client: open links in new tab

If links are clicked while holding Ctrl or clicked with middle mouse
button, they will be opened in a new tab.

Changelog: Fixed
This commit is contained in:
Johann150 2023-03-31 22:19:01 +02:00
parent 1472c21cb6
commit 7914fcfef2
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -65,8 +65,11 @@ function onContextmenu(ev) {
}], ev);
}
function nav() {
if (props.behavior === 'browser') {
function nav(evt: MouseEvent) {
if (evt.ctrlKey || evt.buttons === 4) {
// held Control or clicked with middle mouse button
window.open(props.to, '_blank');
} else if (props.behavior === 'browser') {
location.href = props.to;
} else if (props.behavior === 'window') {
os.pageWindow(props.to);