eddyter 1.4.5 → 1.4.6
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 +31 -6
- package/dist/{ImageResizer-Bt7kgv0a.js → ImageResizer-C5luyjPa.js} +68 -59
- package/dist/assets/style.css +1 -1
- package/dist/components/ConfigurableEditorWithAuth.d.ts +8 -6
- package/dist/components/LineHeightPicker/LineHeightControl.d.ts +3 -0
- package/dist/editor/components/FloatingToolbarManager.d.ts +3 -1
- package/dist/editor/hooks/useFloatingToolbar.d.ts +3 -2
- package/dist/{generateDocxThumbnail-CNLulV6U.js → generateDocxThumbnail-BgIdOWg3.js} +1 -1
- package/dist/{generatePdfThumbnail-BFSOSFAX.js → generatePdfThumbnail-DZ8_E1lJ.js} +1 -1
- package/dist/{generateXlsxThumbnail-CfJuOgEl.js → generateXlsxThumbnail-B_vFMM-q.js} +1 -1
- package/dist/hooks/useAutoExpandingHeight.d.ts +1 -1
- package/dist/{html2pdf.bundle.min-wRsYlGzo.js → html2pdf.bundle.min-CDLnol6o.js} +1 -1
- package/dist/{index-Ct824Y4n.js → index-B6FDh2NJ.js} +4 -4
- package/dist/{index-DMZDKMjN.js → index-CU78ju_h.js} +27144 -26447
- package/dist/{index-BJ5KLQGQ.js → index-CVkebuOP.js} +2 -2
- package/dist/{index-Dsv2sdJQ.js → index-DtbCbxgA.js} +2 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/pages/ConfigurableEditor/ConfigurableEditor.d.ts +2 -2
- package/dist/plugins/CustomHorizontalRulePlugin/CustomHorizontalRuleNode.d.ts +4 -1
- package/dist/plugins/CustomHorizontalRulePlugin/HorizontalRuleCustomizationDialog.d.ts +8 -1
- package/dist/types.d.ts +8 -0
- package/dist/utils/fileUploadValidation.d.ts +2 -0
- 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
|
-
| `
|
|
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
|
-
| `
|
|
199
|
+
| `toolbar` | `{ mode?: "sticky" \| "static"; offset?: number; zIndex?: number }` | No | Toolbar behavior config (default: `{ mode: "sticky", offset: 20, zIndex: 1000 }`) |
|
|
200
200
|
|
|
201
|
-
###
|
|
201
|
+
### Toolbar Configuration
|
|
202
202
|
|
|
203
|
-
|
|
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
|
-
|
|
208
|
+
toolbar={{ mode: "sticky", offset: 64, zIndex: 1200 }}
|
|
209
209
|
/>
|
|
210
210
|
```
|
|
211
211
|
|
|
212
|
-
|
|
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
|
|
2
|
-
import { calculateZoomLevel as
|
|
3
|
-
import { useRef as
|
|
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:
|
|
20
|
-
showCaption:
|
|
19
|
+
editor: R,
|
|
20
|
+
showCaption: H,
|
|
21
21
|
setShowCaption: X,
|
|
22
22
|
captionsEnabled: I
|
|
23
23
|
}) {
|
|
24
|
-
const W =
|
|
24
|
+
const W = P(null), g = P({
|
|
25
25
|
priority: "",
|
|
26
26
|
value: "default"
|
|
27
|
-
}), b =
|
|
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
|
-
}),
|
|
38
|
-
const i = t === r.east || t === r.west, e = t === r.north || t === r.south,
|
|
39
|
-
|
|
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
|
-
|
|
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
|
-
},
|
|
63
|
-
if (!
|
|
62
|
+
}, y = (t, i) => {
|
|
63
|
+
if (!R.isEditable())
|
|
64
64
|
return;
|
|
65
|
-
const e = v.current,
|
|
66
|
-
if (e !== 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(),
|
|
69
|
-
o.startWidth = l, o.startHeight = s, o.ratio = l / s, o.currentWidth = l, o.currentHeight = s, o.startX = t.clientX /
|
|
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
|
-
`${
|
|
71
|
+
`${m}px`,
|
|
72
72
|
"important"
|
|
73
73
|
);
|
|
74
|
-
const
|
|
74
|
+
const p = e.parentElement, n = e.closest(
|
|
75
75
|
".editor-image"
|
|
76
76
|
), a = n?.parentElement ?? null;
|
|
77
|
-
|
|
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
|
-
`${
|
|
79
|
+
`${m}px`,
|
|
80
80
|
"important"
|
|
81
81
|
)), n && (n.style.setProperty("display", "inline-block", "important"), n.style.setProperty(
|
|
82
82
|
"max-width",
|
|
83
|
-
`${
|
|
83
|
+
`${m}px`,
|
|
84
84
|
"important"
|
|
85
85
|
)), a && a.style.setProperty(
|
|
86
86
|
"max-width",
|
|
87
|
-
`${
|
|
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,
|
|
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 =
|
|
94
|
+
const s = N(i), { imageWrapper: c, editorImageSpan: o, parentParagraph: p } = w.current;
|
|
95
95
|
if (i.style.setProperty(
|
|
96
96
|
"max-width",
|
|
97
|
-
`${
|
|
97
|
+
`${m}px`,
|
|
98
98
|
"important"
|
|
99
|
-
),
|
|
99
|
+
), c && (c.style.setProperty("display", "inline-block", "important"), c.style.setProperty("width", "auto", "important"), c.style.setProperty(
|
|
100
100
|
"max-width",
|
|
101
|
-
`${
|
|
101
|
+
`${m}px`,
|
|
102
102
|
"important"
|
|
103
103
|
)), o && (o.style.setProperty("display", "inline-block", "important"), o.style.setProperty(
|
|
104
104
|
"max-width",
|
|
105
|
-
`${
|
|
105
|
+
`${m}px`,
|
|
106
106
|
"important"
|
|
107
|
-
)),
|
|
107
|
+
)), p && p.style.setProperty(
|
|
108
108
|
"max-width",
|
|
109
|
-
`${
|
|
109
|
+
`${m}px`,
|
|
110
110
|
"important"
|
|
111
|
-
),
|
|
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
|
-
|
|
118
|
-
),
|
|
119
|
-
i.style.setProperty("width", `${a}px`, "important"), i.style.setProperty("height", `${
|
|
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
|
-
|
|
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
|
|
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:
|
|
146
|
-
s && (s.style.removeProperty("display"), s.style.removeProperty("width"), s.style.removeProperty("max-width")), Y(), x(
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
!
|
|
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(!
|
|
171
|
+
X(!H);
|
|
163
172
|
},
|
|
164
173
|
children: "Add Caption"
|
|
165
174
|
}
|
|
166
175
|
),
|
|
167
|
-
/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ u(
|
|
168
177
|
"div",
|
|
169
178
|
{
|
|
170
179
|
className: "image-resizer image-resizer-n",
|
|
171
180
|
onPointerDown: (t) => {
|
|
172
|
-
|
|
181
|
+
y(t, r.north);
|
|
173
182
|
}
|
|
174
183
|
}
|
|
175
184
|
),
|
|
176
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ u(
|
|
177
186
|
"div",
|
|
178
187
|
{
|
|
179
188
|
className: "image-resizer image-resizer-ne",
|
|
180
189
|
onPointerDown: (t) => {
|
|
181
|
-
|
|
190
|
+
y(t, r.north | r.east);
|
|
182
191
|
}
|
|
183
192
|
}
|
|
184
193
|
),
|
|
185
|
-
/* @__PURE__ */
|
|
194
|
+
/* @__PURE__ */ u(
|
|
186
195
|
"div",
|
|
187
196
|
{
|
|
188
197
|
className: "image-resizer image-resizer-e",
|
|
189
198
|
onPointerDown: (t) => {
|
|
190
|
-
|
|
199
|
+
y(t, r.east);
|
|
191
200
|
}
|
|
192
201
|
}
|
|
193
202
|
),
|
|
194
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ u(
|
|
195
204
|
"div",
|
|
196
205
|
{
|
|
197
206
|
className: "image-resizer image-resizer-se",
|
|
198
207
|
onPointerDown: (t) => {
|
|
199
|
-
|
|
208
|
+
y(t, r.south | r.east);
|
|
200
209
|
}
|
|
201
210
|
}
|
|
202
211
|
),
|
|
203
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ u(
|
|
204
213
|
"div",
|
|
205
214
|
{
|
|
206
215
|
className: "image-resizer image-resizer-s",
|
|
207
216
|
onPointerDown: (t) => {
|
|
208
|
-
|
|
217
|
+
y(t, r.south);
|
|
209
218
|
}
|
|
210
219
|
}
|
|
211
220
|
),
|
|
212
|
-
/* @__PURE__ */
|
|
221
|
+
/* @__PURE__ */ u(
|
|
213
222
|
"div",
|
|
214
223
|
{
|
|
215
224
|
className: "image-resizer image-resizer-sw",
|
|
216
225
|
onPointerDown: (t) => {
|
|
217
|
-
|
|
226
|
+
y(t, r.south | r.west);
|
|
218
227
|
}
|
|
219
228
|
}
|
|
220
229
|
),
|
|
221
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ u(
|
|
222
231
|
"div",
|
|
223
232
|
{
|
|
224
233
|
className: "image-resizer image-resizer-w",
|
|
225
234
|
onPointerDown: (t) => {
|
|
226
|
-
|
|
235
|
+
y(t, r.west);
|
|
227
236
|
}
|
|
228
237
|
}
|
|
229
238
|
),
|
|
230
|
-
/* @__PURE__ */
|
|
239
|
+
/* @__PURE__ */ u(
|
|
231
240
|
"div",
|
|
232
241
|
{
|
|
233
242
|
className: "image-resizer image-resizer-nw",
|
|
234
243
|
onPointerDown: (t) => {
|
|
235
|
-
|
|
244
|
+
y(t, r.north | r.west);
|
|
236
245
|
}
|
|
237
246
|
}
|
|
238
247
|
)
|