MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / editFile

Function editFile

webUi/scripts.js:7–17  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

5function isEditable(name) { return editableExts.has(name.split('.').pop().toLowerCase()); }
6let editingFile = '';
7function editFile(path) {
8 editingFile = path;
9 _('editor-title').textContent = path;
10 _('editor-content').value = 'Loading...';
11 _('editor').style.display = 'block';
12 const xhr = new XMLHttpRequest();
13 xhr.open('GET', '/editfile?name=' + encodeURIComponent(path));
14 xhr.onload = () => { _('editor-content').value = xhr.responseText; };
15 xhr.onerror = () => { _('editor-content').value = 'Error loading file'; };
16 xhr.send();
17}
18function saveFile() {
19 const xhr = new XMLHttpRequest();
20 xhr.open('POST', '/editfile?name=' + encodeURIComponent(editingFile));

Callers

nothing calls this directly

Calls 1

_Function · 0.85

Tested by

no test coverage detected