mirror of
https://github.com/zen-browser/desktop.git
synced 2025-12-26 08:08:52 +00:00
fix: Small fixes for toast notifications, b=(no-bug), c=common
This commit is contained in:
@@ -73,7 +73,10 @@ var gZenCommonActions = {
|
||||
transferable.setTransferData('text/plain', str);
|
||||
Services.clipboard.setData(transferable, null, Ci.nsIClipboard.kGlobalClipboard);
|
||||
let button;
|
||||
if (Services.zen.canShare()) {
|
||||
if (
|
||||
Services.zen.canShare() &&
|
||||
(currentUrl.startsWith('http://') || currentUrl.startsWith('https://'))
|
||||
) {
|
||||
button = {
|
||||
id: 'zen-copy-current-url-button',
|
||||
command: (event) => {
|
||||
|
||||
@@ -419,6 +419,12 @@ var gZenUIManager = {
|
||||
// Check if this message ID already exists
|
||||
for (const child of this._toastContainer.children) {
|
||||
if (child._messageId === messageId) {
|
||||
if (options.button && child.querySelector('button')) {
|
||||
const button = child.querySelector('button');
|
||||
const clone = button.cloneNode(true);
|
||||
button.replaceWith(clone);
|
||||
clone.addEventListener('command', options.button.command);
|
||||
}
|
||||
return [child, true];
|
||||
}
|
||||
}
|
||||
@@ -441,6 +447,7 @@ var gZenUIManager = {
|
||||
button.classList.add('primary');
|
||||
button.addEventListener('command', options.button.command);
|
||||
wrapper.appendChild(button);
|
||||
wrapper.setAttribute('button', true);
|
||||
}
|
||||
wrapper.classList.add('zen-toast');
|
||||
wrapper._messageId = messageId;
|
||||
|
||||
@@ -363,13 +363,17 @@ menuitem {
|
||||
translate: 100%;
|
||||
}
|
||||
|
||||
--zen-toast-padding: 10px;
|
||||
--zen-toast-max-height: 52px;
|
||||
@media (-moz-platform: windows) {
|
||||
--zen-toast-padding: 6px;
|
||||
--zen-toast-max-height: 46px;
|
||||
}
|
||||
|
||||
gap: 10px;
|
||||
z-index: 1000;
|
||||
padding: 10px;
|
||||
@media (-moz-platform: windows) {
|
||||
padding: 6px;
|
||||
}
|
||||
border-radius: 12px;
|
||||
padding: var(--zen-toast-padding);
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(
|
||||
170deg,
|
||||
var(--zen-primary-color) -40%,
|
||||
@@ -385,6 +389,9 @@ menuitem {
|
||||
font-size: small;
|
||||
position: absolute;
|
||||
transform-origin: top center;
|
||||
max-height: var(--zen-toast-max-height);
|
||||
min-height: var(--zen-toast-max-height);
|
||||
font-size: 14px;
|
||||
|
||||
& .description {
|
||||
opacity: 0.6;
|
||||
@@ -402,6 +409,10 @@ menuitem {
|
||||
min-width: unset !important;
|
||||
margin: 0px !important;
|
||||
border-radius: 8px !important;
|
||||
|
||||
:root[zen-right-side='true'] & {
|
||||
order: -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user