eddyter 1.3.63 → 1.3.65

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.
@@ -0,0 +1,199 @@
1
+ import { jsxs as Y, jsx as c } from "react/jsx-runtime";
2
+ import { calculateZoomLevel as N } from "@lexical/utils";
3
+ import { useRef as z } from "react";
4
+ function v(m, g, p) {
5
+ return Math.min(Math.max(m, g), p);
6
+ }
7
+ const r = {
8
+ east: 1,
9
+ north: 8,
10
+ south: 2,
11
+ west: 4
12
+ };
13
+ function S({
14
+ onResizeStart: m,
15
+ onResizeEnd: g,
16
+ buttonRef: p,
17
+ imageRef: w,
18
+ maxWidth: k,
19
+ editor: P,
20
+ showCaption: W,
21
+ setShowCaption: C,
22
+ captionsEnabled: E
23
+ }) {
24
+ const y = z(null), d = z({
25
+ priority: "",
26
+ value: "default"
27
+ }), f = z({
28
+ currentHeight: 0,
29
+ currentWidth: 0,
30
+ direction: 0,
31
+ isResizing: !1,
32
+ ratio: 0,
33
+ startHeight: 0,
34
+ startWidth: 0,
35
+ startX: 0,
36
+ startY: 0
37
+ }), a = P.getRootElement(), b = a !== null ? a.getBoundingClientRect().width - 20 : 100, X = a !== null ? a.getBoundingClientRect().height - 20 : 100, x = 100, $ = 100, L = (t) => {
38
+ const i = t === r.east || t === r.west, e = t === r.north || t === r.south, u = t & r.north && t & r.west || t & r.south && t & r.east, o = i ? "ew" : e ? "ns" : u ? "nwse" : "nesw";
39
+ a !== null && a.style.setProperty(
40
+ "cursor",
41
+ `${o}-resize`,
42
+ "important"
43
+ ), document.body !== null && (document.body.style.setProperty(
44
+ "cursor",
45
+ `${o}-resize`,
46
+ "important"
47
+ ), d.current.value = document.body.style.getPropertyValue(
48
+ "-webkit-user-select"
49
+ ), d.current.priority = document.body.style.getPropertyPriority(
50
+ "-webkit-user-select"
51
+ ), document.body.style.setProperty(
52
+ "-webkit-user-select",
53
+ "none",
54
+ "important"
55
+ ));
56
+ }, M = () => {
57
+ a !== null && a.style.setProperty("cursor", "text"), document.body !== null && (document.body.style.setProperty("cursor", "default"), document.body.style.setProperty(
58
+ "-webkit-user-select",
59
+ d.current.value,
60
+ d.current.priority
61
+ ));
62
+ }, l = (t, i) => {
63
+ if (!P.isEditable())
64
+ return;
65
+ const e = w.current, u = y.current;
66
+ if (e !== null && u !== null) {
67
+ t.preventDefault();
68
+ const { width: o, height: h } = e.getBoundingClientRect(), s = N(e), n = f.current;
69
+ n.startWidth = o, n.startHeight = h, n.ratio = o / h, n.currentWidth = o, n.currentHeight = h, n.startX = t.clientX / s, n.startY = t.clientY / s, n.isResizing = !0, n.direction = i, L(i), m(), u.classList.add("image-control-wrapper--resizing"), e.style.height = `${h}px`, e.style.width = `${o}px`, document.addEventListener("pointermove", H), document.addEventListener("pointerup", D);
70
+ }
71
+ }, H = (t) => {
72
+ const i = w.current, e = f.current, u = e.direction & (r.east | r.west), o = e.direction & (r.south | r.north);
73
+ if (i !== null && e.isResizing) {
74
+ const h = N(i);
75
+ if (u && o) {
76
+ let s = Math.floor(e.startX - t.clientX / h);
77
+ s = e.direction & r.east ? -s : s;
78
+ const n = v(
79
+ e.startWidth + s,
80
+ x,
81
+ b
82
+ ), R = n / e.ratio;
83
+ i.style.width = `${n}px`, i.style.height = `${R}px`, e.currentHeight = R, e.currentWidth = n;
84
+ } else if (o) {
85
+ let s = Math.floor(e.startY - t.clientY / h);
86
+ s = e.direction & r.south ? -s : s;
87
+ const n = v(
88
+ e.startHeight + s,
89
+ $,
90
+ X
91
+ );
92
+ i.style.height = `${n}px`, e.currentHeight = n;
93
+ } else {
94
+ let s = Math.floor(e.startX - t.clientX / h);
95
+ s = e.direction & r.east ? -s : s;
96
+ const n = v(
97
+ e.startWidth + s,
98
+ x,
99
+ b
100
+ );
101
+ i.style.width = `${n}px`, e.currentWidth = n;
102
+ }
103
+ }
104
+ }, D = () => {
105
+ const t = w.current, i = f.current, e = y.current;
106
+ if (t !== null && e !== null && i.isResizing) {
107
+ const u = i.currentWidth, o = i.currentHeight;
108
+ 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"), M(), g(u, o), document.removeEventListener("pointermove", H), document.removeEventListener("pointerup", D);
109
+ }
110
+ };
111
+ return /* @__PURE__ */ Y("div", { ref: y, children: [
112
+ !W && E && /* @__PURE__ */ c(
113
+ "button",
114
+ {
115
+ className: "image-caption-button",
116
+ ref: p,
117
+ onClick: () => {
118
+ C(!W);
119
+ },
120
+ children: "Add Caption"
121
+ }
122
+ ),
123
+ /* @__PURE__ */ c(
124
+ "div",
125
+ {
126
+ className: "image-resizer image-resizer-n",
127
+ onPointerDown: (t) => {
128
+ l(t, r.north);
129
+ }
130
+ }
131
+ ),
132
+ /* @__PURE__ */ c(
133
+ "div",
134
+ {
135
+ className: "image-resizer image-resizer-ne",
136
+ onPointerDown: (t) => {
137
+ l(t, r.north | r.east);
138
+ }
139
+ }
140
+ ),
141
+ /* @__PURE__ */ c(
142
+ "div",
143
+ {
144
+ className: "image-resizer image-resizer-e",
145
+ onPointerDown: (t) => {
146
+ l(t, r.east);
147
+ }
148
+ }
149
+ ),
150
+ /* @__PURE__ */ c(
151
+ "div",
152
+ {
153
+ className: "image-resizer image-resizer-se",
154
+ onPointerDown: (t) => {
155
+ l(t, r.south | r.east);
156
+ }
157
+ }
158
+ ),
159
+ /* @__PURE__ */ c(
160
+ "div",
161
+ {
162
+ className: "image-resizer image-resizer-s",
163
+ onPointerDown: (t) => {
164
+ l(t, r.south);
165
+ }
166
+ }
167
+ ),
168
+ /* @__PURE__ */ c(
169
+ "div",
170
+ {
171
+ className: "image-resizer image-resizer-sw",
172
+ onPointerDown: (t) => {
173
+ l(t, r.south | r.west);
174
+ }
175
+ }
176
+ ),
177
+ /* @__PURE__ */ c(
178
+ "div",
179
+ {
180
+ className: "image-resizer image-resizer-w",
181
+ onPointerDown: (t) => {
182
+ l(t, r.west);
183
+ }
184
+ }
185
+ ),
186
+ /* @__PURE__ */ c(
187
+ "div",
188
+ {
189
+ className: "image-resizer image-resizer-nw",
190
+ onPointerDown: (t) => {
191
+ l(t, r.north | r.west);
192
+ }
193
+ }
194
+ )
195
+ ] });
196
+ }
197
+ export {
198
+ S as I
199
+ };
@@ -10,6 +10,7 @@ interface EditorContextType {
10
10
  isLoading: boolean;
11
11
  error: string | null;
12
12
  editorConfig: EditorConfigTypes | null;
13
+ planConfig: EditorConfigTypes | null;
13
14
  projectName: string | null;
14
15
  isPaidPlan: boolean;
15
16
  apiKey: string | null;
@@ -8,7 +8,7 @@ export interface EditorConfig {
8
8
  enableFontControls: boolean;
9
9
  enableTableOptions: boolean;
10
10
  enableInsertMenu: boolean;
11
- enableColorPicker: boolean;
11
+ enableColors: boolean;
12
12
  enableClearOptions: boolean;
13
13
  enableEmojiPicker: boolean;
14
14
  enableLinks: boolean;
@@ -36,6 +36,7 @@ export interface EditorConfig {
36
36
  aiChat: boolean;
37
37
  comment: boolean;
38
38
  improve: boolean;
39
+ colors: boolean;
39
40
  };
40
41
  };
41
42
  expiresAt: string;
@@ -56,7 +57,7 @@ export interface ProjectData {
56
57
  enableFontControls: boolean;
57
58
  enableTableOptions: boolean;
58
59
  enableInsertMenu: boolean;
59
- enableColorPicker: boolean;
60
+ enableColors: boolean;
60
61
  enableClearOptions: boolean;
61
62
  enableEmojiPicker: boolean;
62
63
  enableLinks: boolean;
@@ -83,8 +84,18 @@ export interface ProjectData {
83
84
  aiChat: boolean;
84
85
  comment: boolean;
85
86
  improve: boolean;
87
+ colors: boolean;
86
88
  };
87
89
  };
90
+ planCustomizations?: {
91
+ enableToolbar?: boolean;
92
+ toolbarOptions?: Record<string, boolean>;
93
+ enableFloatingMenu?: boolean;
94
+ htmlViewOption?: boolean;
95
+ floatingMenuOptions?: Record<string, boolean>;
96
+ enableThemeToggle?: boolean;
97
+ enableShortcuts?: boolean;
98
+ };
88
99
  expiresAt: string;
89
100
  isValid: boolean;
90
101
  status: string;