[fix] file upload
This commit is contained in:
parent
e63912740a
commit
ff67b936cc
1 changed files with 12 additions and 7 deletions
|
|
@ -84,15 +84,20 @@ $("lint").onclick = async e => {
|
|||
};
|
||||
|
||||
$("sync").onclick = e => { client.sync(); console.log("XXXsync"); };
|
||||
// state a state
|
||||
$("bnSave").onclick = e => { workspace[iFile]=view.state; };
|
||||
$("bnLoad").onclick = e => { const v=workspace[iFile];if(v)view.setState(v)};
|
||||
$("bnRead").onclick = e => { const c=$("fileElem");
|
||||
c.click();
|
||||
const f=c.files[0];
|
||||
if(!f)return;
|
||||
c.value=null;
|
||||
alert(f.name);
|
||||
};
|
||||
|
||||
// select local file
|
||||
$("bnRead").onclick = e => { $("fileElem").click(); };
|
||||
$("fileElem").onchange= e=> {
|
||||
let fr = new FileReader();
|
||||
fr.onload = function () {
|
||||
alert( fr.result);
|
||||
}
|
||||
fr.readAsText(e.target.files[0]);
|
||||
};
|
||||
|
||||
$("format").onclick = e => { console.log("FMT", lsp.formatDocument(view));};
|
||||
|
||||
$("load").onchange = e => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue