@layers-app/editor 0.0.17 → 0.0.18
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 +11 -11
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +46 -6
- package/dist/index.js +2 -2
- package/dist/{layers.CjmCIVDQ.js → layers.Beb8H5iK.js} +33 -33
- package/dist/{layers.Cl_uz2hp.js → layers.CWaWCp52.js} +1 -1
- package/dist/layers.CmuE7cyq.js +1 -0
- package/dist/{layers.BtDUR7c8.js → layers.Cnf8ktNm.js} +13324 -12443
- package/dist/layers.Crl1Kzhp.js +164 -0
- package/dist/{layers.BgmvxWuS.js → layers.DicigL6z.js} +51 -51
- package/package.json +9 -7
- package/dist/layers.O3pZNIRN.js +0 -164
- package/dist/layers.Q3nBF5Jz.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as o, jsxs as G } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as V, useState as I, useContext as q, useEffect as
|
|
2
|
+
import { useRef as V, useState as I, useContext as q, useEffect as w } from "react";
|
|
3
3
|
import { useTranslation as J } from "react-i18next";
|
|
4
|
-
import { l as Q, u as X, C as Y, a as Z, b as K, c as C, $ as E, t as ee, I as te, E as ie, d as oe, R as ne, F as ae } from "./layers.
|
|
5
|
-
import { LoadingOverlay as
|
|
4
|
+
import { l as Q, u as X, C as Y, a as Z, b as K, c as C, $ as E, t as ee, I as te, E as ie, d as oe, R as ne, F as ae } from "./layers.Cnf8ktNm.js";
|
|
5
|
+
import { LoadingOverlay as H, Flex as se, Alert as re } from "@mantine/core";
|
|
6
6
|
import { IconInfoCircle as le } from "@tabler/icons-react";
|
|
7
|
-
const
|
|
7
|
+
const T = (t) => {
|
|
8
8
|
const {
|
|
9
9
|
width: c,
|
|
10
10
|
height: a,
|
|
@@ -13,8 +13,8 @@ const j = (t) => {
|
|
|
13
13
|
src: g,
|
|
14
14
|
id: f,
|
|
15
15
|
altText: u,
|
|
16
|
-
imageRef:
|
|
17
|
-
maxWidth:
|
|
16
|
+
imageRef: b,
|
|
17
|
+
maxWidth: v
|
|
18
18
|
} = t;
|
|
19
19
|
return /* @__PURE__ */ G(
|
|
20
20
|
"div",
|
|
@@ -28,7 +28,7 @@ const j = (t) => {
|
|
|
28
28
|
},
|
|
29
29
|
children: [
|
|
30
30
|
/* @__PURE__ */ o(
|
|
31
|
-
|
|
31
|
+
H,
|
|
32
32
|
{
|
|
33
33
|
visible: s,
|
|
34
34
|
zIndex: 1e3,
|
|
@@ -37,7 +37,7 @@ const j = (t) => {
|
|
|
37
37
|
}
|
|
38
38
|
),
|
|
39
39
|
/* @__PURE__ */ o(
|
|
40
|
-
|
|
40
|
+
H,
|
|
41
41
|
{
|
|
42
42
|
visible: d,
|
|
43
43
|
zIndex: 1e3,
|
|
@@ -62,10 +62,10 @@ const j = (t) => {
|
|
|
62
62
|
className: null,
|
|
63
63
|
src: g,
|
|
64
64
|
altText: u,
|
|
65
|
-
imageRef:
|
|
65
|
+
imageRef: b,
|
|
66
66
|
width: "inherit",
|
|
67
67
|
height: "inherit",
|
|
68
|
-
maxWidth:
|
|
68
|
+
maxWidth: v || "auto",
|
|
69
69
|
id: f
|
|
70
70
|
}
|
|
71
71
|
)
|
|
@@ -109,22 +109,22 @@ function pe({
|
|
|
109
109
|
maxWidth: g,
|
|
110
110
|
showCaption: f,
|
|
111
111
|
caption: u,
|
|
112
|
-
id:
|
|
113
|
-
create:
|
|
114
|
-
alignment:
|
|
112
|
+
id: b,
|
|
113
|
+
create: v,
|
|
114
|
+
alignment: j
|
|
115
115
|
}) {
|
|
116
|
-
const
|
|
116
|
+
const P = V(null), [z, y] = I(!0), [R, _] = I(!1), { isCollabActive: k } = Q(), [h] = X(), [m, S] = I(!0), [r, W] = I({
|
|
117
117
|
width: 0,
|
|
118
118
|
height: 0
|
|
119
|
-
}), {
|
|
120
|
-
|
|
119
|
+
}), { fetchUploadMedia: A, fetchDeleteMedia: F } = q(Y), { t: M } = J();
|
|
120
|
+
w(() => {
|
|
121
121
|
if (!t || t.startsWith("data:image/")) {
|
|
122
122
|
y(!1);
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
125
|
const e = new Image();
|
|
126
126
|
e.src = t, e.onload = () => y(!1), e.onerror = () => {
|
|
127
|
-
y(!1),
|
|
127
|
+
y(!1), _(!0);
|
|
128
128
|
};
|
|
129
129
|
}, [t]);
|
|
130
130
|
const U = (e, n) => {
|
|
@@ -133,8 +133,8 @@ function pe({
|
|
|
133
133
|
const l = C(a);
|
|
134
134
|
E(l) && l.setWidthAndHeight(e, n);
|
|
135
135
|
});
|
|
136
|
-
}, { historyState:
|
|
137
|
-
settings: { showNestedEditorTreeView:
|
|
136
|
+
}, { historyState: L } = Z(), {
|
|
137
|
+
settings: { showNestedEditorTreeView: O }
|
|
138
138
|
} = K(), [x, p] = I(!1);
|
|
139
139
|
function $(e) {
|
|
140
140
|
return e.endsWith(".svg") || e.includes("image/svg+xml");
|
|
@@ -153,9 +153,9 @@ function pe({
|
|
|
153
153
|
};
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
|
-
return
|
|
157
|
-
|
|
158
|
-
}, [
|
|
156
|
+
return w(() => {
|
|
157
|
+
v && p(!0);
|
|
158
|
+
}, [v]), w(() => {
|
|
159
159
|
let e = s, n = d, l = 100;
|
|
160
160
|
t && B(t).then((i) => {
|
|
161
161
|
typeof e == "number" && e < l && i < l ? (S(!0), W({
|
|
@@ -169,36 +169,36 @@ function pe({
|
|
|
169
169
|
height: i
|
|
170
170
|
}), S(!1));
|
|
171
171
|
});
|
|
172
|
-
}, [t]),
|
|
172
|
+
}, [t]), w(() => {
|
|
173
173
|
r.width && r.height && m && h.update(() => {
|
|
174
174
|
const e = C(a);
|
|
175
175
|
E(e) && e.setWidthAndHeight(r.width, r.height);
|
|
176
176
|
});
|
|
177
|
-
}, [r.width, r.height, m]),
|
|
177
|
+
}, [r.width, r.height, m]), w(() => {
|
|
178
178
|
const e = document.documentElement;
|
|
179
179
|
ee(x, e);
|
|
180
180
|
}, [x]), t ? m ? /* @__PURE__ */ o(
|
|
181
|
-
|
|
181
|
+
T,
|
|
182
182
|
{
|
|
183
183
|
width: r.width,
|
|
184
184
|
height: r.height,
|
|
185
|
-
isLoading:
|
|
186
|
-
isError:
|
|
185
|
+
isLoading: z,
|
|
186
|
+
isError: R,
|
|
187
187
|
isIcon: m,
|
|
188
188
|
src: t,
|
|
189
|
-
id:
|
|
189
|
+
id: b,
|
|
190
190
|
editor: h,
|
|
191
191
|
nodeKey: a,
|
|
192
|
-
|
|
192
|
+
fetchDeleteMedia: F,
|
|
193
193
|
altText: c,
|
|
194
|
-
imageRef:
|
|
194
|
+
imageRef: P,
|
|
195
195
|
maxWidth: g,
|
|
196
196
|
showCaption: f,
|
|
197
197
|
caption: u,
|
|
198
|
-
isCollabActive:
|
|
199
|
-
historyState:
|
|
200
|
-
showNestedEditorTreeView:
|
|
201
|
-
t:
|
|
198
|
+
isCollabActive: k,
|
|
199
|
+
historyState: L,
|
|
200
|
+
showNestedEditorTreeView: O,
|
|
201
|
+
t: M
|
|
202
202
|
}
|
|
203
203
|
) : /* @__PURE__ */ o(
|
|
204
204
|
ne,
|
|
@@ -210,29 +210,29 @@ function pe({
|
|
|
210
210
|
initialWidth: r.width || "",
|
|
211
211
|
initialHeight: r.height || "",
|
|
212
212
|
onResizeEnd: U,
|
|
213
|
-
alignment:
|
|
213
|
+
alignment: j,
|
|
214
214
|
children: /* @__PURE__ */ o(
|
|
215
|
-
|
|
215
|
+
T,
|
|
216
216
|
{
|
|
217
217
|
width: "inherit",
|
|
218
218
|
height: "inherit",
|
|
219
|
-
isLoading:
|
|
220
|
-
isError:
|
|
219
|
+
isLoading: z,
|
|
220
|
+
isError: R,
|
|
221
221
|
isIcon: m,
|
|
222
222
|
src: t,
|
|
223
|
-
id:
|
|
223
|
+
id: b,
|
|
224
224
|
editor: h,
|
|
225
225
|
nodeKey: a,
|
|
226
|
-
|
|
226
|
+
fetchDeleteMedia: F,
|
|
227
227
|
altText: c,
|
|
228
|
-
imageRef:
|
|
228
|
+
imageRef: P,
|
|
229
229
|
maxWidth: g,
|
|
230
230
|
showCaption: f,
|
|
231
231
|
caption: u,
|
|
232
|
-
isCollabActive:
|
|
233
|
-
historyState:
|
|
234
|
-
showNestedEditorTreeView:
|
|
235
|
-
t:
|
|
232
|
+
isCollabActive: k,
|
|
233
|
+
historyState: L,
|
|
234
|
+
showNestedEditorTreeView: O,
|
|
235
|
+
t: M
|
|
236
236
|
}
|
|
237
237
|
)
|
|
238
238
|
}
|
|
@@ -241,15 +241,15 @@ function pe({
|
|
|
241
241
|
{
|
|
242
242
|
uploading: !1,
|
|
243
243
|
onUpload: (e) => {
|
|
244
|
-
!
|
|
245
|
-
|
|
244
|
+
!A || !e.length || (e.forEach((n, l) => {
|
|
245
|
+
A(n, (i, D) => {
|
|
246
246
|
l === 0 ? h.update(() => {
|
|
247
|
-
const
|
|
248
|
-
E(
|
|
247
|
+
const N = C(a);
|
|
248
|
+
E(N) && (N.setSrc(i), N.setId(D));
|
|
249
249
|
}) : h.dispatchCommand(oe, {
|
|
250
250
|
altText: "",
|
|
251
251
|
src: i,
|
|
252
|
-
id:
|
|
252
|
+
id: D
|
|
253
253
|
});
|
|
254
254
|
});
|
|
255
255
|
}), p(!1));
|
|
@@ -268,7 +268,7 @@ function pe({
|
|
|
268
268
|
children: /* @__PURE__ */ o(
|
|
269
269
|
ie,
|
|
270
270
|
{
|
|
271
|
-
title:
|
|
271
|
+
title: M("editor.image.add_photo"),
|
|
272
272
|
icon: "photo",
|
|
273
273
|
onClick: () => p(!x)
|
|
274
274
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layers-app/editor",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.18",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "vite --mode full",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"main": "dist/index.js",
|
|
26
26
|
"types": "dist/index.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@layers-app/shared": "^0.0.
|
|
28
|
+
"@layers-app/shared": "^0.0.27",
|
|
29
29
|
"@lexical/headless": "0.21.0",
|
|
30
30
|
"@lexical/markdown": "0.21.0",
|
|
31
31
|
"@lexical/react": "0.21.0",
|
|
@@ -40,11 +40,13 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@eslint/js": "^9.9.0",
|
|
43
|
-
"@mantine/core": "
|
|
44
|
-
"@mantine/dropzone": "
|
|
45
|
-
"@mantine/form": "
|
|
46
|
-
"@mantine/hooks": "
|
|
47
|
-
"@mantine/modals": "
|
|
43
|
+
"@mantine/core": "7.17.2",
|
|
44
|
+
"@mantine/dropzone": "7.17.2",
|
|
45
|
+
"@mantine/form": "7.17.2",
|
|
46
|
+
"@mantine/hooks": "7.17.2",
|
|
47
|
+
"@mantine/modals": "7.17.2",
|
|
48
|
+
"@mantine/tiptap": "7.17.2",
|
|
49
|
+
"@mantine/notifications": "7.17.2",
|
|
48
50
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
49
51
|
"@tabler/icons-react": "^3.7.0",
|
|
50
52
|
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
|