@layers-app/editor 0.0.2 → 0.0.3

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 CHANGED
@@ -48,26 +48,26 @@ const json = {
48
48
  style: '',
49
49
  text: text,
50
50
  type: 'text',
51
- version: 1
52
- }
51
+ version: 1,
52
+ },
53
53
  ],
54
54
  direction: 'ltr',
55
55
  format: '',
56
56
  indent: 0,
57
57
  type: 'paragraph',
58
- version: 1
59
- }
58
+ version: 1,
59
+ },
60
60
  ],
61
61
  direction: 'ltr',
62
62
  format: '',
63
63
  indent: 0,
64
64
  type: 'root',
65
- version: 1
66
- }
65
+ version: 1,
66
+ },
67
67
  };
68
68
 
69
69
  const onChange = (
70
- data // json
70
+ data, // json
71
71
  ) => <Editor initialContent={json} onChange={onChange} />;
72
72
  ```
73
73
 
@@ -301,7 +301,7 @@ Dropzone.Idle is visible when the user is not dragging any file into the drop zo
301
301
  getActiveUsers: (users) => {
302
302
  // Returns active users editing the document
303
303
  setActiveUsers(users);
304
- }
304
+ },
305
305
  }}
306
306
  />
307
307
  ```
@@ -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.BJ38UQLe.js";
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.NL0fFbop.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(B, h, v),
119
- a.registerCommand(w, h, v)
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("div", { className: `PollNode__container ${N ? "focused" : ""}`, ref: i, children: /* @__PURE__ */ C("div", { className: "PollNode__inner", children: [
135
- /* @__PURE__ */ o("h2", { className: "PollNode__heading", children: t }),
136
- c.map((e, l) => {
137
- const s = e.uid;
138
- return /* @__PURE__ */ o(
139
- L,
140
- {
141
- withPollNode: d,
142
- option: e,
143
- index: l,
144
- options: c,
145
- totalVotes: p
146
- },
147
- s
148
- );
149
- }),
150
- /* @__PURE__ */ o("div", { className: "PollNode__footer", children: /* @__PURE__ */ o(A, { onClick: u, small: !0, children: "Add Option" }) })
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
@@ -1,7 +1,7 @@
1
1
  import { jsx as g, jsxs as $, Fragment as F } from "react/jsx-runtime";
2
2
  import { useState as U, useEffect as b, useMemo as V, Suspense as q, useLayoutEffect as Y, useRef as W } from "react";
3
- import { N as T, D as G, R as a, o as c, p as u, q as J, s as Q, v as A, x as Z, A as ee, z as te, H as ne, d as re, y as M, e as oe, E as S, k as se, G as ie, I as O, J as X, M as ae, O as ce, P as le, Q as ue, S as de, T as fe, U as me, V as ge, b as B, W as pe, X as Ce, Y as he, Z as ye, _ as ve, a0 as Ee, a1 as we, m as ke, a2 as De, a3 as be, a4 as Le, g as Re, i as Se, C as x, a5 as P } from "./DSD.BJ38UQLe.js";
4
- import { d as xe, P as Pe } from "./DSD.CdYWFL0O.js";
3
+ import { N as T, D as G, R as a, o as c, p as u, q as J, s as Q, v as A, x as Z, A as ee, z as te, H as ne, d as re, y as M, e as oe, E as S, k as se, G as ie, I as O, J as X, M as ae, O as ce, P as le, Q as ue, S as de, T as fe, U as me, V as ge, b as B, W as pe, X as Ce, Y as he, Z as ye, _ as ve, a0 as Ee, a1 as we, m as ke, a2 as De, a3 as be, a4 as Le, g as Re, i as Se, C as x, a5 as P } from "./DSD.NL0fFbop.js";
4
+ import { d as xe, P as Pe } from "./DSD.CaG79eSb.js";
5
5
  import { flushSync as $e, createPortal as Ne } from "react-dom";
6
6
  const E = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Te = E && "documentMode" in document ? document.documentMode : null, Be = !(!E || !("InputEvent" in window) || Te) && "getTargetRanges" in new window.InputEvent("input"), _e = E && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), z = E && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, We = E && /^(?=.*Chrome).*/i.test(navigator.userAgent), Ae = E && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !We;
7
7
  function I(n, t) {
@@ -187,9 +187,11 @@ function Ge({
187
187
  const _ = d.current;
188
188
  _ !== null && L(_, r);
189
189
  }
190
- }), f = o.registerRootListener((h, p) => {
191
- p !== null && l.unobserve(p), h !== null && l.observe(h);
192
- }), C = () => {
190
+ }), f = o.registerRootListener(
191
+ (h, p) => {
192
+ p !== null && l.unobserve(p), h !== null && l.observe(h);
193
+ }
194
+ ), C = () => {
193
195
  const h = o.getRootElement(), p = d.current;
194
196
  h !== null && p !== null && (r.rootElementRect = h.getBoundingClientRect(), L(p, r));
195
197
  };
@@ -199,7 +201,10 @@ function Ge({
199
201
  }, [o]), b(() => {
200
202
  const r = d.current;
201
203
  r !== null && setTimeout(() => {
202
- r.style.setProperty("transition", "top 0.3s ease 0s, left 0.3s ease 0s");
204
+ r.style.setProperty(
205
+ "transition",
206
+ "top 0.3s ease 0s, left 0.3s ease 0s"
207
+ );
203
208
  }, 500);
204
209
  }, []);
205
210
  const y = (r) => {
@@ -1,7 +1,7 @@
1
1
  import { jsx as e, jsxs as f, Fragment as L } from "react/jsx-runtime";
2
- import { u as j, a as M, b as U, w, R as _, C as B, $ as z, F as D, N as O, c as W, K as h, d as q, k as G, e as H, D as J, r as Q, t as V, L as X, f as Y, h as Z, g as K, i as ee, j as te, B as ne } from "./DSD.BJ38UQLe.js";
3
- import { d as ae, P as le } from "./DSD.CdYWFL0O.js";
4
- import { useRef as k, useState as E, useCallback as F, useEffect as oe, Suspense as ie } from "react";
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.NL0fFbop.js";
4
+ import { d as oe, P as ie } from "./DSD.CaG79eSb.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({ children: n, label: o, className: t, ...u }) {
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(() => B(o)), [c, r] = E(i.getAltText()), [I, x] = E(i.getShowCaption()), [v, C] = E(i.getPosition()), b = (m) => {
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(te, { children: /* @__PURE__ */ e(ne, { "data-test-id": "image-modal-file-upload-btn", onClick: () => p(), children: "Применить" }) })
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] = j(), C = k(null), b = k(null), [d, p, m] = M(t), [l] = U(), [$, A] = E(null), P = k(null), N = F(
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 && w(_())) {
154
+ if (d && k(F())) {
141
155
  s.preventDefault();
142
156
  const a = B(t);
143
- z(a) && a.remove();
157
+ W(a) && a.remove();
144
158
  }
145
159
  return !1;
146
160
  },
147
161
  [d, t]
148
- ), R = F(
162
+ ), R = _(
149
163
  (s) => {
150
- const g = _(), a = b.current;
151
- if (d && w(g) && g.getNodes().length === 1) {
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 = F(
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 oe(() => {
182
+ return j(() => {
169
183
  let s = !0;
170
- const g = O(
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
- V,
189
+ Y,
176
190
  (a, S) => (P.current = S, !1),
177
191
  h
178
192
  ),
179
193
  l.registerCommand(
180
- Q,
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
- J,
202
+ V,
189
203
  (a) => a.target === C.current ? (a.preventDefault(), !0) : !1,
190
204
  h
191
205
  ),
192
- l.registerCommand(H, N, h),
193
- l.registerCommand(G, N, h),
194
- l.registerCommand(q, R, h),
195
- l.registerCommand(W, T, h)
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
- }, [m, l, d, t, N, R, T, p]), /* @__PURE__ */ f(ie, { fallback: null, children: [
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 ${w($) ? "draggable" : ""}` : null,
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(ae, { initialEditor: r, children: [
235
- /* @__PURE__ */ e(X, {}),
236
- /* @__PURE__ */ e(Y, {}),
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
- Z,
273
+ ee,
239
274
  {
240
- contentEditable: /* @__PURE__ */ e(K, { className: "InlineImageNode__contentEditable" }),
241
- placeholder: /* @__PURE__ */ e(le, { className: "InlineImageNode__placeholder", children: "Enter a caption..." }),
242
- ErrorBoundary: ee
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,4 +1,4 @@
1
- import { a6 as p, a7 as k, m as E } from "./DSD.BJ38UQLe.js";
1
+ import { a6 as p, a7 as k, m as E } from "./DSD.NL0fFbop.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) {