feat(files): gerenciador de arquivos/anexos com árvore de pastas, upload, preview e picker
- store/files.go: pastas (parent, anti-ciclo), FileMeta (nota opcional = avulso),
blobs com extensão neutralizada p/ tipos perigosos, sanitização de nome
- api/files.go: upload multipart (64MiB), tree, static com ETag/Range + CSP
sandbox + attachment p/ html/svg/js (stored-XSS mitigado), move/rename/delete,
CRUD de pastas
- web: overlay Ctrl+J / 📎 (modo seletor insere sintaxe md/html/txt e associa),
filtros Todos/Anexos/Avulsos/Nota atual, busca, lightbox img/video/audio/pdf/texto,
colar-e-arrastar no editor e no gerenciador, ações por card (preview/associar/
mover/renomear/excluir), mobile-first (ações sempre visíveis)
- fix: api() já serializa o body — chamadas do gerenciador passavam JSON pré-string
(dupla codificação); auth por cookie (sem Bearer manual no fetch)
- sw v10; testes store+api (traversal, ciclo, XSS headers, range); README
This commit is contained in:
1 parent
ea6b3b915d
commit
119e6cefe9
10 files changed
+1605
-4
No files matched your search
+119
@@ -1800,3 +1800,122 @@ html[data-theme="carbon-paper"] #notes-list li.active,
|
||||
html[data-theme="carbon-paper"] #revisions-list li.active { background: #c2ccd5; }
|
||||
html[data-theme="carbon-paper"] #notes-list li:hover,
|
||||
html[data-theme="carbon-paper"] #revisions-list li:hover { background: #e6e5dd; }
|
||||
|
||||
/* ------------------------------------------------- gerenciador de arquivos */
|
||||
.files-overlay {
|
||||
position: fixed;
|
||||
inset: 4vh 3vw;
|
||||
z-index: 95;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--panel);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
|
||||
overflow: hidden;
|
||||
}
|
||||
.files-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
padding: 10px 14px;
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
background: var(--panel-2);
|
||||
}
|
||||
.files-title { font-weight: 700; font-size: 15px; margin-right: 6px; }
|
||||
.files-filters { display: flex; gap: 5px; flex-wrap: wrap; }
|
||||
#files-search {
|
||||
flex: 1 1 120px;
|
||||
max-width: 220px;
|
||||
font: inherit;
|
||||
font-size: 13px;
|
||||
padding: 5px 9px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
background: var(--panel);
|
||||
color: var(--fg);
|
||||
}
|
||||
.files-body { display: flex; flex: 1 1 auto; min-height: 0; }
|
||||
.files-tree {
|
||||
width: 264px;
|
||||
flex: none;
|
||||
overflow-y: auto;
|
||||
border-right: 1px solid var(--border-soft);
|
||||
padding: 8px 6px;
|
||||
background: var(--panel-2);
|
||||
}
|
||||
.ftree-acts { display: none; gap: 2px; }
|
||||
.ftree-row:hover .ftree-acts, .ftree-row.active .ftree-acts { display: inline-flex; }
|
||||
.ftree-act {
|
||||
border: 0;
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
padding: 1px 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.ftree-act:hover { background: var(--accent); color: #fff; }
|
||||
.files-list {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
overflow-y: auto;
|
||||
padding: 10px 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
.files-empty { padding: 24px 12px; text-align: center; }
|
||||
.fitem {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: 12px;
|
||||
background: var(--panel);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
|
||||
cursor: pointer;
|
||||
transition: transform .1s ease, box-shadow .12s ease, border-color .12s ease;
|
||||
}
|
||||
.fitem:hover { transform: translateY(-1px); border-color: var(--accent); box-shadow: 0 4px 14px -4px rgba(0, 0, 0, .2); }
|
||||
.fitem:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
||||
.fitem-icon { font-size: 22px; flex: none; }
|
||||
.fitem-main { flex: 1 1 auto; min-width: 0; }
|
||||
.fitem-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.fitem-meta { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.fitem-acts { display: flex; gap: 3px; flex: none; opacity: 0; transition: opacity .12s ease; }
|
||||
.fitem:hover .fitem-acts, .fitem:focus-within .fitem-acts { opacity: 1; }
|
||||
.dropzone.drop-hl, #editor-host.drop-hl {
|
||||
outline: 2px dashed var(--accent);
|
||||
outline-offset: -4px;
|
||||
background: color-mix(in srgb, var(--accent) 7%, transparent);
|
||||
}
|
||||
#editor-host { position: relative; }
|
||||
|
||||
/* lightbox */
|
||||
.lightbox-box {
|
||||
width: min(940px, 94vw);
|
||||
max-height: 92vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
background: var(--panel);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 14px;
|
||||
padding: 14px;
|
||||
}
|
||||
.lightbox-body { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; justify-content: center; }
|
||||
.lightbox-body img { max-width: 100%; max-height: 74vh; border-radius: 8px; }
|
||||
.lightbox-body video { width: 100%; max-height: 74vh; }
|
||||
.lightbox-body audio { width: 100%; }
|
||||
.lightbox-body iframe { width: 100%; height: 70vh; border: 1px solid var(--border-soft); border-radius: 8px; }
|
||||
.lightbox-text { width: 100%; max-height: 66vh; overflow: auto; background: var(--panel-2); border-radius: 8px; padding: 12px; font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.files-overlay { inset: 0; border-radius: 0; }
|
||||
.files-tree { width: 172px; }
|
||||
.fitem-acts { opacity: 1; flex-wrap: wrap; justify-content: flex-end; max-width: 40%; }
|
||||
.ftree-acts { display: inline-flex; }
|
||||
}
|
||||
Reference in new issue
Block a user