Improvement + fix bug:

- improve Tag API
- Improve CodePad UI + Extension API
- Add package dependencies to Market Place
This commit is contained in:
lxsang
2020-12-18 19:51:19 +01:00
parent 6c935e88ee
commit 566592dc8e
15 changed files with 480 additions and 158 deletions

View File

@ -301,7 +301,7 @@ namespace OS {
* @memberof BaseApplication
*/
show(): void {
return this.trigger("focus", undefined);
this.trigger("focus", undefined);
}
/**

View File

@ -63,7 +63,6 @@ namespace OS {
*/
quit(): void {
const evt = new BaseEvent("exit", false);
this.onexit(evt);
if (!evt.prevent) {
delete this._observable;
if (this.scheme) {
@ -72,6 +71,7 @@ namespace OS {
if (this.dialog) {
return this.dialog.quit();
}
this.onexit(evt);
}
}
@ -117,6 +117,9 @@ namespace OS {
show(): void {
this.trigger("focus");
$(this.scheme).css("z-index", GUI.zindex + 2);
if (this.dialog) {
this.dialog.show();
}
}
/**
@ -406,7 +409,10 @@ namespace OS {
if (this.data && this.data.value) {
$input.val(this.data.value);
}
if(this.data && this.data.disable)
{
$input.prop('disabled', true);
}
(this.find("btnOk") as tag.ButtonTag).onbtclick = (e) => {
const value = $input.val();
if (!value || value === "") {

View File

@ -565,7 +565,6 @@ namespace OS {
this.dialog.handle = resolve;
this.dialog.pid = this.pid;
this.dialog.data = data;
return this.dialog.init();
});
}

View File

@ -1059,6 +1059,25 @@ namespace OS {
* @memberof PackageMetaType
*/
version: string;
/**
* Package dependencies, each entry is in the following format
*
* `package_name@version`
*
* Example:
*
* ```json
* [
* "File@0.1.5-b"
* ]
* ```
*
* @type {string[]}
* @memberof PackageMetaType
*/
dependencies: string[];
[propName: string]: any;
}
/**
@ -1359,11 +1378,12 @@ namespace OS {
*
* @export
* @param {string} l VFS path to the library
* @param {string} force force reload library
* @returns {Promise<any>} a promise on the result data
*/
export function requires(l: string): Promise<any> {
export function requires(l: string, force: boolean = false): Promise<any> {
return new Promise(function(resolve, reject) {
if (!API.shared[l]) {
if (!API.shared[l] || force) {
const libfp = l.asFileHandle();
switch (libfp.ext) {
case "css":
@ -1427,7 +1447,7 @@ namespace OS {
}
return resolve(r);
});
return API.requires(libs[0]).catch((e: Error) =>
return API.requires(libs[0], false).catch((e: Error) =>
reject(__e(e))
);
});