eddyter 1.4.5 → 1.4.7

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.
Files changed (24) hide show
  1. package/README.md +31 -6
  2. package/dist/{ImageResizer-Bt7kgv0a.js → ImageResizer-C5luyjPa.js} +68 -59
  3. package/dist/assets/style.css +1 -1
  4. package/dist/components/ConfigurableEditorWithAuth.d.ts +8 -6
  5. package/dist/components/LineHeightPicker/LineHeightControl.d.ts +3 -0
  6. package/dist/editor/components/FloatingToolbarManager.d.ts +3 -1
  7. package/dist/editor/hooks/useFloatingToolbar.d.ts +3 -2
  8. package/dist/{generateDocxThumbnail-CNLulV6U.js → generateDocxThumbnail-CsyiVRDN.js} +1 -1
  9. package/dist/{generatePdfThumbnail-BFSOSFAX.js → generatePdfThumbnail-DCt8gJMy.js} +1 -1
  10. package/dist/{generateXlsxThumbnail-CfJuOgEl.js → generateXlsxThumbnail-DgeyjjM-.js} +1 -1
  11. package/dist/hooks/useAutoExpandingHeight.d.ts +1 -1
  12. package/dist/{html2pdf.bundle.min-wRsYlGzo.js → html2pdf.bundle.min-Da_gEqE8.js} +1 -1
  13. package/dist/{index-Ct824Y4n.js → index-Bq1EWxza.js} +4 -4
  14. package/dist/{index-Dsv2sdJQ.js → index-CoO1ZeVi.js} +106 -109
  15. package/dist/{index-DMZDKMjN.js → index-Cs_v2OZr.js} +47393 -43616
  16. package/dist/{index-BJ5KLQGQ.js → index-DAqL9TB6.js} +66 -67
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/pages/ConfigurableEditor/ConfigurableEditor.d.ts +2 -2
  20. package/dist/plugins/CustomHorizontalRulePlugin/CustomHorizontalRuleNode.d.ts +4 -1
  21. package/dist/plugins/CustomHorizontalRulePlugin/HorizontalRuleCustomizationDialog.d.ts +8 -1
  22. package/dist/types.d.ts +8 -0
  23. package/dist/utils/fileUploadValidation.d.ts +2 -0
  24. package/package.json +1 -1
package/README.md CHANGED
@@ -189,27 +189,52 @@ The main editor component with authentication.
189
189
  | `customVerifyKey` | `(key: string) => Promise<ApiResponse>` | No | Custom key verification function |
190
190
  | `mode` | `"edit" \| "preview"` | No | Editor mode (default: `"edit"`) |
191
191
  | `previewClassName` | `string` | No | CSS class for preview container |
192
- | `previewStyle` | `React.CSSProperties` | No | Inline styles for preview container |
192
+ | `editor` | `{ maxHeight?: React.CSSProperties["maxHeight"] }` | No | Editor container options (`maxHeight`) |
193
193
  | `onPreviewClick` | `() => void` | No | Click handler for preview mode |
194
194
  | `enableReactNativeBridge` | `boolean` | No | Enable React Native WebView bridge |
195
195
  | `onEditorReady` | `() => void` | No | Called when editor is fully loaded |
196
196
  | `onFocus` | `() => void` | No | Called on editor focus |
197
197
  | `onBlur` | `() => void` | No | Called on editor blur |
198
198
  | `onHeightChange` | `(height: number) => void` | No | Called when editor height changes |
199
- | `toolbarTopOffset` | `number` | No | Distance (px) the floating toolbar keeps from the viewport top when it detaches on scroll (default: `20`) |
199
+ | `toolbar` | `{ mode?: "sticky" \| "static"; offset?: number; zIndex?: number }` | No | Toolbar behavior config (default: `{ mode: "sticky", offset: 20, zIndex: 1000 }`) |
200
200
 
201
- ### Floating Toolbar Offset
201
+ ### Toolbar Configuration
202
202
 
