@layers-app/editor 0.0.2 → 0.0.4
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 +8 -8
- package/dist/{DSD.CjmkQe7N.js → DSD.B4zOTE_q.js} +11 -6
- package/dist/{DSD.CdYWFL0O.js → DSD.BwAjvxen.js} +1 -1
- package/dist/{DSD.BJ38UQLe.js → DSD.D5yIMAX4.js} +108143 -106892
- package/dist/{DSD.C11ukNU9.js → DSD.KRbYP03K.js} +67 -32
- package/dist/{DSD.BL_py6LH.js → DSD.yNW5052Q.js} +36 -21
- package/dist/index.d.ts +1 -2
- package/dist/index.js +2 -2
- package/dist/index.umd.cjs +88 -88
- package/package.json +9 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as f, Fragment as L } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { d as ae,
|
|
4
|
-
import {
|
|
2
|
+
import { useRef as w, useState as E, useCallback as _, useEffect as j, Suspense as M } from "react";
|
|
3
|
+
import { u as U, a as z, b as O, w as k, R as F, C as B, $ as W, F as D, N as q, c as G, K as h, d as H, k as J, e as Q, D as V, r as X, t as Y, L as Z, f as K, h as ee, g as te, i as ne, j as ae, B as le } from "./DSD.D5yIMAX4.js";
|
|
4
|
+
import { d as oe, P as ie } from "./DSD.BwAjvxen.js";
|
|
5
5
|
import { TextInput as re } from "@mantine/core";
|
|
6
6
|
function se({
|
|
7
7
|
label: n,
|
|
@@ -26,7 +26,12 @@ function se({
|
|
|
26
26
|
}
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
|
-
function ce({
|
|
29
|
+
function ce({
|
|
30
|
+
children: n,
|
|
31
|
+
label: o,
|
|
32
|
+
className: t,
|
|
33
|
+
...u
|
|
34
|
+
}) {
|
|
30
35
|
return /* @__PURE__ */ f("div", { className: "Input__wrapper", children: [
|
|
31
36
|
/* @__PURE__ */ e("label", { style: { marginTop: "-1em" }, className: "Input__label", children: o }),
|
|
32
37
|
/* @__PURE__ */ e("select", { ...u, className: t || "select", children: n })
|
|
@@ -73,7 +78,9 @@ function me({
|
|
|
73
78
|
nodeKey: o,
|
|
74
79
|
onClose: t
|
|
75
80
|
}) {
|
|
76
|
-
const i = n.getEditorState().read(
|
|
81
|
+
const i = n.getEditorState().read(
|
|
82
|
+
() => B(o)
|
|
83
|
+
), [c, r] = E(i.getAltText()), [I, x] = E(i.getShowCaption()), [v, C] = E(i.getPosition()), b = (m) => {
|
|
77
84
|
x(m.target.checked);
|
|
78
85
|
}, d = (m) => {
|
|
79
86
|
C(m.target.value);
|
|
@@ -122,7 +129,14 @@ function me({
|
|
|
122
129
|
),
|
|
123
130
|
/* @__PURE__ */ e("label", { htmlFor: "caption", children: "Show Caption" })
|
|
124
131
|
] }),
|
|
125
|
-
/* @__PURE__ */ e(
|
|
132
|
+
/* @__PURE__ */ e(ae, { children: /* @__PURE__ */ e(
|
|
133
|
+
le,
|
|
134
|
+
{
|
|
135
|
+
"data-test-id": "image-modal-file-upload-btn",
|
|
136
|
+
onClick: () => p(),
|
|
137
|
+
children: "Применить"
|
|
138
|
+
}
|
|
139
|
+
) })
|
|
126
140
|
] });
|
|
127
141
|
}
|
|
128
142
|
function Ie({
|
|
@@ -135,20 +149,20 @@ function Ie({
|
|
|
135
149
|
caption: r,
|
|
136
150
|
position: I
|
|
137
151
|
}) {
|
|
138
|
-
const [x, v] =
|
|
152
|
+
const [x, v] = U(), C = w(null), b = w(null), [d, p, m] = z(t), [l] = O(), [$, A] = E(null), P = w(null), N = _(
|
|
139
153
|
(s) => {
|
|
140
|
-
if (d &&
|
|
154
|
+
if (d && k(F())) {
|
|
141
155
|
s.preventDefault();
|
|
142
156
|
const a = B(t);
|
|
143
|
-
|
|
157
|
+
W(a) && a.remove();
|
|
144
158
|
}
|
|
145
159
|
return !1;
|
|
146
160
|
},
|
|
147
161
|
[d, t]
|
|
148
|
-
), R =
|
|
162
|
+
), R = _(
|
|
149
163
|
(s) => {
|
|
150
|
-
const g =
|
|
151
|
-
if (d &&
|
|
164
|
+
const g = F(), a = b.current;
|
|
165
|
+
if (d && k(g) && g.getNodes().length === 1) {
|
|
152
166
|
if (c)
|
|
153
167
|
return D(null), s.preventDefault(), r.focus(), !0;
|
|
154
168
|
if (a !== null && a !== document.activeElement)
|
|
@@ -157,7 +171,7 @@ function Ie({
|
|
|
157
171
|
return !1;
|
|
158
172
|
},
|
|
159
173
|
[r, d, c]
|
|
160
|
-
), T =
|
|
174
|
+
), T = _(
|
|
161
175
|
(s) => P.current === r || b.current === s.target ? (D(null), l.update(() => {
|
|
162
176
|
p(!0);
|
|
163
177
|
const g = l.getRootElement();
|
|
@@ -165,19 +179,19 @@ function Ie({
|
|
|
165
179
|
}), !0) : !1,
|
|
166
180
|
[r, l, p]
|
|
167
181
|
);
|
|
168
|
-
return
|
|
182
|
+
return j(() => {
|
|
169
183
|
let s = !0;
|
|
170
|
-
const g =
|
|
184
|
+
const g = q(
|
|
171
185
|
l.registerUpdateListener(({ editorState: a }) => {
|
|
172
|
-
s && A(a.read(() =>
|
|
186
|
+
s && A(a.read(() => F()));
|
|
173
187
|
}),
|
|
174
188
|
l.registerCommand(
|
|
175
|
-
|
|
189
|
+
Y,
|
|
176
190
|
(a, S) => (P.current = S, !1),
|
|
177
191
|
h
|
|
178
192
|
),
|
|
179
193
|
l.registerCommand(
|
|
180
|
-
|
|
194
|
+
X,
|
|
181
195
|
(a) => {
|
|
182
196
|
const S = a;
|
|
183
197
|
return S.target === C.current ? (S.shiftKey ? p(!d) : (m(), p(!0)), !0) : !1;
|
|
@@ -185,19 +199,40 @@ function Ie({
|
|
|
185
199
|
h
|
|
186
200
|
),
|
|
187
201
|
l.registerCommand(
|
|
188
|
-
|
|
202
|
+
V,
|
|
189
203
|
(a) => a.target === C.current ? (a.preventDefault(), !0) : !1,
|
|
190
204
|
h
|
|
191
205
|
),
|
|
192
|
-
l.registerCommand(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
206
|
+
l.registerCommand(
|
|
207
|
+
Q,
|
|
208
|
+
N,
|
|
209
|
+
h
|
|
210
|
+
),
|
|
211
|
+
l.registerCommand(
|
|
212
|
+
J,
|
|
213
|
+
N,
|
|
214
|
+
h
|
|
215
|
+
),
|
|
216
|
+
l.registerCommand(H, R, h),
|
|
217
|
+
l.registerCommand(
|
|
218
|
+
G,
|
|
219
|
+
T,
|
|
220
|
+
h
|
|
221
|
+
)
|
|
196
222
|
);
|
|
197
223
|
return () => {
|
|
198
224
|
s = !1, g();
|
|
199
225
|
};
|
|
200
|
-
}, [
|
|
226
|
+
}, [
|
|
227
|
+
m,
|
|
228
|
+
l,
|
|
229
|
+
d,
|
|
230
|
+
t,
|
|
231
|
+
N,
|
|
232
|
+
R,
|
|
233
|
+
T,
|
|
234
|
+
p
|
|
235
|
+
]), /* @__PURE__ */ f(M, { fallback: null, children: [
|
|
201
236
|
/* @__PURE__ */ f(L, { children: [
|
|
202
237
|
/* @__PURE__ */ f("div", { draggable: !1, children: [
|
|
203
238
|
/* @__PURE__ */ e(
|
|
@@ -221,7 +256,7 @@ function Ie({
|
|
|
221
256
|
/* @__PURE__ */ e(
|
|
222
257
|
de,
|
|
223
258
|
{
|
|
224
|
-
className: d ? `focused ${
|
|
259
|
+
className: d ? `focused ${k($) ? "draggable" : ""}` : null,
|
|
225
260
|
src: n,
|
|
226
261
|
altText: o,
|
|
227
262
|
imageRef: C,
|
|
@@ -231,15 +266,15 @@ function Ie({
|
|
|
231
266
|
}
|
|
232
267
|
)
|
|
233
268
|
] }),
|
|
234
|
-
c && /* @__PURE__ */ e("div", { className: "image-caption-container", children: /* @__PURE__ */ f(
|
|
235
|
-
/* @__PURE__ */ e(
|
|
236
|
-
/* @__PURE__ */ e(
|
|
269
|
+
c && /* @__PURE__ */ e("div", { className: "image-caption-container", children: /* @__PURE__ */ f(oe, { initialEditor: r, children: [
|
|
270
|
+
/* @__PURE__ */ e(Z, {}),
|
|
271
|
+
/* @__PURE__ */ e(K, {}),
|
|
237
272
|
/* @__PURE__ */ e(
|
|
238
|
-
|
|
273
|
+
ee,
|
|
239
274
|
{
|
|
240
|
-
contentEditable: /* @__PURE__ */ e(
|
|
241
|
-
placeholder: /* @__PURE__ */ e(
|
|
242
|
-
ErrorBoundary:
|
|
275
|
+
contentEditable: /* @__PURE__ */ e(te, { className: "InlineImageNode__contentEditable" }),
|
|
276
|
+
placeholder: /* @__PURE__ */ e(ie, { className: "InlineImageNode__placeholder", children: "Enter a caption..." }),
|
|
277
|
+
ErrorBoundary: ne
|
|
243
278
|
}
|
|
244
279
|
)
|
|
245
280
|
] }) })
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as o, jsxs as C } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as I, useState as D, useRef as S, useCallback as $, useEffect as R } from "react";
|
|
3
|
-
import { b as V, a as j, w as P, R as x, C as k, l as b, N as E, k as w, K as v, e as B, r as y, B as A, m as T, n as W } from "./DSD.
|
|
3
|
+
import { b as V, a as j, w as P, R as x, C as k, l as b, N as E, k as w, K as v, e as B, r as y, B as A, m as T, n as W } from "./DSD.D5yIMAX4.js";
|
|
4
4
|
function O(...t) {
|
|
5
5
|
return t.filter(Boolean).join(" ");
|
|
6
6
|
}
|
|
@@ -115,8 +115,16 @@ function z({
|
|
|
115
115
|
},
|
|
116
116
|
v
|
|
117
117
|
),
|
|
118
|
-
a.registerCommand(
|
|
119
|
-
|
|
118
|
+
a.registerCommand(
|
|
119
|
+
B,
|
|
120
|
+
h,
|
|
121
|
+
v
|
|
122
|
+
),
|
|
123
|
+
a.registerCommand(
|
|
124
|
+
w,
|
|
125
|
+
h,
|
|
126
|
+
v
|
|
127
|
+
)
|
|
120
128
|
), [m, a, r, n, h, _]);
|
|
121
129
|
const d = (e, l) => {
|
|
122
130
|
a.update(
|
|
@@ -131,24 +139,31 @@ function z({
|
|
|
131
139
|
e.addOption(W());
|
|
132
140
|
});
|
|
133
141
|
}, N = P(g) && r;
|
|
134
|
-
return /* @__PURE__ */ o(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
{
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
142
|
+
return /* @__PURE__ */ o(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
className: `PollNode__container ${N ? "focused" : ""}`,
|
|
146
|
+
ref: i,
|
|
147
|
+
children: /* @__PURE__ */ C("div", { className: "PollNode__inner", children: [
|
|
148
|
+
/* @__PURE__ */ o("h2", { className: "PollNode__heading", children: t }),
|
|
149
|
+
c.map((e, l) => {
|
|
150
|
+
const s = e.uid;
|
|
151
|
+
return /* @__PURE__ */ o(
|
|
152
|
+
L,
|
|
153
|
+
{
|
|
154
|
+
withPollNode: d,
|
|
155
|
+
option: e,
|
|
156
|
+
index: l,
|
|
157
|
+
options: c,
|
|
158
|
+
totalVotes: p
|
|
159
|
+
},
|
|
160
|
+
s
|
|
161
|
+
);
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ o("div", { className: "PollNode__footer", children: /* @__PURE__ */ o(A, { onClick: u, small: !0, children: "Add Option" }) })
|
|
164
|
+
] })
|
|
165
|
+
}
|
|
166
|
+
);
|
|
152
167
|
}
|
|
153
168
|
export {
|
|
154
169
|
z as default
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export { CLEAR_EDITOR_COMMAND }
|
|
|
14
14
|
|
|
15
15
|
export { Dropzone }
|
|
16
16
|
|
|
17
|
-
export declare const Editor: <USER_DATA extends object, CHILD_PAGE extends PageData>({ initialContent, onChange, outputFormat, mode, maxHeight, onBlur, onFocus, fetchUploadImage, fetchDeleteImage, maxImageSize, contentModalUploadImage, maxImageSizeError, debounce: debounceMs, disable, ws, excludeNodes, imagePickerSettings, childPages, language, editorRef }: EditorProps<USER_DATA, CHILD_PAGE>) => JSX_2.Element;
|
|
17
|
+
export declare const Editor: <USER_DATA extends object, CHILD_PAGE extends PageData>({ initialContent, onChange, outputFormat, mode, maxHeight, onBlur, onFocus, fetchUploadImage, fetchDeleteImage, maxImageSize, contentModalUploadImage, maxImageSizeError, debounce: debounceMs, disable, ws, excludeNodes, imagePickerSettings, childPages, language, editorRef, }: EditorProps<USER_DATA, CHILD_PAGE>) => JSX_2.Element;
|
|
18
18
|
|
|
19
19
|
declare interface EditorProps<USER_DATA extends object = object, PAGE_DATA extends PageData = PageData> {
|
|
20
20
|
initialContent: Root | string;
|
|
@@ -81,7 +81,6 @@ declare interface PageData {
|
|
|
81
81
|
icon: string | null;
|
|
82
82
|
title: string;
|
|
83
83
|
order: number;
|
|
84
|
-
onClick?: () => void;
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
export declare type Root = SerializedEditorState<SerializedLexicalNode>;
|