open-text-editor-latest 1.0.1
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 +16 -0
- package/dist/index.cjs.js +41 -0
- package/dist/index.es.js +1146 -0
- package/dist/index.umd.js +41 -0
- package/dist/vite.svg +1 -0
- package/docs/PUBLISH.md +27 -0
- package/docs/editor/developer.md +31 -0
- package/package.json +71 -0
- package/src/editor/OpenTextEditor.jsx +1021 -0
- package/src/editor/README.md +15 -0
- package/src/editor/assets/.gitkeep +0 -0
- package/src/editor/index.jsx +4 -0
- package/src/editor/plugins/formatting.js +10 -0
- package/src/editor/plugins/history.js +9 -0
- package/src/editor/plugins/image.js +9 -0
- package/src/editor/plugins/index.js +25 -0
- package/src/editor/plugins/table.js +9 -0
- package/src/editor/styles/editor.css +8 -0
- package/src/editor/tests/.gitkeep +0 -0
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,1146 @@
|
|
|
1
|
+
import Qe, { forwardRef as Ce, createElement as je, useRef as O, useState as v, useImperativeHandle as Ze, useEffect as fe, useCallback as Ke } from "react";
|
|
2
|
+
var pe = { exports: {} }, re = {};
|
|
3
|
+
var Ae;
|
|
4
|
+
function et() {
|
|
5
|
+
if (Ae) return re;
|
|
6
|
+
Ae = 1;
|
|
7
|
+
var m = /* @__PURE__ */ Symbol.for("react.transitional.element"), g = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
8
|
+
function k(j, w, l) {
|
|
9
|
+
var T = null;
|
|
10
|
+
if (l !== void 0 && (T = "" + l), w.key !== void 0 && (T = "" + w.key), "key" in w) {
|
|
11
|
+
l = {};
|
|
12
|
+
for (var N in w)
|
|
13
|
+
N !== "key" && (l[N] = w[N]);
|
|
14
|
+
} else l = w;
|
|
15
|
+
return w = l.ref, {
|
|
16
|
+
$$typeof: m,
|
|
17
|
+
type: j,
|
|
18
|
+
key: T,
|
|
19
|
+
ref: w !== void 0 ? w : null,
|
|
20
|
+
props: l
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return re.Fragment = g, re.jsx = k, re.jsxs = k, re;
|
|
24
|
+
}
|
|
25
|
+
var oe = {};
|
|
26
|
+
var Le;
|
|
27
|
+
function tt() {
|
|
28
|
+
return Le || (Le = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
29
|
+
function m(e) {
|
|
30
|
+
if (e == null) return null;
|
|
31
|
+
if (typeof e == "function")
|
|
32
|
+
return e.$$typeof === ce ? null : e.displayName || e.name || null;
|
|
33
|
+
if (typeof e == "string") return e;
|
|
34
|
+
switch (e) {
|
|
35
|
+
case F:
|
|
36
|
+
return "Fragment";
|
|
37
|
+
case le:
|
|
38
|
+
return "Profiler";
|
|
39
|
+
case ae:
|
|
40
|
+
return "StrictMode";
|
|
41
|
+
case B:
|
|
42
|
+
return "Suspense";
|
|
43
|
+
case xe:
|
|
44
|
+
return "SuspenseList";
|
|
45
|
+
case ie:
|
|
46
|
+
return "Activity";
|
|
47
|
+
}
|
|
48
|
+
if (typeof e == "object")
|
|
49
|
+
switch (typeof e.tag == "number" && console.error(
|
|
50
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
51
|
+
), e.$$typeof) {
|
|
52
|
+
case se:
|
|
53
|
+
return "Portal";
|
|
54
|
+
case S:
|
|
55
|
+
return e.displayName || "Context";
|
|
56
|
+
case ge:
|
|
57
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
58
|
+
case be:
|
|
59
|
+
var s = e.render;
|
|
60
|
+
return e = e.displayName, e || (e = s.displayName || s.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
61
|
+
case J:
|
|
62
|
+
return s = e.displayName || null, s !== null ? s : m(e.type) || "Memo";
|
|
63
|
+
case U:
|
|
64
|
+
s = e._payload, e = e._init;
|
|
65
|
+
try {
|
|
66
|
+
return m(e(s));
|
|
67
|
+
} catch {
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
function g(e) {
|
|
73
|
+
return "" + e;
|
|
74
|
+
}
|
|
75
|
+
function k(e) {
|
|
76
|
+
try {
|
|
77
|
+
g(e);
|
|
78
|
+
var s = !1;
|
|
79
|
+
} catch {
|
|
80
|
+
s = !0;
|
|
81
|
+
}
|
|
82
|
+
if (s) {
|
|
83
|
+
s = console;
|
|
84
|
+
var i = s.error, d = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
85
|
+
return i.call(
|
|
86
|
+
s,
|
|
87
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
88
|
+
d
|
|
89
|
+
), g(e);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function j(e) {
|
|
93
|
+
if (e === F) return "<>";
|
|
94
|
+
if (typeof e == "object" && e !== null && e.$$typeof === U)
|
|
95
|
+
return "<...>";
|
|
96
|
+
try {
|
|
97
|
+
var s = m(e);
|
|
98
|
+
return s ? "<" + s + ">" : "<...>";
|
|
99
|
+
} catch {
|
|
100
|
+
return "<...>";
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function w() {
|
|
104
|
+
var e = Q.A;
|
|
105
|
+
return e === null ? null : e.getOwner();
|
|
106
|
+
}
|
|
107
|
+
function l() {
|
|
108
|
+
return Error("react-stack-top-frame");
|
|
109
|
+
}
|
|
110
|
+
function T(e) {
|
|
111
|
+
if (Z.call(e, "key")) {
|
|
112
|
+
var s = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
113
|
+
if (s && s.isReactWarning) return !1;
|
|
114
|
+
}
|
|
115
|
+
return e.key !== void 0;
|
|
116
|
+
}
|
|
117
|
+
function N(e, s) {
|
|
118
|
+
function i() {
|
|
119
|
+
W || (W = !0, console.error(
|
|
120
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
121
|
+
s
|
|
122
|
+
));
|
|
123
|
+
}
|
|
124
|
+
i.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
125
|
+
get: i,
|
|
126
|
+
configurable: !0
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function P() {
|
|
130
|
+
var e = m(this.type);
|
|
131
|
+
return n[e] || (n[e] = !0, console.error(
|
|
132
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
133
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
134
|
+
}
|
|
135
|
+
function q(e, s, i, d, M, L) {
|
|
136
|
+
var y = i.ref;
|
|
137
|
+
return e = {
|
|
138
|
+
$$typeof: G,
|
|
139
|
+
type: e,
|
|
140
|
+
key: s,
|
|
141
|
+
props: i,
|
|
142
|
+
_owner: d
|
|
143
|
+
}, (y !== void 0 ? y : null) !== null ? Object.defineProperty(e, "ref", {
|
|
144
|
+
enumerable: !1,
|
|
145
|
+
get: P
|
|
146
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
147
|
+
configurable: !1,
|
|
148
|
+
enumerable: !1,
|
|
149
|
+
writable: !0,
|
|
150
|
+
value: 0
|
|
151
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
152
|
+
configurable: !1,
|
|
153
|
+
enumerable: !1,
|
|
154
|
+
writable: !0,
|
|
155
|
+
value: null
|
|
156
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
157
|
+
configurable: !1,
|
|
158
|
+
enumerable: !1,
|
|
159
|
+
writable: !0,
|
|
160
|
+
value: M
|
|
161
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
162
|
+
configurable: !1,
|
|
163
|
+
enumerable: !1,
|
|
164
|
+
writable: !0,
|
|
165
|
+
value: L
|
|
166
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
167
|
+
}
|
|
168
|
+
function E(e, s, i, d, M, L) {
|
|
169
|
+
var y = s.children;
|
|
170
|
+
if (y !== void 0)
|
|
171
|
+
if (d)
|
|
172
|
+
if (ye(y)) {
|
|
173
|
+
for (d = 0; d < y.length; d++)
|
|
174
|
+
C(y[d]);
|
|
175
|
+
Object.freeze && Object.freeze(y);
|
|
176
|
+
} else
|
|
177
|
+
console.error(
|
|
178
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
179
|
+
);
|
|
180
|
+
else C(y);
|
|
181
|
+
if (Z.call(s, "key")) {
|
|
182
|
+
y = m(e);
|
|
183
|
+
var _ = Object.keys(s).filter(function(de) {
|
|
184
|
+
return de !== "key";
|
|
185
|
+
});
|
|
186
|
+
d = 0 < _.length ? "{key: someKey, " + _.join(": ..., ") + ": ...}" : "{key: someKey}", A[y + d] || (_ = 0 < _.length ? "{" + _.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
187
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
188
|
+
let props = %s;
|
|
189
|
+
<%s {...props} />
|
|
190
|
+
React keys must be passed directly to JSX without using spread:
|
|
191
|
+
let props = %s;
|
|
192
|
+
<%s key={someKey} {...props} />`,
|
|
193
|
+
d,
|
|
194
|
+
y,
|
|
195
|
+
_,
|
|
196
|
+
y
|
|
197
|
+
), A[y + d] = !0);
|
|
198
|
+
}
|
|
199
|
+
if (y = null, i !== void 0 && (k(i), y = "" + i), T(s) && (k(s.key), y = "" + s.key), "key" in s) {
|
|
200
|
+
i = {};
|
|
201
|
+
for (var I in s)
|
|
202
|
+
I !== "key" && (i[I] = s[I]);
|
|
203
|
+
} else i = s;
|
|
204
|
+
return y && N(
|
|
205
|
+
i,
|
|
206
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
207
|
+
), q(
|
|
208
|
+
e,
|
|
209
|
+
y,
|
|
210
|
+
i,
|
|
211
|
+
w(),
|
|
212
|
+
M,
|
|
213
|
+
L
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
function C(e) {
|
|
217
|
+
ne(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === U && (e._payload.status === "fulfilled" ? ne(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
218
|
+
}
|
|
219
|
+
function ne(e) {
|
|
220
|
+
return typeof e == "object" && e !== null && e.$$typeof === G;
|
|
221
|
+
}
|
|
222
|
+
var D = Qe, G = /* @__PURE__ */ Symbol.for("react.transitional.element"), se = /* @__PURE__ */ Symbol.for("react.portal"), F = /* @__PURE__ */ Symbol.for("react.fragment"), ae = /* @__PURE__ */ Symbol.for("react.strict_mode"), le = /* @__PURE__ */ Symbol.for("react.profiler"), ge = /* @__PURE__ */ Symbol.for("react.consumer"), S = /* @__PURE__ */ Symbol.for("react.context"), be = /* @__PURE__ */ Symbol.for("react.forward_ref"), B = /* @__PURE__ */ Symbol.for("react.suspense"), xe = /* @__PURE__ */ Symbol.for("react.suspense_list"), J = /* @__PURE__ */ Symbol.for("react.memo"), U = /* @__PURE__ */ Symbol.for("react.lazy"), ie = /* @__PURE__ */ Symbol.for("react.activity"), ce = /* @__PURE__ */ Symbol.for("react.client.reference"), Q = D.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Z = Object.prototype.hasOwnProperty, ye = Array.isArray, K = console.createTask ? console.createTask : function() {
|
|
223
|
+
return null;
|
|
224
|
+
};
|
|
225
|
+
D = {
|
|
226
|
+
react_stack_bottom_frame: function(e) {
|
|
227
|
+
return e();
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
var W, n = {}, ee = D.react_stack_bottom_frame.bind(
|
|
231
|
+
D,
|
|
232
|
+
l
|
|
233
|
+
)(), V = K(j(l)), A = {};
|
|
234
|
+
oe.Fragment = F, oe.jsx = function(e, s, i) {
|
|
235
|
+
var d = 1e4 > Q.recentlyCreatedOwnerStacks++;
|
|
236
|
+
return E(
|
|
237
|
+
e,
|
|
238
|
+
s,
|
|
239
|
+
i,
|
|
240
|
+
!1,
|
|
241
|
+
d ? Error("react-stack-top-frame") : ee,
|
|
242
|
+
d ? K(j(e)) : V
|
|
243
|
+
);
|
|
244
|
+
}, oe.jsxs = function(e, s, i) {
|
|
245
|
+
var d = 1e4 > Q.recentlyCreatedOwnerStacks++;
|
|
246
|
+
return E(
|
|
247
|
+
e,
|
|
248
|
+
s,
|
|
249
|
+
i,
|
|
250
|
+
!0,
|
|
251
|
+
d ? Error("react-stack-top-frame") : ee,
|
|
252
|
+
d ? K(j(e)) : V
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
})()), oe;
|
|
256
|
+
}
|
|
257
|
+
var ze;
|
|
258
|
+
function rt() {
|
|
259
|
+
return ze || (ze = 1, process.env.NODE_ENV === "production" ? pe.exports = et() : pe.exports = tt()), pe.exports;
|
|
260
|
+
}
|
|
261
|
+
var r = rt();
|
|
262
|
+
const Ie = (...m) => m.filter((g, k, j) => !!g && g.trim() !== "" && j.indexOf(g) === k).join(" ").trim();
|
|
263
|
+
const ot = (m) => m.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
264
|
+
const nt = (m) => m.replace(
|
|
265
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
266
|
+
(g, k, j) => j ? j.toUpperCase() : k.toLowerCase()
|
|
267
|
+
);
|
|
268
|
+
const He = (m) => {
|
|
269
|
+
const g = nt(m);
|
|
270
|
+
return g.charAt(0).toUpperCase() + g.slice(1);
|
|
271
|
+
};
|
|
272
|
+
var st = {
|
|
273
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
274
|
+
width: 24,
|
|
275
|
+
height: 24,
|
|
276
|
+
viewBox: "0 0 24 24",
|
|
277
|
+
fill: "none",
|
|
278
|
+
stroke: "currentColor",
|
|
279
|
+
strokeWidth: 2,
|
|
280
|
+
strokeLinecap: "round",
|
|
281
|
+
strokeLinejoin: "round"
|
|
282
|
+
};
|
|
283
|
+
const at = (m) => {
|
|
284
|
+
for (const g in m)
|
|
285
|
+
if (g.startsWith("aria-") || g === "role" || g === "title")
|
|
286
|
+
return !0;
|
|
287
|
+
return !1;
|
|
288
|
+
};
|
|
289
|
+
const lt = Ce(
|
|
290
|
+
({
|
|
291
|
+
color: m = "currentColor",
|
|
292
|
+
size: g = 24,
|
|
293
|
+
strokeWidth: k = 2,
|
|
294
|
+
absoluteStrokeWidth: j,
|
|
295
|
+
className: w = "",
|
|
296
|
+
children: l,
|
|
297
|
+
iconNode: T,
|
|
298
|
+
...N
|
|
299
|
+
}, P) => je(
|
|
300
|
+
"svg",
|
|
301
|
+
{
|
|
302
|
+
ref: P,
|
|
303
|
+
...st,
|
|
304
|
+
width: g,
|
|
305
|
+
height: g,
|
|
306
|
+
stroke: m,
|
|
307
|
+
strokeWidth: j ? Number(k) * 24 / Number(g) : k,
|
|
308
|
+
className: Ie("lucide", w),
|
|
309
|
+
...!l && !at(N) && { "aria-hidden": "true" },
|
|
310
|
+
...N
|
|
311
|
+
},
|
|
312
|
+
[
|
|
313
|
+
...T.map(([q, E]) => je(q, E)),
|
|
314
|
+
...Array.isArray(l) ? l : [l]
|
|
315
|
+
]
|
|
316
|
+
)
|
|
317
|
+
);
|
|
318
|
+
const u = (m, g) => {
|
|
319
|
+
const k = Ce(
|
|
320
|
+
({ className: j, ...w }, l) => je(lt, {
|
|
321
|
+
ref: l,
|
|
322
|
+
iconNode: g,
|
|
323
|
+
className: Ie(
|
|
324
|
+
`lucide-${ot(He(m))}`,
|
|
325
|
+
`lucide-${m}`,
|
|
326
|
+
j
|
|
327
|
+
),
|
|
328
|
+
...w
|
|
329
|
+
})
|
|
330
|
+
);
|
|
331
|
+
return k.displayName = He(m), k;
|
|
332
|
+
};
|
|
333
|
+
const it = [
|
|
334
|
+
["path", { d: "M12 5v14", key: "s699le" }],
|
|
335
|
+
["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
|
|
336
|
+
], ct = u("arrow-down", it);
|
|
337
|
+
const dt = [
|
|
338
|
+
["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
|
|
339
|
+
["path", { d: "M19 12H5", key: "x3x0zl" }]
|
|
340
|
+
], ut = u("arrow-left", dt);
|
|
341
|
+
const mt = [
|
|
342
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
343
|
+
["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
|
|
344
|
+
], ft = u("arrow-right", mt);
|
|
345
|
+
const pt = [
|
|
346
|
+
["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
|
|
347
|
+
["path", { d: "M12 19V5", key: "x0mq9r" }]
|
|
348
|
+
], ht = u("arrow-up", pt);
|
|
349
|
+
const gt = [
|
|
350
|
+
[
|
|
351
|
+
"path",
|
|
352
|
+
{ d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8", key: "mg9rjx" }
|
|
353
|
+
]
|
|
354
|
+
], bt = u("bold", gt);
|
|
355
|
+
const xt = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], he = u("chevron-down", xt);
|
|
356
|
+
const yt = [
|
|
357
|
+
["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
|
|
358
|
+
["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
|
|
359
|
+
], vt = u("code", yt);
|
|
360
|
+
const kt = [
|
|
361
|
+
[
|
|
362
|
+
"path",
|
|
363
|
+
{
|
|
364
|
+
d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
|
|
365
|
+
key: "1oefj6"
|
|
366
|
+
}
|
|
367
|
+
],
|
|
368
|
+
["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }],
|
|
369
|
+
["path", { d: "M10 12.5 8 15l2 2.5", key: "1tg20x" }],
|
|
370
|
+
["path", { d: "m14 12.5 2 2.5-2 2.5", key: "yinavb" }]
|
|
371
|
+
], wt = u("file-code", kt);
|
|
372
|
+
const jt = [
|
|
373
|
+
["path", { d: "m9 11-6 6v3h9l3-3", key: "1a3l36" }],
|
|
374
|
+
["path", { d: "m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4", key: "14a9rk" }]
|
|
375
|
+
], Ct = u("highlighter", jt);
|
|
376
|
+
const Nt = [
|
|
377
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
|
|
378
|
+
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
|
|
379
|
+
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
|
|
380
|
+
], _t = u("image", Nt);
|
|
381
|
+
const Mt = [
|
|
382
|
+
["line", { x1: "19", x2: "10", y1: "4", y2: "4", key: "15jd3p" }],
|
|
383
|
+
["line", { x1: "14", x2: "5", y1: "20", y2: "20", key: "bu0au3" }],
|
|
384
|
+
["line", { x1: "15", x2: "9", y1: "4", y2: "20", key: "uljnxc" }]
|
|
385
|
+
], Rt = u("italic", Mt);
|
|
386
|
+
const Tt = [
|
|
387
|
+
["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
|
|
388
|
+
["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
|
|
389
|
+
], Et = u("link", Tt);
|
|
390
|
+
const St = [
|
|
391
|
+
["path", { d: "M21 5H11", key: "us1j55" }],
|
|
392
|
+
["path", { d: "M21 12H11", key: "wd7e0v" }],
|
|
393
|
+
["path", { d: "M21 19H11", key: "saa85w" }],
|
|
394
|
+
["path", { d: "m7 8-4 4 4 4", key: "o5hrat" }]
|
|
395
|
+
], At = u("list-indent-decrease", St);
|
|
396
|
+
const Lt = [
|
|
397
|
+
["path", { d: "M21 5H11", key: "us1j55" }],
|
|
398
|
+
["path", { d: "M21 12H11", key: "wd7e0v" }],
|
|
399
|
+
["path", { d: "M21 19H11", key: "saa85w" }],
|
|
400
|
+
["path", { d: "m3 8 4 4-4 4", key: "1a3j6y" }]
|
|
401
|
+
], zt = u("list-indent-increase", Lt);
|
|
402
|
+
const Ht = [
|
|
403
|
+
["path", { d: "M11 5h10", key: "1cz7ny" }],
|
|
404
|
+
["path", { d: "M11 12h10", key: "1438ji" }],
|
|
405
|
+
["path", { d: "M11 19h10", key: "11t30w" }],
|
|
406
|
+
["path", { d: "M4 4h1v5", key: "10yrso" }],
|
|
407
|
+
["path", { d: "M4 9h2", key: "r1h2o0" }],
|
|
408
|
+
["path", { d: "M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02", key: "xtkcd5" }]
|
|
409
|
+
], $t = u("list-ordered", Ht);
|
|
410
|
+
const Ot = [
|
|
411
|
+
["path", { d: "M3 5h.01", key: "18ugdj" }],
|
|
412
|
+
["path", { d: "M3 12h.01", key: "nlz23k" }],
|
|
413
|
+
["path", { d: "M3 19h.01", key: "noohij" }],
|
|
414
|
+
["path", { d: "M8 5h13", key: "1pao27" }],
|
|
415
|
+
["path", { d: "M8 12h13", key: "1za7za" }],
|
|
416
|
+
["path", { d: "M8 19h13", key: "m83p4d" }]
|
|
417
|
+
], Dt = u("list", Ot);
|
|
418
|
+
const It = [["path", { d: "M5 12h14", key: "1ays0h" }]], Pt = u("minus", It);
|
|
419
|
+
const qt = [
|
|
420
|
+
[
|
|
421
|
+
"path",
|
|
422
|
+
{
|
|
423
|
+
d: "M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
|
|
424
|
+
key: "rib7q0"
|
|
425
|
+
}
|
|
426
|
+
],
|
|
427
|
+
[
|
|
428
|
+
"path",
|
|
429
|
+
{
|
|
430
|
+
d: "M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
|
|
431
|
+
key: "1ymkrd"
|
|
432
|
+
}
|
|
433
|
+
]
|
|
434
|
+
], Ft = u("quote", qt);
|
|
435
|
+
const Bt = [
|
|
436
|
+
["path", { d: "M21 7v6h-6", key: "3ptur4" }],
|
|
437
|
+
["path", { d: "M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7", key: "1kgawr" }]
|
|
438
|
+
], Ut = u("redo", Bt);
|
|
439
|
+
const Wt = [
|
|
440
|
+
["path", { d: "M4 7V4h16v3", key: "9msm58" }],
|
|
441
|
+
["path", { d: "M5 20h6", key: "1h6pxn" }],
|
|
442
|
+
["path", { d: "M13 4 8 20", key: "kqq6aj" }],
|
|
443
|
+
["path", { d: "m15 15 5 5", key: "me55sn" }],
|
|
444
|
+
["path", { d: "m20 15-5 5", key: "11p7ol" }]
|
|
445
|
+
], Vt = u("remove-formatting", Wt);
|
|
446
|
+
const Yt = [
|
|
447
|
+
["path", { d: "M16 4H9a3 3 0 0 0-2.83 4", key: "43sutm" }],
|
|
448
|
+
["path", { d: "M14 12a4 4 0 0 1 0 8H6", key: "nlfj13" }],
|
|
449
|
+
["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
|
|
450
|
+
], Xt = u("strikethrough", Yt);
|
|
451
|
+
const Gt = [
|
|
452
|
+
["path", { d: "m4 5 8 8", key: "1eunvl" }],
|
|
453
|
+
["path", { d: "m12 5-8 8", key: "1ah0jp" }],
|
|
454
|
+
[
|
|
455
|
+
"path",
|
|
456
|
+
{
|
|
457
|
+
d: "M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",
|
|
458
|
+
key: "e8ta8j"
|
|
459
|
+
}
|
|
460
|
+
]
|
|
461
|
+
], Jt = u("subscript", Gt);
|
|
462
|
+
const Qt = [
|
|
463
|
+
["path", { d: "m4 19 8-8", key: "hr47gm" }],
|
|
464
|
+
["path", { d: "m12 19-8-8", key: "1dhhmo" }],
|
|
465
|
+
[
|
|
466
|
+
"path",
|
|
467
|
+
{
|
|
468
|
+
d: "M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",
|
|
469
|
+
key: "1dfcux"
|
|
470
|
+
}
|
|
471
|
+
]
|
|
472
|
+
], Zt = u("superscript", Qt);
|
|
473
|
+
const Kt = [
|
|
474
|
+
["path", { d: "M12 3v18", key: "108xh3" }],
|
|
475
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
476
|
+
["path", { d: "M3 9h18", key: "1pudct" }],
|
|
477
|
+
["path", { d: "M3 15h18", key: "5xshup" }]
|
|
478
|
+
], er = u("table", Kt);
|
|
479
|
+
const tr = [
|
|
480
|
+
["path", { d: "M21 5H3", key: "1fi0y6" }],
|
|
481
|
+
["path", { d: "M17 12H7", key: "16if0g" }],
|
|
482
|
+
["path", { d: "M19 19H5", key: "vjpgq2" }]
|
|
483
|
+
], $e = u("text-align-center", tr);
|
|
484
|
+
const rr = [
|
|
485
|
+
["path", { d: "M21 5H3", key: "1fi0y6" }],
|
|
486
|
+
["path", { d: "M21 12H9", key: "dn1m92" }],
|
|
487
|
+
["path", { d: "M21 19H7", key: "4cu937" }]
|
|
488
|
+
], Oe = u("text-align-end", rr);
|
|
489
|
+
const or = [
|
|
490
|
+
["path", { d: "M21 5H3", key: "1fi0y6" }],
|
|
491
|
+
["path", { d: "M15 12H3", key: "6jk70r" }],
|
|
492
|
+
["path", { d: "M17 19H3", key: "z6ezky" }]
|
|
493
|
+
], De = u("text-align-start", or);
|
|
494
|
+
const nr = [
|
|
495
|
+
["path", { d: "M10 11v6", key: "nco0om" }],
|
|
496
|
+
["path", { d: "M14 11v6", key: "outv1u" }],
|
|
497
|
+
["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
|
|
498
|
+
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
499
|
+
["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
|
|
500
|
+
], we = u("trash-2", nr);
|
|
501
|
+
const sr = [
|
|
502
|
+
["path", { d: "M12 4v16", key: "1654pz" }],
|
|
503
|
+
["path", { d: "M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2", key: "e0r10z" }],
|
|
504
|
+
["path", { d: "M9 20h6", key: "s66wpe" }]
|
|
505
|
+
], ar = u("type", sr);
|
|
506
|
+
const lr = [
|
|
507
|
+
["path", { d: "M6 4v6a6 6 0 0 0 12 0V4", key: "9kb039" }],
|
|
508
|
+
["line", { x1: "4", x2: "20", y1: "20", y2: "20", key: "nun2al" }]
|
|
509
|
+
], ir = u("underline", lr);
|
|
510
|
+
const cr = [
|
|
511
|
+
["path", { d: "M3 7v6h6", key: "1v2h90" }],
|
|
512
|
+
["path", { d: "M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13", key: "1r6uu6" }]
|
|
513
|
+
], dr = u("undo", cr);
|
|
514
|
+
const ur = [
|
|
515
|
+
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
516
|
+
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
517
|
+
], mr = u("x", ur), fr = "", hr = Ce(({
|
|
518
|
+
initialValue: m = fr,
|
|
519
|
+
onChange: g,
|
|
520
|
+
className: k = "w-full h-full",
|
|
521
|
+
placeholder: j = "Start typing..."
|
|
522
|
+
}, w) => {
|
|
523
|
+
const l = O(null), T = O(null), N = O(null), P = O(null), q = O(null), E = O(null), [C, ne] = v({}), [D, G] = v(!1), [se, F] = v(!1), [ae, le] = v(!1), [ge, S] = v("Normal"), [be, B] = v("Sans Serif"), [xe, J] = v("16px"), [U, ie] = v(!1), [ce, Q] = v(3), [Z, ye] = v(3), [K, W] = v(!0), [n, ee] = v(!1), [V, A] = v(m || ""), [e, s] = v(null), [i, d] = v(null), [M, L] = v(null), [y, _] = v([]), [I, de] = v(!1), [ue, Ne] = v(!1), Y = O({ startX: 0, startWidth: 0, target: null }), X = O({ startX: 0, startWidth: 0, target: null }), me = () => {
|
|
524
|
+
if (E.current) {
|
|
525
|
+
const t = window.getSelection();
|
|
526
|
+
t.removeAllRanges(), t.addRange(E.current);
|
|
527
|
+
} else
|
|
528
|
+
l.current?.focus();
|
|
529
|
+
};
|
|
530
|
+
Ze(w, () => ({
|
|
531
|
+
focus: () => l.current?.focus(),
|
|
532
|
+
getHtml: () => l.current?.innerHTML || "",
|
|
533
|
+
setHtml: (t) => {
|
|
534
|
+
l.current && (l.current.innerHTML = t, A(t), te());
|
|
535
|
+
},
|
|
536
|
+
insertHtml: (t) => {
|
|
537
|
+
me(), p("insertHTML", t);
|
|
538
|
+
},
|
|
539
|
+
execCommand: (t, o) => {
|
|
540
|
+
me(), p(t, o);
|
|
541
|
+
},
|
|
542
|
+
insertTable: (t, o) => {
|
|
543
|
+
_e(t, o);
|
|
544
|
+
},
|
|
545
|
+
tableAction: (t) => {
|
|
546
|
+
me(), z(t);
|
|
547
|
+
}
|
|
548
|
+
})), fe(() => {
|
|
549
|
+
l.current && !n && (m && m !== l.current.innerHTML ? (l.current.innerHTML = m, A(m), W(!1)) : !m && !l.current.innerHTML && (l.current.innerHTML = "<p><br/></p>", A("<p><br/></p>"), W(!0)));
|
|
550
|
+
}, [m, n]);
|
|
551
|
+
const te = () => {
|
|
552
|
+
if (ke(), R(), l.current) {
|
|
553
|
+
const t = l.current.textContent;
|
|
554
|
+
W(!t || t.trim() === ""), g && g(l.current.innerHTML);
|
|
555
|
+
}
|
|
556
|
+
}, Pe = (t) => {
|
|
557
|
+
const o = t.target.value;
|
|
558
|
+
A(o), g && g(o);
|
|
559
|
+
}, qe = () => {
|
|
560
|
+
n ? ee(!1) : (l.current && (A(l.current.innerHTML), s(null), L(null), d(null), _([])), ee(!0));
|
|
561
|
+
};
|
|
562
|
+
fe(() => {
|
|
563
|
+
!n && l.current && l.current.innerHTML !== V && (l.current.innerHTML = V || "<p><br/></p>", te());
|
|
564
|
+
}, [n]);
|
|
565
|
+
const p = (t, o = null) => {
|
|
566
|
+
n || (document.execCommand(t, !1, o), te(), l.current?.focus());
|
|
567
|
+
}, Fe = (t, o) => {
|
|
568
|
+
p("formatBlock", t), S(o), G(!1);
|
|
569
|
+
}, Be = (t, o) => {
|
|
570
|
+
p("fontName", t), B(o), F(!1);
|
|
571
|
+
}, Ue = (t, o) => {
|
|
572
|
+
p("fontSize", t), J(o), le(!1);
|
|
573
|
+
}, We = (t) => {
|
|
574
|
+
const o = t.target.files[0];
|
|
575
|
+
if (o) {
|
|
576
|
+
const a = new FileReader();
|
|
577
|
+
a.onload = (c) => {
|
|
578
|
+
const f = `<img src="${c.target.result}" style="width: 300px; max-width: 100%; height: auto; border-radius: 4px; display: inline-block; cursor: pointer; border: 1px solid transparent;" draggable="true" />`;
|
|
579
|
+
p("insertHTML", f);
|
|
580
|
+
}, a.readAsDataURL(o);
|
|
581
|
+
}
|
|
582
|
+
t.target.value = "";
|
|
583
|
+
}, Ve = () => {
|
|
584
|
+
const t = prompt("Enter URL:");
|
|
585
|
+
t && p("createLink", t);
|
|
586
|
+
}, _e = (t, o) => {
|
|
587
|
+
me();
|
|
588
|
+
const a = t !== void 0 ? t : ce, c = o !== void 0 ? o : Z, f = parseInt(a) || 3, x = parseInt(c) || 3, h = `
|
|
589
|
+
<table style="border-collapse: collapse; width: 100%; margin: 1em 0; border: 1px solid #e5e7eb; table-layout: fixed;">
|
|
590
|
+
<tbody>
|
|
591
|
+
${Array(f).fill(0).map(() => `
|
|
592
|
+
<tr>
|
|
593
|
+
${Array(x).fill(0).map(() => `
|
|
594
|
+
<td style="border: 1px solid #d1d5db; padding: 8px; min-width: 30px; position: relative; width: ${100 / x}%;">
|
|
595
|
+
<br />
|
|
596
|
+
</td>
|
|
597
|
+
`).join("")}
|
|
598
|
+
</tr>
|
|
599
|
+
`).join("")}
|
|
600
|
+
</tbody>
|
|
601
|
+
</table>
|
|
602
|
+
<p><br/></p>
|
|
603
|
+
`;
|
|
604
|
+
p("insertHTML", h), ie(!1);
|
|
605
|
+
}, z = (t) => {
|
|
606
|
+
if (!i || !e || e.tagName !== "TABLE") return;
|
|
607
|
+
const o = i.closest("tr");
|
|
608
|
+
if (!o) return;
|
|
609
|
+
const a = e, c = a.querySelector("tbody");
|
|
610
|
+
o.rowIndex;
|
|
611
|
+
const f = i.cellIndex;
|
|
612
|
+
if (f === -1) return;
|
|
613
|
+
const x = () => {
|
|
614
|
+
const h = document.createElement("td");
|
|
615
|
+
return h.style.border = "1px solid #d1d5db", h.style.padding = "8px", h.style.minWidth = "30px", h.innerHTML = "<br>", h;
|
|
616
|
+
};
|
|
617
|
+
if (t === "row-above") {
|
|
618
|
+
const h = o.cloneNode(!1);
|
|
619
|
+
Array.from(o.children).forEach(() => h.appendChild(x())), c.insertBefore(h, o);
|
|
620
|
+
} else if (t === "row-below") {
|
|
621
|
+
const h = o.cloneNode(!1);
|
|
622
|
+
Array.from(o.children).forEach(() => h.appendChild(x())), c.insertBefore(h, o.nextSibling);
|
|
623
|
+
} else t === "col-left" ? Array.from(a.rows).forEach((h) => {
|
|
624
|
+
const $ = h.children[f];
|
|
625
|
+
$ && h.insertBefore(x(), $);
|
|
626
|
+
}) : t === "col-right" ? Array.from(a.rows).forEach((h) => {
|
|
627
|
+
const $ = h.children[f];
|
|
628
|
+
$ && h.insertBefore(x(), $.nextSibling);
|
|
629
|
+
}) : t === "del-row" ? (o.remove(), c.children.length === 0 ? (a.remove(), s(null), d(null)) : i.isConnected || d(null)) : t === "del-col" ? (Array.from(a.rows).forEach((h) => {
|
|
630
|
+
h.children[f] && h.children[f].remove();
|
|
631
|
+
}), a.rows[0] && a.rows[0].children.length === 0 ? (a.remove(), s(null), d(null)) : i.isConnected || d(null)) : t === "del-table" && (a.remove(), s(null), d(null));
|
|
632
|
+
te(), R();
|
|
633
|
+
}, R = Ke(() => {
|
|
634
|
+
if (!l.current || n) return;
|
|
635
|
+
if (e && e.isConnected) {
|
|
636
|
+
const o = e.getBoundingClientRect(), a = l.current.getBoundingClientRect();
|
|
637
|
+
L({
|
|
638
|
+
top: o.top - a.top,
|
|
639
|
+
left: o.left - a.left,
|
|
640
|
+
width: o.width,
|
|
641
|
+
height: o.height
|
|
642
|
+
});
|
|
643
|
+
} else
|
|
644
|
+
L(null);
|
|
645
|
+
const t = e?.tagName === "TABLE" ? e : i?.closest("table");
|
|
646
|
+
if (t && t.isConnected) {
|
|
647
|
+
const o = t.getBoundingClientRect(), a = l.current.getBoundingClientRect(), c = [], f = t.rows[0];
|
|
648
|
+
f && Array.from(f.cells).forEach((x) => {
|
|
649
|
+
const h = x.getBoundingClientRect();
|
|
650
|
+
c.push({
|
|
651
|
+
left: h.left - a.left + h.width,
|
|
652
|
+
top: o.top - a.top,
|
|
653
|
+
height: o.height,
|
|
654
|
+
cell: x
|
|
655
|
+
});
|
|
656
|
+
}), _(c);
|
|
657
|
+
} else
|
|
658
|
+
_([]);
|
|
659
|
+
}, [e, i, n]);
|
|
660
|
+
fe(() => {
|
|
661
|
+
document.execCommand("enableObjectResizing", !1, "false");
|
|
662
|
+
const t = () => {
|
|
663
|
+
R();
|
|
664
|
+
}, o = () => {
|
|
665
|
+
R();
|
|
666
|
+
}, a = l.current;
|
|
667
|
+
return a && a.addEventListener("scroll", t), window.addEventListener("resize", o), () => {
|
|
668
|
+
a && a.removeEventListener("scroll", t), window.removeEventListener("resize", o);
|
|
669
|
+
};
|
|
670
|
+
}, [R]);
|
|
671
|
+
const Ye = (t) => {
|
|
672
|
+
if (n) return;
|
|
673
|
+
const o = t.target, a = o.closest("td") || o.closest("th"), c = o.closest("table"), f = o.tagName === "IMG" ? o : o.closest("img");
|
|
674
|
+
if (a) {
|
|
675
|
+
d(a);
|
|
676
|
+
const x = a.closest("table");
|
|
677
|
+
x && e !== x && s(x);
|
|
678
|
+
} else
|
|
679
|
+
ue || d(null);
|
|
680
|
+
if (f) {
|
|
681
|
+
e !== f && s(f);
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
if (c && c !== l.current) {
|
|
685
|
+
e !== c && s(c);
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
!I && !ue && e && !c && !f && !a && (s(null), L(null), d(null), _([])), ke();
|
|
689
|
+
}, Xe = (t) => {
|
|
690
|
+
if (n) return;
|
|
691
|
+
const o = t.target, a = o.tagName === "IMG" ? o : o.closest("img"), c = o.closest("td") || o.closest("th"), f = o.closest("table");
|
|
692
|
+
if (a) {
|
|
693
|
+
t.preventDefault(), e !== a && s(a), setTimeout(R, 0);
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
if (c || f) {
|
|
697
|
+
t.preventDefault();
|
|
698
|
+
const x = f || (c ? c.closest("table") : null);
|
|
699
|
+
c && d(c), x && e !== x && s(x), setTimeout(R, 0);
|
|
700
|
+
}
|
|
701
|
+
}, Ge = (t) => {
|
|
702
|
+
t.preventDefault(), t.stopPropagation(), e && (de(!0), Y.current = {
|
|
703
|
+
startX: t.clientX,
|
|
704
|
+
startWidth: e.offsetWidth,
|
|
705
|
+
target: e
|
|
706
|
+
}, document.addEventListener("mousemove", Me), document.addEventListener("mouseup", Re));
|
|
707
|
+
}, Me = (t) => {
|
|
708
|
+
if (!Y.current.target) return;
|
|
709
|
+
const o = t.clientX - Y.current.startX, a = Math.max(50, Y.current.startWidth + o);
|
|
710
|
+
Y.current.target.style.width = `${a}px`, R();
|
|
711
|
+
}, Re = () => {
|
|
712
|
+
de(!1), Y.current = { startX: 0, startWidth: 0, target: null }, document.removeEventListener("mousemove", Me), document.removeEventListener("mouseup", Re);
|
|
713
|
+
}, Je = (t, o) => {
|
|
714
|
+
t.preventDefault(), t.stopPropagation(), o && (Ne(!0), X.current = {
|
|
715
|
+
startX: t.clientX,
|
|
716
|
+
startWidth: o.offsetWidth,
|
|
717
|
+
target: o
|
|
718
|
+
}, document.addEventListener("mousemove", Te), document.addEventListener("mouseup", Ee));
|
|
719
|
+
}, Te = (t) => {
|
|
720
|
+
if (!X.current.target) return;
|
|
721
|
+
const o = t.clientX - X.current.startX, a = Math.max(20, X.current.startWidth + o);
|
|
722
|
+
X.current.target.style.width = `${a}px`, R();
|
|
723
|
+
}, Ee = () => {
|
|
724
|
+
Ne(!1), X.current = { startX: 0, startWidth: 0, target: null }, document.removeEventListener("mousemove", Te), document.removeEventListener("mouseup", Ee);
|
|
725
|
+
}, ve = (t) => {
|
|
726
|
+
e && (e.style.display = "", e.style.float = "", e.style.margin = "", e.style.outline = "none", t === "left" ? (e.style.float = "left", e.style.margin = "0 1rem 1rem 0") : t === "right" ? (e.style.float = "right", e.style.margin = "0 0 1rem 1rem") : t === "center" ? (e.style.display = "block", e.style.marginLeft = "auto", e.style.marginRight = "auto") : e.style.display = "inline-block", setTimeout(R, 0));
|
|
727
|
+
}, ke = () => {
|
|
728
|
+
if (!l.current || n) return;
|
|
729
|
+
const t = window.getSelection();
|
|
730
|
+
if (t.rangeCount > 0) {
|
|
731
|
+
const a = t.getRangeAt(0);
|
|
732
|
+
if (l.current.contains(a.commonAncestorContainer)) {
|
|
733
|
+
E.current = a.cloneRange();
|
|
734
|
+
let c = a.commonAncestorContainer;
|
|
735
|
+
c.nodeType === 3 && (c = c.parentNode);
|
|
736
|
+
const f = c.closest("td") || c.closest("th"), x = c.closest("table");
|
|
737
|
+
f && i !== f && d(f), x ? e !== x && s(x) : !I && !ue && !c.closest("img") && e && e.tagName === "TABLE" && (s(null), d(null));
|
|
738
|
+
const h = document.queryCommandValue("fontSize"), $ = {
|
|
739
|
+
1: "10px",
|
|
740
|
+
2: "13px",
|
|
741
|
+
3: "16px",
|
|
742
|
+
4: "18px",
|
|
743
|
+
5: "24px",
|
|
744
|
+
6: "32px",
|
|
745
|
+
7: "48px"
|
|
746
|
+
};
|
|
747
|
+
h && $[h] ? J($[h]) : J("16px");
|
|
748
|
+
const Se = document.queryCommandValue("fontName");
|
|
749
|
+
Se.includes("Serif") ? B("Serif") : Se.includes("Mono") ? B("Monospace") : B("Sans Serif");
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
const o = {
|
|
753
|
+
bold: document.queryCommandState("bold"),
|
|
754
|
+
italic: document.queryCommandState("italic"),
|
|
755
|
+
underline: document.queryCommandState("underline"),
|
|
756
|
+
strikethrough: document.queryCommandState("strikethrough"),
|
|
757
|
+
subscript: document.queryCommandState("subscript"),
|
|
758
|
+
superscript: document.queryCommandState("superscript"),
|
|
759
|
+
justifyLeft: document.queryCommandState("justifyLeft"),
|
|
760
|
+
justifyCenter: document.queryCommandState("justifyCenter"),
|
|
761
|
+
justifyRight: document.queryCommandState("justifyRight"),
|
|
762
|
+
justifyFull: document.queryCommandState("justifyFull"),
|
|
763
|
+
insertUnorderedList: document.queryCommandState("insertUnorderedList"),
|
|
764
|
+
insertOrderedList: document.queryCommandState("insertOrderedList")
|
|
765
|
+
};
|
|
766
|
+
if (ne(o), t.rangeCount > 0)
|
|
767
|
+
try {
|
|
768
|
+
const a = t.getRangeAt(0).commonAncestorContainer, f = (a.nodeType === 3 ? a.parentNode : a)?.tagName?.toLowerCase();
|
|
769
|
+
S(f === "h1" ? "Heading 1" : f === "h2" ? "Heading 2" : f === "h3" ? "Heading 3" : f === "blockquote" ? "Quote" : "Normal");
|
|
770
|
+
} catch {
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
fe(() => {
|
|
774
|
+
const t = () => ke();
|
|
775
|
+
return document.addEventListener("selectionchange", t), () => document.removeEventListener("selectionchange", t);
|
|
776
|
+
}, [i, e, I, ue, n]);
|
|
777
|
+
const b = ({ onClick: t, isActive: o, icon: a, title: c, hasArrow: f = !1, disabled: x = !1 }) => /* @__PURE__ */ r.jsxs(
|
|
778
|
+
"button",
|
|
779
|
+
{
|
|
780
|
+
type: "button",
|
|
781
|
+
onClick: t,
|
|
782
|
+
disabled: x,
|
|
783
|
+
title: c,
|
|
784
|
+
className: `p-1.5 rounded-md transition-colors duration-150 flex items-center justify-center gap-1
|
|
785
|
+
${o ? "bg-indigo-100 text-indigo-700" : "text-gray-600 hover:bg-gray-100 hover:text-gray-900"}
|
|
786
|
+
${x ? "opacity-30 cursor-not-allowed" : ""}
|
|
787
|
+
`,
|
|
788
|
+
children: [
|
|
789
|
+
/* @__PURE__ */ r.jsx(a, { size: 18, strokeWidth: 2.5 }),
|
|
790
|
+
f && /* @__PURE__ */ r.jsx(he, { size: 12, className: "opacity-50" })
|
|
791
|
+
]
|
|
792
|
+
}
|
|
793
|
+
), H = () => /* @__PURE__ */ r.jsx("div", { className: "w-px h-6 bg-gray-300 mx-1 self-center" });
|
|
794
|
+
return /* @__PURE__ */ r.jsxs("div", { className: `bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden flex flex-col font-sans text-gray-800 min-h-[300px] ${k}`, children: [
|
|
795
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex flex-wrap items-center gap-0.5 p-2 border-b border-gray-200 bg-white sticky top-0 z-20 select-none shadow-sm", children: [
|
|
796
|
+
/* @__PURE__ */ r.jsx(
|
|
797
|
+
b,
|
|
798
|
+
{
|
|
799
|
+
onClick: qe,
|
|
800
|
+
isActive: n,
|
|
801
|
+
icon: wt,
|
|
802
|
+
title: n ? "Switch to Visual Editor" : "View Source / HTML"
|
|
803
|
+
}
|
|
804
|
+
),
|
|
805
|
+
/* @__PURE__ */ r.jsx(H, {}),
|
|
806
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center", children: [
|
|
807
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("undo"), icon: dr, title: "Undo", disabled: n }),
|
|
808
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("redo"), icon: Ut, title: "Redo", disabled: n })
|
|
809
|
+
] }),
|
|
810
|
+
/* @__PURE__ */ r.jsx(H, {}),
|
|
811
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
812
|
+
/* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
813
|
+
/* @__PURE__ */ r.jsxs(
|
|
814
|
+
"button",
|
|
815
|
+
{
|
|
816
|
+
disabled: n,
|
|
817
|
+
onClick: () => G(!D),
|
|
818
|
+
className: `flex items-center justify-between gap-2 px-2 py-1.5 text-sm font-medium rounded-md min-w-[100px] ${n ? "text-gray-300 cursor-not-allowed" : "text-gray-700 hover:bg-gray-100"}`,
|
|
819
|
+
children: [
|
|
820
|
+
/* @__PURE__ */ r.jsx("span", { className: "truncate", children: ge }),
|
|
821
|
+
/* @__PURE__ */ r.jsx(he, { size: 14 })
|
|
822
|
+
]
|
|
823
|
+
}
|
|
824
|
+
),
|
|
825
|
+
D && !n && /* @__PURE__ */ r.jsx("div", { className: "absolute top-full left-0 mt-1 w-40 bg-white border border-gray-200 rounded shadow-lg py-1 z-30", children: [
|
|
826
|
+
{ label: "Normal", tag: "P" },
|
|
827
|
+
{ label: "Heading 1", tag: "H1" },
|
|
828
|
+
{ label: "Heading 2", tag: "H2" },
|
|
829
|
+
{ label: "Heading 3", tag: "H3" },
|
|
830
|
+
{ label: "Quote", tag: "BLOCKQUOTE" }
|
|
831
|
+
].map((t) => /* @__PURE__ */ r.jsx(
|
|
832
|
+
"button",
|
|
833
|
+
{
|
|
834
|
+
onClick: () => Fe(t.tag, t.label),
|
|
835
|
+
className: "block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 hover:text-indigo-600",
|
|
836
|
+
children: t.label
|
|
837
|
+
},
|
|
838
|
+
t.tag
|
|
839
|
+
)) })
|
|
840
|
+
] }),
|
|
841
|
+
/* @__PURE__ */ r.jsxs("div", { className: "relative hidden md:block", children: [
|
|
842
|
+
/* @__PURE__ */ r.jsxs(
|
|
843
|
+
"button",
|
|
844
|
+
{
|
|
845
|
+
disabled: n,
|
|
846
|
+
onClick: () => F(!se),
|
|
847
|
+
className: `flex items-center justify-between gap-2 px-2 py-1.5 text-sm font-medium rounded-md min-w-[130px] ${n ? "text-gray-300 cursor-not-allowed" : "text-gray-700 hover:bg-gray-100"}`,
|
|
848
|
+
children: [
|
|
849
|
+
/* @__PURE__ */ r.jsx("span", { className: "truncate", children: be }),
|
|
850
|
+
/* @__PURE__ */ r.jsx(he, { size: 14 })
|
|
851
|
+
]
|
|
852
|
+
}
|
|
853
|
+
),
|
|
854
|
+
se && !n && /* @__PURE__ */ r.jsx("div", { className: "absolute top-full left-0 mt-1 w-48 bg-white border border-gray-200 rounded shadow-lg py-1 z-30 max-h-60 overflow-y-auto", children: [
|
|
855
|
+
{ label: "Sans Serif", value: "ui-sans-serif, system-ui, sans-serif" },
|
|
856
|
+
{ label: "Serif", value: "ui-serif, Georgia, serif" },
|
|
857
|
+
{ label: "Monospace", value: "ui-monospace, monospace" },
|
|
858
|
+
{ label: "Arial", value: "Arial, Helvetica, sans-serif" },
|
|
859
|
+
{ label: "Arial Black", value: '"Arial Black", Gadget, sans-serif' },
|
|
860
|
+
{ label: "Comic Sans MS", value: '"Comic Sans MS", "Comic Sans", cursive' },
|
|
861
|
+
{ label: "Courier New", value: '"Courier New", Courier, monospace' },
|
|
862
|
+
{ label: "Georgia", value: "Georgia, serif" },
|
|
863
|
+
{ label: "Impact", value: "Impact, Charcoal, sans-serif" },
|
|
864
|
+
{ label: "Lucida Console", value: '"Lucida Console", Monaco, monospace' },
|
|
865
|
+
{ label: "Tahoma", value: "Tahoma, Geneva, sans-serif" },
|
|
866
|
+
{ label: "Times New Roman", value: '"Times New Roman", Times, serif' },
|
|
867
|
+
{ label: "Trebuchet MS", value: '"Trebuchet MS", Helvetica, sans-serif' },
|
|
868
|
+
{ label: "Verdana", value: "Verdana, Geneva, sans-serif" }
|
|
869
|
+
].map((t) => /* @__PURE__ */ r.jsx(
|
|
870
|
+
"button",
|
|
871
|
+
{
|
|
872
|
+
onClick: () => Be(t.value, t.label),
|
|
873
|
+
className: "block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 hover:text-indigo-600",
|
|
874
|
+
style: { fontFamily: t.value },
|
|
875
|
+
children: t.label
|
|
876
|
+
},
|
|
877
|
+
t.value
|
|
878
|
+
)) })
|
|
879
|
+
] }),
|
|
880
|
+
/* @__PURE__ */ r.jsxs("div", { className: "relative hidden md:block", children: [
|
|
881
|
+
/* @__PURE__ */ r.jsxs(
|
|
882
|
+
"button",
|
|
883
|
+
{
|
|
884
|
+
disabled: n,
|
|
885
|
+
onClick: () => le(!ae),
|
|
886
|
+
className: `flex items-center justify-between gap-2 px-2 py-1.5 text-sm font-medium rounded-md min-w-[70px] ${n ? "text-gray-300 cursor-not-allowed" : "text-gray-700 hover:bg-gray-100"}`,
|
|
887
|
+
children: [
|
|
888
|
+
/* @__PURE__ */ r.jsx("span", { className: "truncate", children: xe }),
|
|
889
|
+
/* @__PURE__ */ r.jsx(he, { size: 14 })
|
|
890
|
+
]
|
|
891
|
+
}
|
|
892
|
+
),
|
|
893
|
+
ae && !n && /* @__PURE__ */ r.jsx("div", { className: "absolute top-full left-0 mt-1 w-24 bg-white border border-gray-200 rounded shadow-lg py-1 z-30 max-h-60 overflow-y-auto", children: [
|
|
894
|
+
{ label: "10px", value: "1" },
|
|
895
|
+
{ label: "13px", value: "2" },
|
|
896
|
+
{ label: "16px", value: "3" },
|
|
897
|
+
{ label: "18px", value: "4" },
|
|
898
|
+
{ label: "24px", value: "5" },
|
|
899
|
+
{ label: "32px", value: "6" },
|
|
900
|
+
{ label: "48px", value: "7" }
|
|
901
|
+
].map((t) => /* @__PURE__ */ r.jsx(
|
|
902
|
+
"button",
|
|
903
|
+
{
|
|
904
|
+
onClick: () => Ue(t.value, t.label),
|
|
905
|
+
className: "block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 hover:text-indigo-600",
|
|
906
|
+
children: t.label
|
|
907
|
+
},
|
|
908
|
+
t.value
|
|
909
|
+
)) })
|
|
910
|
+
] })
|
|
911
|
+
] }),
|
|
912
|
+
/* @__PURE__ */ r.jsx(H, {}),
|
|
913
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center", children: [
|
|
914
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("bold"), isActive: C.bold, icon: bt, title: "Bold", disabled: n }),
|
|
915
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("italic"), isActive: C.italic, icon: Rt, title: "Italic", disabled: n }),
|
|
916
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("underline"), isActive: C.underline, icon: ir, title: "Underline", disabled: n }),
|
|
917
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("strikethrough"), isActive: C.strikethrough, icon: Xt, title: "Strikethrough", disabled: n })
|
|
918
|
+
] }),
|
|
919
|
+
/* @__PURE__ */ r.jsx(H, {}),
|
|
920
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center", children: [
|
|
921
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("subscript"), isActive: C.subscript, icon: Jt, title: "Subscript", disabled: n }),
|
|
922
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("superscript"), isActive: C.superscript, icon: Zt, title: "Superscript", disabled: n }),
|
|
923
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("formatBlock", "PRE"), icon: vt, title: "Code Block", disabled: n }),
|
|
924
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("formatBlock", "BLOCKQUOTE"), icon: Ft, title: "Blockquote", disabled: n })
|
|
925
|
+
] }),
|
|
926
|
+
/* @__PURE__ */ r.jsx(H, {}),
|
|
927
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center relative", children: [
|
|
928
|
+
/* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
929
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => P.current.click(), icon: ar, title: "Text Color", disabled: n }),
|
|
930
|
+
/* @__PURE__ */ r.jsx(
|
|
931
|
+
"input",
|
|
932
|
+
{
|
|
933
|
+
type: "color",
|
|
934
|
+
ref: P,
|
|
935
|
+
disabled: n,
|
|
936
|
+
className: "absolute inset-0 opacity-0 w-full h-full cursor-pointer",
|
|
937
|
+
onChange: (t) => p("foreColor", t.target.value)
|
|
938
|
+
}
|
|
939
|
+
)
|
|
940
|
+
] }),
|
|
941
|
+
/* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
942
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => q.current.click(), icon: Ct, title: "Highlight Color", disabled: n }),
|
|
943
|
+
/* @__PURE__ */ r.jsx(
|
|
944
|
+
"input",
|
|
945
|
+
{
|
|
946
|
+
type: "color",
|
|
947
|
+
ref: q,
|
|
948
|
+
disabled: n,
|
|
949
|
+
defaultValue: "#ffff00",
|
|
950
|
+
className: "absolute inset-0 opacity-0 w-full h-full cursor-pointer",
|
|
951
|
+
onChange: (t) => p("hiliteColor", t.target.value)
|
|
952
|
+
}
|
|
953
|
+
)
|
|
954
|
+
] })
|
|
955
|
+
] }),
|
|
956
|
+
/* @__PURE__ */ r.jsx(H, {}),
|
|
957
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center", children: [
|
|
958
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("justifyLeft"), isActive: C.justifyLeft, icon: De, title: "Align Left", disabled: n }),
|
|
959
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("justifyCenter"), isActive: C.justifyCenter, icon: $e, title: "Align Center", disabled: n }),
|
|
960
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("justifyRight"), isActive: C.justifyRight, icon: Oe, title: "Align Right", disabled: n }),
|
|
961
|
+
/* @__PURE__ */ r.jsx("div", { className: "mx-1" }),
|
|
962
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("insertUnorderedList"), isActive: C.insertUnorderedList, icon: Dt, title: "Bullet List", disabled: n }),
|
|
963
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("insertOrderedList"), isActive: C.insertOrderedList, icon: $t, title: "Numbered List", disabled: n })
|
|
964
|
+
] }),
|
|
965
|
+
/* @__PURE__ */ r.jsx(H, {}),
|
|
966
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center", children: [
|
|
967
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("indent"), icon: zt, title: "Indent", disabled: n }),
|
|
968
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("outdent"), icon: At, title: "Outdent", disabled: n })
|
|
969
|
+
] }),
|
|
970
|
+
/* @__PURE__ */ r.jsx(H, {}),
|
|
971
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center", children: [
|
|
972
|
+
/* @__PURE__ */ r.jsx(b, { onClick: Ve, icon: Et, title: "Insert Link", disabled: n }),
|
|
973
|
+
/* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
974
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => N.current?.click(), icon: _t, title: "Upload Image", disabled: n }),
|
|
975
|
+
/* @__PURE__ */ r.jsx("input", { type: "file", accept: "image/*", ref: N, onChange: We, className: "hidden", disabled: n })
|
|
976
|
+
] }),
|
|
977
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("insertHorizontalRule"), icon: Pt, title: "Horizontal Line", disabled: n }),
|
|
978
|
+
/* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
979
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => ie(!U), icon: er, title: "Insert Table", disabled: n }),
|
|
980
|
+
U && !n && /* @__PURE__ */ r.jsxs(
|
|
981
|
+
"div",
|
|
982
|
+
{
|
|
983
|
+
className: "absolute top-full left-0 mt-2 p-3 bg-white border border-gray-200 shadow-xl rounded-lg z-30 w-48",
|
|
984
|
+
onClick: (t) => t.stopPropagation(),
|
|
985
|
+
children: [
|
|
986
|
+
/* @__PURE__ */ r.jsx("h4", { className: "text-xs font-semibold text-gray-500 mb-2 uppercase tracking-wider", children: "Table Size" }),
|
|
987
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-2 mb-3", children: [
|
|
988
|
+
/* @__PURE__ */ r.jsxs("label", { className: "text-sm flex justify-between", children: [
|
|
989
|
+
"Rows: ",
|
|
990
|
+
/* @__PURE__ */ r.jsx("input", { type: "number", min: "1", max: "10", value: ce, onChange: (t) => Q(t.target.value), className: "w-12 border border-gray-300 rounded px-1 text-right" })
|
|
991
|
+
] }),
|
|
992
|
+
/* @__PURE__ */ r.jsxs("label", { className: "text-sm flex justify-between", children: [
|
|
993
|
+
"Cols: ",
|
|
994
|
+
/* @__PURE__ */ r.jsx("input", { type: "number", min: "1", max: "10", value: Z, onChange: (t) => ye(t.target.value), className: "w-12 border border-gray-300 rounded px-1 text-right" })
|
|
995
|
+
] })
|
|
996
|
+
] }),
|
|
997
|
+
/* @__PURE__ */ r.jsx("button", { onClick: () => _e(), className: "w-full bg-indigo-600 text-white text-xs font-bold py-1.5 rounded hover:bg-indigo-700 transition-colors", children: "Insert Table" })
|
|
998
|
+
]
|
|
999
|
+
}
|
|
1000
|
+
)
|
|
1001
|
+
] })
|
|
1002
|
+
] }),
|
|
1003
|
+
/* @__PURE__ */ r.jsx("div", { className: "flex-grow" }),
|
|
1004
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center border-l border-gray-200 pl-2", children: [
|
|
1005
|
+
/* @__PURE__ */ r.jsx(b, { onClick: () => p("removeFormat"), icon: Vt, title: "Clear Formatting", disabled: n }),
|
|
1006
|
+
/* @__PURE__ */ r.jsx("div", { className: "ml-1 pl-1 border-l border-gray-200 hidden md:block", children: /* @__PURE__ */ r.jsx(b, { onClick: () => {
|
|
1007
|
+
}, icon: mr, title: "Close" }) })
|
|
1008
|
+
] })
|
|
1009
|
+
] }),
|
|
1010
|
+
/* @__PURE__ */ r.jsx("div", { className: "flex-grow overflow-hidden flex flex-col relative", children: n ? /* @__PURE__ */ r.jsx(
|
|
1011
|
+
"textarea",
|
|
1012
|
+
{
|
|
1013
|
+
ref: T,
|
|
1014
|
+
value: V,
|
|
1015
|
+
onChange: Pe,
|
|
1016
|
+
className: "flex-grow p-4 w-full h-full resize-none font-mono text-sm bg-gray-50 text-gray-800 outline-none",
|
|
1017
|
+
spellCheck: "false"
|
|
1018
|
+
}
|
|
1019
|
+
) : /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
1020
|
+
/* @__PURE__ */ r.jsx(
|
|
1021
|
+
"div",
|
|
1022
|
+
{
|
|
1023
|
+
ref: l,
|
|
1024
|
+
contentEditable: !0,
|
|
1025
|
+
suppressContentEditableWarning: !0,
|
|
1026
|
+
className: "flex-grow p-4 md:p-8 overflow-y-auto outline-none prose prose-indigo max-w-none prose-lg relative z-0",
|
|
1027
|
+
onInput: te,
|
|
1028
|
+
onClick: Ye,
|
|
1029
|
+
onContextMenu: Xe,
|
|
1030
|
+
onKeyDown: (t) => {
|
|
1031
|
+
t.key === "Tab" && (t.preventDefault(), p("insertHTML", " "));
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
),
|
|
1035
|
+
K && /* @__PURE__ */ r.jsx("div", { className: "absolute top-4 left-4 md:top-8 md:left-8 right-4 md:right-8 pointer-events-none", children: /* @__PURE__ */ r.jsx("div", { className: "prose prose-indigo max-w-none prose-lg text-gray-400", children: /* @__PURE__ */ r.jsx("p", { children: j }) }) }),
|
|
1036
|
+
e && M && /* @__PURE__ */ r.jsxs(
|
|
1037
|
+
"div",
|
|
1038
|
+
{
|
|
1039
|
+
className: "absolute pointer-events-none z-50",
|
|
1040
|
+
style: {
|
|
1041
|
+
top: M.top,
|
|
1042
|
+
left: M.left,
|
|
1043
|
+
width: M.width,
|
|
1044
|
+
height: M.height,
|
|
1045
|
+
border: "2px solid #3b82f6",
|
|
1046
|
+
// blue-500
|
|
1047
|
+
boxSizing: "border-box"
|
|
1048
|
+
},
|
|
1049
|
+
children: [
|
|
1050
|
+
/* @__PURE__ */ r.jsxs("div", { className: "absolute -top-10 left-1/2 transform -translate-x-1/2 bg-white shadow-lg border border-gray-200 rounded-md flex p-1 pointer-events-auto gap-1 whitespace-nowrap", children: [
|
|
1051
|
+
e.tagName === "IMG" && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
1052
|
+
/* @__PURE__ */ r.jsx("button", { onMouseDown: (t) => {
|
|
1053
|
+
t.preventDefault(), ve("left");
|
|
1054
|
+
}, className: "p-1 hover:bg-gray-100 rounded text-gray-600", title: "Align Left", children: /* @__PURE__ */ r.jsx(De, { size: 16 }) }),
|
|
1055
|
+
/* @__PURE__ */ r.jsx("button", { onMouseDown: (t) => {
|
|
1056
|
+
t.preventDefault(), ve("center");
|
|
1057
|
+
}, className: "p-1 hover:bg-gray-100 rounded text-gray-600", title: "Align Center", children: /* @__PURE__ */ r.jsx($e, { size: 16 }) }),
|
|
1058
|
+
/* @__PURE__ */ r.jsx("button", { onMouseDown: (t) => {
|
|
1059
|
+
t.preventDefault(), ve("right");
|
|
1060
|
+
}, className: "p-1 hover:bg-gray-100 rounded text-gray-600", title: "Align Right", children: /* @__PURE__ */ r.jsx(Oe, { size: 16 }) })
|
|
1061
|
+
] }),
|
|
1062
|
+
e.tagName === "TABLE" && i && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
1063
|
+
/* @__PURE__ */ r.jsx("button", { onMouseDown: (t) => {
|
|
1064
|
+
t.preventDefault(), z("row-above");
|
|
1065
|
+
}, className: "p-1 hover:bg-gray-100 rounded text-gray-600", title: "Insert Row Above", children: /* @__PURE__ */ r.jsx(ht, { size: 16 }) }),
|
|
1066
|
+
/* @__PURE__ */ r.jsx("button", { onMouseDown: (t) => {
|
|
1067
|
+
t.preventDefault(), z("row-below");
|
|
1068
|
+
}, className: "p-1 hover:bg-gray-100 rounded text-gray-600", title: "Insert Row Below", children: /* @__PURE__ */ r.jsx(ct, { size: 16 }) }),
|
|
1069
|
+
/* @__PURE__ */ r.jsx("div", { className: "w-px h-4 bg-gray-300 mx-1 self-center" }),
|
|
1070
|
+
/* @__PURE__ */ r.jsx("button", { onMouseDown: (t) => {
|
|
1071
|
+
t.preventDefault(), z("col-left");
|
|
1072
|
+
}, className: "p-1 hover:bg-gray-100 rounded text-gray-600", title: "Insert Col Left", children: /* @__PURE__ */ r.jsx(ut, { size: 16 }) }),
|
|
1073
|
+
/* @__PURE__ */ r.jsx("button", { onMouseDown: (t) => {
|
|
1074
|
+
t.preventDefault(), z("col-right");
|
|
1075
|
+
}, className: "p-1 hover:bg-gray-100 rounded text-gray-600", title: "Insert Col Right", children: /* @__PURE__ */ r.jsx(ft, { size: 16 }) }),
|
|
1076
|
+
/* @__PURE__ */ r.jsx("div", { className: "w-px h-4 bg-gray-300 mx-1 self-center" }),
|
|
1077
|
+
/* @__PURE__ */ r.jsxs("button", { onMouseDown: (t) => {
|
|
1078
|
+
t.preventDefault(), z("del-row");
|
|
1079
|
+
}, className: "p-1 hover:bg-red-50 text-red-500 rounded font-xs flex items-center", title: "Delete Row", children: [
|
|
1080
|
+
/* @__PURE__ */ r.jsx(we, { size: 14, className: "mr-0.5" }),
|
|
1081
|
+
"R"
|
|
1082
|
+
] }),
|
|
1083
|
+
/* @__PURE__ */ r.jsxs("button", { onMouseDown: (t) => {
|
|
1084
|
+
t.preventDefault(), z("del-col");
|
|
1085
|
+
}, className: "p-1 hover:bg-red-50 text-red-500 rounded font-xs flex items-center", title: "Delete Column", children: [
|
|
1086
|
+
/* @__PURE__ */ r.jsx(we, { size: 14, className: "mr-0.5" }),
|
|
1087
|
+
"C"
|
|
1088
|
+
] })
|
|
1089
|
+
] }),
|
|
1090
|
+
/* @__PURE__ */ r.jsx("div", { className: "w-px h-4 bg-gray-300 mx-1 self-center" }),
|
|
1091
|
+
/* @__PURE__ */ r.jsx("button", { onMouseDown: (t) => {
|
|
1092
|
+
t.preventDefault(), e.tagName === "TABLE" ? z("del-table") : e.remove(), s(null);
|
|
1093
|
+
}, className: "p-1 hover:bg-red-50 text-red-500 rounded", title: e.tagName === "TABLE" ? "Delete Table" : "Delete", children: /* @__PURE__ */ r.jsx(we, { size: 16 }) })
|
|
1094
|
+
] }),
|
|
1095
|
+
/* @__PURE__ */ r.jsx(
|
|
1096
|
+
"div",
|
|
1097
|
+
{
|
|
1098
|
+
className: "absolute bottom-1 right-1 w-4 h-4 bg-blue-500 rounded-full cursor-nwse-resize pointer-events-auto shadow-sm hover:scale-125 transition-transform border-2 border-white z-50",
|
|
1099
|
+
onMouseDown: Ge
|
|
1100
|
+
}
|
|
1101
|
+
)
|
|
1102
|
+
]
|
|
1103
|
+
}
|
|
1104
|
+
),
|
|
1105
|
+
y.map((t, o) => /* @__PURE__ */ r.jsx(
|
|
1106
|
+
"div",
|
|
1107
|
+
{
|
|
1108
|
+
className: "absolute z-50 cursor-col-resize flex items-center justify-center hover:bg-blue-400 hover:opacity-50 transition-colors",
|
|
1109
|
+
style: {
|
|
1110
|
+
top: t.top,
|
|
1111
|
+
left: t.left - 4,
|
|
1112
|
+
// Center on border
|
|
1113
|
+
width: "8px",
|
|
1114
|
+
height: t.height,
|
|
1115
|
+
pointerEvents: "auto"
|
|
1116
|
+
},
|
|
1117
|
+
onMouseDown: (a) => Je(a, t.cell),
|
|
1118
|
+
title: "Resize Column",
|
|
1119
|
+
children: /* @__PURE__ */ r.jsx("div", { className: "w-0.5 h-full bg-blue-500 opacity-0 hover:opacity-100 transition-opacity" })
|
|
1120
|
+
},
|
|
1121
|
+
o
|
|
1122
|
+
))
|
|
1123
|
+
] }) }),
|
|
1124
|
+
/* @__PURE__ */ r.jsx("style", { children: `
|
|
1125
|
+
.prose { display: flow-root; }
|
|
1126
|
+
.prose p { display: flow-root; margin-top: 0.5em; margin-bottom: 0.5em; line-height: 1.4; }
|
|
1127
|
+
.prose table { width: auto; max-width: 100%; table-layout: fixed; border-collapse: collapse; margin: 1em 0; }
|
|
1128
|
+
.prose td, .prose th { border: 1px solid #d1d5db; padding: 0.75rem; vertical-align: top; position: relative; }
|
|
1129
|
+
.prose th { background-color: #f3f4f6; font-weight: 600; }
|
|
1130
|
+
.prose h1 { font-size: 2.25em; margin-top: 0.5em; margin-bottom: 0.5em; line-height: 1.1; font-weight: 800; color: #111827; }
|
|
1131
|
+
.prose h2 { font-size: 1.75em; margin-top: 0.5em; margin-bottom: 0.5em; line-height: 1.2; font-weight: 700; color: #1f2937; }
|
|
1132
|
+
.prose h3 { font-size: 1.5em; margin-top: 0.5em; margin-bottom: 0.5em; line-height: 1.3; font-weight: 600; color: #374151; }
|
|
1133
|
+
.prose ul { list-style-type: disc; padding-left: 1.5em; margin: 0.5em 0; }
|
|
1134
|
+
.prose ol { list-style-type: decimal; padding-left: 1.5em; margin: 0.5em 0; }
|
|
1135
|
+
.prose li { margin: 0.5em 0; }
|
|
1136
|
+
.prose blockquote { border-left: 4px solid #6366f1; padding-left: 1rem; margin: 1rem 0; font-style: italic; color: #4b5563; background: #f9fafb; padding: 1rem; border-radius: 0 0.5rem 0.5rem 0; }
|
|
1137
|
+
.prose pre { background-color: #1e293b; color: #e2e8f0; padding: 1rem; border-radius: 0.5rem; overflow-x: auto; font-family: monospace; }
|
|
1138
|
+
.prose img { border-radius: 0.5rem; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
|
|
1139
|
+
.prose hr { border: 0; border-top: 1px solid #e5e7eb; margin: 2em 0; }
|
|
1140
|
+
::selection { background-color: #c7d2fe; color: #1e1b4b; }
|
|
1141
|
+
` })
|
|
1142
|
+
] });
|
|
1143
|
+
});
|
|
1144
|
+
export {
|
|
1145
|
+
hr as default
|
|
1146
|
+
};
|