@schukai/monster 3.118.1 → 3.119.0
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
@@ -2,6 +2,17 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
+
## [3.119.0] - 2025-05-06
|
6
|
+
|
7
|
+
### Add Features
|
8
|
+
|
9
|
+
- **viewer:** extend setContent with mimetype [#309](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/309)
|
10
|
+
### Bug Fixes
|
11
|
+
|
12
|
+
- restore removed funktion
|
13
|
+
|
14
|
+
|
15
|
+
|
5
16
|
## [3.118.1] - 2025-05-02
|
6
17
|
|
7
18
|
### Bug Fixes
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.
|
1
|
+
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.0","@popperjs/core":"^2.11.8","buffer":"^6.0.3"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.119.0"}
|
@@ -13,17 +13,18 @@
|
|
13
13
|
*/
|
14
14
|
|
15
15
|
import {
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
assembleMethodSymbol,
|
17
|
+
CustomElement,
|
18
|
+
registerCustomElement,
|
19
19
|
} from "../../dom/customelement.mjs";
|
20
20
|
import "../notify/notify.mjs";
|
21
|
-
import {
|
22
|
-
import {
|
23
|
-
import {
|
24
|
-
import {
|
21
|
+
import {ViewerStyleSheet} from "./stylesheet/viewer.mjs";
|
22
|
+
import {instanceSymbol} from "../../constants.mjs";
|
23
|
+
import {isString} from "../../types/is.mjs";
|
24
|
+
import {getGlobal} from "../../types/global.mjs";
|
25
|
+
import {MediaType, parseMediaType} from "../../types/mediatype.mjs";
|
25
26
|
|
26
|
-
export {
|
27
|
+
export {Viewer};
|
27
28
|
|
28
29
|
/**
|
29
30
|
* @private
|
@@ -44,178 +45,288 @@ const viewerElementSymbol = Symbol("viewerElement");
|
|
44
45
|
* @summary A simple viewer component for PDF, HTML and images.
|
45
46
|
*/
|
46
47
|
class Viewer extends CustomElement {
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
48
|
+
/**
|
49
|
+
* This method is called by the `instanceof` operator.
|
50
|
+
* @return {symbol}
|
51
|
+
*/
|
52
|
+
static get [instanceSymbol]() {
|
53
|
+
return Symbol.for("@schukai/monster/components/content/viewer@@instance");
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* To set the options via the HTML tag, the attribute `data-monster-options` must be used.
|
58
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
59
|
+
*
|
60
|
+
* The individual configuration values can be found in the table.
|
61
|
+
*
|
62
|
+
* @property {Object} templates Template definitions
|
63
|
+
* @property {string} templates.main Main template
|
64
|
+
* @property {string} content Content to be displayed in the viewer
|
65
|
+
* @property {Object} classes Css classes
|
66
|
+
* @property {string} classes.viewer Css class for the viewer
|
67
|
+
*/
|
68
|
+
get defaults() {
|
69
|
+
return Object.assign({}, super.defaults, {
|
70
|
+
templates: {
|
71
|
+
main: getTemplate(),
|
72
|
+
},
|
73
|
+
content: "<slot></slot>",
|
74
|
+
classes: {
|
75
|
+
viewer: "",
|
76
|
+
}
|
77
|
+
});
|
78
|
+
}
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Sets the content of an element based on the provided content and media type.
|
82
|
+
*
|
83
|
+
* @param {string} content - The content to be set.
|
84
|
+
* @param {string} [mediaType="text/plain"] - The media type of the content. Defaults to "text/plain" if not specified.
|
85
|
+
* @return {void} This method does not return a value.
|
86
|
+
* @throws {Error} Throws an error if shadowRoot is not defined.
|
87
|
+
*/
|
88
|
+
setContent(content, mediaType = "text/plain") {
|
89
|
+
|
90
|
+
if (!this.shadowRoot) {
|
91
|
+
throw new Error("no shadow-root is defined");
|
92
|
+
}
|
93
|
+
|
94
|
+
let type;
|
95
|
+
try {
|
96
|
+
const m = new parseMediaType(mediaType)
|
97
|
+
switch (m.type) {
|
98
|
+
case "image":
|
99
|
+
return this.setImage(content)
|
100
|
+
}
|
101
|
+
|
102
|
+
mediaType = m.toString()
|
103
|
+
|
104
|
+
} catch (error) {
|
105
|
+
type = null
|
106
|
+
}
|
107
|
+
|
108
|
+
if (mediaType === undefined || mediaType === null || mediaType === "") {
|
109
|
+
mediaType = "text/plain";
|
110
|
+
}
|
111
|
+
|
112
|
+
switch (mediaType) {
|
113
|
+
case "text/html":
|
114
|
+
this.setHTML(content);
|
115
|
+
break;
|
116
|
+
case "text/plain":
|
117
|
+
this.setPlainText(content);
|
118
|
+
break;
|
119
|
+
case "application/pdf":
|
120
|
+
this.setPDF(content);
|
121
|
+
break;
|
122
|
+
case "image/png":
|
123
|
+
case "image/jpeg":
|
124
|
+
case "image/gif":
|
125
|
+
this.setImage(content);
|
126
|
+
break;
|
127
|
+
default:
|
128
|
+
this.setOption("content", content);
|
129
|
+
}
|
130
|
+
|
131
|
+
}
|
132
|
+
|
133
|
+
/**
|
134
|
+
* Configures and embeds a PDF document into the application with customizable display settings.
|
135
|
+
*
|
136
|
+
* @param {Blob|URL|string} data The PDF data to be embedded. Can be provided as a Blob, URL or base64 string.
|
137
|
+
* @param {boolean} [navigation=true] Determines whether the navigation pane is displayed in the PDF viewer.
|
138
|
+
* @param {boolean} [toolbar=true] Controls the visibility of the toolbar in the PDF viewer.
|
139
|
+
* @param {boolean} [scrollbar=false] Configures the display of the scrollbar in the PDF viewer.
|
140
|
+
* @return {void} This method returns nothing but sets the embedded PDF as the content.
|
141
|
+
*/
|
142
|
+
setPDF(data, navigation = true, toolbar = true, scrollbar = false) {
|
143
|
+
const hashes =
|
144
|
+
"#toolbar=" +
|
145
|
+
(toolbar ? "1" : "0") +
|
146
|
+
"&navpanes=" +
|
147
|
+
(navigation ? "1" : "0") +
|
148
|
+
"&scrollbar=" +
|
149
|
+
(scrollbar ? "1" : "0");
|
150
|
+
|
151
|
+
let pdfURL = "";
|
152
|
+
if (isBlob(data)) {
|
153
|
+
pdfURL = URL.createObjectURL(data);
|
154
|
+
pdfURL += hashes;
|
155
|
+
} else if (isURL(data)) {
|
156
|
+
// check if the url already contains the hashes
|
157
|
+
if (data?.hash?.indexOf("#") === -1) {
|
158
|
+
pdfURL = data.toString() + hashes;
|
159
|
+
} else {
|
160
|
+
pdfURL = data.toString();
|
161
|
+
}
|
162
|
+
|
163
|
+
|
164
|
+
} else if (isString(data)) {
|
165
|
+
//URL.createObjectURL(data);
|
166
|
+
const blobObj = new Blob([atob(data)], {type: "application/pdf"});
|
167
|
+
const url = window.URL.createObjectURL(blobObj);
|
168
|
+
|
169
|
+
pdfURL = data;
|
170
|
+
} else {
|
171
|
+
throw new Error("Blob or URL expected");
|
172
|
+
}
|
173
|
+
|
174
|
+
const html =
|
175
|
+
'<object data="' +
|
176
|
+
pdfURL +
|
177
|
+
'" width="100%" height="100%" type="application/pdf"></object>';
|
178
|
+
|
179
|
+
this.setOption("content", html);
|
180
|
+
|
181
|
+
}
|
182
|
+
|
183
|
+
/**
|
184
|
+
* Sets an image for the target by accepting a blob, URL, or string representation of the image.
|
185
|
+
*
|
186
|
+
* @param {(Blob|string)} data - The image data, which can be a Blob, a valid URL, or a string representation of the image.
|
187
|
+
* @return {void} Does not return a value.
|
188
|
+
*/
|
189
|
+
setImage(data) {
|
190
|
+
if (isBlob(data)) {
|
191
|
+
data = URL.createObjectURL(data);
|
192
|
+
} else if (isURL(data)) {
|
193
|
+
// nothing to do
|
194
|
+
} else if (isString(data)) {
|
195
|
+
// nothing to do
|
196
|
+
} else {
|
197
|
+
throw new Error("Blob or URL expected");
|
198
|
+
}
|
199
|
+
|
200
|
+
this.setOption("content", '<img src="' + data + '" alt="image" />');
|
201
|
+
}
|
202
|
+
|
203
|
+
/**
|
204
|
+
*
|
205
|
+
* if the data is a string, it is interpreted as HTML.
|
206
|
+
* if the data is an url, the HTML is loaded from the url and set as content.
|
207
|
+
* if the data is an HTMLElement, the outerHTML is used as content.
|
208
|
+
*
|
209
|
+
* @param {HTMLElement|URL|string|Blob} data
|
210
|
+
*/
|
211
|
+
setHTML(data) {
|
212
|
+
if (data instanceof Blob) {
|
213
|
+
blobToText(data)
|
214
|
+
.then((html) => {
|
215
|
+
this.setOption("content", html);
|
216
|
+
})
|
217
|
+
.catch((error) => {
|
218
|
+
throw new Error(error);
|
219
|
+
});
|
220
|
+
|
221
|
+
return;
|
222
|
+
} else if (data instanceof HTMLElement) {
|
223
|
+
data = data.outerHTML;
|
224
|
+
} else if (isString(data)) {
|
225
|
+
// nothing to do
|
226
|
+
} else if (isURL(data)) {
|
227
|
+
// fetch element
|
228
|
+
getGlobal()
|
229
|
+
.fetch(data)
|
230
|
+
.then((response) => {
|
231
|
+
return response.text();
|
232
|
+
})
|
233
|
+
.then((html) => {
|
234
|
+
this.setOption("content", html);
|
235
|
+
})
|
236
|
+
.catch((error) => {
|
237
|
+
throw new Error(error);
|
238
|
+
});
|
239
|
+
} else {
|
240
|
+
throw new Error("HTMLElement or string expected");
|
241
|
+
}
|
242
|
+
|
243
|
+
this.setOption("content", data);
|
244
|
+
|
245
|
+
}
|
246
|
+
|
247
|
+
/**
|
248
|
+
* Sets the plain text content by processing the input data, which can be of various types, including Blob,
|
249
|
+
* HTMLElement, string, or a valid URL. The method extracts and sets the raw text content into a predefined option.
|
250
|
+
*
|
251
|
+
* @param {Blob|HTMLElement|string} data - The input data to be processed. It can be a Blob object, an HTMLElement,
|
252
|
+
* a plain string, or a string formatted as a valid URL. The method determines
|
253
|
+
* the data type and processes it accordingly.
|
254
|
+
* @return {void} - This method does not return any value. It processes the content and updates the relevant option
|
255
|
+
* property.
|
256
|
+
*/
|
257
|
+
setPlainText(data) {
|
258
|
+
if (data instanceof Blob) {
|
259
|
+
blobToText(data)
|
260
|
+
.then((html) => {
|
261
|
+
|
262
|
+
const div = document.createElement("div");
|
263
|
+
div.innerHTML = html;
|
264
|
+
html = div.innerText
|
265
|
+
|
266
|
+
this.setOption("content", html);
|
267
|
+
})
|
268
|
+
.catch((error) => {
|
269
|
+
throw new Error(error);
|
270
|
+
});
|
271
|
+
|
272
|
+
return;
|
273
|
+
} else if (data instanceof HTMLElement) {
|
274
|
+
data = data.outerText
|
275
|
+
} else if (isString(data)) {
|
276
|
+
const div = document.createElement("div");
|
277
|
+
div.innerHTML = data;
|
278
|
+
data = div.innerText
|
279
|
+
|
280
|
+
} else if (isURL(data)) {
|
281
|
+
// fetch element
|
282
|
+
getGlobal()
|
283
|
+
.fetch(data)
|
284
|
+
.then((response) => {
|
285
|
+
return response.text();
|
286
|
+
})
|
287
|
+
.then((text) => {
|
288
|
+
|
289
|
+
const div = document.createElement("div");
|
290
|
+
div.innerHTML = text;
|
291
|
+
text = div.innerText
|
292
|
+
|
293
|
+
this.setOption("content", text);
|
294
|
+
})
|
295
|
+
.catch((error) => {
|
296
|
+
throw new Error(error);
|
297
|
+
});
|
298
|
+
} else {
|
299
|
+
throw new Error("HTMLElement or string expected");
|
300
|
+
}
|
301
|
+
|
302
|
+
this.setOption("content", data);
|
303
|
+
}
|
304
|
+
|
305
|
+
/**
|
306
|
+
*
|
307
|
+
* @return {Viewer}
|
308
|
+
*/
|
309
|
+
[assembleMethodSymbol]() {
|
310
|
+
super[assembleMethodSymbol]();
|
311
|
+
|
312
|
+
initControlReferences.call(this);
|
313
|
+
initEventHandler.call(this);
|
314
|
+
}
|
315
|
+
|
316
|
+
/**
|
317
|
+
*
|
318
|
+
* @return {string}
|
319
|
+
*/
|
320
|
+
static getTag() {
|
321
|
+
return "monster-viewer";
|
322
|
+
}
|
323
|
+
|
324
|
+
/**
|
325
|
+
* @return {CSSStyleSheet[]}
|
326
|
+
*/
|
327
|
+
static getCSSStyleSheet() {
|
328
|
+
return [ViewerStyleSheet];
|
329
|
+
}
|
219
330
|
}
|
220
331
|
|
221
332
|
/**
|
@@ -224,12 +335,12 @@ class Viewer extends CustomElement {
|
|
224
335
|
* @return {boolean}
|
225
336
|
*/
|
226
337
|
function isURL(variable) {
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
338
|
+
try {
|
339
|
+
new URL(variable);
|
340
|
+
return true;
|
341
|
+
} catch (error) {
|
342
|
+
return false;
|
343
|
+
}
|
233
344
|
}
|
234
345
|
|
235
346
|
/**
|
@@ -238,7 +349,7 @@ function isURL(variable) {
|
|
238
349
|
* @return {boolean}
|
239
350
|
*/
|
240
351
|
function isBlob(variable) {
|
241
|
-
|
352
|
+
return variable instanceof Blob;
|
242
353
|
}
|
243
354
|
|
244
355
|
/**
|
@@ -247,12 +358,12 @@ function isBlob(variable) {
|
|
247
358
|
* @return {Promise<unknown>}
|
248
359
|
*/
|
249
360
|
function blobToText(blob) {
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
361
|
+
return new Promise((resolve, reject) => {
|
362
|
+
const reader = new FileReader();
|
363
|
+
reader.onloadend = () => resolve(reader.result);
|
364
|
+
reader.onerror = reject;
|
365
|
+
reader.readAsText(blob);
|
366
|
+
});
|
256
367
|
}
|
257
368
|
|
258
369
|
/**
|
@@ -261,18 +372,18 @@ function blobToText(blob) {
|
|
261
372
|
* @throws {Error} no shadow-root is defined
|
262
373
|
*/
|
263
374
|
function initControlReferences() {
|
264
|
-
|
265
|
-
|
266
|
-
|
375
|
+
if (!this.shadowRoot) {
|
376
|
+
throw new Error("no shadow-root is defined");
|
377
|
+
}
|
267
378
|
|
268
|
-
|
379
|
+
this[viewerElementSymbol] = this.shadowRoot.getElementById("viewer");
|
269
380
|
}
|
270
381
|
|
271
382
|
/**
|
272
383
|
* @private
|
273
384
|
*/
|
274
385
|
function initEventHandler() {
|
275
|
-
|
386
|
+
return this;
|
276
387
|
}
|
277
388
|
|
278
389
|
/**
|
@@ -280,9 +391,11 @@ function initEventHandler() {
|
|
280
391
|
* @return {string}
|
281
392
|
*/
|
282
393
|
function getTemplate() {
|
283
|
-
|
284
|
-
|
285
|
-
<div id="viewer" data-monster-role="viewer" part="viewer"
|
394
|
+
// language=HTML
|
395
|
+
return `
|
396
|
+
<div id="viewer" data-monster-role="viewer" part="viewer"
|
397
|
+
data-monster-replace="path:content"
|
398
|
+
data-monster-attributes="class path:classes.viewer">
|
286
399
|
</div>`;
|
287
400
|
}
|
288
401
|
|
@@ -287,6 +287,9 @@ const FILTER_POSITION_INLINE = "inline";
|
|
287
287
|
* @summary A beautiful select control that can make your life easier and also looks good.
|
288
288
|
* @fires monster-change
|
289
289
|
* @fires monster-changed
|
290
|
+
* @fires monster-options-set this event is fired when the options are set
|
291
|
+
* @fires monster-selection-removed
|
292
|
+
* @fires monster-selection-cleared
|
290
293
|
*/
|
291
294
|
class Select extends CustomControl {
|
292
295
|
/**
|
@@ -1817,11 +1820,12 @@ function formatURL(url, value) {
|
|
1817
1820
|
}
|
1818
1821
|
|
1819
1822
|
/**
|
1820
|
-
*
|
1821
|
-
*
|
1822
|
-
* @param
|
1823
|
-
* @param
|
1824
|
-
* @
|
1823
|
+
* Formats a given URL by applying specific filters and markers.
|
1824
|
+
*
|
1825
|
+
* @param {string} optionUrl The URL to format.
|
1826
|
+
* @param {string} [value] The filter value to apply. If not provided, it attempts to retrieve a default value.
|
1827
|
+
* @param {boolean} [openPopper] Flag indicating whether to open the popper.
|
1828
|
+
* @return {string} The formatted URL with the applied filters and markers.
|
1825
1829
|
*/
|
1826
1830
|
function filterFromRemoteByValue(optionUrl, value, openPopper) {
|
1827
1831
|
return new Processing(() => {
|
@@ -31,7 +31,7 @@ const internal = Symbol("internal");
|
|
31
31
|
*/
|
32
32
|
|
33
33
|
/**
|
34
|
-
* You can create an object via the monster namespace `new
|
34
|
+
* You can create an object via the monster namespace `new MediaType()`.
|
35
35
|
*
|
36
36
|
* @license AGPLv3
|
37
37
|
* @since 1.8.0
|
@@ -42,7 +42,7 @@ class MediaType extends Base {
|
|
42
42
|
*
|
43
43
|
* @param {String} type
|
44
44
|
* @param {String} subtype
|
45
|
-
* @param {
|
45
|
+
* @param {Parameter[]} parameter
|
46
46
|
*/
|
47
47
|
constructor(type, subtype, parameter) {
|
48
48
|
super();
|
@@ -82,7 +82,7 @@ class MediaType extends Base {
|
|
82
82
|
}
|
83
83
|
|
84
84
|
// /**
|
85
|
-
// * @return {
|
85
|
+
// * @return {Parameter[]}
|
86
86
|
// */
|
87
87
|
// get parameter() {
|
88
88
|
// return this[internal].parameter;
|
@@ -127,12 +127,12 @@ class MediaType extends Base {
|
|
127
127
|
}
|
128
128
|
|
129
129
|
/**
|
130
|
-
* You can call the function via the monster namespace `
|
130
|
+
* You can call the function via the monster namespace `parseMediaType()`.
|
131
131
|
*
|
132
132
|
* ```
|
133
133
|
* <script type="module">
|
134
134
|
* import {Monster} from '@schukai/monster/source/monster.mjs';
|
135
|
-
* console.log(
|
135
|
+
* console.log(parseMediaType())
|
136
136
|
* </script>
|
137
137
|
* ```
|
138
138
|
*
|
@@ -155,7 +155,7 @@ class MediaType extends Base {
|
|
155
155
|
* ```
|
156
156
|
*
|
157
157
|
* @param {String} mediatype
|
158
|
-
* @return {
|
158
|
+
* @return {MediaType}
|
159
159
|
* @see https://datatracker.ietf.org/doc/html/rfc2045#section-5.1
|
160
160
|
* @throws {TypeError} the mimetype can not be parsed
|
161
161
|
* @throws {TypeError} blank value is not allowed
|
@@ -187,7 +187,7 @@ function parseMediaType(mediatype) {
|
|
187
187
|
* @license AGPLv3
|
188
188
|
* @since 1.18.0
|
189
189
|
* @param {String} parameter
|
190
|
-
* @return {
|
190
|
+
* @return {Parameter[]|undefined}
|
191
191
|
*/
|
192
192
|
function parseParameter(parameter) {
|
193
193
|
if (!isString(parameter)) {
|
@@ -167,14 +167,12 @@ describe('Select', function () {
|
|
167
167
|
expect(optionHtml).contain.html('data-monster-insert-reference="options-1"');
|
168
168
|
expect(optionHtml).contain.html('data-monster-insert-reference="options-2"');
|
169
169
|
expect(optionHtml).contain.not.html('data-monster-insert-reference="options-3"');
|
170
|
+
done();
|
170
171
|
|
171
172
|
} catch (e) {
|
172
173
|
done(e)
|
173
|
-
return;
|
174
|
-
}
|
175
|
-
|
176
|
-
done();
|
177
174
|
|
175
|
+
}
|
178
176
|
}, 100)
|
179
177
|
})
|
180
178
|
|
@@ -222,4 +220,4 @@ describe('Select', function () {
|
|
222
220
|
});
|
223
221
|
|
224
222
|
|
225
|
-
});
|
223
|
+
});
|