alchemy-media 0.9.0-alpha.3 → 0.9.0-alpha.5

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/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
- ## 0.9.0-alpha.3 (2024-08-16)
1
+ ## 0.9.0-alpha.5 (2025-07-10)
2
2
 
3
- * Implement Alchemy v1.4 `Field` changes
3
+ * Add `size` to the media file chooser
4
+ * Allow using filters in the table
5
+ * Limit the height of the media file chooser
6
+
7
+ ## 0.9.0-alpha.4 (2024-10-10)
8
+
9
+ * Make `MediaRaw#addFile(url)` support data uris too
10
+
11
+ ## 0.9.0-alpha.3 (2024-08-16)
12
+
13
+ * Implement Alchemy v1.4 `Field` changes
4
14
 
5
15
  ## 0.9.0-alpha.2 (2024-02-19)
6
16
 
@@ -133,4 +133,16 @@ al-field[field-type="file"] {
133
133
  margin: auto;
134
134
  }
135
135
  }
136
+ }
137
+
138
+ .alchemy-file-selection-dialog {
139
+ .alchemy-file-selection-wrapper {
140
+ max-height: 85vh;
141
+
142
+ al-table {
143
+ max-height: 76vh;
144
+ margin-bottom: 1rem;
145
+ overflow: auto;
146
+ }
147
+ }
136
148
  }
@@ -460,13 +460,12 @@ MediaFiles.setAction(async function recordsource(conduit) {
460
460
  continue;
461
461
  }
462
462
 
463
- val = RegExp.interpretWildcard('*' + val + '*', 'i');
464
- crit.where(key).equals(val);
463
+ crit.where(key).matchesFilter(val);
465
464
  }
466
465
  }
467
466
 
468
467
  let records = await model.find('all', crit);
469
-
468
+
470
469
  conduit.end({
471
470
  records : records
472
471
  });
@@ -192,7 +192,7 @@ MediaRaw.Document.setMethod(function extraImportFromStream(input) {
192
192
  *
193
193
  * @author Jelle De Loecker <jelle@develry.be>
194
194
  * @since 0.0.1
195
- * @version 0.7.1
195
+ * @version 0.9.0
196
196
  *
197
197
  * @param {String} file The path to the file, can be a URL
198
198
  * @param {Object} options
@@ -217,8 +217,11 @@ MediaRaw.setMethod(function addFile(file, options, callback) {
217
217
  file = file.path;
218
218
  }
219
219
 
220
+ let is_url = file.startsWith('http://') || file.startsWith('https://'),
221
+ is_data_uri = !is_url && file.startsWith('data:');
222
+
220
223
  // If the given file is actually a url, we'll need to download it first
221
- if (file.startsWith('http://') || file.startsWith('https://')) {
224
+ if (is_url || is_data_uri) {
222
225
 
223
226
  // Set the url as the origin
224
227
  options.origin = file;
@@ -232,16 +235,18 @@ MediaRaw.setMethod(function addFile(file, options, callback) {
232
235
  return callback(err);
233
236
  }
234
237
 
235
- if (!options.filename) {
236
- options.filename = filename;
237
- }
238
+ if (!is_data_uri) {
239
+ if (!options.filename) {
240
+ options.filename = filename;
241
+ }
238
242
 
239
- if (!options.filename) {
240
- options.filename = Url.parse(file).pathname.split('/').last();
241
- }
243
+ if (!options.filename) {
244
+ options.filename = Url.parse(file).pathname.split('/').last();
245
+ }
242
246
 
243
- if (!options.name) {
244
- options.name = options.filename.beforeLast('.') || options.filename;
247
+ if (!options.name) {
248
+ options.name = options.filename.beforeLast('.') || options.filename;
249
+ }
245
250
  }
246
251
 
247
252
  that.addFile(tempfile, options, callback);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "alchemy-media",
3
3
  "description": "The media plugin for Alchemy",
4
- "version": "0.9.0-alpha.3",
4
+ "version": "0.9.0-alpha.5",
5
5
  "repository": {
6
6
  "type" : "git",
7
7
  "url" : "https://github.com/11ways/alchemy-media.git"
@@ -15,6 +15,14 @@ fieldset.addField('_id', {
15
15
 
16
16
  fieldset.addField('filename');
17
17
  fieldset.addField('type');
18
+ fieldset.addField('MediaRaw.size');
19
+
20
+ if (!filters) {
21
+ filters = {
22
+ 'MediaRaw.size': '>500000'
23
+ };
24
+ }
25
+
18
26
  %>
19
27
 
20
28
  <div class="alchemy-file-selection-wrapper">