1
0
Fork 1
mirror of https://github.com/zen-browser/desktop.git synced 2025-07-07 23:00:01 +02:00

feat: Add comfirmation before deleting a workspace, b=no-bug, c=common, workspaces

This commit is contained in:
Mr. M 2025-06-12 19:13:50 +02:00
parent 75a3b82d2c
commit bf6e493f89
No known key found for this signature in database
GPG key ID: 6292C4C8F8652B18
8 changed files with 29 additions and 9 deletions

2
l10n

@ -1 +1 @@
Subproject commit 80f03d913e3703933e9f4c1099720e112814e953 Subproject commit ac5ebba5c12de1190dd073993c1e46b6d1b41dab

View file

@ -1,5 +1,5 @@
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index 6d664917a5a3bb1cea8a747e42e8bc0065ec999e..5059293ebfa29d646455b7a3505bd6eae408ba64 100644 index 6d664917a5a3bb1cea8a747e42e8bc0065ec999e..dfacd5c40ef14319fe7398452c007f167003a583 100644
--- a/browser/base/content/browser.js --- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js +++ b/browser/base/content/browser.js
@@ -33,6 +33,7 @@ ChromeUtils.defineESModuleGetters(this, { @@ -33,6 +33,7 @@ ChromeUtils.defineESModuleGetters(this, {
@ -39,3 +39,13 @@ index 6d664917a5a3bb1cea8a747e42e8bc0065ec999e..5059293ebfa29d646455b7a3505bd6ea
} }
return true; return true;
@@ -5717,6 +5722,9 @@ var ConfirmationHint = {
MozXULElement.insertFTLIfNeeded("toolkit/branding/brandings.ftl");
MozXULElement.insertFTLIfNeeded("browser/confirmationHints.ftl");
document.l10n.setAttributes(this._message, messageId, options.l10nArgs);
+ if (window.gZenUIManager?.showToast) {
+ return window.gZenUIManager.showToast(messageId, options);
+ }
if (options.descriptionId) {
document.l10n.setAttributes(this._description, options.descriptionId);
this._description.hidden = false;

View file

@ -107,14 +107,14 @@ export var ZenCustomizableUI = new (class {
_initCreateNewButton(window) { _initCreateNewButton(window) {
const button = window.document.getElementById('zen-create-new-button'); const button = window.document.getElementById('zen-create-new-button');
button.addEventListener('command', () => { button.addEventListener('command', () => {
if (button.hasAttribute('open')) { if (button.hasAttribute('zen-ignore-open')) {
return; return;
} }
const image = button.querySelector('image'); const image = button.querySelector('image');
const popup = window.document.getElementById('zenCreateNewPopup'); const popup = window.document.getElementById('zenCreateNewPopup');
button.setAttribute('open', 'true'); button.setAttribute('zen-ignore-open', 'true');
const handlePopupHidden = () => { const handlePopupHidden = () => {
button.removeAttribute('open'); button.removeAttribute('zen-ignore-open');
window.gZenUIManager.motion.animate( window.gZenUIManager.motion.animate(
image, image,
{ transform: ['rotate(45deg)', 'rotate(0deg)'] }, { transform: ['rotate(45deg)', 'rotate(0deg)'] },

View file

@ -455,7 +455,7 @@ var gZenUIManager = {
const wrapper = document.createXULElement('hbox'); const wrapper = document.createXULElement('hbox');
const element = document.createXULElement('vbox'); const element = document.createXULElement('vbox');
const label = document.createXULElement('label'); const label = document.createXULElement('label');
document.l10n.setAttributes(label, messageId, options); document.l10n.setAttributes(label, messageId, options.l10nArgs);
element.appendChild(label); element.appendChild(label);
if (options.descriptionId) { if (options.descriptionId) {
const description = document.createXULElement('label'); const description = document.createXULElement('label');

View file

@ -418,3 +418,7 @@ menuseparator {
padding: 0 !important; padding: 0 !important;
min-width: unset !important; min-width: unset !important;
} }
#window-modal-dialog {
inset: 0;
}

View file

@ -103,7 +103,7 @@ document.addEventListener(
break; break;
case 'cmd_zenReorderWorkspaces': case 'cmd_zenReorderWorkspaces':
gZenUIManager.showToast('zen-workspaces-how-to-reorder-title', { gZenUIManager.showToast('zen-workspaces-how-to-reorder-title', {
timeout: 10000, timeout: 9000,
descriptionId: 'zen-workspaces-how-to-reorder-desc', descriptionId: 'zen-workspaces-how-to-reorder-desc',
}); });
break; break;

View file

@ -170,6 +170,7 @@
document.getElementById('nav-bar').style.visibility = 'collapse'; document.getElementById('nav-bar').style.visibility = 'collapse';
} }
this.style.visibility = 'visible'; this.style.visibility = 'visible';
this.resolveInitialized();
gZenUIManager.motion gZenUIManager.motion
.animate( .animate(
this.elementsToAnimate, this.elementsToAnimate,
@ -188,7 +189,6 @@
.then(() => { .then(() => {
this.inputName.focus(); this.inputName.focus();
gZenWorkspaces.workspaceElement(this.workspaceId).hidden = false; gZenWorkspaces.workspaceElement(this.workspaceId).hidden = false;
this.resolveInitialized();
}); });
}); });
} }

View file

@ -2338,7 +2338,13 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
} }
async contextDeleteWorkspace() { async contextDeleteWorkspace() {
await this.removeWorkspace(this.activeWorkspace); const [title, body] = await document.l10n.formatValues([
{ id: 'zen-workspaces-delete-workspace-title' },
{ id: 'zen-workspaces-delete-workspace-body' },
]);
if (Services.prompt.confirm(null, title, body)) {
await this.removeWorkspace(this.activeWorkspace);
}
} }
findTabToBlur(tab) { findTabToBlur(tab) {