@dualbox/editor 1.0.22 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/dist/GraphEditor.js +84 -59
- package/js/src/GraphEditor.js +23 -4
- package/js/src/c/GraphController.js +1 -1
- package/package.json +1 -1
package/js/src/GraphEditor.js
CHANGED
|
@@ -309,8 +309,21 @@ class DualboxEditor {
|
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
+
var loadScript = (pkg, cb) => {
|
|
313
|
+
if( attrs.load ) {
|
|
314
|
+
attrs.load( pkg.name, pkg.version, cb);
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
cb();
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// we need to find the package.json and make sure the script is loaded
|
|
312
322
|
if( this.packages[name] ) {
|
|
313
|
-
|
|
323
|
+
loadScript(this.packages[name], (err) => {
|
|
324
|
+
if( err ) reject(err)
|
|
325
|
+
else resolve(this.packages[name]);
|
|
326
|
+
});
|
|
314
327
|
}
|
|
315
328
|
else {
|
|
316
329
|
// mark the package as beeing resolved
|
|
@@ -320,7 +333,10 @@ class DualboxEditor {
|
|
|
320
333
|
}
|
|
321
334
|
else {
|
|
322
335
|
this.packages[name] = result; // cache result
|
|
323
|
-
|
|
336
|
+
loadScript(this.packages[name], (err) => {
|
|
337
|
+
if( err ) reject(err)
|
|
338
|
+
else resolve(result);
|
|
339
|
+
});
|
|
324
340
|
}
|
|
325
341
|
});
|
|
326
342
|
}
|
|
@@ -347,7 +363,10 @@ class DualboxEditor {
|
|
|
347
363
|
|
|
348
364
|
if( attrs.json ) {
|
|
349
365
|
this.onReady(() => {
|
|
350
|
-
this.setApp(attrs.json);
|
|
366
|
+
var p = this.setApp(attrs.json);
|
|
367
|
+
if( attrs.onLoaded ) {
|
|
368
|
+
p.then(attrs.onLoaded);
|
|
369
|
+
}
|
|
351
370
|
});
|
|
352
371
|
}
|
|
353
372
|
}
|
|
@@ -372,7 +391,7 @@ class DualboxEditor {
|
|
|
372
391
|
}
|
|
373
392
|
|
|
374
393
|
setApp(json) {
|
|
375
|
-
this.c.load(json);
|
|
394
|
+
return this.c.load(json);
|
|
376
395
|
}
|
|
377
396
|
|
|
378
397
|
getApp() {
|
|
@@ -547,7 +547,7 @@ class GraphController {
|
|
|
547
547
|
|
|
548
548
|
load( json ) {
|
|
549
549
|
// first load the packages
|
|
550
|
-
this.e.loadPackages(json).then( async () => {
|
|
550
|
+
return this.e.loadPackages(json).then( async () => {
|
|
551
551
|
console.log('LOADED ALL PACKAGES !');
|
|
552
552
|
|
|
553
553
|
// hold state saving for now
|