@@ -240,11 +245,14 @@ async Coder(){
async List(){
this.infoLine = 'List Loading...';
const e=await this.cmd('list','','');
- this.infoLine = e.msg;
- this.fileList = e.file.slice().sort();
- this.saveList();
- if(this.extOk(this.openedFile)){
- setTimeout(this.oldText, 500, this);
+ if(e){
+ this.edit.cver = e.cver;
+ this.infoLine = e.msg;
+ this.fileList = e.file.slice().sort();
+ this.saveList();
+ if(this.extOk(this.openedFile)){
+ setTimeout(this.oldText, 500, this);
+ }
}
}
@@ -258,20 +266,23 @@ async Load(x) {
if(this.openedFile){
this.infoLine = 'Loading: '+this.openedFile;
const e=await this.cmd('load','',this.openedFile);
- this.openedFile = e.file;
- this.infoLine = e.msg;
- this.Toast(this.infoLine,1000);
- const uns={f:this.localGet('Open'),
- d:this.localGet('Text')};
- if(uns.f == this.openedFile && uns.d && uns.d != e.data){
- this.localSet('Unsaved', uns.d);
- this.alertLine = html`
- Load unsaved from browser `;
- }else{
- this.localSet('Text','');this.alertLine = '';
+ if(e){
+ this.edit.cver = e.cver;
+ this.openedFile = e.file;
+ this.infoLine = e.msg;
+ this.Toast(this.infoLine,1000);
+ const uns={f:this.localGet('Open'),
+ d:this.localGet('Text')};
+ if(uns.f == this.openedFile && uns.d && uns.d != e.data){
+ this.localSet('Unsaved', uns.d);
+ this.alertLine = html`
+ Load unsaved from browser `;
+ }else{
+ this.localSet('Text','');this.alertLine = '';
+ }
+ this.renderRoot.querySelector('#code').value=e.data;
+ this.code = e.data;
}
- this.renderRoot.querySelector('#code').value=e.data;
- this.code = e.data;
}
this.edit.orgCode = this.code;
this.localSet('Open', this.openedFile);
@@ -298,13 +309,15 @@ async Save() {
if(!this.code){this.infoLine=''; this.infoLine = 'Text is empty!'; return;}
this.infoLine = 'Saving: '+this.openedFile;
const e=await this.cmd('save', this.code, this.openedFile);
- this.infoLine = e.msg;
- this.Toast(this.infoLine,2000);
- if(e.msg.includes('Saved:')){
- this.localSet('Text','');
- if(savenew){
- this.fileList.unshift(this.openedFile);
- this.saveList();
+ if(e){
+ this.infoLine = e.msg;
+ this.Toast(this.infoLine,2000);
+ if(e.msg.includes('Saved:')){
+ this.localSet('Text','');
+ if(savenew){
+ this.fileList.unshift(this.openedFile);
+ this.saveList();
+ }
}
}
}else{this.openedFile='';}
@@ -316,7 +329,7 @@ getCardSize() {
}
setConfig(config) {
- this.edit = {file: '', hidefooter: false, readonly: false, basic: false, size: 0, depth: 2, ext: '', orgCode: '', coder:1, ...config};
+ this.edit = {file: '', hidefooter: false, readonly: false, basic: false, size: 0, depth: 2, ext: '', orgCode: '', coder: 1, cver: 0, ...config};
if(this.edit.file){
const f=this.edit.file.split('.')[1];
if(f){