@dualbox/editor 1.0.29 → 1.0.30
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/html/editor.html +1 -1
- package/js/dist/GraphEditor.js +16 -13
- package/js/dist/GraphEditor.min.js +15 -12
- package/js/src/GraphEditor.js +15 -12
- package/package.json +1 -1
|
@@ -103830,8 +103830,8 @@ class DualboxEditor {
|
|
|
103830
103830
|
|
|
103831
103831
|
if (type) {
|
|
103832
103832
|
packages = lodash.filter(packages, o => {
|
|
103833
|
-
return o.name.startsWith('@dualbox/dualbox-' + type)
|
|
103834
|
-
|| (type=="module" && o.name.startsWith('dualbox-core'))
|
|
103833
|
+
return o.name.startsWith('@dualbox/dualbox-' + type)
|
|
103834
|
+
|| (type == "module" && o.name.startsWith('dualbox-core'))
|
|
103835
103835
|
});
|
|
103836
103836
|
}
|
|
103837
103837
|
resolve(packages);
|
|
@@ -103878,16 +103878,17 @@ class DualboxEditor {
|
|
|
103878
103878
|
version = version || "*";
|
|
103879
103879
|
|
|
103880
103880
|
return new Promise((resolve, reject) => {
|
|
103881
|
-
if(
|
|
103881
|
+
if (name.startsWith('dualbox-core')) {
|
|
103882
103882
|
var pkg = null;
|
|
103883
103883
|
lodash.each(this.DualBox.core, (corePackage) => {
|
|
103884
|
-
if(
|
|
103884
|
+
if (corePackage.name == name) {
|
|
103885
103885
|
pkg = corePackage;
|
|
103886
|
-
return;
|
|
103886
|
+
return false;
|
|
103887
103887
|
}
|
|
103888
103888
|
});
|
|
103889
103889
|
|
|
103890
|
-
if(
|
|
103890
|
+
if (pkg) {
|
|
103891
|
+
this.packages[name] = pkg;
|
|
103891
103892
|
resolve(pkg);
|
|
103892
103893
|
}
|
|
103893
103894
|
else {
|
|
@@ -103903,20 +103904,20 @@ class DualboxEditor {
|
|
|
103903
103904
|
else {
|
|
103904
103905
|
// Local editor. Bind the callback on the local script load
|
|
103905
103906
|
var script = $('script[data-pkg="' + pkg.name + '"]');
|
|
103906
|
-
if(
|
|
103907
|
+
if (!script) {
|
|
103907
103908
|
throw "Couldn't find script in the current document: " + pkg.name + ". Did you forget gulp link-editor ?";
|
|
103908
103909
|
}
|
|
103909
103910
|
|
|
103910
|
-
if(
|
|
103911
|
+
if (script.attr('data-loaded') === "true") {
|
|
103911
103912
|
cb();
|
|
103912
103913
|
return;
|
|
103913
103914
|
}
|
|
103914
103915
|
else {
|
|
103915
|
-
script[0].addEventListener("error", function() {
|
|
103916
|
+
script[0].addEventListener("error", function () {
|
|
103916
103917
|
throw "Failed to load script " + pkg.name;
|
|
103917
103918
|
});
|
|
103918
103919
|
|
|
103919
|
-
var timeout = setTimeout(function() {
|
|
103920
|
+
var timeout = setTimeout(function () {
|
|
103920
103921
|
cb("Failed to load " + pkg.name + " after 5 seconds");
|
|
103921
103922
|
}, 5000);
|
|
103922
103923
|
script[0].addEventListener("load", () => {
|
|
@@ -103935,7 +103936,7 @@ class DualboxEditor {
|
|
|
103935
103936
|
else resolve(this.packages[name]);
|
|
103936
103937
|
});
|
|
103937
103938
|
}
|
|
103938
|
-
catch(e) {
|
|
103939
|
+
catch (e) {
|
|
103939
103940
|
reject(e);
|
|
103940
103941
|
}
|
|
103941
103942
|
}
|
|
@@ -104031,7 +104032,9 @@ class DualboxEditor {
|
|
|
104031
104032
|
|
|
104032
104033
|
// sync version of this.loadPackage. Will crash if the package has not been loaded yet
|
|
104033
104034
|
getPackage(name, version) {
|
|
104034
|
-
if (this.packages[name] === undefined)
|
|
104035
|
+
if (this.packages[name] === undefined) {
|
|
104036
|
+
throw "Package " + name + " has not been loaded yet.";
|
|
104037
|
+
}
|
|
104035
104038
|
return this.packages[name];
|
|
104036
104039
|
};
|
|
104037
104040
|
}
|
package/js/src/GraphEditor.js
CHANGED
|
@@ -59,8 +59,8 @@ class DualboxEditor {
|
|
|
59
59
|
|
|
60
60
|
if (type) {
|
|
61
61
|
packages = _.filter(packages, o => {
|
|
62
|
-
return o.name.startsWith('@dualbox/dualbox-' + type)
|
|
63
|
-
|| (type=="module" && o.name.startsWith('dualbox-core'))
|
|
62
|
+
return o.name.startsWith('@dualbox/dualbox-' + type)
|
|
63
|
+
|| (type == "module" && o.name.startsWith('dualbox-core'))
|
|
64
64
|
})
|
|
65
65
|
}
|
|
66
66
|
resolve(packages);
|
|
@@ -107,16 +107,17 @@ class DualboxEditor {
|
|
|
107
107
|
version = version || "*";
|
|
108
108
|
|
|
109
109
|
return new Promise((resolve, reject) => {
|
|
110
|
-
if(
|
|
110
|
+
if (name.startsWith('dualbox-core')) {
|
|
111
111
|
var pkg = null;
|
|
112
112
|
_.each(this.DualBox.core, (corePackage) => {
|
|
113
|
-
if(
|
|
113
|
+
if (corePackage.name == name) {
|
|
114
114
|
pkg = corePackage;
|
|
115
|
-
return;
|
|
115
|
+
return false;
|
|
116
116
|
}
|
|
117
117
|
})
|
|
118
118
|
|
|
119
|
-
if(
|
|
119
|
+
if (pkg) {
|
|
120
|
+
this.packages[name] = pkg;
|
|
120
121
|
resolve(pkg);
|
|
121
122
|
}
|
|
122
123
|
else {
|
|
@@ -132,20 +133,20 @@ class DualboxEditor {
|
|
|
132
133
|
else {
|
|
133
134
|
// Local editor. Bind the callback on the local script load
|
|
134
135
|
var script = $('script[data-pkg="' + pkg.name + '"]');
|
|
135
|
-
if(
|
|
136
|
+
if (!script) {
|
|
136
137
|
throw "Couldn't find script in the current document: " + pkg.name + ". Did you forget gulp link-editor ?";
|
|
137
138
|
}
|
|
138
139
|
|
|
139
|
-
if(
|
|
140
|
+
if (script.attr('data-loaded') === "true") {
|
|
140
141
|
cb();
|
|
141
142
|
return;
|
|
142
143
|
}
|
|
143
144
|
else {
|
|
144
|
-
script[0].addEventListener("error", function() {
|
|
145
|
+
script[0].addEventListener("error", function () {
|
|
145
146
|
throw "Failed to load script " + pkg.name;
|
|
146
147
|
});
|
|
147
148
|
|
|
148
|
-
var timeout = setTimeout(function() {
|
|
149
|
+
var timeout = setTimeout(function () {
|
|
149
150
|
cb("Failed to load " + pkg.name + " after 5 seconds");
|
|
150
151
|
}, 5000)
|
|
151
152
|
script[0].addEventListener("load", () => {
|
|
@@ -164,7 +165,7 @@ class DualboxEditor {
|
|
|
164
165
|
else resolve(this.packages[name]);
|
|
165
166
|
});
|
|
166
167
|
}
|
|
167
|
-
catch(e) {
|
|
168
|
+
catch (e) {
|
|
168
169
|
reject(e);
|
|
169
170
|
}
|
|
170
171
|
}
|
|
@@ -263,7 +264,9 @@ class DualboxEditor {
|
|
|
263
264
|
|
|
264
265
|
// sync version of this.loadPackage. Will crash if the package has not been loaded yet
|
|
265
266
|
getPackage(name, version) {
|
|
266
|
-
if (this.packages[name] === undefined)
|
|
267
|
+
if (this.packages[name] === undefined) {
|
|
268
|
+
throw "Package " + name + " has not been loaded yet.";
|
|
269
|
+
}
|
|
267
270
|
return this.packages[name];
|
|
268
271
|
};
|
|
269
272
|
}
|