203
- When a user scrolls down, the toolbar detaches from its original position and sticks to the top of the viewport. By default it stays **20 px** below the top edge. You can customize this gap — for example, if your app has its own fixed header:
203
+ Use the `toolbar` prop to control sticky/static toolbar behavior:
204
204
 
205
205
  ```tsx
206
206
  <ConfigurableEditorWithAuth
207
207
  apiKey="your-api-key"
208
- toolbarTopOffset={64} // sit below a 64px fixed header
208
+ toolbar={{ mode: "sticky", offset: 64, zIndex: 1200 }}
209
209
  />
210
210
  ```
211
211
 
212
- Set `toolbarTopOffset={0}` to pin the toolbar flush against the viewport top.
212
+ Modes:
213
+
214
+ - `mode: "sticky"` -> toolbar detaches/sticks while scrolling and applies `offset` + `zIndex`
215
+ - `mode: "static"` -> toolbar stays attached and ignores `offset` + `zIndex` even if provided
216
+
217
+ Defaults:
218
+
219
+ ```ts
220
+ const defaultToolbar = {
221
+ mode: "sticky",
222
+ offset: 20,
223
+ zIndex: 1000
224
+ };
225
+ ```
226
+
227
+ In static mode, if you want only the editor content area to scroll, pass a `maxHeight` using `editor`:
228
+
229
+ ```tsx
230
+ <ConfigurableEditorWithAuth
231
+ apiKey="your-api-key"
232
+ toolbar={{ mode: "static" }}
233
+ editor={{ maxHeight: 600 }}
234
+ />
235
+ ```
236
+
237
+ If `maxHeight` is not provided, the full page/container scrolls normally with the toolbar.
213
238
 
214
239
  ## Examples
215
240
 
@@ -1,6 +1,6 @@
1
- import { jsxs as B, jsx as m } from "react/jsx-runtime";
2
- import { calculateZoomLevel as C } from "@lexical/utils";
3
- import { useRef as w } from "react";
1
+ import { jsxs as B, jsx as u } from "react/jsx-runtime";
2
+ import { calculateZoomLevel as N } from "@lexical/utils";
3
+ import { useRef as P } from "react";
4
4
  function $(f, x, z) {
5
5
  return Math.min(Math.max(f, x), z);
6
6
  }
