@dualbox/editor 1.0.92 → 1.0.93

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 CHANGED
@@ -133,21 +133,28 @@
133
133
  showLoadButton: true,
134
134
  showSaveButton: true,
135
135
 
136
+ packages: packages,
137
+
138
+ // non-necessary if packages are passed
136
139
  search: function(text, cb) {
137
- var options = {
138
- shouldSort: true,
139
- threshold: 0.6,
140
- location: 0,
141
- distance: 100,
142
- maxPatternLength: 32,
143
- minMatchCharLength: 1,
144
- tokenize: true,
145
- matchAllTokens: true,
146
- keys: ["name", "description"]
147
- };
148
- var fuse = new Fuse(packages, options); // "list" is the item array
149
- var result = fuse.search(text);
150
- cb(null, result);
140
+ if (!text || text.length == 0) {
141
+ cb(null, packages);
142
+ } else {
143
+ var options = {
144
+ shouldSort: true,
145
+ threshold: 0.6,
146
+ location: 0,
147
+ distance: 100,
148
+ maxPatternLength: 32,
149
+ minMatchCharLength: 1,
150
+ tokenize: true,
151
+ matchAllTokens: true,
152
+ keys: ["name", "description"]
153
+ };
154
+ var fuse = new Fuse(packages, options); // "list" is the item array
155
+ var result = fuse.search(text);
156
+ cb(null, result);
157
+ }
151
158
  },
152
159
 
153
160
  find: function(name, version, cb) {