@keyblade/tinymce-editor-vue2 0.0.12-alpha.25 → 0.0.12-alpha.27
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/README.md +2 -2
- package/es/editor.vue2.js +51 -51
- package/es/index.js +10 -9
- package/es/types.d.ts +1 -1
- package/es/util.d.ts +6 -0
- package/es/util.js +13 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ Vue.use(ImgPond, {})
|
|
|
33
33
|
Vue.use(TinymceEditor, {
|
|
34
34
|
// 图片
|
|
35
35
|
imageUploadOptions: {
|
|
36
|
-
handleRequest: (file: File
|
|
36
|
+
handleRequest: (file: File, filename: string, parameters: { extParameters: Record<string, any> }) => {
|
|
37
37
|
return new Promise((resolve) => {
|
|
38
38
|
setTimeout(() => {
|
|
39
39
|
resolve({
|
|
@@ -170,7 +170,7 @@ export interface ImageUploadOptions {
|
|
|
170
170
|
/** 图片最大高度 */
|
|
171
171
|
maxHeight?: number;
|
|
172
172
|
/** 图片上传请求处理 */
|
|
173
|
-
handleRequest?: (file: File
|
|
173
|
+
handleRequest?: (file: File, filename: string, options?: {
|
|
174
174
|
extParameters?: Record<string, any>
|
|
175
175
|
}) => Promise<{success: boolean; url?: string; errorMessage?: string}>;
|
|
176
176
|
}
|
package/es/editor.vue2.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { oneTravelImgPondBeforeAddFile as J, oneTravelImageCheckAndTransform as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { defineComponent as he, ref as h, computed as _, watch as S, onMounted as xe, onUnmounted as be } from "vue";
|
|
2
|
+
import { oneTravelImgPondBeforeAddFile as J, oneTravelImageCheckAndTransform as ye, oneTravelImageCompressor as K } from "@keyblade/one-travel";
|
|
3
|
+
import { blobToFile as Q, getFileExtension as X, getImagePixel as we } from "./util.js";
|
|
4
|
+
import _e from "imgpond";
|
|
5
5
|
import { conclude as C } from "vue-global-config";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import Y from "tinymce";
|
|
7
|
+
import Ce from "./langs/zh_CN.js";
|
|
8
8
|
import "tinymce/skins/ui/oxide/skin";
|
|
9
9
|
import "tinymce/models/dom";
|
|
10
10
|
import "tinymce/themes/silver";
|
|
@@ -33,9 +33,9 @@ import "tinymce/plugins/table";
|
|
|
33
33
|
import "tinymce/plugins/visualblocks";
|
|
34
34
|
import "tinymce/plugins/visualchars";
|
|
35
35
|
import "tinymce/plugins/wordcount";
|
|
36
|
-
import { globalProps as
|
|
37
|
-
import { Loading as
|
|
38
|
-
const
|
|
36
|
+
import { globalProps as T } from "./index.js";
|
|
37
|
+
import { Loading as U, Message as b } from "element-ui";
|
|
38
|
+
const sa = /* @__PURE__ */ he({
|
|
39
39
|
__name: "editor",
|
|
40
40
|
props: {
|
|
41
41
|
value: { default: "" },
|
|
@@ -49,9 +49,9 @@ const ra = /* @__PURE__ */ ge({
|
|
|
49
49
|
initComplete: null
|
|
50
50
|
},
|
|
51
51
|
emits: ["input"],
|
|
52
|
-
setup(
|
|
53
|
-
const m =
|
|
54
|
-
|
|
52
|
+
setup(Z, { emit: z }) {
|
|
53
|
+
const m = Z;
|
|
54
|
+
Y.addI18n("zh_CN", Ce);
|
|
55
55
|
const V = {
|
|
56
56
|
maxCount: 10,
|
|
57
57
|
tipText: "上传",
|
|
@@ -70,7 +70,7 @@ const ra = /* @__PURE__ */ ge({
|
|
|
70
70
|
enable: !0,
|
|
71
71
|
maxSize: 200,
|
|
72
72
|
allowedType: ["mp3", "m4a", "wav", "aac"]
|
|
73
|
-
}, R = h(), x = h(),
|
|
73
|
+
}, R = h(), x = h(), A = h(!1), P = h(!1), c = _(() => C([m.imageUploadOptions, T.imageUploadOptions, V]) || {}), d = _(() => C([m.videoUploadOptions, T.videoUploadOptions, B]) || {}), f = _(() => C([m.audioUploadOptions, T.audioUploadOptions, H]) || {}), k = _(() => C([m.imgPondOptions, T.imgPondOptions]) || {}), ee = _(() => {
|
|
74
74
|
var e, o;
|
|
75
75
|
return ((o = (e = c == null ? void 0 : c.value) == null ? void 0 : e.allowedType) == null ? void 0 : o.map((i) => `.${i}`).join(",")) || "";
|
|
76
76
|
}), D = h();
|
|
@@ -79,7 +79,7 @@ const ra = /* @__PURE__ */ ge({
|
|
|
79
79
|
let e;
|
|
80
80
|
J(D.value, {
|
|
81
81
|
onStart: () => {
|
|
82
|
-
e =
|
|
82
|
+
e = U.service({ text: "加载中...", fullscreen: !0, customClass: "tinymce-loading", background: "rgba(0, 0, 0, 0.8)" });
|
|
83
83
|
},
|
|
84
84
|
onSuccess: () => {
|
|
85
85
|
e == null || e.close();
|
|
@@ -96,7 +96,7 @@ const ra = /* @__PURE__ */ ge({
|
|
|
96
96
|
let e;
|
|
97
97
|
J(M.value, {
|
|
98
98
|
onStart: () => {
|
|
99
|
-
e =
|
|
99
|
+
e = U.service({ text: "加载中", fullscreen: !0, customClass: "tinymce-loading", background: "rgba(0, 0, 0, 0.8)" });
|
|
100
100
|
},
|
|
101
101
|
onSuccess: () => {
|
|
102
102
|
e == null || e.close();
|
|
@@ -116,13 +116,13 @@ const ra = /* @__PURE__ */ ge({
|
|
|
116
116
|
w.value.dialogVisible = !1, w.value.formData = {
|
|
117
117
|
images: []
|
|
118
118
|
};
|
|
119
|
-
},
|
|
119
|
+
}, ae = () => {
|
|
120
120
|
var e;
|
|
121
121
|
(e = W.value) == null || e.validate((o) => {
|
|
122
122
|
o && (w.value.formData.images.forEach((i) => {
|
|
123
123
|
var t;
|
|
124
124
|
let a = i;
|
|
125
|
-
|
|
125
|
+
k.value.srcAt && (a = (i == null ? void 0 : i[k.value.srcAt]) || ""), (t = x.value) == null || t.insertContent(`<img src=${a} alt="" />`);
|
|
126
126
|
}), j());
|
|
127
127
|
});
|
|
128
128
|
}, v = h({
|
|
@@ -143,7 +143,7 @@ const ra = /* @__PURE__ */ ge({
|
|
|
143
143
|
cover: [],
|
|
144
144
|
file: []
|
|
145
145
|
}, v.value.additionalData = {};
|
|
146
|
-
},
|
|
146
|
+
}, te = () => {
|
|
147
147
|
var e;
|
|
148
148
|
(e = $.value) == null || e.validate((o) => {
|
|
149
149
|
var i, a;
|
|
@@ -161,13 +161,13 @@ const ra = /* @__PURE__ */ ge({
|
|
|
161
161
|
g.value.dialogVisible = !1, g.value.formData = {
|
|
162
162
|
file: []
|
|
163
163
|
}, g.value.additionalData = {};
|
|
164
|
-
},
|
|
164
|
+
}, oe = () => {
|
|
165
165
|
var e;
|
|
166
166
|
(e = I.value) == null || e.validate((o) => {
|
|
167
167
|
var i, a;
|
|
168
168
|
o && ((a = x.value) == null || a.insertContent(`<video controls controlslist="nodownload" src="${(i = g.value.formData.file[0]) == null ? void 0 : i.url}"></video>`), q());
|
|
169
169
|
});
|
|
170
|
-
},
|
|
170
|
+
}, ie = (e, o) => new Promise(async (i, a) => {
|
|
171
171
|
var r, l;
|
|
172
172
|
const t = await K(e);
|
|
173
173
|
if (!t.success) {
|
|
@@ -176,7 +176,7 @@ const ra = /* @__PURE__ */ ge({
|
|
|
176
176
|
});
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
|
-
const n = await ((l = (r = c.value).handleRequest) == null ? void 0 : l.call(r, t.file, e.name, { extParameters: m.extParameters }));
|
|
179
|
+
const n = await ((l = (r = c.value).handleRequest) == null ? void 0 : l.call(r, Q(t.file, e.name), e.name, { extParameters: m.extParameters }));
|
|
180
180
|
if (!n || !(n != null && n.success)) {
|
|
181
181
|
a(), setTimeout(() => {
|
|
182
182
|
o.onError(n == null ? void 0 : n.errorMessage);
|
|
@@ -193,12 +193,12 @@ const ra = /* @__PURE__ */ ge({
|
|
|
193
193
|
if (s.startsWith("data:image"))
|
|
194
194
|
(i = l == null ? void 0 : l.remove) == null || i.call(l);
|
|
195
195
|
else if (s.startsWith("http://") || s.startsWith("https://")) {
|
|
196
|
-
const u = await
|
|
196
|
+
const u = await we(s);
|
|
197
197
|
if (u && (u.width < (c.value.minWidth || 0) && u.height < (c.value.minHeight || 0) || u.width > (c.value.maxWidth || 0) && u.height > (c.value.maxHeight || 0))) {
|
|
198
198
|
(a = l == null ? void 0 : l.remove) == null || a.call(l);
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
|
-
const p =
|
|
201
|
+
const p = X(s);
|
|
202
202
|
if (!((n = (t = c.value) == null ? void 0 : t.allowedType) != null && n.includes(p.toLowerCase()))) {
|
|
203
203
|
(r = l == null ? void 0 : l.remove) == null || r.call(l);
|
|
204
204
|
return;
|
|
@@ -206,7 +206,7 @@ const ra = /* @__PURE__ */ ge({
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
|
-
|
|
209
|
+
xe(() => {
|
|
210
210
|
var i;
|
|
211
211
|
const e = {
|
|
212
212
|
// 设置语言
|
|
@@ -301,11 +301,11 @@ const ra = /* @__PURE__ */ ge({
|
|
|
301
301
|
var N, O, L;
|
|
302
302
|
if (!((N = c.value) != null && N.handleRequest))
|
|
303
303
|
return n({ message: "缺少图片上传配置", remove: !0 });
|
|
304
|
-
const r =
|
|
304
|
+
const r = U.service({ text: "上传中....", background: "rgba(0, 0, 0, 0.8)" });
|
|
305
305
|
let l = a.blob(), s = l.name ? l.name : a.filename();
|
|
306
306
|
if (!(l != null && l.name) && !(l != null && l.lastModified) && l.type === "image/png")
|
|
307
307
|
return r == null || r.close(), n({ message: "不允许粘贴", remove: !0 });
|
|
308
|
-
const u = await
|
|
308
|
+
const u = await ye(l, s, {
|
|
309
309
|
imageMaxSize: c.value.maxSize,
|
|
310
310
|
imageAllowedType: c.value.allowedType,
|
|
311
311
|
// imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
|
|
@@ -324,7 +324,7 @@ const ra = /* @__PURE__ */ ge({
|
|
|
324
324
|
const p = await K(l);
|
|
325
325
|
if (!p.success)
|
|
326
326
|
return r == null || r.close(), n({ message: p == null ? void 0 : p.errorMessage, remove: !0 });
|
|
327
|
-
const y = await ((L = (O = c.value).handleRequest) == null ? void 0 : L.call(O, p.file, s, { extParameters: m.extParameters }));
|
|
327
|
+
const y = await ((L = (O = c.value).handleRequest) == null ? void 0 : L.call(O, Q(p.file, s), s, { extParameters: m.extParameters }));
|
|
328
328
|
if (!y || !y.success)
|
|
329
329
|
return r == null || r.close(), n({ message: y.errorMessage, remove: !0 });
|
|
330
330
|
r == null || r.close(), t(y.url);
|
|
@@ -383,7 +383,7 @@ const ra = /* @__PURE__ */ ge({
|
|
|
383
383
|
}, o = C(
|
|
384
384
|
[
|
|
385
385
|
m.options,
|
|
386
|
-
|
|
386
|
+
T.options,
|
|
387
387
|
e
|
|
388
388
|
],
|
|
389
389
|
{
|
|
@@ -393,40 +393,40 @@ const ra = /* @__PURE__ */ ge({
|
|
|
393
393
|
type: Object
|
|
394
394
|
}
|
|
395
395
|
);
|
|
396
|
-
|
|
396
|
+
Y.init(o).then(([a]) => {
|
|
397
397
|
var t;
|
|
398
398
|
a && (a.customProps = { ...m }, a.on("change input Redo Undo SetContent", () => {
|
|
399
|
-
if (
|
|
400
|
-
|
|
399
|
+
if (P.value) {
|
|
400
|
+
P.value = !1;
|
|
401
401
|
return;
|
|
402
402
|
}
|
|
403
|
-
|
|
403
|
+
A.value = !0, z("input", a.getContent());
|
|
404
404
|
}), a.on("paste", (n) => {
|
|
405
405
|
var l, s;
|
|
406
406
|
const r = ((l = n.clipboardData) == null ? void 0 : l.files) || [];
|
|
407
407
|
for (let u of r) {
|
|
408
|
-
const p =
|
|
408
|
+
const p = X(u.name) || "";
|
|
409
409
|
(s = c.value.allowedType) != null && s.includes(p.toLowerCase()) || n.preventDefault();
|
|
410
410
|
}
|
|
411
411
|
}), (t = m.initComplete) == null || t.call(m, { editorIns: a }), x.value = a);
|
|
412
412
|
});
|
|
413
|
-
}),
|
|
413
|
+
}), be(() => {
|
|
414
414
|
var e;
|
|
415
415
|
(e = x.value) == null || e.destroy();
|
|
416
416
|
});
|
|
417
|
-
const
|
|
417
|
+
const le = () => {
|
|
418
418
|
var o, i;
|
|
419
419
|
const e = { ...v.value.additionalData || {} };
|
|
420
420
|
return ((i = (o = f.value) == null ? void 0 : o.data) == null ? void 0 : i.call(o, { file: e, extParameters: m.extParameters })) || {};
|
|
421
|
-
},
|
|
421
|
+
}, ne = () => {
|
|
422
422
|
var o, i;
|
|
423
423
|
const e = { ...v.value.additionalData || {} };
|
|
424
424
|
return ((i = (o = f.value) == null ? void 0 : o.headers) == null ? void 0 : i.call(o, { file: e, extParameters: m.extParameters })) || {};
|
|
425
|
-
},
|
|
425
|
+
}, re = (e, o, i) => {
|
|
426
426
|
var t, n;
|
|
427
427
|
const a = (n = (t = f == null ? void 0 : f.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
|
|
428
428
|
a != null && a.url ? i[i.length - 1].url = a.url : a != null && a.errorMessage && (b.error(a.errorMessage), i.splice(i.length - 1, 1)), v.value.formData.file = i;
|
|
429
|
-
},
|
|
429
|
+
}, se = (e, o) => new Promise((i, a) => {
|
|
430
430
|
var n, r, l, s, u, p;
|
|
431
431
|
const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
|
|
432
432
|
if (!((r = (n = f.value) == null ? void 0 : n.allowedType) != null && r.includes(t.toLowerCase()))) {
|
|
@@ -438,23 +438,23 @@ const ra = /* @__PURE__ */ ge({
|
|
|
438
438
|
return;
|
|
439
439
|
}
|
|
440
440
|
v.value.additionalData = { file: e }, i(!0);
|
|
441
|
-
}),
|
|
441
|
+
}), ue = (e, o) => {
|
|
442
442
|
v.value.formData.file = o;
|
|
443
|
-
},
|
|
443
|
+
}, ce = (e, o, i) => {
|
|
444
444
|
b.error("上传发生错误,请重试!"), v.value.formData.file = i;
|
|
445
|
-
},
|
|
445
|
+
}, me = () => {
|
|
446
446
|
var o, i;
|
|
447
447
|
const e = { ...g.value.additionalData || {} };
|
|
448
448
|
return ((i = (o = d.value) == null ? void 0 : o.data) == null ? void 0 : i.call(o, { file: e, extParameters: m.extParameters })) || {};
|
|
449
|
-
},
|
|
449
|
+
}, de = () => {
|
|
450
450
|
var o, i;
|
|
451
451
|
const e = { ...g.value.additionalData || {} };
|
|
452
452
|
return ((i = (o = d.value) == null ? void 0 : o.headers) == null ? void 0 : i.call(o, { file: e, extParameters: m.extParameters })) || {};
|
|
453
|
-
},
|
|
453
|
+
}, pe = (e, o, i) => {
|
|
454
454
|
var t, n;
|
|
455
455
|
const a = (n = (t = d == null ? void 0 : d.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
|
|
456
456
|
a != null && a.url ? i[i.length - 1].url = a.url : a != null && a.errorMessage && (b.error(a.errorMessage), i.splice(i.length - 1, 1)), g.value.formData.file = i;
|
|
457
|
-
},
|
|
457
|
+
}, ve = (e, o) => new Promise((i, a) => {
|
|
458
458
|
var n, r, l, s, u, p;
|
|
459
459
|
const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
|
|
460
460
|
if (!((r = (n = d == null ? void 0 : d.value) == null ? void 0 : n.allowedType) != null && r.includes(t.toLowerCase()))) {
|
|
@@ -466,9 +466,9 @@ const ra = /* @__PURE__ */ ge({
|
|
|
466
466
|
return;
|
|
467
467
|
}
|
|
468
468
|
g.value.additionalData = { file: e }, i(!0);
|
|
469
|
-
}),
|
|
469
|
+
}), fe = (e, o) => {
|
|
470
470
|
g.value.formData.file = o;
|
|
471
|
-
},
|
|
471
|
+
}, ge = (e, o, i) => {
|
|
472
472
|
b.error("上传发生错误,请重试!"), g.value.formData.file = i;
|
|
473
473
|
};
|
|
474
474
|
return S(() => [m.disabled, x.value], () => {
|
|
@@ -478,16 +478,16 @@ const ra = /* @__PURE__ */ ge({
|
|
|
478
478
|
() => [m.value, x.value],
|
|
479
479
|
() => {
|
|
480
480
|
var e;
|
|
481
|
-
if (
|
|
482
|
-
|
|
481
|
+
if (A.value) {
|
|
482
|
+
A.value = !1;
|
|
483
483
|
return;
|
|
484
484
|
}
|
|
485
|
-
|
|
485
|
+
P.value = !0, (e = x.value) == null || e.setContent(m.value ? m.value : "");
|
|
486
486
|
},
|
|
487
487
|
{ immediate: !0 }
|
|
488
|
-
), { __sfc: !0, defaultImageUploadOptions: V, defaultVideoUploadOptions: B, defaultAudioUploadOptions: H, props: m, emits: z, insRef: R, editorRef: x, preventSettingContent:
|
|
488
|
+
), { __sfc: !0, defaultImageUploadOptions: V, defaultVideoUploadOptions: B, defaultAudioUploadOptions: H, props: m, emits: z, insRef: R, editorRef: x, preventSettingContent: A, preventUpdatingModelValue: P, mergeImageUploadOptions: c, mergeVideoUploadOptions: d, mergeAudioUploadOptions: f, mergeImgPondOptions: k, imgPondAccept: ee, uploadImageImgPondRef: D, audioImageImgPondRef: M, uploadImage: w, uploadImageFormRef: W, onUploadImageClose: j, onUploadImageConfirm: ae, uploadAudio: v, uploadAudioFormRef: $, onUploadAudioClose: E, onUploadAudioConfirm: te, uploadVideo: g, uploadVideoFormRef: I, onUploadVideoClose: q, onUploadVideoConfirm: oe, onImageUploadUpload: ie, processPastedImage: F, getUploadAudioData: le, getUploadAudioHeaders: ne, onUploadAudioSuccess: re, onUploadAudioBeforeUpload: se, onUploadAudioRemove: ue, onUploadAudioError: ce, getUploadVideoData: me, getUploadVideoHeaders: de, onUploadVideoSuccess: pe, onUploadVideoBeforeUpload: ve, onUploadVideoRemove: fe, onUploadVideoError: ge, ImgPond: _e };
|
|
489
489
|
}
|
|
490
490
|
});
|
|
491
491
|
export {
|
|
492
|
-
|
|
492
|
+
sa as default
|
|
493
493
|
};
|
package/es/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import './style.css';
|
|
2
2
|
import o from "./editor.vue.js";
|
|
3
|
-
import { Button as s, Slider as i, Dialog as n, Upload as r, Tag as u, Form as m, FormItem as l, ButtonGroup as g, InputNumber as c, Loading as
|
|
4
|
-
import { getFileExtension as
|
|
5
|
-
const
|
|
3
|
+
import { Button as s, Slider as i, Dialog as n, Upload as r, Tag as u, Form as m, FormItem as l, ButtonGroup as g, InputNumber as c, Loading as b } from "element-ui";
|
|
4
|
+
import { blobToFile as y, getFileExtension as I, getImagePixel as j } from "./util.js";
|
|
5
|
+
const d = {}, x = Object.assign(o, {
|
|
6
6
|
install: (e, t) => {
|
|
7
|
-
Object.assign(
|
|
7
|
+
Object.assign(d, t || {}), e.use(s), e.use(i), e.use(n), e.use(r), e.use(u), e.use(m), e.use(l), e.use(g), e.use(c), e.use(b), e.component("KbTinymceEditor", o);
|
|
8
8
|
}
|
|
9
9
|
});
|
|
10
10
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
I as
|
|
15
|
-
|
|
11
|
+
x as TinymceEditor,
|
|
12
|
+
y as blobToFile,
|
|
13
|
+
x as default,
|
|
14
|
+
I as getFileExtension,
|
|
15
|
+
j as getImagePixel,
|
|
16
|
+
d as globalProps
|
|
16
17
|
};
|
package/es/types.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface ImageUploadOptions {
|
|
|
17
17
|
/** 图片最大高度 */
|
|
18
18
|
maxHeight?: number;
|
|
19
19
|
/** 图片上传请求处理 */
|
|
20
|
-
handleRequest?: (file: File
|
|
20
|
+
handleRequest?: (file: File, filename: string, options?: {
|
|
21
21
|
extParameters?: Record<string, any>;
|
|
22
22
|
}) => Promise<{
|
|
23
23
|
success: boolean;
|
package/es/util.d.ts
CHANGED
|
@@ -12,3 +12,9 @@ export declare function getImagePixel(src: string): Promise<{
|
|
|
12
12
|
* @param filename 文件名
|
|
13
13
|
*/
|
|
14
14
|
export declare function getFileExtension(filename: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* blob 转 file
|
|
17
|
+
* @param data
|
|
18
|
+
* @param filename
|
|
19
|
+
*/
|
|
20
|
+
export declare function blobToFile(data: File | Blob, filename: string): File;
|
package/es/util.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
function
|
|
1
|
+
function r(e) {
|
|
2
2
|
return new Promise((n) => {
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
n({ width:
|
|
6
|
-
},
|
|
3
|
+
const i = new Image();
|
|
4
|
+
i.onload = function() {
|
|
5
|
+
n({ width: i.width, height: i.height, image: i });
|
|
6
|
+
}, i.onerror = function(t) {
|
|
7
7
|
n(void 0);
|
|
8
|
-
},
|
|
8
|
+
}, i.src = e;
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function o(e) {
|
|
12
12
|
const n = e.split(".");
|
|
13
13
|
return n ? n[n.length - 1] : "";
|
|
14
14
|
}
|
|
15
|
+
function u(e, n) {
|
|
16
|
+
return e.name ? e : new File([e], n, { type: e.type });
|
|
17
|
+
}
|
|
15
18
|
export {
|
|
16
|
-
|
|
17
|
-
o as
|
|
19
|
+
u as blobToFile,
|
|
20
|
+
o as getFileExtension,
|
|
21
|
+
r as getImagePixel
|
|
18
22
|
};
|
package/package.json
CHANGED