fix: take the file edit limit in the panel from the agent's read cap
The limit was repeated in the page; a file of exactly the cap is read in full, so it is editable too.
This commit is contained in:
1 parent
7cb9da8569
commit
08fc2d79a8
4 files changed
+10
-6
No files matched your search
@@ -107,7 +107,7 @@
|
||||
}).then(r => r.json()).catch(e => ({ok:false, error:'ошибка сети'})).finally(() => setBusy(false));
|
||||
};
|
||||
|
||||
const EDIT_LIMIT = 5 * 1024 * 1024;
|
||||
const EDIT_LIMIT = {{.EditLimit}};
|
||||
|
||||
// Monochrome inline icons (inherit button color via currentColor).
|
||||
const SVG = '<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">';
|
||||
@@ -190,10 +190,10 @@
|
||||
msg.textContent = 'Размер: '+fmtSize(d.size);
|
||||
} else {
|
||||
ta.value = new TextDecoder().decode(b64ToBytes(d.content));
|
||||
const editable = d.size < EDIT_LIMIT && !d.truncated;
|
||||
const editable = d.size <= EDIT_LIMIT && !d.truncated;
|
||||
ta.readOnly = !editable;
|
||||
save.style.display = editable ? '' : 'none';
|
||||
msg.textContent = 'Размер: '+fmtSize(d.size) + (d.truncated?' · показано первые 5 МБ':'') + (editable?' · редактируемо':' · только чтение (≥ 5 МБ)');
|
||||
msg.textContent = 'Размер: '+fmtSize(d.size) + (d.truncated?' · показано первые '+fmtSize(EDIT_LIMIT):'') + (editable?' · редактируемо':' · только чтение (больше '+fmtSize(EDIT_LIMIT)+')');
|
||||
save.onclick = async () => {
|
||||
const bytes = new TextEncoder().encode(ta.value);
|
||||
const w = await api('write', {path: join(cwd, e.name), data: bytesToB64(bytes)});
|
||||
|
||||
Reference in new issue
Block a user