@layers-app/editor 0.0.15-swagger → 0.0.17-editor
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/dist/index.cjs +2 -2
- package/dist/index.d.ts +191 -41
- package/dist/index.js +5 -5
- package/dist/layers.BGNmu1a1.js +164 -0
- package/dist/layers.C5Hc95B7.js +1 -0
- package/dist/layers.C8654O6g.js +1 -0
- package/dist/{layers.CO00-yDf.js → layers.CMgvQHaj.js} +16 -16
- package/dist/layers.DugZo4iN.js +343 -0
- package/dist/{layers.36_3ol3v.js → layers.YYYKc7Sc.js} +21859 -21242
- package/package.json +12 -11
- package/dist/layers.B073B28e.js +0 -1
- package/dist/layers.BkZOLD-e.js +0 -289
- package/dist/layers.Bt_uh_hb.js +0 -310
- package/dist/layers.CNFYHxt_.js +0 -1
- package/dist/layers.CYqXx2p1.js +0 -1
- package/dist/layers.CypWhmII.js +0 -170
- package/dist/layers.D1A3jNDb.js +0 -164
- package/dist/layers.DZ2FxhQI.js +0 -1
- package/dist/layers.Di1ekcMX.js +0 -52
- package/dist/layers.DuBUvwyq.js +0 -50709
- package/dist/layers.Q4XQ9POM.js +0 -1
- package/dist/layers.qDjx13HJ.js +0 -288
package/dist/layers.Q4XQ9POM.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("react"),D=require("react-i18next"),t=require("./layers.D1A3jNDb.js"),E=require("@mantine/core"),U=require("@tabler/icons-react"),F=i=>{const{width:g,height:r,isLoading:l,isError:u,src:f,id:m,altText:p,imageRef:j,maxWidth:v}=i;return n.jsxs("div",{className:"media-wrapper",style:{width:g,height:r,display:"inline-flex",position:"relative"},children:[n.jsx(E.LoadingOverlay,{visible:l,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{size:24,color:"black"}}),n.jsx(E.LoadingOverlay,{visible:u,zIndex:1e3,overlayProps:{backgroundOpacity:.5},loaderProps:{children:n.jsx(E.Flex,{bg:"white",maw:300,justify:"center",children:n.jsx(E.Alert,{variant:"light",color:"red",title:"Ошибка загрузки",icon:n.jsx(U.IconInfoCircle,{}),children:"Попробуйте загрузить заново."})})}}),n.jsx(B,{className:null,src:f,altText:p,imageRef:j,width:"inherit",height:"inherit",maxWidth:v||"auto",id:m})]})};function B({altText:i,className:g,imageRef:r,src:l,width:u,height:f,maxWidth:m,id:p}){return n.jsx("img",{className:g||void 0,src:l,alt:i,ref:r,style:{height:f,maxWidth:m,width:u},draggable:"false","data-id":p})}function G({src:i,altText:g,nodeKey:r,width:l,height:u,maxWidth:f,showCaption:m,caption:p,id:j,create:v,alignment:H}){const W=s.useRef(null),[P,S]=s.useState(!0),[R,M]=s.useState(!1),{isCollabActive:O}=t.l(),[h]=t.u(),[x,b]=s.useState(!0),[d,w]=s.useState({width:0,height:0}),{fetchUploadImage:z,fetchDeleteImage:L}=s.useContext(t.Context),{t:y}=D.useTranslation();s.useEffect(()=>{if(!i||i.startsWith("data:image/")){S(!1);return}const e=new Image;e.src=i,e.onload=()=>S(!1),e.onerror=()=>{S(!1),M(!0)}},[i]);const T=(e,a)=>{h.update(()=>{t.Ft(null);const c=t.Ct(r);t.$isImageNode(c)&&c.setWidthAndHeight(e,a)})},{historyState:k}=t.useSharedHistoryContext(),{settings:{showNestedEditorTreeView:q}}=t.useSettings(),[C,I]=s.useState(!1);function $(e){return e.endsWith(".svg")||e.includes("image/svg+xml")}function _(e){return new Promise((a,c)=>{if($(e)){a(0);return}const o=new Image;o.src=e,o.onload=()=>{a(o.width)},o.onerror=()=>{c(new Error("Failed to load image"))}})}return s.useEffect(()=>{v&&I(!0)},[v]),s.useEffect(()=>{let e=l,a=u,c=100;i&&_(i).then(o=>{typeof e=="number"&&e<c&&o<c?(b(!0),w({width:e,height:a})):o<c?(b(!0),w({width:"auto",height:"auto"})):(w({width:o,height:o}),b(!1))})},[i]),s.useEffect(()=>{d.width&&d.height&&x&&h.update(()=>{const e=t.Ct(r);t.$isImageNode(e)&&e.setWidthAndHeight(d.width,d.height)})},[d.width,d.height,x]),s.useEffect(()=>{const e=document.documentElement;t.toggleLockScroll(C,e)},[C]),i?x?n.jsx(F,{width:d.width,height:d.height,isLoading:P,isError:R,isIcon:x,src:i,id:j,editor:h,nodeKey:r,fetchDeleteImage:L,altText:g,imageRef:W,maxWidth:f,showCaption:m,caption:p,isCollabActive:O,historyState:k,showNestedEditorTreeView:q,t:y}):n.jsx(t.ResizableContainer,{editor:h,isIcon:x,width:typeof l=="string"&&l.includes("%")?parseFloat(l):l,height:typeof u=="string"&&u.includes("%")?parseFloat(u):l,initialWidth:d.width||"",initialHeight:d.height||"",onResizeEnd:T,alignment:H,children:n.jsx(F,{width:"inherit",height:"inherit",isLoading:P,isError:R,isIcon:x,src:i,id:j,editor:h,nodeKey:r,fetchDeleteImage:L,altText:g,imageRef:W,maxWidth:f,showCaption:m,caption:p,isCollabActive:O,historyState:k,showNestedEditorTreeView:q,t:y})}):n.jsx(t.ImagePicker,{uploading:!1,onUpload:e=>{!z||!e.length||(e.forEach((a,c)=>{z(a,(o,A)=>{c===0?h.update(()=>{const N=t.Ct(r);t.$isImageNode(N)&&(N.setSrc(o),N.setId(A))}):h.dispatchCommand(t.INSERT_IMAGE_COMMAND,{altText:"",src:o,id:A})})}),I(!1))},popoverProps:{opened:C,position:"bottom",onChange:I},onChange:e=>{I(!1),h.update(()=>{const a=t.Ct(r);t.$isImageNode(a)&&a.setSrc(e)})},children:n.jsx(t.EmptyNodeButton,{title:y("editor.image.add_photo"),icon:"photo",onClick:()=>I(!C)})})}exports.default=G;
|
package/dist/layers.qDjx13HJ.js
DELETED
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
import { jsxs as f, jsx as e, Fragment as L } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as w, useState as E, useCallback as _, useEffect as A, Suspense as M } from "react";
|
|
3
|
-
import { e as U, f as q, u as z, w as k, g as F, c as B, h as O, F as D, N as W, i as G, K as h, j as H, k as J, m as Q, D as V, r as X, n as Y, L as Z, o as K, p as ee, q as te, s as ne, B as ae } from "./layers.36_3ol3v.js";
|
|
4
|
-
import { d as le, P as oe } from "./layers.Di1ekcMX.js";
|
|
5
|
-
import { TextInput as re } from "@mantine/core";
|
|
6
|
-
function ie({
|
|
7
|
-
children: n,
|
|
8
|
-
label: o,
|
|
9
|
-
className: t,
|
|
10
|
-
...u
|
|
11
|
-
}) {
|
|
12
|
-
return /* @__PURE__ */ f("div", { className: "Input__wrapper", children: [
|
|
13
|
-
/* @__PURE__ */ e("label", { style: { marginTop: "-1em" }, className: "Input__label", children: o }),
|
|
14
|
-
/* @__PURE__ */ e("select", { ...u, className: t || "select", children: n })
|
|
15
|
-
] });
|
|
16
|
-
}
|
|
17
|
-
function se({
|
|
18
|
-
label: n,
|
|
19
|
-
value: o,
|
|
20
|
-
onChange: t,
|
|
21
|
-
placeholder: u = "",
|
|
22
|
-
"data-test-id": r,
|
|
23
|
-
type: c = "text"
|
|
24
|
-
}) {
|
|
25
|
-
return /* @__PURE__ */ e(
|
|
26
|
-
re,
|
|
27
|
-
{
|
|
28
|
-
type: c,
|
|
29
|
-
placeholder: u,
|
|
30
|
-
value: o,
|
|
31
|
-
onChange: (i) => {
|
|
32
|
-
t(i.target.value);
|
|
33
|
-
},
|
|
34
|
-
label: n,
|
|
35
|
-
"data-test-id": r,
|
|
36
|
-
mb: 10
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
const y = /* @__PURE__ */ new Set();
|
|
41
|
-
function ce(n) {
|
|
42
|
-
if (!y.has(n))
|
|
43
|
-
throw new Promise((o) => {
|
|
44
|
-
const t = new Image();
|
|
45
|
-
t.src = n, t.onload = () => {
|
|
46
|
-
y.add(n), o(null);
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function ue({
|
|
51
|
-
altText: n,
|
|
52
|
-
className: o,
|
|
53
|
-
imageRef: t,
|
|
54
|
-
src: u,
|
|
55
|
-
width: r,
|
|
56
|
-
height: c,
|
|
57
|
-
position: i
|
|
58
|
-
}) {
|
|
59
|
-
return ce(u), /* @__PURE__ */ e(
|
|
60
|
-
"img",
|
|
61
|
-
{
|
|
62
|
-
className: o || void 0,
|
|
63
|
-
src: u,
|
|
64
|
-
alt: n,
|
|
65
|
-
ref: t,
|
|
66
|
-
"data-position": i,
|
|
67
|
-
style: {
|
|
68
|
-
display: "block",
|
|
69
|
-
height: c,
|
|
70
|
-
width: r
|
|
71
|
-
},
|
|
72
|
-
draggable: "false"
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
function de({
|
|
77
|
-
activeEditor: n,
|
|
78
|
-
nodeKey: o,
|
|
79
|
-
onClose: t
|
|
80
|
-
}) {
|
|
81
|
-
const r = n.getEditorState().read(
|
|
82
|
-
() => B(o)
|
|
83
|
-
), [c, i] = E(r.getAltText()), [I, x] = E(r.getShowCaption()), [v, C] = E(r.getPosition()), b = (m) => {
|
|
84
|
-
x(m.target.checked);
|
|
85
|
-
}, d = (m) => {
|
|
86
|
-
C(m.target.value);
|
|
87
|
-
}, p = () => {
|
|
88
|
-
const m = { altText: c, position: v, showCaption: I };
|
|
89
|
-
r && n.update(() => {
|
|
90
|
-
r.update(m);
|
|
91
|
-
}), t();
|
|
92
|
-
};
|
|
93
|
-
return /* @__PURE__ */ f(L, { children: [
|
|
94
|
-
/* @__PURE__ */ e("div", { style: { marginBottom: "1em" }, children: /* @__PURE__ */ e(
|
|
95
|
-
se,
|
|
96
|
-
{
|
|
97
|
-
label: "Alt-текст",
|
|
98
|
-
placeholder: "Альтернативный текст",
|
|
99
|
-
onChange: i,
|
|
100
|
-
value: c,
|
|
101
|
-
"data-test-id": "image-modal-alt-text-input"
|
|
102
|
-
}
|
|
103
|
-
) }),
|
|
104
|
-
/* @__PURE__ */ f(
|
|
105
|
-
ie,
|
|
106
|
-
{
|
|
107
|
-
style: { marginBottom: "1em", width: "208px" },
|
|
108
|
-
value: v,
|
|
109
|
-
label: "Position",
|
|
110
|
-
name: "position",
|
|
111
|
-
id: "position-select",
|
|
112
|
-
onChange: d,
|
|
113
|
-
children: [
|
|
114
|
-
/* @__PURE__ */ e("option", { value: "left", children: "Left" }),
|
|
115
|
-
/* @__PURE__ */ e("option", { value: "right", children: "Right" }),
|
|
116
|
-
/* @__PURE__ */ e("option", { value: "full", children: "Full Width" })
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
),
|
|
120
|
-
/* @__PURE__ */ f("div", { className: "Input__wrapper", children: [
|
|
121
|
-
/* @__PURE__ */ e(
|
|
122
|
-
"input",
|
|
123
|
-
{
|
|
124
|
-
id: "caption",
|
|
125
|
-
type: "checkbox",
|
|
126
|
-
checked: I,
|
|
127
|
-
onChange: b
|
|
128
|
-
}
|
|
129
|
-
),
|
|
130
|
-
/* @__PURE__ */ e("label", { htmlFor: "caption", children: "Show Caption" })
|
|
131
|
-
] }),
|
|
132
|
-
/* @__PURE__ */ e(
|
|
133
|
-
ae,
|
|
134
|
-
{
|
|
135
|
-
"data-test-id": "image-modal-file-upload-btn",
|
|
136
|
-
onClick: () => p(),
|
|
137
|
-
children: "Применить"
|
|
138
|
-
}
|
|
139
|
-
)
|
|
140
|
-
] });
|
|
141
|
-
}
|
|
142
|
-
function be({
|
|
143
|
-
src: n,
|
|
144
|
-
altText: o,
|
|
145
|
-
nodeKey: t,
|
|
146
|
-
width: u,
|
|
147
|
-
height: r,
|
|
148
|
-
showCaption: c,
|
|
149
|
-
caption: i,
|
|
150
|
-
position: I
|
|
151
|
-
}) {
|
|
152
|
-
const [x, v] = U(), C = w(null), b = w(null), [d, p, m] = q(t), [l] = z(), [$, j] = E(null), P = w(null), N = _(
|
|
153
|
-
(s) => {
|
|
154
|
-
if (d && k(F())) {
|
|
155
|
-
s.preventDefault();
|
|
156
|
-
const a = B(t);
|
|
157
|
-
O(a) && a.remove();
|
|
158
|
-
}
|
|
159
|
-
return !1;
|
|
160
|
-
},
|
|
161
|
-
[d, t]
|
|
162
|
-
), T = _(
|
|
163
|
-
(s) => {
|
|
164
|
-
const g = F(), a = b.current;
|
|
165
|
-
if (d && k(g) && g.getNodes().length === 1) {
|
|
166
|
-
if (c)
|
|
167
|
-
return D(null), s.preventDefault(), i.focus(), !0;
|
|
168
|
-
if (a !== null && a !== document.activeElement)
|
|
169
|
-
return s.preventDefault(), a.focus(), !0;
|
|
170
|
-
}
|
|
171
|
-
return !1;
|
|
172
|
-
},
|
|
173
|
-
[i, d, c]
|
|
174
|
-
), R = _(
|
|
175
|
-
(s) => P.current === i || b.current === s.target ? (D(null), l.update(() => {
|
|
176
|
-
p(!0);
|
|
177
|
-
const g = l.getRootElement();
|
|
178
|
-
g !== null && g.focus();
|
|
179
|
-
}), !0) : !1,
|
|
180
|
-
[i, l, p]
|
|
181
|
-
);
|
|
182
|
-
return A(() => {
|
|
183
|
-
let s = !0;
|
|
184
|
-
const g = W(
|
|
185
|
-
l.registerUpdateListener(({ editorState: a }) => {
|
|
186
|
-
s && j(a.read(() => F()));
|
|
187
|
-
}),
|
|
188
|
-
l.registerCommand(
|
|
189
|
-
Y,
|
|
190
|
-
(a, S) => (P.current = S, !1),
|
|
191
|
-
h
|
|
192
|
-
),
|
|
193
|
-
l.registerCommand(
|
|
194
|
-
X,
|
|
195
|
-
(a) => {
|
|
196
|
-
const S = a;
|
|
197
|
-
return S.target === C.current ? (S.shiftKey ? p(!d) : (m(), p(!0)), !0) : !1;
|
|
198
|
-
},
|
|
199
|
-
h
|
|
200
|
-
),
|
|
201
|
-
l.registerCommand(
|
|
202
|
-
V,
|
|
203
|
-
(a) => a.target === C.current ? (a.preventDefault(), !0) : !1,
|
|
204
|
-
h
|
|
205
|
-
),
|
|
206
|
-
l.registerCommand(
|
|
207
|
-
Q,
|
|
208
|
-
N,
|
|
209
|
-
h
|
|
210
|
-
),
|
|
211
|
-
l.registerCommand(
|
|
212
|
-
J,
|
|
213
|
-
N,
|
|
214
|
-
h
|
|
215
|
-
),
|
|
216
|
-
l.registerCommand(H, T, h),
|
|
217
|
-
l.registerCommand(
|
|
218
|
-
G,
|
|
219
|
-
R,
|
|
220
|
-
h
|
|
221
|
-
)
|
|
222
|
-
);
|
|
223
|
-
return () => {
|
|
224
|
-
s = !1, g();
|
|
225
|
-
};
|
|
226
|
-
}, [
|
|
227
|
-
m,
|
|
228
|
-
l,
|
|
229
|
-
d,
|
|
230
|
-
t,
|
|
231
|
-
N,
|
|
232
|
-
T,
|
|
233
|
-
R,
|
|
234
|
-
p
|
|
235
|
-
]), /* @__PURE__ */ f(M, { fallback: null, children: [
|
|
236
|
-
/* @__PURE__ */ f(L, { children: [
|
|
237
|
-
/* @__PURE__ */ f("div", { draggable: !1, children: [
|
|
238
|
-
/* @__PURE__ */ e(
|
|
239
|
-
"button",
|
|
240
|
-
{
|
|
241
|
-
className: "image-edit-button",
|
|
242
|
-
ref: b,
|
|
243
|
-
onClick: () => {
|
|
244
|
-
v("Update Inline Image", (s) => /* @__PURE__ */ e(
|
|
245
|
-
de,
|
|
246
|
-
{
|
|
247
|
-
activeEditor: l,
|
|
248
|
-
nodeKey: t,
|
|
249
|
-
onClose: s
|
|
250
|
-
}
|
|
251
|
-
));
|
|
252
|
-
},
|
|
253
|
-
children: "Edit"
|
|
254
|
-
}
|
|
255
|
-
),
|
|
256
|
-
/* @__PURE__ */ e(
|
|
257
|
-
ue,
|
|
258
|
-
{
|
|
259
|
-
className: d ? `focused ${k($) ? "draggable" : ""}` : null,
|
|
260
|
-
src: n,
|
|
261
|
-
altText: o,
|
|
262
|
-
imageRef: C,
|
|
263
|
-
width: u,
|
|
264
|
-
height: r,
|
|
265
|
-
position: I
|
|
266
|
-
}
|
|
267
|
-
)
|
|
268
|
-
] }),
|
|
269
|
-
c && /* @__PURE__ */ e("div", { className: "image-caption-container", children: /* @__PURE__ */ f(le, { initialEditor: i, children: [
|
|
270
|
-
/* @__PURE__ */ e(Z, {}),
|
|
271
|
-
/* @__PURE__ */ e(K, {}),
|
|
272
|
-
/* @__PURE__ */ e(
|
|
273
|
-
ee,
|
|
274
|
-
{
|
|
275
|
-
contentEditable: /* @__PURE__ */ e(ne, { className: "InlineImageNode__contentEditable" }),
|
|
276
|
-
placeholder: /* @__PURE__ */ e(oe, { className: "InlineImageNode__placeholder", children: "Enter a caption..." }),
|
|
277
|
-
ErrorBoundary: te
|
|
278
|
-
}
|
|
279
|
-
)
|
|
280
|
-
] }) })
|
|
281
|
-
] }),
|
|
282
|
-
x
|
|
283
|
-
] });
|
|
284
|
-
}
|
|
285
|
-
export {
|
|
286
|
-
de as UpdateInlineImageDialog,
|
|
287
|
-
be as default
|
|
288
|
-
};
|