Skip to content

Commit

Permalink
Middle mouse button opens project in new tab // Fixed grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
Kruemelkatze committed Aug 11, 2021
1 parent 57d517f commit 728342a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to the "Project Dashboard" extension will be documented in this file. It follows the [Keep a Changelog](http://keepachangelog.com/) recommendations.

## [2.4.0] 2021-08-11

### Added

- Clicking a project with the middle mouse button opens it in a new tab.

### Fixed

- Fixed grammar. :)

## [2.3.2] 2021-07-16

### Changed
Expand Down
11 changes: 9 additions & 2 deletions media/webviewProjectScripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ function initProjects() {
}

function onInsideProjectClick(e, projectDiv) {
var dataId = projectDiv.getAttribute("data-id");
projectDiv = projectDiv || e.target.closest(".project");
var dataId = projectDiv && projectDiv.getAttribute("data-id");
if (dataId == null)
return;

if (onTriggerProjectAction(e.target, dataId))
return;

var newWindow = e.ctrlKey || e.metaKey;
var newWindow = e.ctrlKey || e.metaKey || e.button === 1;
openProject(dataId, newWindow ? ProjectOpenType.NewWindow : ProjectOpenType.Default);

}
Expand Down Expand Up @@ -235,6 +236,12 @@ function initProjects() {
element.addEventListener("click", onAddProjectClicked)
);

document
.querySelectorAll('.project')
.forEach(element => {
element.addEventListener("mousedown", (e) => e.button === 1 ? onInsideProjectClick(e) : undefined);
});

document.addEventListener('contextmenu', (e) => {
if (!e.target)
return;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-dashboard",
"displayName": "Project Dashboard",
"description": "Organize your workspaces in a speed-dial manner.",
"version": "2.3.2",
"version": "2.4.0",
"publisher": "kruemelkatze",
"icon": "media/extension_icon.png",
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions src/webview/webviewContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ function getProjectContextMenu() {
Open Project
</div>
<div class="custom-context-menu-item" data-action="open-new-window">
Open Project in new Window
Open Project In New Window
</div>
<div class="custom-context-menu-item not-remote" data-action="open-add-to-workspace">
Add to Workspace
Add To Workspace
</div>
<div class="custom-context-menu-separator"></div>
Expand Down

0 comments on commit 728342a

Please sign in to comment.