@@ -16,15 +16,15 @@ function F({
16
16
  buttonRef: z,
17
17
  imageRef: v,
18
18
  maxWidth: j,
19
- editor: H,
20
- showCaption: R,
19
+ editor: R,
20
+ showCaption: H,
21
21
  setShowCaption: X,
22
22
  captionsEnabled: I
23
23
  }) {
24
- const W = w(null), g = w({
24
+ const W = P(null), g = P({
25
25
  priority: "",
26
26
  value: "default"
27
- }), b = w({
27
+ }), b = P({
28
28
  currentHeight: 0,
29
29
  currentWidth: 0,
30
30
  direction: 0,
@@ -34,9 +34,9 @@ function F({
34
34
  startWidth: 0,
35
35
  startX: 0,
36
36
  startY: 0
37
- }), P = w({ imageWrapper: null, editorImageSpan: null, parentParagraph: null }), u = H.getRootElement(), c = u !== null ? u.getBoundingClientRect().width - 20 : 100, L = u !== null ? u.getBoundingClientRect().height - 20 : 100, D = 100, S = 100, M = (t) => {
38
- const i = t === r.east || t === r.west, e = t === r.north || t === r.south, h = t & r.north && t & r.west || t & r.south && t & r.east, l = i ? "ew" : e ? "ns" : h ? "nwse" : "nesw";
39
- u !== null && u.style.setProperty(
37
+ }), w = P({ imageWrapper: null, editorImageSpan: null, parentParagraph: null }), h = R.getRootElement(), m = h !== null ? h.getBoundingClientRect().width - 20 : 100, L = h !== null ? h.getBoundingClientRect().height - 20 : 100, D = 100, S = 100, M = (t) => {
38
+ const i = t === r.east || t === r.west, e = t === r.north || t === r.south, d = t & r.north && t & r.west || t & r.south && t & r.east, l = i ? "ew" : e ? "ns" : d ? "nwse" : "nesw";
39
+ h !== null && h.style.setProperty(
40
40
  "cursor",
41
41
  `${l}-resize`,
42
42
  "important"
@@ -54,69 +54,69 @@ function F({
54
54
  "important"
55
55
  ));
56
56
  }, Y = () => {
57
- u !== null && u.style.setProperty("cursor", "text"), document.body !== null && (document.body.style.setProperty("cursor", "default"), document.body.style.setProperty(
57
+ h !== null && h.style.setProperty("cursor", "text"), document.body !== null && (document.body.style.setProperty("cursor", "default"), document.body.style.setProperty(
58
58
  "-webkit-user-select",
59
59
  g.current.value,
60
60
  g.current.priority
61
61
  ));
62
- }, d = (t, i) => {
63
- if (!H.isEditable())
62
+ }, y = (t, i) => {
63
+ if (!R.isEditable())
64
64
  return;
65
- const e = v.current, h = W.current;
66
- if (e !== null && h !== null) {
65
+ const e = v.current, d = W.current;
66
+ if (e !== null && d !== null) {
67
67
  t.preventDefault();
68
- const { width: l, height: s } = e.getBoundingClientRect(), p = C(e), o = b.current;
69
- o.startWidth = l, o.startHeight = s, o.ratio = l / s, o.currentWidth = l, o.currentHeight = s, o.startX = t.clientX / p, o.startY = t.clientY / p, o.isResizing = !0, o.direction = i, M(i), f(), h.classList.add("image-control-wrapper--resizing"), e.style.setProperty(
68
+ const { width: l, height: s } = e.getBoundingClientRect(), c = N(e), o = b.current;
69
+ o.startWidth = l, o.startHeight = s, o.ratio = l / s, o.currentWidth = l, o.currentHeight = s, o.startX = t.clientX / c, o.startY = t.clientY / c, o.isResizing = !0, o.direction = i, M(i), f(), d.classList.add("image-control-wrapper--resizing"), e.style.setProperty(
70
70
  "max-width",
71
- `${c}px`,
71
+ `${m}px`,
72
72
  "important"
73
73
  );
74
- const y = e.parentElement, n = e.closest(
74
+ const p = e.parentElement, n = e.closest(
75
75
  ".editor-image"
76
76
  ), a = n?.parentElement ?? null;
77
- P.current = { imageWrapper: y, editorImageSpan: n, parentParagraph: a }, y && (y.style.setProperty("display", "inline-block", "important"), y.style.setProperty("width", "auto", "important"), y.style.setProperty(
77
+ w.current = { imageWrapper: p, editorImageSpan: n, parentParagraph: a }, p && (p.style.setProperty("display", "inline-block", "important"), p.style.setProperty("width", "auto", "important"), p.style.setProperty(
78
78
  "max-width",
79
- `${c}px`,
79
+ `${m}px`,
80
80
  "important"
81
81
  )), n && (n.style.setProperty("display", "inline-block", "important"), n.style.setProperty(
82
82
  "max-width",
83
- `${c}px`,
83
+ `${m}px`,
84
84
  "important"
85
85
  )), a && a.style.setProperty(
86
86
  "max-width",
87
- `${c}px`,
87
+ `${m}px`,
88
88
  "important"
89
89
  ), e.style.setProperty("height", `${s}px`, "important"), e.style.setProperty("width", `${l}px`, "important"), document.addEventListener("pointermove", E), document.addEventListener("pointerup", k);
90
90
  }
91
91
  }, E = (t) => {
92
- const i = v.current, e = b.current, h = e.direction & (r.east | r.west), l = e.direction & (r.south | r.north);
92
+ const i = v.current, e = b.current, d = e.direction & (r.east | r.west), l = e.direction & (r.south | r.north);
93
93
  if (i !== null && e.isResizing) {
94
- const s = C(i), { imageWrapper: p, editorImageSpan: o, parentParagraph: y } = P.current;
94
+ const s = N(i), { imageWrapper: c, editorImageSpan: o, parentParagraph: p } = w.current;
95
95
  if (i.style.setProperty(
96
96
  "max-width",
97
- `${c}px`,
97
+ `${m}px`,
98
98
  "important"
99
- ), p && (p.style.setProperty("display", "inline-block", "important"), p.style.setProperty("width", "auto", "important"), p.style.setProperty(
99
+ ), c && (c.style.setProperty("display", "inline-block", "important"), c.style.setProperty("width", "auto", "important"), c.style.setProperty(
100
100
  "max-width",
101
- `${c}px`,
101
+ `${m}px`,
102
102
  "important"
103
103
  )), o && (o.style.setProperty("display", "inline-block", "important"), o.style.setProperty(
104
104
  "max-width",
105
- `${c}px`,
105
+ `${m}px`,
106
106
  "important"
107
- )), y && y.style.setProperty(
107
+ )), p && p.style.setProperty(
108
108
  "max-width",
109
- `${c}px`,
109
+ `${m}px`,
110
110
  "important"
111
- ), h && l) {
111
+ ), d && l) {
112
112
  let n = Math.floor(e.startX - t.clientX / s);
113
113
  n = e.direction & r.east ? -n : n;
114
114
  const a = $(
115
115
  e.startWidth + n,
116
116
  D,
117
- c
118
- ), N = a / e.ratio;
119
- i.style.setProperty("width", `${a}px`, "important"), i.style.setProperty("height", `${N}px`, "important"), e.currentHeight = N, e.currentWidth = a;
117
+ m
118
+ ), C = a / e.ratio;
119
+ i.style.setProperty("width", `${a}px`, "important"), i.style.setProperty("height", `${C}px`, "important"), e.currentHeight = C, e.currentWidth = a;
120
120
  } else if (l) {
121
121
  let n = Math.floor(e.startY - t.clientY / s);
122
122
  n = e.direction & r.south ? -n : n;
@@ -132,7 +132,7 @@ function F({
132
132
  const a = $(
133
133
  e.startWidth + n,
134
134
  D,
135
- c
135
+ m
136
136
  );
137
137
  i.style.setProperty("width", `${a}px`, "important"), e.currentWidth = a;
138
138
  }
@@ -140,12 +140,21 @@ function F({
140
140
  }, k = () => {
141
141
  const t = v.current, i = b.current, e = W.current;
142
142
  if (t !== null && e !== null && i.isResizing) {
143
- const h = i.currentWidth, l = i.currentHeight;
143
+ const d = i.currentWidth, l = i.currentHeight;
144
144
  i.startWidth = 0, i.startHeight = 0, i.ratio = 0, i.startX = 0, i.startY = 0, i.currentWidth = 0, i.currentHeight = 0, i.isResizing = !1, e.classList.remove("image-control-wrapper--resizing");
145
- const { imageWrapper: s, editorImageSpan: p, parentParagraph: o } = P.current;
146
- s && (s.style.removeProperty("display"), s.style.removeProperty("width"), s.style.removeProperty("max-width")), Y(), x(h, l), requestAnimationFrame(() => {
147
- t.style.removeProperty("max-width"), p && (p.style.removeProperty("display"), p.style.removeProperty("max-width")), o && o.style.removeProperty("max-width");
148
- }), P.current = {
145
+ const { imageWrapper: s, editorImageSpan: c, parentParagraph: o } = w.current;
146
+ s && (s.style.removeProperty("display"), s.style.removeProperty("width"), s.style.removeProperty("max-width")), Y(), x(d, l);
147
+ const p = d;
148
+ requestAnimationFrame(() => {
149
+ if (t.style.removeProperty("max-width"), c && (c.style.removeProperty("display"), c.style.removeProperty("max-width")), o) {
150
+ const n = o.getBoundingClientRect().width;
151
+ typeof p == "number" && p > n ? o.style.setProperty(
152
+ "max-width",
153
+ `${p + 40}px`,
154
+ "important"
155
+ ) : o.style.removeProperty("max-width");
156
+ }
157
+ }), w.current = {
149
158
  imageWrapper: null,
150
159
  editorImageSpan: null,
151
160
  parentParagraph: null
@@ -153,86 +162,86 @@ function F({
153
162
  }
154
163
  };
155
164
  return /* @__PURE__ */ B("div", { ref: W, children: [
156
- !R && I && /* @__PURE__ */ m(
165
+ !H && I && /* @__PURE__ */ u(
157
166
  "button",
158
167
  {
159
168
  className: "image-caption-button cteditor-text-sm",
160
169
  ref: z,
161
170
  onClick: () => {
162
- X(!R);
171
+ X(!H);
163
172
  },
164
173
  children: "Add Caption"
165
174
  }
166
175
  ),
167
- /* @__PURE__ */ m(
176
+ /* @__PURE__ */ u(
168
177
  "div",
169
178
  {
170
179
  className: "image-resizer image-resizer-n",
171
180
  onPointerDown: (t) => {
172
- d(t, r.north);
181
+ y(t, r.north);
173
182
  }
174
183
  }
175
184
  ),
176
- /* @__PURE__ */ m(
185
+ /* @__PURE__ */ u(
177
186
  "div",
178
187
  {
179
188
  className: "image-resizer image-resizer-ne",
180
189
  onPointerDown: (t) => {
181
- d(t, r.north | r.east);
190
+ y(t, r.north | r.east);
182
191
  }
183
192
  }
184
193
  ),
185
- /* @__PURE__ */ m(
194
+ /* @__PURE__ */ u(
186
195
  "div",
187
196
  {
188
197
  className: "image-resizer image-resizer-e",
189
198
  onPointerDown: (t) => {
190
- d(t, r.east);
199
+ y(t, r.east);
191
200
  }
192
201
  }
193
202
  ),
194
- /* @__PURE__ */ m(
203
+ /* @__PURE__ */ u(
195
204
  "div",
196
205
  {
197
206
  className: "image-resizer image-resizer-se",
198
207
  onPointerDown: (t) => {
199
- d(t, r.south | r.east);
208
+ y(t, r.south | r.east);
200
209
  }
201
210
  }
202
211
  ),
203
- /* @__PURE__ */ m(
212
+ /* @__PURE__ */ u(
204
213
  "div",
205
214
  {
206
215
  className: "image-resizer image-resizer-s",
207
216
  onPointerDown: (t) => {
208
- d(t, r.south);
217
+ y(t, r.south);
209
218
  }
210
219
  }
211
220
  ),
212
- /* @__PURE__ */ m(
221
+ /* @__PURE__ */ u(
213
222
  "div",
214
223
  {
215
224
  className: "image-resizer image-resizer-sw",
216
225
  onPointerDown: (t) => {
217
- d(t, r.south | r.west);
226
+ y(t, r.south | r.west);
218
227
  }
219
228
  }
220
229
  ),
221
- /* @__PURE__ */ m(
230
+ /* @__PURE__ */ u(
222
231
  "div",
223
232
  {
224
233
  className: "image-resizer image-resizer-w",
225
234
  onPointerDown: (t) => {
226
- d(t, r.west);
235
+ y(t, r.west);
227
236
  }
228
237
  }
229
238
  ),
230
- /* @__PURE__ */ m(
239
+ /* @__PURE__ */ u(
231
240
  "div",
232
241
  {
233
242
  className: "image-resizer image-resizer-nw",
234
243
  onPointerDown: (t) => {
235
- d(t, r.north | r.west);
244
+ y(t, r.north | r.west);
236
245
  }
237
246
  }
238
247
  )