fix: binary editing only for binary files and the ones shown as a preview
This commit is contained in:
1 parent
e1f5595afc
commit
3d6b04e78a
1 file changed
+1
-2
@@ -407,7 +407,7 @@
|
|||||||
c.clearHistory();
|
c.clearHistory();
|
||||||
V.clean = c.changeGeneration();
|
V.clean = c.changeGeneration();
|
||||||
V.dirty = false;
|
V.dirty = false;
|
||||||
setButtons({hex: true, save: editable});
|
setButtons({save: editable});
|
||||||
$('frow2').hidden = !editable;
|
$('frow2').hidden = !editable;
|
||||||
$('vmsg').textContent = fmtSize(d.size) + ' · ' + modeName(mode) +
|
$('vmsg').textContent = fmtSize(d.size) + ' · ' + modeName(mode) +
|
||||||
(d.truncated ? ' · показаны первые ' + fmtSize(EDIT_LIMIT) : '') + (editable ? '' : ' · только чтение (больше ' + fmtSize(EDIT_LIMIT) + ')') +
|
(d.truncated ? ' · показаны первые ' + fmtSize(EDIT_LIMIT) : '') + (editable ? '' : ' · только чтение (больше ' + fmtSize(EDIT_LIMIT) + ')') +
|
||||||
@@ -416,7 +416,6 @@
|
|||||||
const w = await putFile(path, new TextEncoder().encode(c.getValue()));
|
const w = await putFile(path, new TextEncoder().encode(c.getValue()));
|
||||||
if (w.ok) { V.clean = c.changeGeneration(); V.dirty = false; toast('сохранено'); load(cwd); } else toast(w.error || 'ошибка', true);
|
if (w.ok) { V.clean = c.changeGeneration(); V.dirty = false; toast('сохранено'); load(cwd); } else toast(w.error || 'ошибка', true);
|
||||||
};
|
};
|
||||||
$('vhex').onclick = () => { if (!V.dirty || confirm('Несохранённые изменения пропадут. Открыть бинарно?')) viewHex(path, d.size); };
|
|
||||||
setTimeout(() => { c.refresh(); c.focus(); c.setCursor(0, 0); }, 0);
|
setTimeout(() => { c.refresh(); c.focus(); c.setCursor(0, 0); }, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user