fix codepad extension API bugs

This commit is contained in:
lxsang 2020-12-20 19:38:34 +01:00
parent 7d3ff0f206
commit 235a9334d6
6 changed files with 12 additions and 5 deletions

Binary file not shown.

View File

@ -435,7 +435,13 @@ namespace OS {
`${this.app.currdir.path}/${file}` `${this.app.currdir.path}/${file}`
.asFileHandle() .asFileHandle()
.read("json") .read("json")
.then((data) => resolve(data)) .then((data) => {
if(!data.root && this.app.currdir)
{
data.root = this.app.currdir.path;
}
resolve(data);
})
.catch((e) => { .catch((e) => {
return reject( return reject(
API.throwe(__("Unable to read meta-data")) API.throwe(__("Unable to read meta-data"))

View File

@ -293,7 +293,9 @@ namespace OS {
await API.requires(path); await API.requires(path);
let v: GenericObject<any>; let v: GenericObject<any>;
if (this.app.extensions[meta.meta.name]) { if (this.app.extensions[meta.meta.name]) {
this.app.extensions[meta.meta.name].child = []; this.app.extensions[meta.meta.name].text = meta.meta.text;
this.app.extensions[meta.meta.name].nodes = [];
this.app.extensions[meta.meta.name].ext = new App.extensions[meta.meta.name](this.app);
for (v of meta.meta.actions) { for (v of meta.meta.actions) {
this.app.extensions[meta.meta.name].addAction(v); this.app.extensions[meta.meta.name].addAction(v);
} }

View File

@ -428,6 +428,7 @@ namespace OS {
stat.column + 1, stat.column + 1,
stat.line stat.line
); );
if(stat.langmode)
this.langstat.text = stat.langmode.text; this.langstat.text = stat.langmode.text;
this.filestat.text = stat.file this.filestat.text = stat.file
} }

View File

@ -1,5 +1,4 @@
{ {
"root": "{1}",
"javascripts": [], "javascripts": [],
"coffees": ["{0}.coffee"], "coffees": ["{0}.coffee"],
"copies": [], "copies": [],

View File

@ -1,6 +1,5 @@
{ {
"name": "{0}", "name": "{0}",
"root": "{1}",
"css": [], "css": [],
"javascripts": [], "javascripts": [],
"coffees": ["coffees/main.coffee"], "coffees": ["coffees/main.coffee"],