feat: toasts show over the file viewer; icon buttons in the terminal's copy menu
This commit is contained in:
1 parent
2db44e53f7
commit
92c9616826
2 files changed
+27
-8
No files matched your search
@@ -164,7 +164,7 @@
|
||||
.hx-b i { margin-right:3px; }
|
||||
.hx-b i:nth-child(8) { margin-right:8px; }
|
||||
}
|
||||
.toast { position:fixed; bottom:18px; left:50%; transform:translateX(-50%);
|
||||
.toast { z-index:50; position:fixed; bottom:18px; left:50%; transform:translateX(-50%);
|
||||
background:#2a2f3a; border:1px solid var(--border); border-radius:8px;
|
||||
padding:10px 16px; font-size:14px; opacity:0; transition:opacity .2s; pointer-events:none; }
|
||||
.toast.show { opacity:1; }
|
||||
@@ -287,7 +287,17 @@
|
||||
const selected = new Set();
|
||||
|
||||
const $ = id => document.getElementById(id);
|
||||
const toast = (msg, err) => { const t=$('toast'); t.textContent=msg; t.className='toast show'+(err?' err':''); setTimeout(()=>t.className='toast',2200); };
|
||||
// An open dialog sits in the page's top layer, above any z-index: the toast
|
||||
// goes inside it then, so "сохранено" or an error shows over the editor.
|
||||
let toastTimer = null;
|
||||
const toast = (msg, err) => {
|
||||
const t = $('toast'), host = document.querySelector('dialog[open]') || document.body;
|
||||
if (t.parentNode !== host) host.appendChild(t);
|
||||
t.textContent = msg;
|
||||
t.className = 'toast show' + (err ? ' err' : '');
|
||||
clearTimeout(toastTimer);
|
||||
toastTimer = setTimeout(() => t.className = 'toast', err ? 3500 : 2200);
|
||||
};
|
||||
const b64ToBytes = b64 => { const bin=atob(b64); const u=new Uint8Array(bin.length); for(let i=0;i<bin.length;i++)u[i]=bin.charCodeAt(i); return u; };
|
||||
const join = (dir, name) => (dir.endsWith('/') ? dir : dir+'/') + name;
|
||||
const parent = p => { if(p==='/'||p==='') return '/'; const i=p.replace(/\/+$/,'').lastIndexOf('/'); return i<=0 ? '/' : p.slice(0,i); };
|
||||
|
||||
Reference in new issue
Block a user