@emailmaker/filemanager 1.1.69 → 1.1.70
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/.build-meta.json +1 -1
- package/core.esm.js +197 -160
- package/core.js +1 -1
- package/{file-manager-IconsTab-BPDaI1rw.js → file-manager-IconsTab-pUKiId5k.js} +106 -106
- package/{file-manager-ImageCodeGenerator-Bfcf-n-G.js → file-manager-ImageCodeGenerator-sUlzbDys.js} +115 -115
- package/{file-manager-PixieEditor-BRUKJkjp.js → file-manager-PixieEditor-Doy__jUq.js} +149 -149
- package/{file-manager-hooks-aNT0w8kI.js → file-manager-hooks-vqT-4jeg.js} +1489 -1456
- package/{file-manager-useMediaListEngine-zkDk3m1H.js → file-manager-useMediaListEngine-BitrHuUM.js} +2 -2
- package/file-manager.d.ts +2 -20
- package/file-manager.esm.js +2561 -2549
- package/file-manager.js +12 -12
- package/notification.d.ts +4 -4
- package/package.json +1 -1
- package/utils/pixieEditorConfig.d.ts +38 -0
- package/utils/pixieEditorConfig.test.d.ts +1 -0
- package/utils/urlNormalization.d.ts +9 -0
- package/utils/urlNormalization.test.d.ts +1 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as
|
|
3
|
-
import
|
|
4
|
-
import { Button as
|
|
5
|
-
import { jsx as
|
|
6
|
-
import { CloseOutlined as
|
|
7
|
-
import { Pixie as
|
|
1
|
+
import { B as e, C as t, G as n, I as r, M as i, N as a, Q as o, T as s, X as c, _ as l, f as u, nt as ee, ut as d, w as f } from "./file-manager-hooks-vqT-4jeg.js";
|
|
2
|
+
import { i as p, t as te } from "./file-manager-urls-DN9gaYil.js";
|
|
3
|
+
import m from "react";
|
|
4
|
+
import { Button as h, Modal as ne } from "antd";
|
|
5
|
+
import { jsx as g, jsxs as re } from "react/jsx-runtime";
|
|
6
|
+
import { CloseOutlined as ie, HistoryOutlined as ae } from "@ant-design/icons";
|
|
7
|
+
import { Pixie as _ } from "pixie";
|
|
8
8
|
//#region packages/file-manager/src/components/PixieEditor/backgroundColor.ts
|
|
9
|
-
function
|
|
9
|
+
function v(e, t, n, r, i, a) {
|
|
10
10
|
if (t.type === "linear") {
|
|
11
11
|
let i = e.createLinearGradient(n + t.coords.x1, r + t.coords.y1, n + t.coords.x2, r + t.coords.y2);
|
|
12
12
|
return t.colorStops.forEach((e) => i.addColorStop(e.offset, e.color)), i;
|
|
@@ -17,35 +17,35 @@ function y(e, t, n, r, i, a) {
|
|
|
17
17
|
}
|
|
18
18
|
throw Error("Unknown gradient type");
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function y(e) {
|
|
21
21
|
if (!this.backgroundColor) return;
|
|
22
22
|
let t = this._getNonTransformedDimensions(), n = -t.x / 2, r = -t.y / 2, i = t.x, a = t.y, o = this.backgroundColor;
|
|
23
23
|
if (typeof o == "string" || o instanceof CanvasGradient || o instanceof CanvasPattern) e.fillStyle = o, e.fillRect(n, r, i, a);
|
|
24
|
-
else if (typeof o == "object" && "type" in o && (o.type === "linear" || o.type === "radial")) e.fillStyle =
|
|
24
|
+
else if (typeof o == "object" && "type" in o && (o.type === "linear" || o.type === "radial")) e.fillStyle = v(e, o, n, r, i, a), e.fillRect(n, r, i, a);
|
|
25
25
|
else if ("source" in o && (o.source instanceof HTMLImageElement || o.source instanceof HTMLCanvasElement)) if (o.repeat) {
|
|
26
26
|
let t = e.createPattern(o.source, o.repeat);
|
|
27
27
|
t && (e.fillStyle = t, e.fillRect(n, r, i, a));
|
|
28
28
|
} else e.drawImage(o.source, n, r, i, a);
|
|
29
29
|
this._removeShadow(e);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function b(e) {
|
|
32
32
|
if (!e.fabric) {
|
|
33
33
|
console.warn("Pixie fabric instance is not available");
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
e.fabric.on("object:added", (e) => {
|
|
37
37
|
let t = e.target;
|
|
38
|
-
t && t.name === "text" && (t._renderBackground =
|
|
38
|
+
t && t.name === "text" && (t._renderBackground = y);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region packages/file-manager/src/components/PixieEditor/PixieController.tsx
|
|
43
|
-
var
|
|
43
|
+
var x = "fm-pixie-editor", S = new class {
|
|
44
44
|
constructor() {
|
|
45
|
-
this._container = document.createElement("div"), this._instance = null, this._container.classList.add(
|
|
45
|
+
this._container = document.createElement("div"), this._instance = null, this._container.classList.add(x), this._container.style.width = "100%", this._container.style.height = "85vh", this._container.style.minHeight = "400px";
|
|
46
46
|
}
|
|
47
47
|
get className() {
|
|
48
|
-
return `.${
|
|
48
|
+
return `.${x}`;
|
|
49
49
|
}
|
|
50
50
|
get canvas() {
|
|
51
51
|
return this._instance?.state.canvasRef?.current;
|
|
@@ -57,10 +57,10 @@ var S = "fm-pixie-editor", C = new class {
|
|
|
57
57
|
return !!this._instance;
|
|
58
58
|
}
|
|
59
59
|
async _setConfig(e) {
|
|
60
|
-
this._instance ? await this._instance.resetEditor(e) : this._instance = await
|
|
60
|
+
this._instance ? await this._instance.resetEditor(e) : this._instance = await _.init({
|
|
61
61
|
...e,
|
|
62
62
|
selector: this.className
|
|
63
|
-
}),
|
|
63
|
+
}), b(this._instance);
|
|
64
64
|
}
|
|
65
65
|
async show(e, t, n = t.firstChild) {
|
|
66
66
|
t.insertBefore(this._container, n), await this._setConfig(e), this._instance.open();
|
|
@@ -68,59 +68,59 @@ var S = "fm-pixie-editor", C = new class {
|
|
|
68
68
|
close() {
|
|
69
69
|
this._container.parentNode?.removeChild(this._container);
|
|
70
70
|
}
|
|
71
|
-
}(),
|
|
72
|
-
function
|
|
71
|
+
}(), C = (e, t = "image/png") => fetch(`data:${t};base64,${e}`).then((e) => e.blob());
|
|
72
|
+
function oe(e, t) {
|
|
73
73
|
if (e === "json") return new Blob([t], { type: "application/json" });
|
|
74
74
|
if (e === "svg") return new Blob([t], { type: "image/svg+xml" });
|
|
75
|
-
let
|
|
75
|
+
let n = `image/${e}`;
|
|
76
76
|
if (t.startsWith("data:")) {
|
|
77
|
-
let e =
|
|
78
|
-
return e && e.startsWith("image/") && (
|
|
77
|
+
let e = c(t);
|
|
78
|
+
return e && e.startsWith("image/") && (n = e), C(t.replace(/data:image\/[^;]+;base64,/, ""), o(n));
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return C(t, o(n));
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function w(e) {
|
|
83
83
|
return new Promise((t, n) => {
|
|
84
84
|
let r = new FileReader();
|
|
85
85
|
r.onload = () => t(r.result), r.onerror = () => n(r.error ?? /* @__PURE__ */ Error("Failed to convert blob to data URL")), r.readAsDataURL(e);
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
var T = ({ visible:
|
|
89
|
-
let { t:
|
|
90
|
-
G.current =
|
|
91
|
-
|
|
92
|
-
if (J.current !==
|
|
93
|
-
if (typeof
|
|
94
|
-
U(
|
|
88
|
+
var T = ({ visible: c, onClose: _, file: v, onSave: y, onSaveCopy: b }) => {
|
|
89
|
+
let { t: x } = n(), C = m.useRef(null), T = r(), se = u(), { options: E, actions: ce } = e(), { i18n: D } = n(), { config: O } = E, { setCurrentMenuFile: k } = ce, { getFileData: A, resolveFileForEditByUrl: j } = se, [M, N] = m.useState(!1), [P, F] = m.useState(null), [I, L] = m.useState(""), [R, z] = m.useState(!1), [B, V] = m.useState(!1), [H, U] = m.useState(null), W = m.useRef(!1), G = m.useRef(void 0), K = m.useRef(void 0), q = m.useRef("saveCopy"), J = m.useRef(void 0);
|
|
90
|
+
G.current = y, K.current = b, m.useEffect(() => {
|
|
91
|
+
v && !W.current && (async () => {
|
|
92
|
+
if (J.current !== v) {
|
|
93
|
+
if (typeof v == "object") {
|
|
94
|
+
U(v);
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
-
J.current =
|
|
97
|
+
J.current = v, N(!0);
|
|
98
98
|
try {
|
|
99
|
-
if (
|
|
100
|
-
thumbnail:
|
|
99
|
+
if (v.startsWith("data:")) U({
|
|
100
|
+
thumbnail: v,
|
|
101
101
|
saveWithoutFolder: !0
|
|
102
102
|
});
|
|
103
103
|
else {
|
|
104
|
-
let e = await j(
|
|
105
|
-
J.current ===
|
|
104
|
+
let e = await j(v);
|
|
105
|
+
J.current === v && U(e);
|
|
106
106
|
}
|
|
107
107
|
} catch (e) {
|
|
108
|
-
console.error("Failed to load file for editor:", e), J.current ===
|
|
108
|
+
console.error("Failed to load file for editor:", e), J.current === v && (J.current = null), _?.();
|
|
109
109
|
} finally {
|
|
110
110
|
N(!1);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
})();
|
|
114
114
|
}, [
|
|
115
|
-
y,
|
|
116
115
|
v,
|
|
116
|
+
_,
|
|
117
117
|
j
|
|
118
118
|
]);
|
|
119
|
-
let Y =
|
|
119
|
+
let Y = m.useCallback(async (e) => {
|
|
120
120
|
try {
|
|
121
121
|
if (typeof e.thumbnail == "string" && e.thumbnail.startsWith("data:")) return e.thumbnail;
|
|
122
122
|
let t = await A(e.id, !0);
|
|
123
|
-
if (!t) throw Error(
|
|
123
|
+
if (!t) throw Error(x("Error loading image"));
|
|
124
124
|
return new Promise((e) => {
|
|
125
125
|
let n = new FileReader();
|
|
126
126
|
n.onload = () => e(n.result), n.readAsDataURL(t);
|
|
@@ -128,9 +128,9 @@ var T = ({ visible: n, onClose: v, file: y, onSave: b, onSaveCopy: x }) => {
|
|
|
128
128
|
} catch (e) {
|
|
129
129
|
throw console.error("Error getting the image data:", e), e;
|
|
130
130
|
}
|
|
131
|
-
}, [A,
|
|
132
|
-
|
|
133
|
-
if (!P &&
|
|
131
|
+
}, [A, x]);
|
|
132
|
+
m.useEffect(() => {
|
|
133
|
+
if (!P && c && H) {
|
|
134
134
|
let e = !1;
|
|
135
135
|
return (async () => {
|
|
136
136
|
N(!0);
|
|
@@ -146,14 +146,14 @@ var T = ({ visible: n, onClose: v, file: y, onSave: b, onSaveCopy: x }) => {
|
|
|
146
146
|
if (!/^[A-Za-z0-9+/]+=*$/.test(i)) throw Error("Invalid image data: corrupted base64 content");
|
|
147
147
|
if (!e) {
|
|
148
148
|
F(t);
|
|
149
|
-
let e =
|
|
149
|
+
let e = f(H, "image/png");
|
|
150
150
|
L(e.mimeType);
|
|
151
151
|
}
|
|
152
152
|
} catch (t) {
|
|
153
153
|
e || (T.error({
|
|
154
154
|
id: "IMAGE_DOWNLOAD_FAILED",
|
|
155
155
|
innerException: t,
|
|
156
|
-
message:
|
|
156
|
+
message: x("Error loading image"),
|
|
157
157
|
placement: "bottomRight",
|
|
158
158
|
data: {
|
|
159
159
|
itemId: H?.id ?? void 0,
|
|
@@ -161,7 +161,7 @@ var T = ({ visible: n, onClose: v, file: y, onSave: b, onSaveCopy: x }) => {
|
|
|
161
161
|
folderId: H?.folderId ?? null,
|
|
162
162
|
thumbnail: H?.thumbnail
|
|
163
163
|
}
|
|
164
|
-
}),
|
|
164
|
+
}), _?.());
|
|
165
165
|
} finally {
|
|
166
166
|
N(!1);
|
|
167
167
|
}
|
|
@@ -173,71 +173,71 @@ var T = ({ visible: n, onClose: v, file: y, onSave: b, onSaveCopy: x }) => {
|
|
|
173
173
|
H,
|
|
174
174
|
Y,
|
|
175
175
|
P,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
_,
|
|
177
|
+
x,
|
|
178
|
+
c
|
|
179
179
|
]);
|
|
180
|
-
let X =
|
|
181
|
-
let
|
|
182
|
-
if (
|
|
183
|
-
let e = await
|
|
180
|
+
let X = m.useCallback(async (e, t, n) => {
|
|
181
|
+
let r = await oe(n, e), i = o(r.type || `image/${n}`), a = O?.compessorUrl ?? O?.compressorUrl;
|
|
182
|
+
if (i.startsWith("image/")) try {
|
|
183
|
+
let e = await l(new File([r], t, { type: i }), {
|
|
184
184
|
maxSizeMB: O?.compressMaxSize,
|
|
185
185
|
maxWidthOrHeight: O?.compressMaxWidthOrHeight,
|
|
186
|
-
mimeType:
|
|
187
|
-
fileName:
|
|
188
|
-
libURL:
|
|
189
|
-
enableCompression:
|
|
186
|
+
mimeType: i,
|
|
187
|
+
fileName: t,
|
|
188
|
+
libURL: a,
|
|
189
|
+
enableCompression: s(O, i)
|
|
190
190
|
});
|
|
191
|
-
|
|
191
|
+
r = e, i = e.type;
|
|
192
192
|
} catch (e) {
|
|
193
193
|
console.warn("Image preparation failed, using original:", e);
|
|
194
194
|
}
|
|
195
195
|
return {
|
|
196
|
-
blob:
|
|
197
|
-
mimeType:
|
|
198
|
-
thumbnailDataUrl: await
|
|
196
|
+
blob: r,
|
|
197
|
+
mimeType: i,
|
|
198
|
+
thumbnailDataUrl: await w(r)
|
|
199
199
|
};
|
|
200
|
-
}, [O]), Z =
|
|
201
|
-
let
|
|
202
|
-
if (!H || !
|
|
203
|
-
let
|
|
200
|
+
}, [O]), Z = m.useCallback(async (e, t, n, r) => {
|
|
201
|
+
let o = r === "save" ? G.current : K.current;
|
|
202
|
+
if (!H || !o) return;
|
|
203
|
+
let s = typeof H == "object" && H ? H : null, c = null;
|
|
204
204
|
try {
|
|
205
205
|
N(!0);
|
|
206
|
-
let { blob:
|
|
206
|
+
let { blob: i, mimeType: a, thumbnailDataUrl: s } = await X(e, t, n), l = {
|
|
207
207
|
...H,
|
|
208
|
-
thumbnail:
|
|
209
|
-
size:
|
|
208
|
+
thumbnail: s,
|
|
209
|
+
size: i.size,
|
|
210
210
|
date: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
|
|
211
|
-
type:
|
|
211
|
+
type: a,
|
|
212
212
|
folderId: H.folderId || "",
|
|
213
|
-
name: H.name ||
|
|
214
|
-
extension: H.extension || (H.name ||
|
|
213
|
+
name: H.name || t,
|
|
214
|
+
extension: H.extension || (H.name || t).split(".").pop()?.toLowerCase() || ""
|
|
215
215
|
};
|
|
216
|
-
|
|
217
|
-
let u = await
|
|
218
|
-
blob:
|
|
219
|
-
mimeType:
|
|
220
|
-
thumbnail:
|
|
221
|
-
mode:
|
|
216
|
+
c = l;
|
|
217
|
+
let u = await o(l, {
|
|
218
|
+
blob: i,
|
|
219
|
+
mimeType: a,
|
|
220
|
+
thumbnail: s,
|
|
221
|
+
mode: r
|
|
222
222
|
});
|
|
223
223
|
if (u) return N(!1), u;
|
|
224
|
-
throw Error(
|
|
225
|
-
} catch (
|
|
226
|
-
console.error("Error saving:",
|
|
227
|
-
let
|
|
228
|
-
if (!
|
|
229
|
-
let
|
|
224
|
+
throw Error(x(r === "saveCopy" ? "Failed to save image copy" : "Failed to save changes"));
|
|
225
|
+
} catch (e) {
|
|
226
|
+
console.error("Error saving:", e);
|
|
227
|
+
let n = c ?? s;
|
|
228
|
+
if (!e?.notificationShown) {
|
|
229
|
+
let o = i(e), s = a(o?.code, x) ?? o?.message ?? x(r === "saveCopy" ? "Failed to save image copy" : "Error saving image");
|
|
230
230
|
T.error({
|
|
231
|
-
id:
|
|
232
|
-
message:
|
|
231
|
+
id: r === "saveCopy" ? "IMAGE_SAVE_COPY_FAILED" : "IMAGE_SAVE_FAILED",
|
|
232
|
+
message: s,
|
|
233
233
|
placement: "bottomRight",
|
|
234
234
|
data: {
|
|
235
|
-
itemId:
|
|
236
|
-
itemName:
|
|
237
|
-
folderId:
|
|
238
|
-
thumbnail:
|
|
235
|
+
itemId: n?.id ?? void 0,
|
|
236
|
+
itemName: n?.name ?? t,
|
|
237
|
+
folderId: n?.folderId ?? null,
|
|
238
|
+
thumbnail: n?.thumbnail
|
|
239
239
|
},
|
|
240
|
-
innerException:
|
|
240
|
+
innerException: e
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
243
|
N(!1);
|
|
@@ -246,21 +246,21 @@ var T = ({ visible: n, onClose: v, file: y, onSave: b, onSaveCopy: x }) => {
|
|
|
246
246
|
H,
|
|
247
247
|
T,
|
|
248
248
|
X,
|
|
249
|
-
|
|
250
|
-
]), Q =
|
|
251
|
-
if (!
|
|
249
|
+
x
|
|
250
|
+
]), Q = m.useCallback(async (e) => {
|
|
251
|
+
if (!S.isLoaded() || !H) {
|
|
252
252
|
console.error("❌ Pixie instance or file is missing");
|
|
253
253
|
return;
|
|
254
254
|
}
|
|
255
255
|
q.current = e;
|
|
256
|
-
let
|
|
256
|
+
let n = H.name || "edited-image", r = f(H, I);
|
|
257
257
|
try {
|
|
258
|
-
await
|
|
259
|
-
} catch (
|
|
260
|
-
console.error("🎨 Error saving through the button:",
|
|
258
|
+
await S.tools?.export.save(n.replace(/\.[^/.]+$/, ""), r.pixieFormat, t.QUALITY);
|
|
259
|
+
} catch (t) {
|
|
260
|
+
console.error("🎨 Error saving through the button:", t);
|
|
261
261
|
try {
|
|
262
|
-
let
|
|
263
|
-
i && await Z(i,
|
|
262
|
+
let t = S.canvas, i = t ? t.toDataURL(r.mimeType) : null;
|
|
263
|
+
i && await Z(i, n, r.extension, e);
|
|
264
264
|
} catch (e) {
|
|
265
265
|
console.error("🎨 Alternative method also did not work:", e);
|
|
266
266
|
}
|
|
@@ -269,24 +269,24 @@ var T = ({ visible: n, onClose: v, file: y, onSave: b, onSaveCopy: x }) => {
|
|
|
269
269
|
H,
|
|
270
270
|
I,
|
|
271
271
|
Z
|
|
272
|
-
]), $ =
|
|
273
|
-
if (!(!P || !
|
|
272
|
+
]), $ = m.useCallback(async () => {
|
|
273
|
+
if (!(!P || !c || !R || W.current)) try {
|
|
274
274
|
W.current = !0;
|
|
275
|
-
let e =
|
|
276
|
-
for (;
|
|
277
|
-
let
|
|
275
|
+
let e = C.current, n = 0;
|
|
276
|
+
for (; n < 20 && (e.clientWidth === 0 || e.clientHeight === 0);) await new Promise((e) => setTimeout(e, 50)), n++;
|
|
277
|
+
let r = O?.locale ? O?.locale.replace("_", "-") : "en", i = matchMedia("(prefers-color-scheme: dark)").matches ? ee : d, a = O?.theme === "system" ? i : O?.theme, o = (O?.locale || D.language || "en").split("-")[0].split("_")[0], s = (D.getResourceBundle(o, "translation") || {}).pixie || {}, c = (e) => e.split(" ").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" "), l = {};
|
|
278
278
|
Object.entries(s).forEach(([e, t]) => {
|
|
279
|
-
let n =
|
|
280
|
-
|
|
279
|
+
let n = c(e);
|
|
280
|
+
l[n] = t, l[e] = t;
|
|
281
281
|
});
|
|
282
|
-
let
|
|
282
|
+
let u = { [r]: l }, p = f(H, I), m = {
|
|
283
283
|
selector: "#pixie-editor",
|
|
284
|
-
baseUrl:
|
|
284
|
+
baseUrl: te(O?.baseUrl || "", O?.assetsUrl || "assets/image-editor"),
|
|
285
285
|
image: P,
|
|
286
|
-
activeLanguage:
|
|
287
|
-
languages:
|
|
286
|
+
activeLanguage: r,
|
|
287
|
+
languages: u,
|
|
288
288
|
ui: {
|
|
289
|
-
activeTheme:
|
|
289
|
+
activeTheme: a,
|
|
290
290
|
mode: "inline",
|
|
291
291
|
forceOverlayModeOnMobile: !1,
|
|
292
292
|
visible: !0,
|
|
@@ -307,17 +307,17 @@ var T = ({ visible: n, onClose: v, file: y, onSave: b, onSaveCopy: x }) => {
|
|
|
307
307
|
type: "button",
|
|
308
308
|
align: "right",
|
|
309
309
|
desktopOnly: !0,
|
|
310
|
-
icon: () => /* @__PURE__ */
|
|
310
|
+
icon: () => /* @__PURE__ */ g(ae, { style: { fontSize: 20 } }),
|
|
311
311
|
action: (e) => {
|
|
312
312
|
e.togglePanel("history");
|
|
313
313
|
}
|
|
314
314
|
},
|
|
315
315
|
{
|
|
316
316
|
type: "button",
|
|
317
|
-
icon: () => /* @__PURE__ */
|
|
317
|
+
icon: () => /* @__PURE__ */ g(ie, { style: { fontSize: 20 } }),
|
|
318
318
|
align: "right",
|
|
319
319
|
desktopOnly: !0,
|
|
320
|
-
action:
|
|
320
|
+
action: _
|
|
321
321
|
}
|
|
322
322
|
]
|
|
323
323
|
},
|
|
@@ -325,8 +325,8 @@ var T = ({ visible: n, onClose: v, file: y, onSave: b, onSaveCopy: x }) => {
|
|
|
325
325
|
},
|
|
326
326
|
tools: {
|
|
327
327
|
export: {
|
|
328
|
-
defaultFormat:
|
|
329
|
-
defaultQuality:
|
|
328
|
+
defaultFormat: p.pixieFormat,
|
|
329
|
+
defaultQuality: t.QUALITY,
|
|
330
330
|
defaultName: H?.name?.replace(/\.[^/.]+$/, "") || "image"
|
|
331
331
|
},
|
|
332
332
|
text: {
|
|
@@ -457,8 +457,8 @@ var T = ({ visible: n, onClose: v, file: y, onSave: b, onSaveCopy: x }) => {
|
|
|
457
457
|
}
|
|
458
458
|
};
|
|
459
459
|
try {
|
|
460
|
-
V(!1), await
|
|
461
|
-
let e =
|
|
460
|
+
V(!1), await S.show(m, C.current);
|
|
461
|
+
let e = S.canvas;
|
|
462
462
|
e && e.focus(), V(!0), N(!1);
|
|
463
463
|
} catch (e) {
|
|
464
464
|
console.error("init pixie failed:", e);
|
|
@@ -466,38 +466,38 @@ var T = ({ visible: n, onClose: v, file: y, onSave: b, onSaveCopy: x }) => {
|
|
|
466
466
|
} catch (e) {
|
|
467
467
|
console.error("Error initializing Pixie:", e), T.error({
|
|
468
468
|
id: "EDITOR_INIT_FAILED",
|
|
469
|
-
message:
|
|
469
|
+
message: x("Error initializing editor"),
|
|
470
470
|
placement: "bottomRight",
|
|
471
471
|
innerException: e
|
|
472
|
-
}), W.current = !1,
|
|
472
|
+
}), W.current = !1, _?.();
|
|
473
473
|
}
|
|
474
474
|
}, [
|
|
475
475
|
H,
|
|
476
476
|
I,
|
|
477
477
|
P,
|
|
478
|
-
|
|
478
|
+
c,
|
|
479
479
|
R,
|
|
480
480
|
O?.locale,
|
|
481
481
|
O?.theme,
|
|
482
482
|
O?.baseUrl,
|
|
483
483
|
O?.assetsUrl,
|
|
484
|
-
|
|
484
|
+
_,
|
|
485
485
|
Z,
|
|
486
486
|
T,
|
|
487
487
|
D,
|
|
488
|
-
|
|
488
|
+
x
|
|
489
489
|
]);
|
|
490
|
-
|
|
491
|
-
|
|
490
|
+
m.useEffect(() => {
|
|
491
|
+
c && P && R && $();
|
|
492
492
|
}, [
|
|
493
|
-
|
|
493
|
+
c,
|
|
494
494
|
P,
|
|
495
495
|
R,
|
|
496
496
|
$
|
|
497
|
-
]),
|
|
498
|
-
if (!
|
|
497
|
+
]), m.useEffect(() => {
|
|
498
|
+
if (!c) {
|
|
499
499
|
try {
|
|
500
|
-
|
|
500
|
+
S.close();
|
|
501
501
|
} catch (e) {
|
|
502
502
|
console.warn("Error closing Pixie:", e);
|
|
503
503
|
}
|
|
@@ -505,18 +505,18 @@ var T = ({ visible: n, onClose: v, file: y, onSave: b, onSaveCopy: x }) => {
|
|
|
505
505
|
}
|
|
506
506
|
return () => {
|
|
507
507
|
try {
|
|
508
|
-
|
|
508
|
+
S.close();
|
|
509
509
|
} catch (e) {
|
|
510
510
|
console.warn("Error closing Pixie when unmounting:", e);
|
|
511
511
|
}
|
|
512
512
|
};
|
|
513
|
-
}, [
|
|
513
|
+
}, [c]);
|
|
514
514
|
let le = !!H?.id && O?.features?.enableUpdateFile !== !1;
|
|
515
|
-
return /* @__PURE__ */
|
|
516
|
-
title: H?.name ?
|
|
517
|
-
open:
|
|
515
|
+
return /* @__PURE__ */ g(ne, {
|
|
516
|
+
title: H?.name ? x("Editing: {{name}}", { name: H.name }) : x("Editing image"),
|
|
517
|
+
open: c,
|
|
518
518
|
closeIcon: null,
|
|
519
|
-
onCancel:
|
|
519
|
+
onCancel: _,
|
|
520
520
|
afterOpenChange: (e) => z(e),
|
|
521
521
|
forceRender: !0,
|
|
522
522
|
width: "100vw",
|
|
@@ -532,22 +532,22 @@ var T = ({ visible: n, onClose: v, file: y, onSave: b, onSaveCopy: x }) => {
|
|
|
532
532
|
padding: 0
|
|
533
533
|
} },
|
|
534
534
|
footer: [
|
|
535
|
-
/* @__PURE__ */
|
|
536
|
-
onClick:
|
|
535
|
+
/* @__PURE__ */ g(h, {
|
|
536
|
+
onClick: _,
|
|
537
537
|
disabled: !R || M,
|
|
538
|
-
children:
|
|
538
|
+
children: x("Cancel")
|
|
539
539
|
}, "cancel"),
|
|
540
|
-
/* @__PURE__ */
|
|
540
|
+
/* @__PURE__ */ g(h, {
|
|
541
541
|
type: "primary",
|
|
542
542
|
onClick: () => Q("saveCopy"),
|
|
543
543
|
loading: M,
|
|
544
|
-
children:
|
|
544
|
+
children: x("Save as copy and choose")
|
|
545
545
|
}, "save-copy"),
|
|
546
|
-
...le ? [/* @__PURE__ */
|
|
546
|
+
...le ? [/* @__PURE__ */ g(h, {
|
|
547
547
|
type: "primary",
|
|
548
548
|
onClick: () => Q("save"),
|
|
549
549
|
loading: M,
|
|
550
|
-
children:
|
|
550
|
+
children: x("Save and choose")
|
|
551
551
|
}, "save")] : []
|
|
552
552
|
],
|
|
553
553
|
mask: { closable: !1 },
|
|
@@ -555,14 +555,14 @@ var T = ({ visible: n, onClose: v, file: y, onSave: b, onSaveCopy: x }) => {
|
|
|
555
555
|
afterClose: () => {
|
|
556
556
|
k && k("");
|
|
557
557
|
},
|
|
558
|
-
children: /* @__PURE__ */
|
|
559
|
-
ref:
|
|
558
|
+
children: /* @__PURE__ */ re("div", {
|
|
559
|
+
ref: C,
|
|
560
560
|
style: {
|
|
561
561
|
position: "relative",
|
|
562
562
|
width: "100%",
|
|
563
563
|
height: "100%"
|
|
564
564
|
},
|
|
565
|
-
children: [
|
|
565
|
+
children: [c && !B ? /* @__PURE__ */ g("div", {
|
|
566
566
|
style: {
|
|
567
567
|
position: "absolute",
|
|
568
568
|
inset: 0,
|
|
@@ -574,14 +574,14 @@ var T = ({ visible: n, onClose: v, file: y, onSave: b, onSaveCopy: x }) => {
|
|
|
574
574
|
pointerEvents: "all",
|
|
575
575
|
zIndex: 10
|
|
576
576
|
},
|
|
577
|
-
children: /* @__PURE__ */
|
|
577
|
+
children: /* @__PURE__ */ g("span", {
|
|
578
578
|
style: {
|
|
579
579
|
fontSize: 14,
|
|
580
580
|
color: "#555"
|
|
581
581
|
},
|
|
582
|
-
children:
|
|
582
|
+
children: x("Loading editor...")
|
|
583
583
|
})
|
|
584
|
-
}) : null, M && B && /* @__PURE__ */
|
|
584
|
+
}) : null, M && B && /* @__PURE__ */ g(p, { style: {
|
|
585
585
|
position: "absolute",
|
|
586
586
|
top: 0,
|
|
587
587
|
background: "var(--em-colorBgLayout)",
|
|
@@ -594,4 +594,4 @@ var T = ({ visible: n, onClose: v, file: y, onSave: b, onSaveCopy: x }) => {
|
|
|
594
594
|
//#endregion
|
|
595
595
|
export { T as PixieEditor };
|
|
596
596
|
|
|
597
|
-
//# sourceMappingURL=file-manager-PixieEditor-
|
|
597
|
+
//# sourceMappingURL=file-manager-PixieEditor-Doy__jUq.js.map
|