@layers-app/editor 0.0.11 → 0.0.13
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.d.ts +0 -8
- package/dist/index.js +2 -2
- package/dist/index.umd.cjs +362 -53
- package/dist/{layers.DWcfRy1Z.js → layers.B6ItcFxC.js} +2 -2
- package/dist/layers.BI3mGLaL.js +88620 -0
- package/dist/{layers.DwVbMntu.js → layers.BPCxAbVh.js} +3 -3
- package/dist/{layers.qcUUnbCI.js → layers.BZlXoaxQ.js} +1 -1
- package/dist/{layers.C4lrr1t_.js → layers.CoajEwpf.js} +63 -63
- package/dist/{layers.DKx4HQvO.js → layers.D-cYnkWE.js} +1 -1
- package/package.json +14 -4
- package/dist/layers.BngHKUYL.js +0 -37817
- package/dist/layers.D95tWX8p.js +0 -16605
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as o, jsxs as g } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as I, useState as D, useRef as S, useCallback as $, useEffect as V } from "react";
|
|
3
|
-
import { u as j, f as E, w as P, g as x, c as k,
|
|
3
|
+
import { u as j, f as E, w as P, g as x, c as k, v as b, N as R, k as w, K as v, m as B, r as y, B as A, x as T, l as W } from "./layers.BI3mGLaL.js";
|
|
4
4
|
function O(...t) {
|
|
5
5
|
return t.filter(Boolean).join(" ");
|
|
6
6
|
}
|
|
@@ -108,7 +108,7 @@ function z({
|
|
|
108
108
|
_(e.read(() => x()));
|
|
109
109
|
}),
|
|
110
110
|
a.registerCommand(
|
|
111
|
-
|
|
111
|
+
y,
|
|
112
112
|
(e) => {
|
|
113
113
|
const l = e;
|
|
114
114
|
return l.target === i.current ? (l.shiftKey || m(), h(!r), !0) : !1;
|
|
@@ -116,7 +116,7 @@ function z({
|
|
|
116
116
|
v
|
|
117
117
|
),
|
|
118
118
|
a.registerCommand(
|
|
119
|
-
|
|
119
|
+
B,
|
|
120
120
|
f,
|
|
121
121
|
v
|
|
122
122
|
),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as o, jsxs as G } from "react/jsx-runtime";
|
|
2
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.
|
|
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.BI3mGLaL.js";
|
|
5
5
|
import { LoadingOverlay as T, Flex as se, Alert as re } from "@mantine/core";
|
|
6
6
|
import { IconInfoCircle as le } from "@tabler/icons-react";
|
|
7
7
|
const j = (t) => {
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRef as w, useState as E, useCallback as _, useEffect as
|
|
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
|
|
4
|
-
import { d as
|
|
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.BI3mGLaL.js";
|
|
4
|
+
import { d as le, P as oe } from "./layers.D-cYnkWE.js";
|
|
5
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
|
+
}
|
|
6
17
|
function se({
|
|
7
18
|
label: n,
|
|
8
19
|
value: o,
|
|
9
20
|
onChange: t,
|
|
10
21
|
placeholder: u = "",
|
|
11
|
-
"data-test-id":
|
|
22
|
+
"data-test-id": r,
|
|
12
23
|
type: c = "text"
|
|
13
24
|
}) {
|
|
14
25
|
return /* @__PURE__ */ e(
|
|
@@ -17,28 +28,17 @@ function se({
|
|
|
17
28
|
type: c,
|
|
18
29
|
placeholder: u,
|
|
19
30
|
value: o,
|
|
20
|
-
onChange: (
|
|
21
|
-
t(
|
|
31
|
+
onChange: (i) => {
|
|
32
|
+
t(i.target.value);
|
|
22
33
|
},
|
|
23
34
|
label: n,
|
|
24
|
-
"data-test-id":
|
|
35
|
+
"data-test-id": r,
|
|
25
36
|
mb: 10
|
|
26
37
|
}
|
|
27
38
|
);
|
|
28
39
|
}
|
|
29
|
-
function ce({
|
|
30
|
-
children: n,
|
|
31
|
-
label: o,
|
|
32
|
-
className: t,
|
|
33
|
-
...u
|
|
34
|
-
}) {
|
|
35
|
-
return /* @__PURE__ */ f("div", { className: "Input__wrapper", children: [
|
|
36
|
-
/* @__PURE__ */ e("label", { style: { marginTop: "-1em" }, className: "Input__label", children: o }),
|
|
37
|
-
/* @__PURE__ */ e("select", { ...u, className: t || "select", children: n })
|
|
38
|
-
] });
|
|
39
|
-
}
|
|
40
40
|
const y = /* @__PURE__ */ new Set();
|
|
41
|
-
function
|
|
41
|
+
function ce(n) {
|
|
42
42
|
if (!y.has(n))
|
|
43
43
|
throw new Promise((o) => {
|
|
44
44
|
const t = new Image();
|
|
@@ -47,47 +47,47 @@ function ue(n) {
|
|
|
47
47
|
};
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function ue({
|
|
51
51
|
altText: n,
|
|
52
52
|
className: o,
|
|
53
53
|
imageRef: t,
|
|
54
54
|
src: u,
|
|
55
|
-
width:
|
|
55
|
+
width: r,
|
|
56
56
|
height: c,
|
|
57
|
-
position:
|
|
57
|
+
position: i
|
|
58
58
|
}) {
|
|
59
|
-
return
|
|
59
|
+
return ce(u), /* @__PURE__ */ e(
|
|
60
60
|
"img",
|
|
61
61
|
{
|
|
62
62
|
className: o || void 0,
|
|
63
63
|
src: u,
|
|
64
64
|
alt: n,
|
|
65
65
|
ref: t,
|
|
66
|
-
"data-position":
|
|
66
|
+
"data-position": i,
|
|
67
67
|
style: {
|
|
68
68
|
display: "block",
|
|
69
69
|
height: c,
|
|
70
|
-
width:
|
|
70
|
+
width: r
|
|
71
71
|
},
|
|
72
72
|
draggable: "false"
|
|
73
73
|
}
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function de({
|
|
77
77
|
activeEditor: n,
|
|
78
78
|
nodeKey: o,
|
|
79
79
|
onClose: t
|
|
80
80
|
}) {
|
|
81
|
-
const
|
|
81
|
+
const r = n.getEditorState().read(
|
|
82
82
|
() => B(o)
|
|
83
|
-
), [c,
|
|
83
|
+
), [c, i] = E(r.getAltText()), [I, x] = E(r.getShowCaption()), [v, C] = E(r.getPosition()), b = (m) => {
|
|
84
84
|
x(m.target.checked);
|
|
85
85
|
}, d = (m) => {
|
|
86
86
|
C(m.target.value);
|
|
87
87
|
}, p = () => {
|
|
88
|
-
const m = { altText: c, position:
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
const m = { altText: c, position: v, showCaption: I };
|
|
89
|
+
r && n.update(() => {
|
|
90
|
+
r.update(m);
|
|
91
91
|
}), t();
|
|
92
92
|
};
|
|
93
93
|
return /* @__PURE__ */ f(L, { children: [
|
|
@@ -96,16 +96,16 @@ function me({
|
|
|
96
96
|
{
|
|
97
97
|
label: "Alt-текст",
|
|
98
98
|
placeholder: "Альтернативный текст",
|
|
99
|
-
onChange:
|
|
99
|
+
onChange: i,
|
|
100
100
|
value: c,
|
|
101
101
|
"data-test-id": "image-modal-alt-text-input"
|
|
102
102
|
}
|
|
103
103
|
) }),
|
|
104
104
|
/* @__PURE__ */ f(
|
|
105
|
-
|
|
105
|
+
ie,
|
|
106
106
|
{
|
|
107
107
|
style: { marginBottom: "1em", width: "208px" },
|
|
108
|
-
value:
|
|
108
|
+
value: v,
|
|
109
109
|
label: "Position",
|
|
110
110
|
name: "position",
|
|
111
111
|
id: "position-select",
|
|
@@ -123,33 +123,33 @@ function me({
|
|
|
123
123
|
{
|
|
124
124
|
id: "caption",
|
|
125
125
|
type: "checkbox",
|
|
126
|
-
checked:
|
|
126
|
+
checked: I,
|
|
127
127
|
onChange: b
|
|
128
128
|
}
|
|
129
129
|
),
|
|
130
130
|
/* @__PURE__ */ e("label", { htmlFor: "caption", children: "Show Caption" })
|
|
131
131
|
] }),
|
|
132
|
-
/* @__PURE__ */ e(
|
|
133
|
-
|
|
132
|
+
/* @__PURE__ */ e(
|
|
133
|
+
ae,
|
|
134
134
|
{
|
|
135
135
|
"data-test-id": "image-modal-file-upload-btn",
|
|
136
136
|
onClick: () => p(),
|
|
137
137
|
children: "Применить"
|
|
138
138
|
}
|
|
139
|
-
)
|
|
139
|
+
)
|
|
140
140
|
] });
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function be({
|
|
143
143
|
src: n,
|
|
144
144
|
altText: o,
|
|
145
145
|
nodeKey: t,
|
|
146
146
|
width: u,
|
|
147
|
-
height:
|
|
147
|
+
height: r,
|
|
148
148
|
showCaption: c,
|
|
149
|
-
caption:
|
|
150
|
-
position:
|
|
149
|
+
caption: i,
|
|
150
|
+
position: I
|
|
151
151
|
}) {
|
|
152
|
-
const [x,
|
|
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
153
|
(s) => {
|
|
154
154
|
if (d && k(F())) {
|
|
155
155
|
s.preventDefault();
|
|
@@ -164,26 +164,26 @@ function ve({
|
|
|
164
164
|
const g = F(), a = b.current;
|
|
165
165
|
if (d && k(g) && g.getNodes().length === 1) {
|
|
166
166
|
if (c)
|
|
167
|
-
return
|
|
167
|
+
return D(null), s.preventDefault(), i.focus(), !0;
|
|
168
168
|
if (a !== null && a !== document.activeElement)
|
|
169
169
|
return s.preventDefault(), a.focus(), !0;
|
|
170
170
|
}
|
|
171
171
|
return !1;
|
|
172
172
|
},
|
|
173
|
-
[
|
|
174
|
-
),
|
|
175
|
-
(s) => P.current ===
|
|
173
|
+
[i, d, c]
|
|
174
|
+
), R = _(
|
|
175
|
+
(s) => P.current === i || b.current === s.target ? (D(null), l.update(() => {
|
|
176
176
|
p(!0);
|
|
177
177
|
const g = l.getRootElement();
|
|
178
178
|
g !== null && g.focus();
|
|
179
179
|
}), !0) : !1,
|
|
180
|
-
[
|
|
180
|
+
[i, l, p]
|
|
181
181
|
);
|
|
182
|
-
return
|
|
182
|
+
return A(() => {
|
|
183
183
|
let s = !0;
|
|
184
184
|
const g = W(
|
|
185
185
|
l.registerUpdateListener(({ editorState: a }) => {
|
|
186
|
-
s &&
|
|
186
|
+
s && j(a.read(() => F()));
|
|
187
187
|
}),
|
|
188
188
|
l.registerCommand(
|
|
189
189
|
Y,
|
|
@@ -216,7 +216,7 @@ function ve({
|
|
|
216
216
|
l.registerCommand(H, T, h),
|
|
217
217
|
l.registerCommand(
|
|
218
218
|
G,
|
|
219
|
-
|
|
219
|
+
R,
|
|
220
220
|
h
|
|
221
221
|
)
|
|
222
222
|
);
|
|
@@ -230,7 +230,7 @@ function ve({
|
|
|
230
230
|
t,
|
|
231
231
|
N,
|
|
232
232
|
T,
|
|
233
|
-
|
|
233
|
+
R,
|
|
234
234
|
p
|
|
235
235
|
]), /* @__PURE__ */ f(M, { fallback: null, children: [
|
|
236
236
|
/* @__PURE__ */ f(L, { children: [
|
|
@@ -241,8 +241,8 @@ function ve({
|
|
|
241
241
|
className: "image-edit-button",
|
|
242
242
|
ref: b,
|
|
243
243
|
onClick: () => {
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
v("Update Inline Image", (s) => /* @__PURE__ */ e(
|
|
245
|
+
de,
|
|
246
246
|
{
|
|
247
247
|
activeEditor: l,
|
|
248
248
|
nodeKey: t,
|
|
@@ -254,26 +254,26 @@ function ve({
|
|
|
254
254
|
}
|
|
255
255
|
),
|
|
256
256
|
/* @__PURE__ */ e(
|
|
257
|
-
|
|
257
|
+
ue,
|
|
258
258
|
{
|
|
259
|
-
className: d ? `focused ${k(
|
|
259
|
+
className: d ? `focused ${k($) ? "draggable" : ""}` : null,
|
|
260
260
|
src: n,
|
|
261
261
|
altText: o,
|
|
262
262
|
imageRef: C,
|
|
263
263
|
width: u,
|
|
264
|
-
height:
|
|
265
|
-
position:
|
|
264
|
+
height: r,
|
|
265
|
+
position: I
|
|
266
266
|
}
|
|
267
267
|
)
|
|
268
268
|
] }),
|
|
269
|
-
c && /* @__PURE__ */ e("div", { className: "image-caption-container", children: /* @__PURE__ */ f(
|
|
269
|
+
c && /* @__PURE__ */ e("div", { className: "image-caption-container", children: /* @__PURE__ */ f(le, { initialEditor: i, children: [
|
|
270
270
|
/* @__PURE__ */ e(Z, {}),
|
|
271
271
|
/* @__PURE__ */ e(K, {}),
|
|
272
272
|
/* @__PURE__ */ e(
|
|
273
273
|
ee,
|
|
274
274
|
{
|
|
275
275
|
contentEditable: /* @__PURE__ */ e(ne, { className: "InlineImageNode__contentEditable" }),
|
|
276
|
-
placeholder: /* @__PURE__ */ e(
|
|
276
|
+
placeholder: /* @__PURE__ */ e(oe, { className: "InlineImageNode__placeholder", children: "Enter a caption..." }),
|
|
277
277
|
ErrorBoundary: te
|
|
278
278
|
}
|
|
279
279
|
)
|
|
@@ -283,6 +283,6 @@ function ve({
|
|
|
283
283
|
] });
|
|
284
284
|
}
|
|
285
285
|
export {
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
de as UpdateInlineImageDialog,
|
|
287
|
+
be as default
|
|
288
288
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ad as p, ae as k, l as E } from "./layers.BI3mGLaL.js";
|
|
2
2
|
import { useRef as O, useContext as P, useMemo as D, useEffect as h } from "react";
|
|
3
3
|
import { jsx as _ } from "react/jsx-runtime";
|
|
4
4
|
function K(e) {
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layers-app/editor",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.13",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "vite",
|
|
8
8
|
"build": "vite build",
|
|
9
|
-
"lint": "eslint . --ext ts
|
|
9
|
+
"lint": "eslint . --ext .ts,.tsx",
|
|
10
|
+
"lint:fix": "eslint . --ext .ts,.tsx --fix",
|
|
10
11
|
"preview": "vite preview",
|
|
11
12
|
"generate-dts": "tsc --project tsconfig.lib.json",
|
|
12
13
|
"dev:local": "cross-env NODE_ENV=development concurrently \"npm:server:ws\" \"vite --host\"",
|
|
@@ -28,10 +29,12 @@
|
|
|
28
29
|
"@lexical/markdown": "0.21.0",
|
|
29
30
|
"@lexical/react": "0.21.0",
|
|
30
31
|
"@tanstack/react-query": "^5.64.1",
|
|
32
|
+
"@types/swagger-ui-react": "^5.18.0",
|
|
31
33
|
"install": "^0.13.0",
|
|
32
34
|
"lexical": "0.21.0",
|
|
33
35
|
"npm": "^11.0.0",
|
|
34
36
|
"react-selecto": "^1.26.3",
|
|
37
|
+
"swagger-ui-react": "^5.20.2",
|
|
35
38
|
"y-websocket": "^1.5.3",
|
|
36
39
|
"yjs": "^13.6.20"
|
|
37
40
|
},
|
|
@@ -52,16 +55,23 @@
|
|
|
52
55
|
"@types/prettier": "2.7.3",
|
|
53
56
|
"@types/react": "^18.2.55",
|
|
54
57
|
"@types/react-dom": "^18.2.19",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^8.27.0",
|
|
59
|
+
"@typescript-eslint/parser": "^8.27.0",
|
|
55
60
|
"@vitejs/plugin-basic-ssl": "^1.1.0",
|
|
56
61
|
"@vitejs/plugin-react": "^4.2.1",
|
|
57
62
|
"concurrently": "^8.2.2",
|
|
58
63
|
"cross-env": "^7.0.3",
|
|
59
|
-
"eslint": "^9.
|
|
64
|
+
"eslint": "^9.22.0",
|
|
65
|
+
"eslint-config-prettier": "^10.1.1",
|
|
66
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
67
|
+
"eslint-plugin-react": "^7.37.4",
|
|
68
|
+
"eslint-plugin-react-refresh": "^0.4.19",
|
|
69
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
60
70
|
"i18next": "^23.15.1",
|
|
61
71
|
"lodash-es": "^4.17.21",
|
|
62
72
|
"postcss-import": "^16.1.0",
|
|
63
73
|
"postcss-preset-mantine": "^1.15.0",
|
|
64
|
-
"prettier": "3.4.2",
|
|
74
|
+
"prettier": "^3.4.2",
|
|
65
75
|
"react-i18next": "^15.0.2",
|
|
66
76
|
"rollup-plugin-typescript-paths": "^1.5.0",
|
|
67
77
|
"rollup-plugin-visualizer": "^5.12.0",
|