mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 19:29:58 +02:00
Fixed closing workspaces
This commit is contained in:
parent
dcea272d88
commit
be8eafad5f
1 changed files with 10 additions and 4 deletions
|
@ -82,6 +82,9 @@ var ZenWorkspaces = {
|
||||||
},
|
},
|
||||||
|
|
||||||
handleTabClose(event) {
|
handleTabClose(event) {
|
||||||
|
if (this.__contextIsDelete) {
|
||||||
|
return; // Bug when closing tabs from the context menu
|
||||||
|
}
|
||||||
let tab = event.target;
|
let tab = event.target;
|
||||||
let workspaceID = tab.getAttribute("zen-workspace-id");
|
let workspaceID = tab.getAttribute("zen-workspace-id");
|
||||||
// If the tab is the last one in the workspace, create a new tab
|
// If the tab is the last one in the workspace, create a new tab
|
||||||
|
@ -186,14 +189,14 @@ var ZenWorkspaces = {
|
||||||
<image class="toolbarbutton-icon" id="zen-workspace-actions-menu-icon"></image>
|
<image class="toolbarbutton-icon" id="zen-workspace-actions-menu-icon"></image>
|
||||||
</toolbarbutton>
|
</toolbarbutton>
|
||||||
`);
|
`);
|
||||||
childs.querySelector(".zen-workspace-actions").addEventListener("command", ((event) => {
|
childs.querySelector(".zen-workspace-actions").addEventListener("command", (event) => {
|
||||||
let button = event.target;
|
let button = event.target;
|
||||||
this._contextMenuId = button.closest("toolbarbutton[zen-workspace-id]").getAttribute("zen-workspace-id");
|
this._contextMenuId = button.closest("toolbarbutton[zen-workspace-id]").getAttribute("zen-workspace-id");
|
||||||
const popup = button.ownerDocument.getElementById(
|
const popup = button.ownerDocument.getElementById(
|
||||||
"zenWorkspaceActionsMenu"
|
"zenWorkspaceActionsMenu"
|
||||||
);
|
);
|
||||||
popup.openPopup(button, "after_end");
|
popup.openPopup(button, "after_end");
|
||||||
}).bind(this));
|
});
|
||||||
element.appendChild(childs);
|
element.appendChild(childs);
|
||||||
element.onclick = (async () => {
|
element.onclick = (async () => {
|
||||||
if (event.target.closest(".zen-workspace-actions")) {
|
if (event.target.closest(".zen-workspace-actions")) {
|
||||||
|
@ -464,8 +467,11 @@ var ZenWorkspaces = {
|
||||||
await this.changeWorkspace(workspace);
|
await this.changeWorkspace(workspace);
|
||||||
},
|
},
|
||||||
|
|
||||||
async contextDelete() {
|
contextDelete(event) {
|
||||||
await this.removeWorkspace(this._contextMenuId);
|
event.stopPropagation();
|
||||||
|
this.__contextIsDelete = true;
|
||||||
|
this.removeWorkspace(this._contextMenuId);
|
||||||
|
this.__contextIsDelete = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
async changeWorkspaceShortcut() {
|
async changeWorkspaceShortcut() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue