@anilkumarteach/editor-ak 0.1.0 → 0.1.2
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 +86 -45
- package/dist/index.cjs +126 -0
- package/dist/index.js +627 -601
- package/package.json +14 -8
- package/dist/index.umd.cjs +0 -126
package/dist/index.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import gt, { useState as
|
|
2
|
-
var Me = { exports: {} },
|
|
1
|
+
import gt, { useState as E, useRef as U, useEffect as Y, useCallback as C } from "react";
|
|
2
|
+
var Me = { exports: {} }, je = {};
|
|
3
3
|
var ut;
|
|
4
4
|
function Ft() {
|
|
5
|
-
if (ut) return
|
|
5
|
+
if (ut) return je;
|
|
6
6
|
ut = 1;
|
|
7
|
-
var r = gt, n = /* @__PURE__ */ Symbol.for("react.element"), d = /* @__PURE__ */ Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, i = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,
|
|
8
|
-
function
|
|
9
|
-
var p,
|
|
10
|
-
|
|
11
|
-
for (p in
|
|
12
|
-
if (m && m.defaultProps) for (p in
|
|
13
|
-
return { $$typeof: n, type: m, key:
|
|
7
|
+
var r = gt, n = /* @__PURE__ */ Symbol.for("react.element"), d = /* @__PURE__ */ Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, i = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, c = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
8
|
+
function l(m, g, h) {
|
|
9
|
+
var p, k = {}, x = null, f = null;
|
|
10
|
+
h !== void 0 && (x = "" + h), g.key !== void 0 && (x = "" + g.key), g.ref !== void 0 && (f = g.ref);
|
|
11
|
+
for (p in g) o.call(g, p) && !c.hasOwnProperty(p) && (k[p] = g[p]);
|
|
12
|
+
if (m && m.defaultProps) for (p in g = m.defaultProps, g) k[p] === void 0 && (k[p] = g[p]);
|
|
13
|
+
return { $$typeof: n, type: m, key: x, ref: f, props: k, _owner: i.current };
|
|
14
14
|
}
|
|
15
|
-
return
|
|
15
|
+
return je.Fragment = d, je.jsx = l, je.jsxs = l, je;
|
|
16
16
|
}
|
|
17
|
-
var
|
|
17
|
+
var ke = {};
|
|
18
18
|
var ft;
|
|
19
19
|
function Ut() {
|
|
20
20
|
return ft || (ft = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
21
|
-
var r = gt, n = /* @__PURE__ */ Symbol.for("react.element"), d = /* @__PURE__ */ Symbol.for("react.portal"), o = /* @__PURE__ */ Symbol.for("react.fragment"), i = /* @__PURE__ */ Symbol.for("react.strict_mode"),
|
|
21
|
+
var r = gt, n = /* @__PURE__ */ Symbol.for("react.element"), d = /* @__PURE__ */ Symbol.for("react.portal"), o = /* @__PURE__ */ Symbol.for("react.fragment"), i = /* @__PURE__ */ Symbol.for("react.strict_mode"), c = /* @__PURE__ */ Symbol.for("react.profiler"), l = /* @__PURE__ */ Symbol.for("react.provider"), m = /* @__PURE__ */ Symbol.for("react.context"), g = /* @__PURE__ */ Symbol.for("react.forward_ref"), h = /* @__PURE__ */ Symbol.for("react.suspense"), p = /* @__PURE__ */ Symbol.for("react.suspense_list"), k = /* @__PURE__ */ Symbol.for("react.memo"), x = /* @__PURE__ */ Symbol.for("react.lazy"), f = /* @__PURE__ */ Symbol.for("react.offscreen"), b = Symbol.iterator, N = "@@iterator";
|
|
22
22
|
function M(t) {
|
|
23
23
|
if (t === null || typeof t != "object")
|
|
24
24
|
return null;
|
|
25
|
-
var a =
|
|
25
|
+
var a = b && t[b] || t[N];
|
|
26
26
|
return typeof a == "function" ? a : null;
|
|
27
27
|
}
|
|
28
28
|
var S = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
29
|
-
function
|
|
29
|
+
function D(t) {
|
|
30
30
|
{
|
|
31
|
-
for (var a = arguments.length, u = new Array(a > 1 ? a - 1 : 0),
|
|
32
|
-
u[
|
|
33
|
-
|
|
31
|
+
for (var a = arguments.length, u = new Array(a > 1 ? a - 1 : 0), j = 1; j < a; j++)
|
|
32
|
+
u[j - 1] = arguments[j];
|
|
33
|
+
ee("error", t, u);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function ee(t, a, u) {
|
|
37
37
|
{
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
var
|
|
38
|
+
var j = S.ReactDebugCurrentFrame, _ = j.getStackAddendum();
|
|
39
|
+
_ !== "" && (a += "%s", u = u.concat([_]));
|
|
40
|
+
var I = u.map(function(T) {
|
|
41
41
|
return String(T);
|
|
42
42
|
});
|
|
43
|
-
|
|
43
|
+
I.unshift("Warning: " + a), Function.prototype.apply.call(console[t], console, I);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
var
|
|
46
|
+
var R = !1, q = !1, O = !1, ie = !1, ne = !1, ye;
|
|
47
47
|
ye = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
48
48
|
function Pe(t) {
|
|
49
|
-
return !!(typeof t == "string" || typeof t == "function" || t === o || t ===
|
|
49
|
+
return !!(typeof t == "string" || typeof t == "function" || t === o || t === c || ne || t === i || t === h || t === p || ie || t === f || R || q || O || typeof t == "object" && t !== null && (t.$$typeof === x || t.$$typeof === k || t.$$typeof === l || t.$$typeof === m || t.$$typeof === g || // This needs to include all possible module reference object
|
|
50
50
|
// types supported by any Flight configuration anywhere since
|
|
51
51
|
// we don't know which Flight build this will end up being used
|
|
52
52
|
// with.
|
|
53
53
|
t.$$typeof === ye || t.getModuleId !== void 0));
|
|
54
54
|
}
|
|
55
55
|
function we(t, a, u) {
|
|
56
|
-
var
|
|
57
|
-
if (
|
|
58
|
-
return
|
|
59
|
-
var
|
|
60
|
-
return
|
|
56
|
+
var j = t.displayName;
|
|
57
|
+
if (j)
|
|
58
|
+
return j;
|
|
59
|
+
var _ = a.displayName || a.name || "";
|
|
60
|
+
return _ !== "" ? u + "(" + _ + ")" : u;
|
|
61
61
|
}
|
|
62
62
|
function B(t) {
|
|
63
63
|
return t.displayName || "Context";
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function Q(t) {
|
|
66
66
|
if (t == null)
|
|
67
67
|
return null;
|
|
68
|
-
if (typeof t.tag == "number" &&
|
|
68
|
+
if (typeof t.tag == "number" && D("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof t == "function")
|
|
69
69
|
return t.displayName || t.name || null;
|
|
70
70
|
if (typeof t == "string")
|
|
71
71
|
return t;
|
|
@@ -74,11 +74,11 @@ function Ut() {
|
|
|
74
74
|
return "Fragment";
|
|
75
75
|
case d:
|
|
76
76
|
return "Portal";
|
|
77
|
-
case
|
|
77
|
+
case c:
|
|
78
78
|
return "Profiler";
|
|
79
79
|
case i:
|
|
80
80
|
return "StrictMode";
|
|
81
|
-
case
|
|
81
|
+
case h:
|
|
82
82
|
return "Suspense";
|
|
83
83
|
case p:
|
|
84
84
|
return "SuspenseList";
|
|
@@ -88,18 +88,18 @@ function Ut() {
|
|
|
88
88
|
case m:
|
|
89
89
|
var a = t;
|
|
90
90
|
return B(a) + ".Consumer";
|
|
91
|
-
case
|
|
91
|
+
case l:
|
|
92
92
|
var u = t;
|
|
93
93
|
return B(u._context) + ".Provider";
|
|
94
|
-
case
|
|
94
|
+
case g:
|
|
95
95
|
return we(t, t.render, "ForwardRef");
|
|
96
|
-
case
|
|
97
|
-
var
|
|
98
|
-
return
|
|
99
|
-
case
|
|
100
|
-
var
|
|
96
|
+
case k:
|
|
97
|
+
var j = t.displayName || null;
|
|
98
|
+
return j !== null ? j : Q(t.type) || "Memo";
|
|
99
|
+
case x: {
|
|
100
|
+
var _ = t, I = _._payload, T = _._init;
|
|
101
101
|
try {
|
|
102
|
-
return
|
|
102
|
+
return Q(T(I));
|
|
103
103
|
} catch {
|
|
104
104
|
return null;
|
|
105
105
|
}
|
|
@@ -107,18 +107,18 @@ function Ut() {
|
|
|
107
107
|
}
|
|
108
108
|
return null;
|
|
109
109
|
}
|
|
110
|
-
var
|
|
111
|
-
function
|
|
110
|
+
var X = Object.assign, te = 0, Ce, Ne, he, Le, Te, Se, W;
|
|
111
|
+
function J() {
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
J.__reactDisabledLog = !0;
|
|
114
114
|
function Ae() {
|
|
115
115
|
{
|
|
116
|
-
if (
|
|
117
|
-
Ce = console.log, Ne = console.info,
|
|
116
|
+
if (te === 0) {
|
|
117
|
+
Ce = console.log, Ne = console.info, he = console.warn, Le = console.error, Te = console.group, Se = console.groupCollapsed, W = console.groupEnd;
|
|
118
118
|
var t = {
|
|
119
119
|
configurable: !0,
|
|
120
120
|
enumerable: !0,
|
|
121
|
-
value:
|
|
121
|
+
value: J,
|
|
122
122
|
writable: !0
|
|
123
123
|
};
|
|
124
124
|
Object.defineProperties(console, {
|
|
@@ -131,77 +131,77 @@ function Ut() {
|
|
|
131
131
|
groupEnd: t
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
te++;
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
function He() {
|
|
138
138
|
{
|
|
139
|
-
if (
|
|
139
|
+
if (te--, te === 0) {
|
|
140
140
|
var t = {
|
|
141
141
|
configurable: !0,
|
|
142
142
|
enumerable: !0,
|
|
143
143
|
writable: !0
|
|
144
144
|
};
|
|
145
145
|
Object.defineProperties(console, {
|
|
146
|
-
log:
|
|
146
|
+
log: X({}, t, {
|
|
147
147
|
value: Ce
|
|
148
148
|
}),
|
|
149
|
-
info:
|
|
149
|
+
info: X({}, t, {
|
|
150
150
|
value: Ne
|
|
151
151
|
}),
|
|
152
|
-
warn:
|
|
153
|
-
value:
|
|
152
|
+
warn: X({}, t, {
|
|
153
|
+
value: he
|
|
154
154
|
}),
|
|
155
|
-
error:
|
|
155
|
+
error: X({}, t, {
|
|
156
156
|
value: Le
|
|
157
157
|
}),
|
|
158
|
-
group:
|
|
158
|
+
group: X({}, t, {
|
|
159
159
|
value: Te
|
|
160
160
|
}),
|
|
161
|
-
groupCollapsed:
|
|
161
|
+
groupCollapsed: X({}, t, {
|
|
162
162
|
value: Se
|
|
163
163
|
}),
|
|
164
|
-
groupEnd:
|
|
164
|
+
groupEnd: X({}, t, {
|
|
165
165
|
value: W
|
|
166
166
|
})
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
te < 0 && D("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
var
|
|
173
|
-
function
|
|
172
|
+
var pe = S.ReactCurrentDispatcher, xe;
|
|
173
|
+
function Z(t, a, u) {
|
|
174
174
|
{
|
|
175
|
-
if (
|
|
175
|
+
if (xe === void 0)
|
|
176
176
|
try {
|
|
177
177
|
throw Error();
|
|
178
|
-
} catch (
|
|
179
|
-
var
|
|
180
|
-
|
|
178
|
+
} catch (_) {
|
|
179
|
+
var j = _.stack.trim().match(/\n( *(at )?)/);
|
|
180
|
+
xe = j && j[1] || "";
|
|
181
181
|
}
|
|
182
182
|
return `
|
|
183
|
-
` +
|
|
183
|
+
` + xe + t;
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
var
|
|
186
|
+
var ge = !1, re;
|
|
187
187
|
{
|
|
188
188
|
var Be = typeof WeakMap == "function" ? WeakMap : Map;
|
|
189
|
-
|
|
189
|
+
re = new Be();
|
|
190
190
|
}
|
|
191
|
-
function
|
|
192
|
-
if (!t ||
|
|
191
|
+
function le(t, a) {
|
|
192
|
+
if (!t || ge)
|
|
193
193
|
return "";
|
|
194
194
|
{
|
|
195
|
-
var u =
|
|
195
|
+
var u = re.get(t);
|
|
196
196
|
if (u !== void 0)
|
|
197
197
|
return u;
|
|
198
198
|
}
|
|
199
|
-
var
|
|
200
|
-
|
|
201
|
-
var
|
|
199
|
+
var j;
|
|
200
|
+
ge = !0;
|
|
201
|
+
var _ = Error.prepareStackTrace;
|
|
202
202
|
Error.prepareStackTrace = void 0;
|
|
203
|
-
var
|
|
204
|
-
|
|
203
|
+
var I;
|
|
204
|
+
I = pe.current, pe.current = null, Ae();
|
|
205
205
|
try {
|
|
206
206
|
if (a) {
|
|
207
207
|
var T = function() {
|
|
@@ -214,116 +214,116 @@ function Ut() {
|
|
|
214
214
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
215
215
|
try {
|
|
216
216
|
Reflect.construct(T, []);
|
|
217
|
-
} catch (
|
|
218
|
-
|
|
217
|
+
} catch (z) {
|
|
218
|
+
j = z;
|
|
219
219
|
}
|
|
220
220
|
Reflect.construct(t, [], T);
|
|
221
221
|
} else {
|
|
222
222
|
try {
|
|
223
223
|
T.call();
|
|
224
|
-
} catch (
|
|
225
|
-
|
|
224
|
+
} catch (z) {
|
|
225
|
+
j = z;
|
|
226
226
|
}
|
|
227
227
|
t.call(T.prototype);
|
|
228
228
|
}
|
|
229
229
|
} else {
|
|
230
230
|
try {
|
|
231
231
|
throw Error();
|
|
232
|
-
} catch (
|
|
233
|
-
|
|
232
|
+
} catch (z) {
|
|
233
|
+
j = z;
|
|
234
234
|
}
|
|
235
235
|
t();
|
|
236
236
|
}
|
|
237
|
-
} catch (
|
|
238
|
-
if (
|
|
239
|
-
for (var w =
|
|
240
|
-
`),
|
|
241
|
-
`),
|
|
242
|
-
|
|
243
|
-
for (;
|
|
244
|
-
if (w[
|
|
245
|
-
if (
|
|
237
|
+
} catch (z) {
|
|
238
|
+
if (z && j && typeof z.stack == "string") {
|
|
239
|
+
for (var w = z.stack.split(`
|
|
240
|
+
`), F = j.stack.split(`
|
|
241
|
+
`), P = w.length - 1, A = F.length - 1; P >= 1 && A >= 0 && w[P] !== F[A]; )
|
|
242
|
+
A--;
|
|
243
|
+
for (; P >= 1 && A >= 0; P--, A--)
|
|
244
|
+
if (w[P] !== F[A]) {
|
|
245
|
+
if (P !== 1 || A !== 1)
|
|
246
246
|
do
|
|
247
|
-
if (
|
|
248
|
-
var
|
|
249
|
-
` + w[
|
|
250
|
-
return t.displayName &&
|
|
247
|
+
if (P--, A--, A < 0 || w[P] !== F[A]) {
|
|
248
|
+
var G = `
|
|
249
|
+
` + w[P].replace(" at new ", " at ");
|
|
250
|
+
return t.displayName && G.includes("<anonymous>") && (G = G.replace("<anonymous>", t.displayName)), typeof t == "function" && re.set(t, G), G;
|
|
251
251
|
}
|
|
252
|
-
while (
|
|
252
|
+
while (P >= 1 && A >= 0);
|
|
253
253
|
break;
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
} finally {
|
|
257
|
-
|
|
257
|
+
ge = !1, pe.current = I, He(), Error.prepareStackTrace = _;
|
|
258
258
|
}
|
|
259
|
-
var
|
|
260
|
-
return typeof t == "function" &&
|
|
259
|
+
var me = t ? t.displayName || t.name : "", se = me ? Z(me) : "";
|
|
260
|
+
return typeof t == "function" && re.set(t, se), se;
|
|
261
261
|
}
|
|
262
|
-
function
|
|
263
|
-
return
|
|
262
|
+
function ve(t, a, u) {
|
|
263
|
+
return le(t, !1);
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function ce(t) {
|
|
266
266
|
var a = t.prototype;
|
|
267
267
|
return !!(a && a.isReactComponent);
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function de(t, a, u) {
|
|
270
270
|
if (t == null)
|
|
271
271
|
return "";
|
|
272
272
|
if (typeof t == "function")
|
|
273
|
-
return
|
|
273
|
+
return le(t, ce(t));
|
|
274
274
|
if (typeof t == "string")
|
|
275
|
-
return
|
|
275
|
+
return Z(t);
|
|
276
276
|
switch (t) {
|
|
277
|
-
case
|
|
278
|
-
return
|
|
277
|
+
case h:
|
|
278
|
+
return Z("Suspense");
|
|
279
279
|
case p:
|
|
280
|
-
return
|
|
280
|
+
return Z("SuspenseList");
|
|
281
281
|
}
|
|
282
282
|
if (typeof t == "object")
|
|
283
283
|
switch (t.$$typeof) {
|
|
284
|
-
case
|
|
285
|
-
return
|
|
286
|
-
case
|
|
287
|
-
return
|
|
288
|
-
case
|
|
289
|
-
var
|
|
284
|
+
case g:
|
|
285
|
+
return ve(t.render);
|
|
286
|
+
case k:
|
|
287
|
+
return de(t.type, a, u);
|
|
288
|
+
case x: {
|
|
289
|
+
var j = t, _ = j._payload, I = j._init;
|
|
290
290
|
try {
|
|
291
|
-
return
|
|
291
|
+
return de(I(_), a, u);
|
|
292
292
|
} catch {
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
return "";
|
|
297
297
|
}
|
|
298
|
-
var
|
|
299
|
-
function
|
|
298
|
+
var oe = Object.prototype.hasOwnProperty, Re = {}, Ee = S.ReactDebugCurrentFrame;
|
|
299
|
+
function ue(t) {
|
|
300
300
|
if (t) {
|
|
301
|
-
var a = t._owner, u =
|
|
301
|
+
var a = t._owner, u = de(t.type, t._source, a ? a.type : null);
|
|
302
302
|
Ee.setExtraStackFrame(u);
|
|
303
303
|
} else
|
|
304
304
|
Ee.setExtraStackFrame(null);
|
|
305
305
|
}
|
|
306
|
-
function We(t, a, u,
|
|
306
|
+
function We(t, a, u, j, _) {
|
|
307
307
|
{
|
|
308
|
-
var
|
|
308
|
+
var I = Function.call.bind(oe);
|
|
309
309
|
for (var T in t)
|
|
310
|
-
if (
|
|
310
|
+
if (I(t, T)) {
|
|
311
311
|
var w = void 0;
|
|
312
312
|
try {
|
|
313
313
|
if (typeof t[T] != "function") {
|
|
314
|
-
var
|
|
315
|
-
throw
|
|
314
|
+
var F = Error((j || "React class") + ": " + u + " type `" + T + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof t[T] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
315
|
+
throw F.name = "Invariant Violation", F;
|
|
316
316
|
}
|
|
317
|
-
w = t[T](a, T,
|
|
318
|
-
} catch (
|
|
319
|
-
w =
|
|
317
|
+
w = t[T](a, T, j, u, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
318
|
+
} catch (P) {
|
|
319
|
+
w = P;
|
|
320
320
|
}
|
|
321
|
-
w && !(w instanceof Error) && (
|
|
321
|
+
w && !(w instanceof Error) && (ue(_), D("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", j || "React class", u, T, typeof w), ue(null)), w instanceof Error && !(w.message in Re) && (Re[w.message] = !0, ue(_), D("Failed %s type: %s", u, w.message), ue(null));
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
var Ve = Array.isArray;
|
|
326
|
-
function
|
|
326
|
+
function be(t) {
|
|
327
327
|
return Ve(t);
|
|
328
328
|
}
|
|
329
329
|
function Fe(t) {
|
|
@@ -332,7 +332,7 @@ function Ut() {
|
|
|
332
332
|
return u;
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function s(t) {
|
|
336
336
|
try {
|
|
337
337
|
return y(t), !1;
|
|
338
338
|
} catch {
|
|
@@ -343,17 +343,17 @@ function Ut() {
|
|
|
343
343
|
return "" + t;
|
|
344
344
|
}
|
|
345
345
|
function L(t) {
|
|
346
|
-
if (
|
|
347
|
-
return
|
|
346
|
+
if (s(t))
|
|
347
|
+
return D("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Fe(t)), y(t);
|
|
348
348
|
}
|
|
349
|
-
var v = S.ReactCurrentOwner,
|
|
349
|
+
var v = S.ReactCurrentOwner, $ = {
|
|
350
350
|
key: !0,
|
|
351
351
|
ref: !0,
|
|
352
352
|
__self: !0,
|
|
353
353
|
__source: !0
|
|
354
|
-
},
|
|
354
|
+
}, V, K;
|
|
355
355
|
function Ue(t) {
|
|
356
|
-
if (
|
|
356
|
+
if (oe.call(t, "ref")) {
|
|
357
357
|
var a = Object.getOwnPropertyDescriptor(t, "ref").get;
|
|
358
358
|
if (a && a.isReactWarning)
|
|
359
359
|
return !1;
|
|
@@ -361,7 +361,7 @@ function Ut() {
|
|
|
361
361
|
return t.ref !== void 0;
|
|
362
362
|
}
|
|
363
363
|
function qe(t) {
|
|
364
|
-
if (
|
|
364
|
+
if (oe.call(t, "key")) {
|
|
365
365
|
var a = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
366
366
|
if (a && a.isReactWarning)
|
|
367
367
|
return !1;
|
|
@@ -374,7 +374,7 @@ function Ut() {
|
|
|
374
374
|
function Ye(t, a) {
|
|
375
375
|
{
|
|
376
376
|
var u = function() {
|
|
377
|
-
|
|
377
|
+
V || (V = !0, D("%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://reactjs.org/link/special-props)", a));
|
|
378
378
|
};
|
|
379
379
|
u.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
380
380
|
get: u,
|
|
@@ -385,7 +385,7 @@ function Ut() {
|
|
|
385
385
|
function _e(t, a) {
|
|
386
386
|
{
|
|
387
387
|
var u = function() {
|
|
388
|
-
|
|
388
|
+
K || (K = !0, D("%s: `ref` 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://reactjs.org/link/special-props)", a));
|
|
389
389
|
};
|
|
390
390
|
u.isReactWarning = !0, Object.defineProperty(t, "ref", {
|
|
391
391
|
get: u,
|
|
@@ -393,7 +393,7 @@ function Ut() {
|
|
|
393
393
|
});
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
-
var $e = function(t, a, u,
|
|
396
|
+
var $e = function(t, a, u, j, _, I, T) {
|
|
397
397
|
var w = {
|
|
398
398
|
// This tag allows us to uniquely identify this as a React Element
|
|
399
399
|
$$typeof: n,
|
|
@@ -403,7 +403,7 @@ function Ut() {
|
|
|
403
403
|
ref: u,
|
|
404
404
|
props: T,
|
|
405
405
|
// Record the component responsible for creating this element.
|
|
406
|
-
_owner:
|
|
406
|
+
_owner: I
|
|
407
407
|
};
|
|
408
408
|
return w._store = {}, Object.defineProperty(w._store, "validated", {
|
|
409
409
|
configurable: !1,
|
|
@@ -414,36 +414,36 @@ function Ut() {
|
|
|
414
414
|
configurable: !1,
|
|
415
415
|
enumerable: !1,
|
|
416
416
|
writable: !1,
|
|
417
|
-
value:
|
|
417
|
+
value: j
|
|
418
418
|
}), Object.defineProperty(w, "_source", {
|
|
419
419
|
configurable: !1,
|
|
420
420
|
enumerable: !1,
|
|
421
421
|
writable: !1,
|
|
422
|
-
value:
|
|
422
|
+
value: _
|
|
423
423
|
}), Object.freeze && (Object.freeze(w.props), Object.freeze(w)), w;
|
|
424
424
|
};
|
|
425
|
-
function $t(t, a, u,
|
|
425
|
+
function $t(t, a, u, j, _) {
|
|
426
426
|
{
|
|
427
|
-
var
|
|
428
|
-
u !== void 0 && (L(u), w = "" + u), qe(a) && (L(a.key), w = "" + a.key), Ue(a) && (
|
|
429
|
-
for (
|
|
430
|
-
|
|
427
|
+
var I, T = {}, w = null, F = null;
|
|
428
|
+
u !== void 0 && (L(u), w = "" + u), qe(a) && (L(a.key), w = "" + a.key), Ue(a) && (F = a.ref, ze(a, _));
|
|
429
|
+
for (I in a)
|
|
430
|
+
oe.call(a, I) && !$.hasOwnProperty(I) && (T[I] = a[I]);
|
|
431
431
|
if (t && t.defaultProps) {
|
|
432
|
-
var
|
|
433
|
-
for (
|
|
434
|
-
T[
|
|
432
|
+
var P = t.defaultProps;
|
|
433
|
+
for (I in P)
|
|
434
|
+
T[I] === void 0 && (T[I] = P[I]);
|
|
435
435
|
}
|
|
436
|
-
if (w ||
|
|
437
|
-
var
|
|
438
|
-
w && Ye(T,
|
|
436
|
+
if (w || F) {
|
|
437
|
+
var A = typeof t == "function" ? t.displayName || t.name || "Unknown" : t;
|
|
438
|
+
w && Ye(T, A), F && _e(T, A);
|
|
439
439
|
}
|
|
440
|
-
return $e(t, w,
|
|
440
|
+
return $e(t, w, F, _, j, v.current, T);
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
443
|
var Je = S.ReactCurrentOwner, ot = S.ReactDebugCurrentFrame;
|
|
444
|
-
function
|
|
444
|
+
function fe(t) {
|
|
445
445
|
if (t) {
|
|
446
|
-
var a = t._owner, u =
|
|
446
|
+
var a = t._owner, u = de(t.type, t._source, a ? a.type : null);
|
|
447
447
|
ot.setExtraStackFrame(u);
|
|
448
448
|
} else
|
|
449
449
|
ot.setExtraStackFrame(null);
|
|
@@ -456,7 +456,7 @@ function Ut() {
|
|
|
456
456
|
function st() {
|
|
457
457
|
{
|
|
458
458
|
if (Je.current) {
|
|
459
|
-
var t =
|
|
459
|
+
var t = Q(Je.current.type);
|
|
460
460
|
if (t)
|
|
461
461
|
return `
|
|
462
462
|
|
|
@@ -490,25 +490,25 @@ Check the top-level render call using <` + u + ">.");
|
|
|
490
490
|
if (at[u])
|
|
491
491
|
return;
|
|
492
492
|
at[u] = !0;
|
|
493
|
-
var
|
|
494
|
-
t && t._owner && t._owner !== Je.current && (
|
|
493
|
+
var j = "";
|
|
494
|
+
t && t._owner && t._owner !== Je.current && (j = " It was passed a child from " + Q(t._owner.type) + "."), fe(t), D('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', u, j), fe(null);
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
function lt(t, a) {
|
|
498
498
|
{
|
|
499
499
|
if (typeof t != "object")
|
|
500
500
|
return;
|
|
501
|
-
if (
|
|
501
|
+
if (be(t))
|
|
502
502
|
for (var u = 0; u < t.length; u++) {
|
|
503
|
-
var
|
|
504
|
-
Ge(
|
|
503
|
+
var j = t[u];
|
|
504
|
+
Ge(j) && it(j, a);
|
|
505
505
|
}
|
|
506
506
|
else if (Ge(t))
|
|
507
507
|
t._store && (t._store.validated = !0);
|
|
508
508
|
else if (t) {
|
|
509
|
-
var
|
|
510
|
-
if (typeof
|
|
511
|
-
for (var
|
|
509
|
+
var _ = M(t);
|
|
510
|
+
if (typeof _ == "function" && _ !== t.entries)
|
|
511
|
+
for (var I = _.call(t), T; !(T = I.next()).done; )
|
|
512
512
|
Ge(T.value) && it(T.value, a);
|
|
513
513
|
}
|
|
514
514
|
}
|
|
@@ -521,78 +521,78 @@ Check the top-level render call using <` + u + ">.");
|
|
|
521
521
|
var u;
|
|
522
522
|
if (typeof a == "function")
|
|
523
523
|
u = a.propTypes;
|
|
524
|
-
else if (typeof a == "object" && (a.$$typeof ===
|
|
524
|
+
else if (typeof a == "object" && (a.$$typeof === g || // Note: Memo only checks outer props here.
|
|
525
525
|
// Inner props are checked in the reconciler.
|
|
526
|
-
a.$$typeof ===
|
|
526
|
+
a.$$typeof === k))
|
|
527
527
|
u = a.propTypes;
|
|
528
528
|
else
|
|
529
529
|
return;
|
|
530
530
|
if (u) {
|
|
531
|
-
var
|
|
532
|
-
We(u, t.props, "prop",
|
|
531
|
+
var j = Q(a);
|
|
532
|
+
We(u, t.props, "prop", j, t);
|
|
533
533
|
} else if (a.PropTypes !== void 0 && !Ke) {
|
|
534
534
|
Ke = !0;
|
|
535
|
-
var
|
|
536
|
-
|
|
535
|
+
var _ = Q(a);
|
|
536
|
+
D("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _ || "Unknown");
|
|
537
537
|
}
|
|
538
|
-
typeof a.getDefaultProps == "function" && !a.getDefaultProps.isReactClassApproved &&
|
|
538
|
+
typeof a.getDefaultProps == "function" && !a.getDefaultProps.isReactClassApproved && D("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
541
|
function Ot(t) {
|
|
542
542
|
{
|
|
543
543
|
for (var a = Object.keys(t.props), u = 0; u < a.length; u++) {
|
|
544
|
-
var
|
|
545
|
-
if (
|
|
546
|
-
|
|
544
|
+
var j = a[u];
|
|
545
|
+
if (j !== "children" && j !== "key") {
|
|
546
|
+
fe(t), D("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", j), fe(null);
|
|
547
547
|
break;
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
|
-
t.ref !== null && (
|
|
550
|
+
t.ref !== null && (fe(t), D("Invalid attribute `ref` supplied to `React.Fragment`."), fe(null));
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
553
|
var ct = {};
|
|
554
|
-
function dt(t, a, u,
|
|
554
|
+
function dt(t, a, u, j, _, I) {
|
|
555
555
|
{
|
|
556
556
|
var T = Pe(t);
|
|
557
557
|
if (!T) {
|
|
558
558
|
var w = "";
|
|
559
559
|
(t === void 0 || typeof t == "object" && t !== null && Object.keys(t).length === 0) && (w += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
560
|
-
var
|
|
561
|
-
|
|
562
|
-
var
|
|
563
|
-
t === null ?
|
|
560
|
+
var F = Mt();
|
|
561
|
+
F ? w += F : w += st();
|
|
562
|
+
var P;
|
|
563
|
+
t === null ? P = "null" : be(t) ? P = "array" : t !== void 0 && t.$$typeof === n ? (P = "<" + (Q(t.type) || "Unknown") + " />", w = " Did you accidentally export a JSX literal instead of a component?") : P = typeof t, D("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", P, w);
|
|
564
564
|
}
|
|
565
|
-
var
|
|
566
|
-
if (
|
|
567
|
-
return
|
|
565
|
+
var A = $t(t, a, u, _, I);
|
|
566
|
+
if (A == null)
|
|
567
|
+
return A;
|
|
568
568
|
if (T) {
|
|
569
|
-
var
|
|
570
|
-
if (
|
|
571
|
-
if (
|
|
572
|
-
if (
|
|
573
|
-
for (var
|
|
574
|
-
lt(
|
|
575
|
-
Object.freeze && Object.freeze(
|
|
569
|
+
var G = a.children;
|
|
570
|
+
if (G !== void 0)
|
|
571
|
+
if (j)
|
|
572
|
+
if (be(G)) {
|
|
573
|
+
for (var me = 0; me < G.length; me++)
|
|
574
|
+
lt(G[me], t);
|
|
575
|
+
Object.freeze && Object.freeze(G);
|
|
576
576
|
} else
|
|
577
|
-
|
|
577
|
+
D("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
578
578
|
else
|
|
579
|
-
lt(
|
|
579
|
+
lt(G, t);
|
|
580
580
|
}
|
|
581
|
-
if (
|
|
582
|
-
var
|
|
581
|
+
if (oe.call(a, "key")) {
|
|
582
|
+
var se = Q(t), z = Object.keys(a).filter(function(Vt) {
|
|
583
583
|
return Vt !== "key";
|
|
584
|
-
}), Xe =
|
|
585
|
-
if (!ct[
|
|
586
|
-
var Wt =
|
|
587
|
-
|
|
584
|
+
}), Xe = z.length > 0 ? "{key: someKey, " + z.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
585
|
+
if (!ct[se + Xe]) {
|
|
586
|
+
var Wt = z.length > 0 ? "{" + z.join(": ..., ") + ": ...}" : "{}";
|
|
587
|
+
D(`A props object containing a "key" prop is being spread into JSX:
|
|
588
588
|
let props = %s;
|
|
589
589
|
<%s {...props} />
|
|
590
590
|
React keys must be passed directly to JSX without using spread:
|
|
591
591
|
let props = %s;
|
|
592
|
-
<%s key={someKey} {...props} />`, Xe,
|
|
592
|
+
<%s key={someKey} {...props} />`, Xe, se, Wt, se), ct[se + Xe] = !0;
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
|
-
return t === o ? Ot(
|
|
595
|
+
return t === o ? Ot(A) : Dt(A), A;
|
|
596
596
|
}
|
|
597
597
|
}
|
|
598
598
|
function Pt(t, a, u) {
|
|
@@ -602,8 +602,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
602
602
|
return dt(t, a, u, !1);
|
|
603
603
|
}
|
|
604
604
|
var Ht = At, Bt = Pt;
|
|
605
|
-
|
|
606
|
-
})()),
|
|
605
|
+
ke.Fragment = o, ke.jsx = Ht, ke.jsxs = Bt;
|
|
606
|
+
})()), ke;
|
|
607
607
|
}
|
|
608
608
|
var mt;
|
|
609
609
|
function qt() {
|
|
@@ -725,44 +725,44 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
725
725
|
position: d = "bottom",
|
|
726
726
|
shortcut: o
|
|
727
727
|
}) => {
|
|
728
|
-
const [i,
|
|
728
|
+
const [i, c] = E(!1), [l, m] = E({ x: 0, y: 0 }), g = U(null), h = U(null), p = U(), k = () => {
|
|
729
729
|
p.current = window.setTimeout(() => {
|
|
730
|
-
|
|
730
|
+
c(!0);
|
|
731
731
|
}, 400);
|
|
732
|
-
},
|
|
733
|
-
p.current && clearTimeout(p.current),
|
|
732
|
+
}, x = () => {
|
|
733
|
+
p.current && clearTimeout(p.current), c(!1);
|
|
734
734
|
};
|
|
735
|
-
return
|
|
736
|
-
if (i &&
|
|
737
|
-
const f =
|
|
735
|
+
return Y(() => {
|
|
736
|
+
if (i && g.current && h.current) {
|
|
737
|
+
const f = g.current.getBoundingClientRect(), b = h.current.getBoundingClientRect();
|
|
738
738
|
let N = 0, M = 0;
|
|
739
739
|
switch (d) {
|
|
740
740
|
case "top":
|
|
741
|
-
N = f.left + (f.width -
|
|
741
|
+
N = f.left + (f.width - b.width) / 2, M = f.top - b.height - 8;
|
|
742
742
|
break;
|
|
743
743
|
case "bottom":
|
|
744
|
-
N = f.left + (f.width -
|
|
744
|
+
N = f.left + (f.width - b.width) / 2, M = f.bottom + 8;
|
|
745
745
|
break;
|
|
746
746
|
case "left":
|
|
747
|
-
N = f.left -
|
|
747
|
+
N = f.left - b.width - 8, M = f.top + (f.height - b.height) / 2;
|
|
748
748
|
break;
|
|
749
749
|
case "right":
|
|
750
|
-
N = f.right + 8, M = f.top + (f.height -
|
|
750
|
+
N = f.right + 8, M = f.top + (f.height - b.height) / 2;
|
|
751
751
|
break;
|
|
752
752
|
}
|
|
753
|
-
N = Math.max(8, Math.min(N, window.innerWidth -
|
|
753
|
+
N = Math.max(8, Math.min(N, window.innerWidth - b.width - 8)), M = Math.max(8, Math.min(M, window.innerHeight - b.height - 8)), m({ x: N, y: M });
|
|
754
754
|
}
|
|
755
|
-
}, [i, d]),
|
|
755
|
+
}, [i, d]), Y(() => () => {
|
|
756
756
|
p.current && clearTimeout(p.current);
|
|
757
757
|
}, []), /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
758
758
|
/* @__PURE__ */ e.jsx(
|
|
759
759
|
"div",
|
|
760
760
|
{
|
|
761
|
-
ref:
|
|
762
|
-
onMouseEnter:
|
|
763
|
-
onMouseLeave:
|
|
764
|
-
onFocus:
|
|
765
|
-
onBlur:
|
|
761
|
+
ref: g,
|
|
762
|
+
onMouseEnter: k,
|
|
763
|
+
onMouseLeave: x,
|
|
764
|
+
onFocus: k,
|
|
765
|
+
onBlur: x,
|
|
766
766
|
className: "inline-flex",
|
|
767
767
|
children: n
|
|
768
768
|
}
|
|
@@ -770,11 +770,11 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
770
770
|
i && /* @__PURE__ */ e.jsxs(
|
|
771
771
|
"div",
|
|
772
772
|
{
|
|
773
|
-
ref:
|
|
773
|
+
ref: h,
|
|
774
774
|
className: "fixed z-50 px-2.5 py-1.5 text-xs font-medium rounded-md shadow-lg animate-fade-in pointer-events-none bg-tooltip text-tooltip-foreground",
|
|
775
775
|
style: {
|
|
776
|
-
left:
|
|
777
|
-
top:
|
|
776
|
+
left: l.x,
|
|
777
|
+
top: l.y
|
|
778
778
|
},
|
|
779
779
|
children: [
|
|
780
780
|
/* @__PURE__ */ e.jsx("span", { children: r }),
|
|
@@ -783,22 +783,22 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
783
783
|
}
|
|
784
784
|
)
|
|
785
785
|
] });
|
|
786
|
-
},
|
|
786
|
+
}, H = ({
|
|
787
787
|
icon: r,
|
|
788
788
|
tooltip: n,
|
|
789
789
|
shortcut: d,
|
|
790
790
|
isActive: o = !1,
|
|
791
791
|
onClick: i,
|
|
792
|
-
disabled:
|
|
792
|
+
disabled: c = !1
|
|
793
793
|
}) => {
|
|
794
|
-
const
|
|
794
|
+
const l = "p-2 rounded-md transition-all duration-150 flex items-center justify-center hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 disabled:opacity-40 disabled:cursor-not-allowed", m = o ? "bg-accent text-accent-foreground" : "";
|
|
795
795
|
return /* @__PURE__ */ e.jsx(nt, { content: n, shortcut: d, children: /* @__PURE__ */ e.jsx(
|
|
796
796
|
"button",
|
|
797
797
|
{
|
|
798
798
|
type: "button",
|
|
799
799
|
onClick: i,
|
|
800
|
-
disabled:
|
|
801
|
-
className: `${
|
|
800
|
+
disabled: c,
|
|
801
|
+
className: `${l} ${m}`,
|
|
802
802
|
"aria-pressed": o,
|
|
803
803
|
children: r
|
|
804
804
|
}
|
|
@@ -814,12 +814,12 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
814
814
|
{ name: "Courier New", value: "courier", className: "font-courier" },
|
|
815
815
|
{ name: "Times New Roman", value: "times", className: "font-times" }
|
|
816
816
|
], er = ({ currentFont: r, onFontChange: n }) => {
|
|
817
|
-
const [d, o] =
|
|
818
|
-
return
|
|
819
|
-
const
|
|
817
|
+
const [d, o] = E(!1), i = U(null), c = Qe.find((l) => l.value === r) || Qe[0];
|
|
818
|
+
return Y(() => {
|
|
819
|
+
const l = (m) => {
|
|
820
820
|
i.current && !i.current.contains(m.target) && o(!1);
|
|
821
821
|
};
|
|
822
|
-
return document.addEventListener("mousedown",
|
|
822
|
+
return document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l);
|
|
823
823
|
}, []), /* @__PURE__ */ e.jsxs("div", { className: "relative", ref: i, children: [
|
|
824
824
|
/* @__PURE__ */ e.jsx(nt, { content: "Font family", children: /* @__PURE__ */ e.jsxs(
|
|
825
825
|
"button",
|
|
@@ -828,25 +828,25 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
828
828
|
onClick: () => o(!d),
|
|
829
829
|
className: `flex items-center gap-1.5 px-3 py-1.5 rounded-md transition-all duration-150 hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 text-sm font-medium min-w-[140px] justify-between ${d ? "bg-secondary" : ""}`,
|
|
830
830
|
children: [
|
|
831
|
-
/* @__PURE__ */ e.jsx("span", { className:
|
|
831
|
+
/* @__PURE__ */ e.jsx("span", { className: c.className, children: c.name }),
|
|
832
832
|
/* @__PURE__ */ e.jsx(Tt, { className: `w-4 h-4 transition-transform duration-200 ${d ? "rotate-180" : ""}` })
|
|
833
833
|
]
|
|
834
834
|
}
|
|
835
835
|
) }),
|
|
836
|
-
d && /* @__PURE__ */ e.jsx("div", { className: "absolute top-full left-0 mt-1 w-52 py-1 rounded-lg shadow-dropdown animate-scale-in z-50 bg-popover border border-border", children: Qe.map((
|
|
836
|
+
d && /* @__PURE__ */ e.jsx("div", { className: "absolute top-full left-0 mt-1 w-52 py-1 rounded-lg shadow-dropdown animate-scale-in z-50 bg-popover border border-border", children: Qe.map((l) => /* @__PURE__ */ e.jsxs(
|
|
837
837
|
"button",
|
|
838
838
|
{
|
|
839
839
|
type: "button",
|
|
840
840
|
onClick: () => {
|
|
841
|
-
n(
|
|
841
|
+
n(l), o(!1);
|
|
842
842
|
},
|
|
843
|
-
className: `w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors hover:bg-accent ${
|
|
843
|
+
className: `w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors hover:bg-accent ${l.value === r ? "bg-accent" : ""}`,
|
|
844
844
|
children: [
|
|
845
|
-
/* @__PURE__ */ e.jsx("span", { className: `flex-1 text-left ${
|
|
846
|
-
|
|
845
|
+
/* @__PURE__ */ e.jsx("span", { className: `flex-1 text-left ${l.className}`, children: l.name }),
|
|
846
|
+
l.value === r && /* @__PURE__ */ e.jsx(Jt, { className: "w-4 h-4 text-primary" })
|
|
847
847
|
]
|
|
848
848
|
},
|
|
849
|
-
|
|
849
|
+
l.value
|
|
850
850
|
)) })
|
|
851
851
|
] });
|
|
852
852
|
}, Ze = [
|
|
@@ -855,12 +855,12 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
855
855
|
{ name: "Heading 2", value: "h2", icon: /* @__PURE__ */ e.jsx(Et, { className: "w-4 h-4" }) },
|
|
856
856
|
{ name: "Heading 3", value: "h3", icon: /* @__PURE__ */ e.jsx(_t, { className: "w-4 h-4" }) }
|
|
857
857
|
], tr = ({ currentHeading: r, onHeadingChange: n }) => {
|
|
858
|
-
const [d, o] =
|
|
859
|
-
return
|
|
860
|
-
const
|
|
858
|
+
const [d, o] = E(!1), i = U(null), c = Ze.find((l) => l.value === r) || Ze[0];
|
|
859
|
+
return Y(() => {
|
|
860
|
+
const l = (m) => {
|
|
861
861
|
i.current && !i.current.contains(m.target) && o(!1);
|
|
862
862
|
};
|
|
863
|
-
return document.addEventListener("mousedown",
|
|
863
|
+
return document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l);
|
|
864
864
|
}, []), /* @__PURE__ */ e.jsxs("div", { className: "relative", ref: i, children: [
|
|
865
865
|
/* @__PURE__ */ e.jsx(nt, { content: "Text style", children: /* @__PURE__ */ e.jsxs(
|
|
866
866
|
"button",
|
|
@@ -870,27 +870,27 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
870
870
|
className: `flex items-center gap-1.5 px-3 py-1.5 rounded-md transition-all duration-150 hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 text-sm font-medium min-w-[120px] justify-between ${d ? "bg-secondary" : ""}`,
|
|
871
871
|
children: [
|
|
872
872
|
/* @__PURE__ */ e.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
873
|
-
|
|
874
|
-
|
|
873
|
+
c.icon,
|
|
874
|
+
c.name
|
|
875
875
|
] }),
|
|
876
876
|
/* @__PURE__ */ e.jsx(Tt, { className: `w-4 h-4 transition-transform duration-200 ${d ? "rotate-180" : ""}` })
|
|
877
877
|
]
|
|
878
878
|
}
|
|
879
879
|
) }),
|
|
880
|
-
d && /* @__PURE__ */ e.jsx("div", { className: "absolute top-full left-0 mt-1 w-44 py-1 rounded-lg shadow-dropdown animate-scale-in z-50 bg-popover border border-border", children: Ze.map((
|
|
880
|
+
d && /* @__PURE__ */ e.jsx("div", { className: "absolute top-full left-0 mt-1 w-44 py-1 rounded-lg shadow-dropdown animate-scale-in z-50 bg-popover border border-border", children: Ze.map((l) => /* @__PURE__ */ e.jsxs(
|
|
881
881
|
"button",
|
|
882
882
|
{
|
|
883
883
|
type: "button",
|
|
884
884
|
onClick: () => {
|
|
885
|
-
n(
|
|
885
|
+
n(l.value), o(!1);
|
|
886
886
|
},
|
|
887
|
-
className: `w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors hover:bg-accent ${
|
|
887
|
+
className: `w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors hover:bg-accent ${l.value === r ? "bg-accent" : ""}`,
|
|
888
888
|
children: [
|
|
889
|
-
|
|
890
|
-
/* @__PURE__ */ e.jsx("span", { className: `${
|
|
889
|
+
l.icon,
|
|
890
|
+
/* @__PURE__ */ e.jsx("span", { className: `${l.value === "h1" ? "text-lg font-bold" : ""} ${l.value === "h2" ? "text-base font-semibold" : ""} ${l.value === "h3" ? "text-sm font-semibold" : ""}`, children: l.name })
|
|
891
891
|
]
|
|
892
892
|
},
|
|
893
|
-
|
|
893
|
+
l.value
|
|
894
894
|
)) })
|
|
895
895
|
] });
|
|
896
896
|
}, rr = ({
|
|
@@ -899,31 +899,31 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
899
899
|
onFormat: d,
|
|
900
900
|
onFontChange: o,
|
|
901
901
|
onHeadingChange: i,
|
|
902
|
-
onUndo:
|
|
903
|
-
onRedo:
|
|
902
|
+
onUndo: c,
|
|
903
|
+
onRedo: l,
|
|
904
904
|
canUndo: m,
|
|
905
|
-
canRedo:
|
|
906
|
-
onInsertLink:
|
|
905
|
+
canRedo: g,
|
|
906
|
+
onInsertLink: h
|
|
907
907
|
}) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 px-3 py-2 border-b rounded-t-lg flex-wrap bg-toolbar border-toolbar-border", children: [
|
|
908
908
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-0.5 mr-2", children: [
|
|
909
909
|
/* @__PURE__ */ e.jsx(
|
|
910
|
-
|
|
910
|
+
H,
|
|
911
911
|
{
|
|
912
912
|
icon: /* @__PURE__ */ e.jsx(zt, { className: "w-4 h-4" }),
|
|
913
913
|
tooltip: "Undo",
|
|
914
914
|
shortcut: "⌘Z",
|
|
915
|
-
onClick:
|
|
915
|
+
onClick: c,
|
|
916
916
|
disabled: !m
|
|
917
917
|
}
|
|
918
918
|
),
|
|
919
919
|
/* @__PURE__ */ e.jsx(
|
|
920
|
-
|
|
920
|
+
H,
|
|
921
921
|
{
|
|
922
922
|
icon: /* @__PURE__ */ e.jsx(Yt, { className: "w-4 h-4" }),
|
|
923
923
|
tooltip: "Redo",
|
|
924
924
|
shortcut: "⌘⇧Z",
|
|
925
|
-
onClick:
|
|
926
|
-
disabled: !
|
|
925
|
+
onClick: l,
|
|
926
|
+
disabled: !g
|
|
927
927
|
}
|
|
928
928
|
)
|
|
929
929
|
] }),
|
|
@@ -933,7 +933,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
933
933
|
/* @__PURE__ */ e.jsx("div", { className: "w-px h-6 bg-border mx-1" }),
|
|
934
934
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-0.5", children: [
|
|
935
935
|
/* @__PURE__ */ e.jsx(
|
|
936
|
-
|
|
936
|
+
H,
|
|
937
937
|
{
|
|
938
938
|
icon: /* @__PURE__ */ e.jsx(vt, { className: "w-4 h-4" }),
|
|
939
939
|
tooltip: "Bold",
|
|
@@ -943,7 +943,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
943
943
|
}
|
|
944
944
|
),
|
|
945
945
|
/* @__PURE__ */ e.jsx(
|
|
946
|
-
|
|
946
|
+
H,
|
|
947
947
|
{
|
|
948
948
|
icon: /* @__PURE__ */ e.jsx(bt, { className: "w-4 h-4" }),
|
|
949
949
|
tooltip: "Italic",
|
|
@@ -953,7 +953,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
953
953
|
}
|
|
954
954
|
),
|
|
955
955
|
/* @__PURE__ */ e.jsx(
|
|
956
|
-
|
|
956
|
+
H,
|
|
957
957
|
{
|
|
958
958
|
icon: /* @__PURE__ */ e.jsx(jt, { className: "w-4 h-4" }),
|
|
959
959
|
tooltip: "Underline",
|
|
@@ -963,7 +963,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
963
963
|
}
|
|
964
964
|
),
|
|
965
965
|
/* @__PURE__ */ e.jsx(
|
|
966
|
-
|
|
966
|
+
H,
|
|
967
967
|
{
|
|
968
968
|
icon: /* @__PURE__ */ e.jsx(kt, { className: "w-4 h-4" }),
|
|
969
969
|
tooltip: "Strikethrough",
|
|
@@ -976,7 +976,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
976
976
|
/* @__PURE__ */ e.jsx("div", { className: "w-px h-6 bg-border mx-1" }),
|
|
977
977
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-0.5", children: [
|
|
978
978
|
/* @__PURE__ */ e.jsx(
|
|
979
|
-
|
|
979
|
+
H,
|
|
980
980
|
{
|
|
981
981
|
icon: /* @__PURE__ */ e.jsx(yt, { className: "w-4 h-4" }),
|
|
982
982
|
tooltip: "Bullet list",
|
|
@@ -986,7 +986,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
986
986
|
}
|
|
987
987
|
),
|
|
988
988
|
/* @__PURE__ */ e.jsx(
|
|
989
|
-
|
|
989
|
+
H,
|
|
990
990
|
{
|
|
991
991
|
icon: /* @__PURE__ */ e.jsx(wt, { className: "w-4 h-4" }),
|
|
992
992
|
tooltip: "Numbered list",
|
|
@@ -996,7 +996,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
996
996
|
}
|
|
997
997
|
),
|
|
998
998
|
/* @__PURE__ */ e.jsx(
|
|
999
|
-
|
|
999
|
+
H,
|
|
1000
1000
|
{
|
|
1001
1001
|
icon: /* @__PURE__ */ e.jsx(Ct, { className: "w-4 h-4" }),
|
|
1002
1002
|
tooltip: "Task list",
|
|
@@ -1009,7 +1009,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1009
1009
|
/* @__PURE__ */ e.jsx("div", { className: "w-px h-6 bg-border mx-1" }),
|
|
1010
1010
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-0.5", children: [
|
|
1011
1011
|
/* @__PURE__ */ e.jsx(
|
|
1012
|
-
|
|
1012
|
+
H,
|
|
1013
1013
|
{
|
|
1014
1014
|
icon: /* @__PURE__ */ e.jsx(Nt, { className: "w-4 h-4" }),
|
|
1015
1015
|
tooltip: "Blockquote",
|
|
@@ -1019,7 +1019,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1019
1019
|
}
|
|
1020
1020
|
),
|
|
1021
1021
|
/* @__PURE__ */ e.jsx(
|
|
1022
|
-
|
|
1022
|
+
H,
|
|
1023
1023
|
{
|
|
1024
1024
|
icon: /* @__PURE__ */ e.jsx(De, { className: "w-4 h-4" }),
|
|
1025
1025
|
tooltip: "Code block",
|
|
@@ -1029,7 +1029,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1029
1029
|
}
|
|
1030
1030
|
),
|
|
1031
1031
|
/* @__PURE__ */ e.jsx(
|
|
1032
|
-
|
|
1032
|
+
H,
|
|
1033
1033
|
{
|
|
1034
1034
|
icon: /* @__PURE__ */ e.jsx(Lt, { className: "w-4 h-4" }),
|
|
1035
1035
|
tooltip: "Horizontal rule",
|
|
@@ -1039,12 +1039,12 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1039
1039
|
] }),
|
|
1040
1040
|
/* @__PURE__ */ e.jsx("div", { className: "w-px h-6 bg-border mx-1" }),
|
|
1041
1041
|
/* @__PURE__ */ e.jsx(
|
|
1042
|
-
|
|
1042
|
+
H,
|
|
1043
1043
|
{
|
|
1044
1044
|
icon: /* @__PURE__ */ e.jsx(Oe, { className: "w-4 h-4" }),
|
|
1045
1045
|
tooltip: "Insert link",
|
|
1046
1046
|
shortcut: "⌘K",
|
|
1047
|
-
onClick:
|
|
1047
|
+
onClick: h
|
|
1048
1048
|
}
|
|
1049
1049
|
)
|
|
1050
1050
|
] }), nr = ({
|
|
@@ -1053,46 +1053,46 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1053
1053
|
onInsertLink: d,
|
|
1054
1054
|
editorRef: o
|
|
1055
1055
|
}) => {
|
|
1056
|
-
const [i,
|
|
1057
|
-
return
|
|
1058
|
-
const
|
|
1056
|
+
const [i, c] = E(!1), [l, m] = E({ x: 0, y: 0 }), g = U(null);
|
|
1057
|
+
return Y(() => {
|
|
1058
|
+
const h = () => {
|
|
1059
1059
|
const p = window.getSelection();
|
|
1060
1060
|
if (!p || p.isCollapsed || !o.current) {
|
|
1061
|
-
|
|
1061
|
+
c(!1);
|
|
1062
1062
|
return;
|
|
1063
1063
|
}
|
|
1064
|
-
const
|
|
1065
|
-
if (!o.current.contains(
|
|
1066
|
-
|
|
1064
|
+
const k = p.getRangeAt(0);
|
|
1065
|
+
if (!o.current.contains(k.commonAncestorContainer)) {
|
|
1066
|
+
c(!1);
|
|
1067
1067
|
return;
|
|
1068
1068
|
}
|
|
1069
1069
|
if (!p.toString().trim()) {
|
|
1070
|
-
|
|
1070
|
+
c(!1);
|
|
1071
1071
|
return;
|
|
1072
1072
|
}
|
|
1073
|
-
const f =
|
|
1074
|
-
let
|
|
1075
|
-
if (
|
|
1076
|
-
const M =
|
|
1077
|
-
|
|
1073
|
+
const f = k.getBoundingClientRect();
|
|
1074
|
+
let b = f.left + f.width / 2, N = f.top - 50;
|
|
1075
|
+
if (g.current) {
|
|
1076
|
+
const M = g.current.offsetWidth || 300;
|
|
1077
|
+
b = Math.max(M / 2 + 8, Math.min(b, window.innerWidth - M / 2 - 8));
|
|
1078
1078
|
}
|
|
1079
|
-
N < 10 && (N = f.bottom + 10), m({ x:
|
|
1079
|
+
N < 10 && (N = f.bottom + 10), m({ x: b, y: N }), c(!0);
|
|
1080
1080
|
};
|
|
1081
|
-
return document.addEventListener("selectionchange",
|
|
1081
|
+
return document.addEventListener("selectionchange", h), () => document.removeEventListener("selectionchange", h);
|
|
1082
1082
|
}, [o]), i ? /* @__PURE__ */ e.jsxs(
|
|
1083
1083
|
"div",
|
|
1084
1084
|
{
|
|
1085
|
-
ref:
|
|
1085
|
+
ref: g,
|
|
1086
1086
|
className: "fixed z-50 flex items-center gap-0.5 px-2 py-1.5 rounded-lg shadow-floating animate-scale-in bg-popover border border-border",
|
|
1087
1087
|
style: {
|
|
1088
|
-
left:
|
|
1089
|
-
top:
|
|
1088
|
+
left: l.x,
|
|
1089
|
+
top: l.y,
|
|
1090
1090
|
transform: "translateX(-50%)"
|
|
1091
1091
|
},
|
|
1092
|
-
onMouseDown: (
|
|
1092
|
+
onMouseDown: (h) => h.preventDefault(),
|
|
1093
1093
|
children: [
|
|
1094
1094
|
/* @__PURE__ */ e.jsx(
|
|
1095
|
-
|
|
1095
|
+
H,
|
|
1096
1096
|
{
|
|
1097
1097
|
icon: /* @__PURE__ */ e.jsx(vt, { className: "w-4 h-4" }),
|
|
1098
1098
|
tooltip: "Bold",
|
|
@@ -1102,7 +1102,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1102
1102
|
}
|
|
1103
1103
|
),
|
|
1104
1104
|
/* @__PURE__ */ e.jsx(
|
|
1105
|
-
|
|
1105
|
+
H,
|
|
1106
1106
|
{
|
|
1107
1107
|
icon: /* @__PURE__ */ e.jsx(bt, { className: "w-4 h-4" }),
|
|
1108
1108
|
tooltip: "Italic",
|
|
@@ -1112,7 +1112,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1112
1112
|
}
|
|
1113
1113
|
),
|
|
1114
1114
|
/* @__PURE__ */ e.jsx(
|
|
1115
|
-
|
|
1115
|
+
H,
|
|
1116
1116
|
{
|
|
1117
1117
|
icon: /* @__PURE__ */ e.jsx(jt, { className: "w-4 h-4" }),
|
|
1118
1118
|
tooltip: "Underline",
|
|
@@ -1122,7 +1122,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1122
1122
|
}
|
|
1123
1123
|
),
|
|
1124
1124
|
/* @__PURE__ */ e.jsx(
|
|
1125
|
-
|
|
1125
|
+
H,
|
|
1126
1126
|
{
|
|
1127
1127
|
icon: /* @__PURE__ */ e.jsx(kt, { className: "w-4 h-4" }),
|
|
1128
1128
|
tooltip: "Strikethrough",
|
|
@@ -1132,7 +1132,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1132
1132
|
),
|
|
1133
1133
|
/* @__PURE__ */ e.jsx("div", { className: "w-px h-5 bg-border mx-1" }),
|
|
1134
1134
|
/* @__PURE__ */ e.jsx(
|
|
1135
|
-
|
|
1135
|
+
H,
|
|
1136
1136
|
{
|
|
1137
1137
|
icon: /* @__PURE__ */ e.jsx(De, { className: "w-4 h-4" }),
|
|
1138
1138
|
tooltip: "Inline code",
|
|
@@ -1141,7 +1141,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1141
1141
|
}
|
|
1142
1142
|
),
|
|
1143
1143
|
/* @__PURE__ */ e.jsx(
|
|
1144
|
-
|
|
1144
|
+
H,
|
|
1145
1145
|
{
|
|
1146
1146
|
icon: /* @__PURE__ */ e.jsx(Oe, { className: "w-4 h-4" }),
|
|
1147
1147
|
tooltip: "Insert link",
|
|
@@ -1158,14 +1158,17 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1158
1158
|
onInsert: d,
|
|
1159
1159
|
selectedText: o = ""
|
|
1160
1160
|
}) => {
|
|
1161
|
-
const [i,
|
|
1162
|
-
|
|
1163
|
-
r && (m(o),
|
|
1161
|
+
const [i, c] = E(""), [l, m] = E(o), g = U(null);
|
|
1162
|
+
Y(() => {
|
|
1163
|
+
r && (m(o), c(""), setTimeout(() => {
|
|
1164
|
+
var p;
|
|
1165
|
+
return (p = g.current) == null ? void 0 : p.focus();
|
|
1166
|
+
}, 100));
|
|
1164
1167
|
}, [r, o]);
|
|
1165
|
-
const
|
|
1168
|
+
const h = (p) => {
|
|
1166
1169
|
if (p.preventDefault(), i.trim()) {
|
|
1167
|
-
let
|
|
1168
|
-
!
|
|
1170
|
+
let k = i.trim();
|
|
1171
|
+
!k.startsWith("http://") && !k.startsWith("https://") && (k = "https://" + k), d(k, l || void 0), n();
|
|
1169
1172
|
}
|
|
1170
1173
|
};
|
|
1171
1174
|
return r ? /* @__PURE__ */ e.jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm animate-fade-in", children: /* @__PURE__ */ e.jsxs("div", { className: "w-full max-w-md p-6 rounded-xl shadow-floating animate-scale-in bg-card border border-border", children: [
|
|
@@ -1184,16 +1187,16 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1184
1187
|
}
|
|
1185
1188
|
)
|
|
1186
1189
|
] }),
|
|
1187
|
-
/* @__PURE__ */ e.jsxs("form", { onSubmit:
|
|
1190
|
+
/* @__PURE__ */ e.jsxs("form", { onSubmit: h, className: "space-y-4", children: [
|
|
1188
1191
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
1189
1192
|
/* @__PURE__ */ e.jsx("label", { className: "block text-sm font-medium mb-1.5 text-foreground", children: "URL" }),
|
|
1190
1193
|
/* @__PURE__ */ e.jsx(
|
|
1191
1194
|
"input",
|
|
1192
1195
|
{
|
|
1193
|
-
ref:
|
|
1196
|
+
ref: g,
|
|
1194
1197
|
type: "text",
|
|
1195
1198
|
value: i,
|
|
1196
|
-
onChange: (p) =>
|
|
1199
|
+
onChange: (p) => c(p.target.value),
|
|
1197
1200
|
placeholder: "https://example.com",
|
|
1198
1201
|
className: "w-full px-3 py-2 rounded-lg border transition-colors bg-background border-input focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent placeholder:text-muted-foreground"
|
|
1199
1202
|
}
|
|
@@ -1205,7 +1208,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1205
1208
|
"input",
|
|
1206
1209
|
{
|
|
1207
1210
|
type: "text",
|
|
1208
|
-
value:
|
|
1211
|
+
value: l,
|
|
1209
1212
|
onChange: (p) => m(p.target.value),
|
|
1210
1213
|
placeholder: "Link text",
|
|
1211
1214
|
className: "w-full px-3 py-2 rounded-lg border transition-colors bg-background border-input focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent placeholder:text-muted-foreground"
|
|
@@ -1254,95 +1257,96 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1254
1257
|
onSelect: o,
|
|
1255
1258
|
onClose: i
|
|
1256
1259
|
}) => {
|
|
1257
|
-
const [
|
|
1258
|
-
(
|
|
1259
|
-
),
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
}, [d]),
|
|
1263
|
-
const
|
|
1260
|
+
const [c, l] = E(0), m = U(null), g = sr.filter(
|
|
1261
|
+
(x) => x.label.toLowerCase().includes(d.toLowerCase()) || x.description.toLowerCase().includes(d.toLowerCase())
|
|
1262
|
+
), h = g.reduce((x, f) => (x[f.category] || (x[f.category] = []), x[f.category].push(f), x), {});
|
|
1263
|
+
Y(() => {
|
|
1264
|
+
l(0);
|
|
1265
|
+
}, [d]), Y(() => {
|
|
1266
|
+
const x = (f) => {
|
|
1264
1267
|
m.current && !m.current.contains(f.target) && i();
|
|
1265
1268
|
};
|
|
1266
|
-
return r && document.addEventListener("mousedown",
|
|
1267
|
-
document.removeEventListener("mousedown",
|
|
1269
|
+
return r && document.addEventListener("mousedown", x), () => {
|
|
1270
|
+
document.removeEventListener("mousedown", x);
|
|
1268
1271
|
};
|
|
1269
1272
|
}, [r, i]);
|
|
1270
1273
|
const p = C(
|
|
1271
|
-
(
|
|
1274
|
+
(x) => {
|
|
1272
1275
|
if (r)
|
|
1273
|
-
switch (
|
|
1276
|
+
switch (x.key) {
|
|
1274
1277
|
case "ArrowDown":
|
|
1275
|
-
|
|
1278
|
+
x.preventDefault(), l((f) => (f + 1) % g.length);
|
|
1276
1279
|
break;
|
|
1277
1280
|
case "ArrowUp":
|
|
1278
|
-
|
|
1281
|
+
x.preventDefault(), l((f) => (f - 1 + g.length) % g.length);
|
|
1279
1282
|
break;
|
|
1280
1283
|
case "Enter":
|
|
1281
|
-
|
|
1284
|
+
x.preventDefault(), g[c] && o(g[c].action);
|
|
1282
1285
|
break;
|
|
1283
1286
|
case "Escape":
|
|
1284
|
-
|
|
1287
|
+
x.preventDefault(), i();
|
|
1285
1288
|
break;
|
|
1286
1289
|
}
|
|
1287
1290
|
},
|
|
1288
|
-
[r,
|
|
1291
|
+
[r, g, c, o, i]
|
|
1289
1292
|
);
|
|
1290
|
-
if (
|
|
1291
|
-
let
|
|
1293
|
+
if (Y(() => (document.addEventListener("keydown", p), () => document.removeEventListener("keydown", p)), [p]), !r || g.length === 0) return null;
|
|
1294
|
+
let k = 0;
|
|
1292
1295
|
return /* @__PURE__ */ e.jsx(
|
|
1293
1296
|
"div",
|
|
1294
1297
|
{
|
|
1295
1298
|
ref: m,
|
|
1296
1299
|
className: "fixed z-50 w-72 max-h-80 overflow-y-auto rounded-lg border shadow-lg animate-scale-in bg-popover border-border",
|
|
1297
1300
|
style: { top: n.top, left: n.left },
|
|
1298
|
-
children: Object.entries(
|
|
1299
|
-
/* @__PURE__ */ e.jsx("div", { className: "px-3 py-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider", children:
|
|
1300
|
-
f.map((
|
|
1301
|
-
const N =
|
|
1301
|
+
children: Object.entries(h).map(([x, f]) => /* @__PURE__ */ e.jsxs("div", { children: [
|
|
1302
|
+
/* @__PURE__ */ e.jsx("div", { className: "px-3 py-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: x }),
|
|
1303
|
+
f.map((b) => {
|
|
1304
|
+
const N = k++;
|
|
1302
1305
|
return /* @__PURE__ */ e.jsxs(
|
|
1303
1306
|
"button",
|
|
1304
1307
|
{
|
|
1305
|
-
className: `w-full flex items-center gap-3 px-3 py-2 text-left transition-colors ${N ===
|
|
1306
|
-
onClick: () => o(
|
|
1307
|
-
onMouseEnter: () =>
|
|
1308
|
+
className: `w-full flex items-center gap-3 px-3 py-2 text-left transition-colors ${N === c ? "bg-accent text-accent-foreground" : "hover:bg-muted"}`,
|
|
1309
|
+
onClick: () => o(b.action),
|
|
1310
|
+
onMouseEnter: () => l(N),
|
|
1308
1311
|
children: [
|
|
1309
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-md bg-secondary text-secondary-foreground", children:
|
|
1312
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-md bg-secondary text-secondary-foreground", children: b.icon }),
|
|
1310
1313
|
/* @__PURE__ */ e.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
1311
|
-
/* @__PURE__ */ e.jsx("div", { className: "text-sm font-medium", children:
|
|
1312
|
-
/* @__PURE__ */ e.jsx("div", { className: "text-xs text-muted-foreground truncate", children:
|
|
1314
|
+
/* @__PURE__ */ e.jsx("div", { className: "text-sm font-medium", children: b.label }),
|
|
1315
|
+
/* @__PURE__ */ e.jsx("div", { className: "text-xs text-muted-foreground truncate", children: b.description })
|
|
1313
1316
|
] })
|
|
1314
1317
|
]
|
|
1315
1318
|
},
|
|
1316
|
-
|
|
1319
|
+
b.id
|
|
1317
1320
|
);
|
|
1318
1321
|
})
|
|
1319
|
-
] },
|
|
1322
|
+
] }, x))
|
|
1320
1323
|
}
|
|
1321
1324
|
);
|
|
1322
1325
|
}, ir = ({ isOpen: r, onClose: n, onInsert: d }) => {
|
|
1323
|
-
const [o, i] =
|
|
1324
|
-
if (!
|
|
1326
|
+
const [o, i] = E("upload"), [c, l] = E(""), [m, g] = E(""), [h, p] = E(!1), [k, x] = E(null), f = U(null), b = C((R) => {
|
|
1327
|
+
if (!R.type.startsWith("image/")) {
|
|
1325
1328
|
alert("Please select an image file");
|
|
1326
1329
|
return;
|
|
1327
1330
|
}
|
|
1328
|
-
const
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1331
|
+
const q = new FileReader();
|
|
1332
|
+
q.onload = (O) => {
|
|
1333
|
+
var ne;
|
|
1334
|
+
const ie = (ne = O.target) == null ? void 0 : ne.result;
|
|
1335
|
+
x(ie);
|
|
1336
|
+
}, q.readAsDataURL(R);
|
|
1337
|
+
}, []), N = C((R) => {
|
|
1338
|
+
R.preventDefault(), p(!1);
|
|
1339
|
+
const q = R.dataTransfer.files[0];
|
|
1340
|
+
q && b(q);
|
|
1341
|
+
}, [b]), M = C((R) => {
|
|
1342
|
+
R.preventDefault(), p(!0);
|
|
1343
|
+
}, []), S = C((R) => {
|
|
1344
|
+
R.preventDefault(), p(!1);
|
|
1345
|
+
}, []), D = () => {
|
|
1346
|
+
const R = o === "upload" ? k : c;
|
|
1347
|
+
R && (d(R, m || void 0), ee());
|
|
1348
|
+
}, ee = () => {
|
|
1349
|
+
l(""), g(""), x(null), n();
|
|
1346
1350
|
};
|
|
1347
1351
|
return r ? /* @__PURE__ */ e.jsx(
|
|
1348
1352
|
"div",
|
|
@@ -1353,7 +1357,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1353
1357
|
"div",
|
|
1354
1358
|
{
|
|
1355
1359
|
className: "w-full max-w-md rounded-xl border shadow-xl overflow-hidden animate-scale-in bg-card border-border",
|
|
1356
|
-
onClick: (
|
|
1360
|
+
onClick: (R) => R.stopPropagation(),
|
|
1357
1361
|
children: [
|
|
1358
1362
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between px-4 py-3 border-b border-border bg-muted/50", children: [
|
|
1359
1363
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -1400,14 +1404,17 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1400
1404
|
onDrop: N,
|
|
1401
1405
|
onDragOver: M,
|
|
1402
1406
|
onDragLeave: S,
|
|
1403
|
-
onClick: () =>
|
|
1404
|
-
|
|
1407
|
+
onClick: () => {
|
|
1408
|
+
var R;
|
|
1409
|
+
return (R = f.current) == null ? void 0 : R.click();
|
|
1410
|
+
},
|
|
1411
|
+
className: `border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors ${h ? "border-primary bg-primary/5" : "border-border hover:border-muted-foreground"} ${k ? "border-solid" : ""}`,
|
|
1405
1412
|
children: [
|
|
1406
|
-
|
|
1413
|
+
k ? /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
|
|
1407
1414
|
/* @__PURE__ */ e.jsx(
|
|
1408
1415
|
"img",
|
|
1409
1416
|
{
|
|
1410
|
-
src:
|
|
1417
|
+
src: k,
|
|
1411
1418
|
alt: "Preview",
|
|
1412
1419
|
className: "max-h-48 mx-auto rounded-lg"
|
|
1413
1420
|
}
|
|
@@ -1415,8 +1422,8 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1415
1422
|
/* @__PURE__ */ e.jsx(
|
|
1416
1423
|
"button",
|
|
1417
1424
|
{
|
|
1418
|
-
onClick: (
|
|
1419
|
-
|
|
1425
|
+
onClick: (R) => {
|
|
1426
|
+
R.stopPropagation(), x(null);
|
|
1420
1427
|
},
|
|
1421
1428
|
className: "absolute top-2 right-2 p-1 rounded-full bg-destructive text-destructive-foreground",
|
|
1422
1429
|
children: /* @__PURE__ */ e.jsx(Ie, { className: "w-4 h-4" })
|
|
@@ -1434,9 +1441,10 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1434
1441
|
type: "file",
|
|
1435
1442
|
accept: "image/*",
|
|
1436
1443
|
className: "hidden",
|
|
1437
|
-
onChange: (
|
|
1438
|
-
|
|
1439
|
-
|
|
1444
|
+
onChange: (R) => {
|
|
1445
|
+
var O;
|
|
1446
|
+
const q = (O = R.target.files) == null ? void 0 : O[0];
|
|
1447
|
+
q && b(q);
|
|
1440
1448
|
}
|
|
1441
1449
|
}
|
|
1442
1450
|
)
|
|
@@ -1448,20 +1456,20 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1448
1456
|
"input",
|
|
1449
1457
|
{
|
|
1450
1458
|
type: "url",
|
|
1451
|
-
value:
|
|
1452
|
-
onChange: (
|
|
1459
|
+
value: c,
|
|
1460
|
+
onChange: (R) => l(R.target.value),
|
|
1453
1461
|
placeholder: "https://example.com/image.jpg",
|
|
1454
1462
|
className: "w-full px-3 py-2 rounded-lg border text-sm bg-background border-input focus:outline-none focus:ring-2 focus:ring-ring"
|
|
1455
1463
|
}
|
|
1456
1464
|
),
|
|
1457
|
-
|
|
1465
|
+
c && /* @__PURE__ */ e.jsx("div", { className: "mt-3", children: /* @__PURE__ */ e.jsx(
|
|
1458
1466
|
"img",
|
|
1459
1467
|
{
|
|
1460
|
-
src:
|
|
1468
|
+
src: c,
|
|
1461
1469
|
alt: "Preview",
|
|
1462
1470
|
className: "max-h-32 mx-auto rounded-lg",
|
|
1463
|
-
onError: (
|
|
1464
|
-
|
|
1471
|
+
onError: (R) => {
|
|
1472
|
+
R.target.style.display = "none";
|
|
1465
1473
|
}
|
|
1466
1474
|
}
|
|
1467
1475
|
) })
|
|
@@ -1473,7 +1481,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1473
1481
|
{
|
|
1474
1482
|
type: "text",
|
|
1475
1483
|
value: m,
|
|
1476
|
-
onChange: (
|
|
1484
|
+
onChange: (R) => g(R.target.value),
|
|
1477
1485
|
placeholder: "Describe the image...",
|
|
1478
1486
|
className: "w-full px-3 py-2 rounded-lg border text-sm bg-background border-input focus:outline-none focus:ring-2 focus:ring-ring"
|
|
1479
1487
|
}
|
|
@@ -1483,7 +1491,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1483
1491
|
/* @__PURE__ */ e.jsx(
|
|
1484
1492
|
"button",
|
|
1485
1493
|
{
|
|
1486
|
-
onClick:
|
|
1494
|
+
onClick: ee,
|
|
1487
1495
|
className: "px-4 py-2 rounded-lg text-sm font-medium transition-colors hover:bg-muted",
|
|
1488
1496
|
children: "Cancel"
|
|
1489
1497
|
}
|
|
@@ -1491,8 +1499,8 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1491
1499
|
/* @__PURE__ */ e.jsx(
|
|
1492
1500
|
"button",
|
|
1493
1501
|
{
|
|
1494
|
-
onClick:
|
|
1495
|
-
disabled: o === "upload" ? !
|
|
1502
|
+
onClick: D,
|
|
1503
|
+
disabled: o === "upload" ? !k : !c,
|
|
1496
1504
|
className: "px-4 py-2 rounded-lg text-sm font-medium transition-colors bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1497
1505
|
children: "Insert Image"
|
|
1498
1506
|
}
|
|
@@ -1505,8 +1513,8 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1505
1513
|
}
|
|
1506
1514
|
) : null;
|
|
1507
1515
|
}, lr = ({ isOpen: r, onClose: n, onInsert: d }) => {
|
|
1508
|
-
const [o, i] =
|
|
1509
|
-
d(o,
|
|
1516
|
+
const [o, i] = E(3), [c, l] = E(3), [m, g] = E({ row: 0, col: 0 }), h = () => {
|
|
1517
|
+
d(o, c), n();
|
|
1510
1518
|
};
|
|
1511
1519
|
return r ? /* @__PURE__ */ e.jsx(
|
|
1512
1520
|
"div",
|
|
@@ -1535,17 +1543,17 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1535
1543
|
] }),
|
|
1536
1544
|
/* @__PURE__ */ e.jsxs("div", { className: "p-4 space-y-4", children: [
|
|
1537
1545
|
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center", children: [
|
|
1538
|
-
/* @__PURE__ */ e.jsx("div", { className: "grid gap-1 p-2 rounded-lg bg-muted/50", children: Array.from({ length: 6 }, (p,
|
|
1546
|
+
/* @__PURE__ */ e.jsx("div", { className: "grid gap-1 p-2 rounded-lg bg-muted/50", children: Array.from({ length: 6 }, (p, k) => /* @__PURE__ */ e.jsx("div", { className: "flex gap-1", children: Array.from({ length: 6 }, (x, f) => /* @__PURE__ */ e.jsx(
|
|
1539
1547
|
"button",
|
|
1540
1548
|
{
|
|
1541
|
-
className: `w-6 h-6 rounded border-2 transition-all ${
|
|
1542
|
-
onMouseEnter: () =>
|
|
1549
|
+
className: `w-6 h-6 rounded border-2 transition-all ${k < m.row && f < m.col ? "bg-primary border-primary" : "border-border hover:border-muted-foreground"}`,
|
|
1550
|
+
onMouseEnter: () => g({ row: k + 1, col: f + 1 }),
|
|
1543
1551
|
onClick: () => {
|
|
1544
|
-
i(
|
|
1552
|
+
i(k + 1), l(f + 1);
|
|
1545
1553
|
}
|
|
1546
1554
|
},
|
|
1547
1555
|
f
|
|
1548
|
-
)) },
|
|
1556
|
+
)) }, k)) }),
|
|
1549
1557
|
/* @__PURE__ */ e.jsxs("p", { className: "text-sm text-muted-foreground mt-2", children: [
|
|
1550
1558
|
m.row,
|
|
1551
1559
|
" × ",
|
|
@@ -1575,8 +1583,8 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1575
1583
|
type: "number",
|
|
1576
1584
|
min: "1",
|
|
1577
1585
|
max: "10",
|
|
1578
|
-
value:
|
|
1579
|
-
onChange: (p) =>
|
|
1586
|
+
value: c,
|
|
1587
|
+
onChange: (p) => l(Math.max(1, Math.min(10, parseInt(p.target.value) || 1))),
|
|
1580
1588
|
className: "w-16 px-2 py-1 rounded border text-sm text-center bg-background border-input focus:outline-none focus:ring-2 focus:ring-ring"
|
|
1581
1589
|
}
|
|
1582
1590
|
)
|
|
@@ -1594,7 +1602,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1594
1602
|
/* @__PURE__ */ e.jsx(
|
|
1595
1603
|
"button",
|
|
1596
1604
|
{
|
|
1597
|
-
onClick:
|
|
1605
|
+
onClick: h,
|
|
1598
1606
|
className: "px-4 py-2 rounded-lg text-sm font-medium transition-colors bg-primary text-primary-foreground hover:bg-primary/90",
|
|
1599
1607
|
children: "Insert Table"
|
|
1600
1608
|
}
|
|
@@ -1614,9 +1622,9 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1614
1622
|
onDelete: i
|
|
1615
1623
|
}) => {
|
|
1616
1624
|
if (!r) return null;
|
|
1617
|
-
const
|
|
1618
|
-
const m = new Date(
|
|
1619
|
-
return
|
|
1625
|
+
const c = (l) => {
|
|
1626
|
+
const m = new Date(l), h = (/* @__PURE__ */ new Date()).getTime() - m.getTime();
|
|
1627
|
+
return h < 6e4 ? "Just now" : h < 36e5 ? `${Math.floor(h / 6e4)} min ago` : h < 864e5 ? `${Math.floor(h / 36e5)} hours ago` : m.toLocaleDateString("en-US", {
|
|
1620
1628
|
month: "short",
|
|
1621
1629
|
day: "numeric",
|
|
1622
1630
|
hour: "2-digit",
|
|
@@ -1632,7 +1640,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1632
1640
|
"div",
|
|
1633
1641
|
{
|
|
1634
1642
|
className: "w-full max-w-md max-h-[70vh] rounded-xl border shadow-xl overflow-hidden animate-scale-in bg-card border-border",
|
|
1635
|
-
onClick: (
|
|
1643
|
+
onClick: (l) => l.stopPropagation(),
|
|
1636
1644
|
children: [
|
|
1637
1645
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between px-4 py-3 border-b border-border bg-muted/50", children: [
|
|
1638
1646
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -1652,21 +1660,21 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1652
1660
|
/* @__PURE__ */ e.jsx(et, { className: "w-10 h-10 mx-auto mb-2 opacity-50" }),
|
|
1653
1661
|
/* @__PURE__ */ e.jsx("p", { children: "No versions saved yet" }),
|
|
1654
1662
|
/* @__PURE__ */ e.jsx("p", { className: "text-sm", children: "Changes are automatically saved" })
|
|
1655
|
-
] }) : /* @__PURE__ */ e.jsx("div", { className: "divide-y divide-border", children: [...d].reverse().map((
|
|
1663
|
+
] }) : /* @__PURE__ */ e.jsx("div", { className: "divide-y divide-border", children: [...d].reverse().map((l, m) => /* @__PURE__ */ e.jsxs(
|
|
1656
1664
|
"div",
|
|
1657
1665
|
{
|
|
1658
1666
|
className: "px-4 py-3 hover:bg-muted/50 transition-colors group",
|
|
1659
1667
|
children: [
|
|
1660
1668
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1661
1669
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
1662
|
-
/* @__PURE__ */ e.jsx("div", { className: "font-medium text-sm", children: m === 0 ? "Current Version" :
|
|
1663
|
-
/* @__PURE__ */ e.jsx("div", { className: "text-xs text-muted-foreground", children:
|
|
1670
|
+
/* @__PURE__ */ e.jsx("div", { className: "font-medium text-sm", children: m === 0 ? "Current Version" : l.title }),
|
|
1671
|
+
/* @__PURE__ */ e.jsx("div", { className: "text-xs text-muted-foreground", children: c(l.timestamp) })
|
|
1664
1672
|
] }),
|
|
1665
1673
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity", children: [
|
|
1666
1674
|
m !== 0 && /* @__PURE__ */ e.jsx(
|
|
1667
1675
|
"button",
|
|
1668
1676
|
{
|
|
1669
|
-
onClick: () => o(
|
|
1677
|
+
onClick: () => o(l.id),
|
|
1670
1678
|
className: "p-1.5 rounded-md transition-colors hover:bg-primary/10 text-primary",
|
|
1671
1679
|
title: "Restore this version",
|
|
1672
1680
|
children: /* @__PURE__ */ e.jsx(Qt, { className: "w-4 h-4" })
|
|
@@ -1675,7 +1683,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1675
1683
|
/* @__PURE__ */ e.jsx(
|
|
1676
1684
|
"button",
|
|
1677
1685
|
{
|
|
1678
|
-
onClick: () => i(
|
|
1686
|
+
onClick: () => i(l.id),
|
|
1679
1687
|
className: "p-1.5 rounded-md transition-colors hover:bg-destructive/10 text-destructive",
|
|
1680
1688
|
title: "Delete this version",
|
|
1681
1689
|
children: /* @__PURE__ */ e.jsx(Xt, { className: "w-4 h-4" })
|
|
@@ -1684,12 +1692,12 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1684
1692
|
] })
|
|
1685
1693
|
] }),
|
|
1686
1694
|
/* @__PURE__ */ e.jsxs("div", { className: "mt-1 text-xs text-muted-foreground line-clamp-2", children: [
|
|
1687
|
-
|
|
1695
|
+
l.content.replace(/<[^>]*>/g, "").slice(0, 100),
|
|
1688
1696
|
"..."
|
|
1689
1697
|
] })
|
|
1690
1698
|
]
|
|
1691
1699
|
},
|
|
1692
|
-
|
|
1700
|
+
l.id
|
|
1693
1701
|
)) }) })
|
|
1694
1702
|
]
|
|
1695
1703
|
}
|
|
@@ -1701,19 +1709,19 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1701
1709
|
onExportMarkdown: n,
|
|
1702
1710
|
onExportPDF: d
|
|
1703
1711
|
}) => {
|
|
1704
|
-
const [o, i] =
|
|
1705
|
-
|
|
1706
|
-
const m = (
|
|
1707
|
-
|
|
1712
|
+
const [o, i] = E(!1), c = U(null);
|
|
1713
|
+
Y(() => {
|
|
1714
|
+
const m = (g) => {
|
|
1715
|
+
c.current && !c.current.contains(g.target) && i(!1);
|
|
1708
1716
|
};
|
|
1709
1717
|
return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
|
|
1710
1718
|
}, []);
|
|
1711
|
-
const
|
|
1719
|
+
const l = [
|
|
1712
1720
|
{ label: "Export as HTML", icon: /* @__PURE__ */ e.jsx(De, { className: "w-4 h-4" }), action: r },
|
|
1713
1721
|
{ label: "Export as Markdown", icon: /* @__PURE__ */ e.jsx(Gt, { className: "w-4 h-4" }), action: n },
|
|
1714
1722
|
{ label: "Export as PDF", icon: /* @__PURE__ */ e.jsx(Zt, { className: "w-4 h-4" }), action: d }
|
|
1715
1723
|
];
|
|
1716
|
-
return /* @__PURE__ */ e.jsxs("div", { ref:
|
|
1724
|
+
return /* @__PURE__ */ e.jsxs("div", { ref: c, className: "relative", children: [
|
|
1717
1725
|
/* @__PURE__ */ e.jsxs(
|
|
1718
1726
|
"button",
|
|
1719
1727
|
{
|
|
@@ -1725,7 +1733,7 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1725
1733
|
]
|
|
1726
1734
|
}
|
|
1727
1735
|
),
|
|
1728
|
-
o && /* @__PURE__ */ e.jsx("div", { className: "absolute top-full right-0 mt-1 w-48 rounded-lg border shadow-lg overflow-hidden z-50 animate-scale-in bg-popover border-border", children:
|
|
1736
|
+
o && /* @__PURE__ */ e.jsx("div", { className: "absolute top-full right-0 mt-1 w-48 rounded-lg border shadow-lg overflow-hidden z-50 animate-scale-in bg-popover border-border", children: l.map((m) => /* @__PURE__ */ e.jsxs(
|
|
1729
1737
|
"button",
|
|
1730
1738
|
{
|
|
1731
1739
|
onClick: () => {
|
|
@@ -1741,18 +1749,19 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1741
1749
|
)) })
|
|
1742
1750
|
] });
|
|
1743
1751
|
}, ur = (r = "") => {
|
|
1744
|
-
const [n, d] =
|
|
1752
|
+
const [n, d] = E([{ content: r }]), [o, i] = E(0), c = U(0), l = C((k, x) => {
|
|
1745
1753
|
const f = Date.now();
|
|
1746
|
-
f -
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1754
|
+
f - c.current < 500 || (c.current = f, d((b) => {
|
|
1755
|
+
var M;
|
|
1756
|
+
const N = b.slice(0, o + 1);
|
|
1757
|
+
return ((M = N[N.length - 1]) == null ? void 0 : M.content) === k ? b : (N.length >= 100 && N.shift(), [...N, { content: k, cursorPosition: x }]);
|
|
1758
|
+
}), i((b) => Math.min(b + 1, 99)));
|
|
1759
|
+
}, [o]), m = C(() => o > 0 ? (i(o - 1), n[o - 1]) : null, [o, n]), g = C(() => o < n.length - 1 ? (i(o + 1), n[o + 1]) : null, [o, n]), h = o > 0, p = o < n.length - 1;
|
|
1751
1760
|
return {
|
|
1752
|
-
saveToHistory:
|
|
1761
|
+
saveToHistory: l,
|
|
1753
1762
|
undo: m,
|
|
1754
|
-
redo:
|
|
1755
|
-
canUndo:
|
|
1763
|
+
redo: g,
|
|
1764
|
+
canUndo: h,
|
|
1756
1765
|
canRedo: p
|
|
1757
1766
|
};
|
|
1758
1767
|
}, fr = [
|
|
@@ -1789,23 +1798,24 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1789
1798
|
{ pattern: /\[(.+?)\]\((.+?)\)/, replacement: (r, n, d) => `<a href="${d}">${n}</a>` }
|
|
1790
1799
|
], hr = () => {
|
|
1791
1800
|
const r = C((d) => {
|
|
1792
|
-
for (const { pattern: i, replacement:
|
|
1801
|
+
for (const { pattern: i, replacement: c, format: l } of fr)
|
|
1793
1802
|
if (d.match(i))
|
|
1794
1803
|
return {
|
|
1795
|
-
html: d.replace(i,
|
|
1796
|
-
format:
|
|
1804
|
+
html: d.replace(i, c),
|
|
1805
|
+
format: l
|
|
1797
1806
|
};
|
|
1798
1807
|
let o = d;
|
|
1799
|
-
for (const { pattern: i, replacement:
|
|
1800
|
-
o = o.replace(i,
|
|
1808
|
+
for (const { pattern: i, replacement: c } of mr)
|
|
1809
|
+
o = o.replace(i, c);
|
|
1801
1810
|
return o !== d ? { html: `<p>${o}</p>` } : { html: d };
|
|
1802
1811
|
}, []), n = C((d) => {
|
|
1812
|
+
var c, l, m, g;
|
|
1803
1813
|
const o = [];
|
|
1804
1814
|
if (!d) return o;
|
|
1805
1815
|
let i = d;
|
|
1806
1816
|
for (; i; ) {
|
|
1807
|
-
const
|
|
1808
|
-
(
|
|
1817
|
+
const h = (c = i.tagName) == null ? void 0 : c.toLowerCase();
|
|
1818
|
+
(h === "strong" || h === "b") && o.push("bold"), (h === "em" || h === "i") && o.push("italic"), h === "u" && o.push("underline"), (h === "s" || h === "strike" || h === "del") && o.push("strikethrough"), h === "code" && ((m = (l = i.parentElement) == null ? void 0 : l.tagName) == null ? void 0 : m.toLowerCase()) !== "pre" && o.push("inlineCode"), h === "pre" && o.push("code"), h === "blockquote" && o.push("blockquote"), h === "ul" && o.push("unorderedList"), h === "ol" && o.push("orderedList"), h === "h1" && o.push("h1"), h === "h2" && o.push("h2"), h === "h3" && o.push("h3"), (g = i.classList) != null && g.contains("task-list") && o.push("taskList"), i = i.parentElement;
|
|
1809
1819
|
}
|
|
1810
1820
|
return [...new Set(o)];
|
|
1811
1821
|
}, []);
|
|
@@ -1813,80 +1823,83 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1813
1823
|
processMarkdown: r,
|
|
1814
1824
|
detectActiveFormats: n
|
|
1815
1825
|
};
|
|
1816
|
-
},
|
|
1817
|
-
const [n, d] =
|
|
1826
|
+
}, ae = "docuedit_documents", pr = 5e3, pt = 50, xr = (r = "default") => {
|
|
1827
|
+
const [n, d] = E({
|
|
1818
1828
|
currentDocumentId: r,
|
|
1819
1829
|
versions: [],
|
|
1820
1830
|
lastSaved: null,
|
|
1821
1831
|
isSaving: !1
|
|
1822
|
-
}), o =
|
|
1823
|
-
|
|
1824
|
-
const
|
|
1825
|
-
if (
|
|
1832
|
+
}), o = U(""), i = U(null);
|
|
1833
|
+
Y(() => {
|
|
1834
|
+
const x = localStorage.getItem(ae);
|
|
1835
|
+
if (x)
|
|
1826
1836
|
try {
|
|
1827
|
-
const
|
|
1837
|
+
const b = JSON.parse(x)[r] || [];
|
|
1828
1838
|
d((N) => ({
|
|
1829
1839
|
...N,
|
|
1830
|
-
versions:
|
|
1831
|
-
lastSaved:
|
|
1840
|
+
versions: b,
|
|
1841
|
+
lastSaved: b.length > 0 ? b[b.length - 1].timestamp : null
|
|
1832
1842
|
}));
|
|
1833
1843
|
} catch (f) {
|
|
1834
1844
|
console.error("Failed to load autosave data:", f);
|
|
1835
1845
|
}
|
|
1836
1846
|
}, [r]);
|
|
1837
|
-
const
|
|
1838
|
-
const
|
|
1847
|
+
const c = C((x, f = !1) => {
|
|
1848
|
+
const b = localStorage.getItem(ae), N = b ? JSON.parse(b) : {}, M = Date.now(), S = N[r] || [];
|
|
1839
1849
|
if (f || S.length === 0) {
|
|
1840
|
-
const
|
|
1850
|
+
const D = {
|
|
1841
1851
|
id: `v_${M}`,
|
|
1842
|
-
content:
|
|
1852
|
+
content: x,
|
|
1843
1853
|
timestamp: M,
|
|
1844
1854
|
title: `Version ${S.length + 1}`
|
|
1845
1855
|
};
|
|
1846
|
-
S.push(
|
|
1856
|
+
S.push(D), S.length > pt && S.splice(0, S.length - pt);
|
|
1847
1857
|
} else
|
|
1848
1858
|
S.length > 0 && (S[S.length - 1] = {
|
|
1849
1859
|
...S[S.length - 1],
|
|
1850
|
-
content:
|
|
1860
|
+
content: x,
|
|
1851
1861
|
timestamp: M
|
|
1852
1862
|
});
|
|
1853
|
-
N[r] = S, localStorage.setItem(
|
|
1854
|
-
...
|
|
1863
|
+
N[r] = S, localStorage.setItem(ae, JSON.stringify(N)), d((D) => ({
|
|
1864
|
+
...D,
|
|
1855
1865
|
versions: S,
|
|
1856
1866
|
lastSaved: M,
|
|
1857
1867
|
isSaving: !1
|
|
1858
1868
|
}));
|
|
1859
|
-
}, [r]),
|
|
1860
|
-
o.current =
|
|
1861
|
-
|
|
1869
|
+
}, [r]), l = C((x, f = !1) => {
|
|
1870
|
+
o.current = x, d((b) => ({ ...b, isSaving: !0 })), setTimeout(() => {
|
|
1871
|
+
c(x, f);
|
|
1862
1872
|
}, 100);
|
|
1863
|
-
}, [
|
|
1864
|
-
o.current &&
|
|
1865
|
-
}, [
|
|
1866
|
-
const f =
|
|
1867
|
-
|
|
1873
|
+
}, [c]), m = C(() => {
|
|
1874
|
+
o.current && c(o.current, !0);
|
|
1875
|
+
}, [c]), g = C((x) => {
|
|
1876
|
+
const f = n.versions.find((b) => b.id === x);
|
|
1877
|
+
return (f == null ? void 0 : f.content) || null;
|
|
1878
|
+
}, [n.versions]), h = C(() => n.versions.length === 0 ? null : n.versions[n.versions.length - 1].content, [n.versions]), p = C((x) => {
|
|
1879
|
+
const f = localStorage.getItem(ae), b = f ? JSON.parse(f) : {}, M = (b[r] || []).filter((S) => S.id !== x);
|
|
1880
|
+
b[r] = M, localStorage.setItem(ae, JSON.stringify(b)), d((S) => ({
|
|
1868
1881
|
...S,
|
|
1869
1882
|
versions: M
|
|
1870
1883
|
}));
|
|
1871
|
-
}, [r]),
|
|
1872
|
-
const
|
|
1873
|
-
delete f[r], localStorage.setItem(
|
|
1874
|
-
...
|
|
1884
|
+
}, [r]), k = C(() => {
|
|
1885
|
+
const x = localStorage.getItem(ae), f = x ? JSON.parse(x) : {};
|
|
1886
|
+
delete f[r], localStorage.setItem(ae, JSON.stringify(f)), d((b) => ({
|
|
1887
|
+
...b,
|
|
1875
1888
|
versions: [],
|
|
1876
1889
|
lastSaved: null
|
|
1877
1890
|
}));
|
|
1878
1891
|
}, [r]);
|
|
1879
|
-
return
|
|
1880
|
-
o.current &&
|
|
1892
|
+
return Y(() => (i.current = setInterval(() => {
|
|
1893
|
+
o.current && c(o.current, !1);
|
|
1881
1894
|
}, pr), () => {
|
|
1882
1895
|
i.current && clearInterval(i.current);
|
|
1883
|
-
}), [
|
|
1884
|
-
save:
|
|
1896
|
+
}), [c]), {
|
|
1897
|
+
save: l,
|
|
1885
1898
|
createVersionSnapshot: m,
|
|
1886
|
-
loadVersion:
|
|
1887
|
-
getLatestContent:
|
|
1899
|
+
loadVersion: g,
|
|
1900
|
+
getLatestContent: h,
|
|
1888
1901
|
deleteVersion: p,
|
|
1889
|
-
clearAllVersions:
|
|
1902
|
+
clearAllVersions: k,
|
|
1890
1903
|
versions: n.versions,
|
|
1891
1904
|
lastSaved: n.lastSaved,
|
|
1892
1905
|
isSaving: n.isSaving
|
|
@@ -1894,8 +1907,8 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1894
1907
|
}, gr = (r) => {
|
|
1895
1908
|
let n = r;
|
|
1896
1909
|
n = n.replace(/<div class="task-list">([\s\S]*?)<\/div>/gi, (o, i) => i), n = n.replace(/<div class="task-item">([\s\S]*?)<\/div>/gi, (o, i) => {
|
|
1897
|
-
const
|
|
1898
|
-
return
|
|
1910
|
+
const c = i.includes("checked"), l = i.match(/<span class="task-text"[^>]*>([\s\S]*?)<\/span>/i), m = l ? l[1].trim() : "";
|
|
1911
|
+
return c ? `- [x] ${m}
|
|
1899
1912
|
` : `- [ ] ${m}
|
|
1900
1913
|
`;
|
|
1901
1914
|
}), n = n.replace(/<span class="task-checkbox[^"]*"[^>]*><\/span>/gi, ""), n = n.replace(/<span class="task-text"[^>]*>([\s\S]*?)<\/span>/gi, "$1"), n = n.replace(/<h1[^>]*>([\s\S]*?)<\/h1>/gi, `# $1
|
|
@@ -1913,12 +1926,12 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
1913
1926
|
`), n = n.replace(/<strong[^>]*>([\s\S]*?)<\/strong>/gi, "**$1**"), n = n.replace(/<b[^>]*>([\s\S]*?)<\/b>/gi, "**$1**"), n = n.replace(/<em[^>]*>([\s\S]*?)<\/em>/gi, "*$1*"), n = n.replace(/<i[^>]*>([\s\S]*?)<\/i>/gi, "*$1*"), n = n.replace(/<u[^>]*>([\s\S]*?)<\/u>/gi, "<u>$1</u>"), n = n.replace(/<s[^>]*>([\s\S]*?)<\/s>/gi, "~~$1~~"), n = n.replace(/<strike[^>]*>([\s\S]*?)<\/strike>/gi, "~~$1~~"), n = n.replace(/<pre[^>]*><code[^>]*>([\s\S]*?)<\/code><\/pre>/gi, "```\n$1\n```\n\n"), n = n.replace(/<code[^>]*>([\s\S]*?)<\/code>/gi, "`$1`"), n = n.replace(/<a[^>]*href="([^"]*)"[^>]*>([\s\S]*?)<\/a>/gi, "[$2]($1)"), n = n.replace(/<img[^>]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*\/?>/gi, ""), n = n.replace(/<img[^>]*src="([^"]*)"[^>]*\/?>/gi, ""), n = n.replace(/<ul[^>]*>([\s\S]*?)<\/ul>/gi, (o, i) => i.replace(/<li[^>]*>([\s\S]*?)<\/li>/gi, `- $1
|
|
1914
1927
|
`) + `
|
|
1915
1928
|
`), n = n.replace(/<ol[^>]*>([\s\S]*?)<\/ol>/gi, (o, i) => {
|
|
1916
|
-
let
|
|
1917
|
-
return i.replace(/<li[^>]*>([\s\S]*?)<\/li>/gi, () => (
|
|
1929
|
+
let c = 0;
|
|
1930
|
+
return i.replace(/<li[^>]*>([\s\S]*?)<\/li>/gi, () => (c++, `${c}. $1
|
|
1918
1931
|
`)) + `
|
|
1919
1932
|
`;
|
|
1920
1933
|
}), n = n.replace(/<blockquote[^>]*>([\s\S]*?)<\/blockquote>/gi, (o, i) => i.split(`
|
|
1921
|
-
`).map((
|
|
1934
|
+
`).map((c) => `> ${c}`).join(`
|
|
1922
1935
|
`) + `
|
|
1923
1936
|
|
|
1924
1937
|
`), n = n.replace(/<hr[^>]*\/?>/gi, `
|
|
@@ -2000,11 +2013,11 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
2000
2013
|
d.print();
|
|
2001
2014
|
}, 500);
|
|
2002
2015
|
}, xt = (r, n, d) => {
|
|
2003
|
-
const o = new Blob([r], { type: d }), i = URL.createObjectURL(o),
|
|
2004
|
-
|
|
2016
|
+
const o = new Blob([r], { type: d }), i = URL.createObjectURL(o), c = document.createElement("a");
|
|
2017
|
+
c.href = i, c.download = n, document.body.appendChild(c), c.click(), document.body.removeChild(c), URL.revokeObjectURL(i);
|
|
2005
2018
|
}, br = () => {
|
|
2006
2019
|
const r = C((o, i = "document") => {
|
|
2007
|
-
const
|
|
2020
|
+
const c = `<!DOCTYPE html>
|
|
2008
2021
|
<html lang="en">
|
|
2009
2022
|
<head>
|
|
2010
2023
|
<meta charset="UTF-8">
|
|
@@ -2029,10 +2042,10 @@ const vt = ({ className: r = "w-4 h-4" }) => /* @__PURE__ */ e.jsxs("svg", { cla
|
|
|
2029
2042
|
${o}
|
|
2030
2043
|
</body>
|
|
2031
2044
|
</html>`;
|
|
2032
|
-
xt(
|
|
2045
|
+
xt(c, `${i}.html`, "text/html");
|
|
2033
2046
|
}, []), n = C((o, i = "document") => {
|
|
2034
|
-
const
|
|
2035
|
-
xt(
|
|
2047
|
+
const c = gr(o);
|
|
2048
|
+
xt(c, `${i}.md`, "text/markdown");
|
|
2036
2049
|
}, []), d = C((o, i = "Document") => {
|
|
2037
2050
|
vr(o, i);
|
|
2038
2051
|
}, []);
|
|
@@ -2053,15 +2066,15 @@ ${o}
|
|
|
2053
2066
|
code: !1,
|
|
2054
2067
|
heading: "p"
|
|
2055
2068
|
}, yr = () => {
|
|
2056
|
-
const r =
|
|
2057
|
-
|
|
2058
|
-
const
|
|
2059
|
-
|
|
2069
|
+
const r = U(null), [n, d] = E(jr), [o, i] = E("dm-sans"), [c, l] = E(!1), [m, g] = E(""), h = U(null), [p, k] = E(!1), [x, f] = E({ top: 0, left: 0 }), [b, N] = E(""), [M, S] = E(!1), [D, ee] = E(!1), [R, q] = E(!1), { saveToHistory: O, undo: ie, redo: ne, canUndo: ye, canRedo: Pe } = ur(), { detectActiveFormats: we } = hr(), { save: B, versions: Q, lastSaved: X, loadVersion: te, deleteVersion: Ce, getLatestContent: Ne, createVersionSnapshot: he } = xr(), { exportHTML: Le, exportMarkdown: Te, exportPDF: Se } = br();
|
|
2070
|
+
Y(() => {
|
|
2071
|
+
const s = Ne();
|
|
2072
|
+
s && r.current && (r.current.innerHTML = s);
|
|
2060
2073
|
}, []);
|
|
2061
2074
|
const W = C(() => {
|
|
2062
|
-
const
|
|
2063
|
-
if (!
|
|
2064
|
-
const L =
|
|
2075
|
+
const s = window.getSelection();
|
|
2076
|
+
if (!s || !s.rangeCount) return;
|
|
2077
|
+
const L = s.getRangeAt(0).commonAncestorContainer.parentElement, v = we(L);
|
|
2065
2078
|
d({
|
|
2066
2079
|
bold: v.includes("bold") || document.queryCommandState("bold"),
|
|
2067
2080
|
italic: v.includes("italic") || document.queryCommandState("italic"),
|
|
@@ -2072,11 +2085,11 @@ ${o}
|
|
|
2072
2085
|
taskList: v.includes("taskList"),
|
|
2073
2086
|
blockquote: v.includes("blockquote"),
|
|
2074
2087
|
code: v.includes("code") || v.includes("inlineCode"),
|
|
2075
|
-
heading: v.find((
|
|
2088
|
+
heading: v.find(($) => $.match(/^h[1-3]$/)) || "p"
|
|
2076
2089
|
});
|
|
2077
|
-
}, [we]),
|
|
2090
|
+
}, [we]), J = C((s) => {
|
|
2078
2091
|
if (r.current) {
|
|
2079
|
-
switch (r.current.focus(),
|
|
2092
|
+
switch (r.current.focus(), s) {
|
|
2080
2093
|
case "bold":
|
|
2081
2094
|
document.execCommand("bold", !1);
|
|
2082
2095
|
break;
|
|
@@ -2102,10 +2115,10 @@ ${o}
|
|
|
2102
2115
|
He();
|
|
2103
2116
|
break;
|
|
2104
2117
|
case "code":
|
|
2105
|
-
|
|
2118
|
+
pe();
|
|
2106
2119
|
break;
|
|
2107
2120
|
case "inlineCode":
|
|
2108
|
-
|
|
2121
|
+
xe("code");
|
|
2109
2122
|
break;
|
|
2110
2123
|
case "horizontalRule":
|
|
2111
2124
|
document.execCommand("insertHorizontalRule", !1);
|
|
@@ -2116,126 +2129,128 @@ ${o}
|
|
|
2116
2129
|
case "h1":
|
|
2117
2130
|
case "h2":
|
|
2118
2131
|
case "h3":
|
|
2119
|
-
document.execCommand("formatBlock", !1,
|
|
2132
|
+
document.execCommand("formatBlock", !1, s);
|
|
2120
2133
|
break;
|
|
2121
2134
|
case "image":
|
|
2122
2135
|
S(!0);
|
|
2123
2136
|
return;
|
|
2124
2137
|
case "table":
|
|
2125
|
-
|
|
2138
|
+
ee(!0);
|
|
2126
2139
|
return;
|
|
2127
2140
|
}
|
|
2128
|
-
|
|
2141
|
+
O(r.current.innerHTML), B(r.current.innerHTML), W();
|
|
2129
2142
|
}
|
|
2130
|
-
}, [
|
|
2143
|
+
}, [O, W, B]), Ae = () => {
|
|
2131
2144
|
document.execCommand("insertHTML", !1, `<div class="task-list"><div class="task-item"><span class="task-checkbox" onclick="this.classList.toggle('checked'); this.nextElementSibling.classList.toggle('completed');"></span><span class="task-text" contenteditable="true">Task item</span></div></div>`);
|
|
2132
2145
|
}, He = () => {
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2146
|
+
var v;
|
|
2147
|
+
const s = window.getSelection();
|
|
2148
|
+
if (!s || !s.rangeCount) return;
|
|
2149
|
+
const L = (v = s.getRangeAt(0).commonAncestorContainer.parentElement) == null ? void 0 : v.closest("blockquote");
|
|
2136
2150
|
if (L) {
|
|
2137
|
-
const
|
|
2138
|
-
L.outerHTML = `<p>${
|
|
2151
|
+
const $ = L.innerHTML;
|
|
2152
|
+
L.outerHTML = `<p>${$}</p>`;
|
|
2139
2153
|
} else {
|
|
2140
|
-
const
|
|
2141
|
-
document.execCommand("insertHTML", !1, `<blockquote>${
|
|
2154
|
+
const $ = s.toString() || "Quote text here...";
|
|
2155
|
+
document.execCommand("insertHTML", !1, `<blockquote>${$}</blockquote>`);
|
|
2142
2156
|
}
|
|
2143
|
-
},
|
|
2144
|
-
const
|
|
2145
|
-
if (!
|
|
2146
|
-
const y =
|
|
2157
|
+
}, pe = () => {
|
|
2158
|
+
const s = window.getSelection();
|
|
2159
|
+
if (!s || !s.rangeCount) return;
|
|
2160
|
+
const y = s.toString() || "Code here...";
|
|
2147
2161
|
document.execCommand("insertHTML", !1, `<pre><code>${y}</code></pre><p></p>`);
|
|
2148
|
-
},
|
|
2162
|
+
}, xe = (s) => {
|
|
2163
|
+
var V;
|
|
2149
2164
|
const y = window.getSelection();
|
|
2150
2165
|
if (!y || !y.rangeCount || y.isCollapsed) return;
|
|
2151
|
-
const L = y.getRangeAt(0), v = L.toString(),
|
|
2152
|
-
if (
|
|
2153
|
-
const
|
|
2154
|
-
|
|
2166
|
+
const L = y.getRangeAt(0), v = L.toString(), $ = L.commonAncestorContainer.parentElement;
|
|
2167
|
+
if (((V = $ == null ? void 0 : $.tagName) == null ? void 0 : V.toLowerCase()) === s) {
|
|
2168
|
+
const K = document.createTextNode(v);
|
|
2169
|
+
$.replaceWith(K);
|
|
2155
2170
|
} else
|
|
2156
|
-
document.execCommand("insertHTML", !1, `<${
|
|
2157
|
-
},
|
|
2171
|
+
document.execCommand("insertHTML", !1, `<${s}>${v}</${s}>`);
|
|
2172
|
+
}, Z = C((s, y) => {
|
|
2158
2173
|
if (!r.current) return;
|
|
2159
2174
|
r.current.focus();
|
|
2160
|
-
const L = `<img src="${
|
|
2161
|
-
document.execCommand("insertHTML", !1, L),
|
|
2162
|
-
}, [
|
|
2175
|
+
const L = `<img src="${s}" alt="${y || ""}" class="editor-image" style="max-width: 100%; border-radius: 8px;" /><p></p>`;
|
|
2176
|
+
document.execCommand("insertHTML", !1, L), O(r.current.innerHTML), B(r.current.innerHTML), S(!1);
|
|
2177
|
+
}, [O, B]), ge = C((s, y) => {
|
|
2163
2178
|
if (!r.current) return;
|
|
2164
2179
|
r.current.focus();
|
|
2165
2180
|
let L = '<table class="editor-table"><thead><tr>';
|
|
2166
2181
|
for (let v = 0; v < y; v++)
|
|
2167
2182
|
L += "<th>Header</th>";
|
|
2168
2183
|
L += "</tr></thead><tbody>";
|
|
2169
|
-
for (let v = 0; v <
|
|
2184
|
+
for (let v = 0; v < s - 1; v++) {
|
|
2170
2185
|
L += "<tr>";
|
|
2171
|
-
for (let
|
|
2186
|
+
for (let $ = 0; $ < y; $++)
|
|
2172
2187
|
L += "<td>Cell</td>";
|
|
2173
2188
|
L += "</tr>";
|
|
2174
2189
|
}
|
|
2175
|
-
L += "</tbody></table><p></p>", document.execCommand("insertHTML", !1, L),
|
|
2176
|
-
}, [
|
|
2177
|
-
r.current && (r.current.focus(), document.execCommand("formatBlock", !1,
|
|
2178
|
-
}, [
|
|
2179
|
-
i(
|
|
2180
|
-
}, []),
|
|
2181
|
-
const
|
|
2182
|
-
|
|
2183
|
-
}, [
|
|
2184
|
-
const
|
|
2185
|
-
|
|
2186
|
-
}, [
|
|
2187
|
-
const
|
|
2188
|
-
|
|
2189
|
-
}, []),
|
|
2190
|
+
L += "</tbody></table><p></p>", document.execCommand("insertHTML", !1, L), O(r.current.innerHTML), B(r.current.innerHTML), ee(!1);
|
|
2191
|
+
}, [O, B]), re = C((s) => {
|
|
2192
|
+
r.current && (r.current.focus(), document.execCommand("formatBlock", !1, s === "p" ? "p" : s), O(r.current.innerHTML), B(r.current.innerHTML), W());
|
|
2193
|
+
}, [O, W, B]), Be = C((s) => {
|
|
2194
|
+
i(s.value);
|
|
2195
|
+
}, []), le = C(() => {
|
|
2196
|
+
const s = ie();
|
|
2197
|
+
s && r.current && (r.current.innerHTML = s.content, W());
|
|
2198
|
+
}, [ie, W]), ve = C(() => {
|
|
2199
|
+
const s = ne();
|
|
2200
|
+
s && r.current && (r.current.innerHTML = s.content, W());
|
|
2201
|
+
}, [ne, W]), ce = C(() => {
|
|
2202
|
+
const s = window.getSelection();
|
|
2203
|
+
s && s.rangeCount > 0 && (h.current = s.getRangeAt(0).cloneRange(), g(s.toString())), l(!0);
|
|
2204
|
+
}, []), de = C((s, y) => {
|
|
2190
2205
|
if (!r.current) return;
|
|
2191
|
-
if (r.current.focus(),
|
|
2206
|
+
if (r.current.focus(), h.current) {
|
|
2192
2207
|
const v = window.getSelection();
|
|
2193
|
-
v
|
|
2208
|
+
v == null || v.removeAllRanges(), v == null || v.addRange(h.current);
|
|
2194
2209
|
}
|
|
2195
|
-
const L = y || m ||
|
|
2196
|
-
document.execCommand("insertHTML", !1, `<a href="${
|
|
2197
|
-
}, [m,
|
|
2210
|
+
const L = y || m || s;
|
|
2211
|
+
document.execCommand("insertHTML", !1, `<a href="${s}" target="_blank" rel="noopener noreferrer">${L}</a>`), O(r.current.innerHTML), B(r.current.innerHTML), l(!1), g(""), h.current = null;
|
|
2212
|
+
}, [m, O, B]), oe = C((s) => {
|
|
2198
2213
|
if (!r.current) return;
|
|
2199
2214
|
const y = window.getSelection();
|
|
2200
2215
|
if (y && y.rangeCount > 0) {
|
|
2201
2216
|
const v = y.getRangeAt(0).startContainer;
|
|
2202
2217
|
if (v.nodeType === Node.TEXT_NODE && v.textContent) {
|
|
2203
|
-
const
|
|
2204
|
-
|
|
2218
|
+
const $ = v.textContent.lastIndexOf("/");
|
|
2219
|
+
$ >= 0 && (v.textContent = v.textContent.substring(0, $));
|
|
2205
2220
|
}
|
|
2206
2221
|
}
|
|
2207
|
-
|
|
2208
|
-
}, [
|
|
2209
|
-
const L = navigator.platform.toUpperCase().indexOf("MAC") >= 0 ?
|
|
2210
|
-
if (
|
|
2211
|
-
|
|
2222
|
+
k(!1), N(""), J(s);
|
|
2223
|
+
}, [J]), Re = C((s) => {
|
|
2224
|
+
const L = navigator.platform.toUpperCase().indexOf("MAC") >= 0 ? s.metaKey : s.ctrlKey;
|
|
2225
|
+
if (s.key === "Escape" && p) {
|
|
2226
|
+
k(!1);
|
|
2212
2227
|
return;
|
|
2213
2228
|
}
|
|
2214
2229
|
if (L)
|
|
2215
|
-
switch (
|
|
2230
|
+
switch (s.key.toLowerCase()) {
|
|
2216
2231
|
case "b":
|
|
2217
|
-
|
|
2232
|
+
s.preventDefault(), J("bold");
|
|
2218
2233
|
break;
|
|
2219
2234
|
case "i":
|
|
2220
|
-
|
|
2235
|
+
s.preventDefault(), J("italic");
|
|
2221
2236
|
break;
|
|
2222
2237
|
case "u":
|
|
2223
|
-
|
|
2238
|
+
s.preventDefault(), J("underline");
|
|
2224
2239
|
break;
|
|
2225
2240
|
case "k":
|
|
2226
|
-
|
|
2241
|
+
s.preventDefault(), ce();
|
|
2227
2242
|
break;
|
|
2228
2243
|
case "s":
|
|
2229
|
-
|
|
2244
|
+
s.preventDefault(), he();
|
|
2230
2245
|
break;
|
|
2231
2246
|
case "z":
|
|
2232
|
-
|
|
2247
|
+
s.preventDefault(), s.shiftKey ? ve() : le();
|
|
2233
2248
|
break;
|
|
2234
2249
|
}
|
|
2235
|
-
if (
|
|
2250
|
+
if (s.key === " " || s.key === "Enter") {
|
|
2236
2251
|
const v = window.getSelection();
|
|
2237
2252
|
if (!v || !v.rangeCount) return;
|
|
2238
|
-
const
|
|
2253
|
+
const $ = v.getRangeAt(0), V = $.startContainer.textContent || "", K = $.startOffset, Ue = V.substring(0, K), qe = [
|
|
2239
2254
|
{ regex: /^# $/, format: "h1", heading: "h1" },
|
|
2240
2255
|
{ regex: /^## $/, format: "h2", heading: "h2" },
|
|
2241
2256
|
{ regex: /^### $/, format: "h3", heading: "h3" },
|
|
@@ -2249,58 +2264,60 @@ ${o}
|
|
|
2249
2264
|
];
|
|
2250
2265
|
for (const { regex: ze, format: Ye, heading: _e } of qe)
|
|
2251
2266
|
if (ze.test(Ue)) {
|
|
2252
|
-
|
|
2253
|
-
const $e =
|
|
2254
|
-
$e.nodeType === Node.TEXT_NODE && ($e.textContent = ""), _e ?
|
|
2267
|
+
s.preventDefault();
|
|
2268
|
+
const $e = $.startContainer;
|
|
2269
|
+
$e.nodeType === Node.TEXT_NODE && ($e.textContent = ""), _e ? re(_e) : J(Ye);
|
|
2255
2270
|
return;
|
|
2256
2271
|
}
|
|
2257
2272
|
}
|
|
2258
|
-
}, [
|
|
2273
|
+
}, [J, re, ce, le, ve, p, he]), Ee = C(() => {
|
|
2259
2274
|
if (!r.current) return;
|
|
2260
|
-
const
|
|
2261
|
-
if (
|
|
2262
|
-
const y =
|
|
2263
|
-
if (
|
|
2264
|
-
const
|
|
2265
|
-
f({ top:
|
|
2275
|
+
const s = window.getSelection();
|
|
2276
|
+
if (s && s.rangeCount > 0) {
|
|
2277
|
+
const y = s.getRangeAt(0), L = y.startContainer.textContent || "", v = y.startOffset, V = L.substring(0, v).match(/\/([a-zA-Z]*)$/);
|
|
2278
|
+
if (V) {
|
|
2279
|
+
const K = y.getBoundingClientRect();
|
|
2280
|
+
f({ top: K.bottom + 8, left: K.left }), N(V[1]), k(!0);
|
|
2266
2281
|
} else
|
|
2267
|
-
|
|
2282
|
+
k(!1);
|
|
2268
2283
|
}
|
|
2269
|
-
|
|
2270
|
-
}, [
|
|
2271
|
-
const y =
|
|
2284
|
+
O(r.current.innerHTML), B(r.current.innerHTML), W();
|
|
2285
|
+
}, [O, W, B]), ue = C((s) => {
|
|
2286
|
+
const y = s.clipboardData.items;
|
|
2272
2287
|
for (const L of y)
|
|
2273
2288
|
if (L.type.startsWith("image/")) {
|
|
2274
|
-
|
|
2289
|
+
s.preventDefault();
|
|
2275
2290
|
const v = L.getAsFile();
|
|
2276
2291
|
if (v) {
|
|
2277
|
-
const
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2292
|
+
const $ = new FileReader();
|
|
2293
|
+
$.onload = (V) => {
|
|
2294
|
+
var K;
|
|
2295
|
+
Z((K = V.target) == null ? void 0 : K.result);
|
|
2296
|
+
}, $.readAsDataURL(v);
|
|
2281
2297
|
}
|
|
2282
2298
|
return;
|
|
2283
2299
|
}
|
|
2284
|
-
}, [
|
|
2285
|
-
const y =
|
|
2300
|
+
}, [Z]), We = C((s) => {
|
|
2301
|
+
const y = s.dataTransfer.files;
|
|
2286
2302
|
for (const L of y)
|
|
2287
2303
|
if (L.type.startsWith("image/")) {
|
|
2288
|
-
|
|
2304
|
+
s.preventDefault();
|
|
2289
2305
|
const v = new FileReader();
|
|
2290
|
-
v.onload = (
|
|
2291
|
-
|
|
2306
|
+
v.onload = ($) => {
|
|
2307
|
+
var V;
|
|
2308
|
+
Z((V = $.target) == null ? void 0 : V.result);
|
|
2292
2309
|
}, v.readAsDataURL(L);
|
|
2293
2310
|
return;
|
|
2294
2311
|
}
|
|
2295
|
-
}, [
|
|
2296
|
-
const y =
|
|
2297
|
-
y && r.current && (r.current.innerHTML = y,
|
|
2298
|
-
}, [
|
|
2299
|
-
|
|
2300
|
-
const
|
|
2301
|
-
return document.addEventListener("selectionchange",
|
|
2312
|
+
}, [Z]), Ve = C((s) => {
|
|
2313
|
+
const y = te(s);
|
|
2314
|
+
y && r.current && (r.current.innerHTML = y, O(y), B(y, !0), q(!1));
|
|
2315
|
+
}, [te, O, B]);
|
|
2316
|
+
Y(() => {
|
|
2317
|
+
const s = () => W();
|
|
2318
|
+
return document.addEventListener("selectionchange", s), () => document.removeEventListener("selectionchange", s);
|
|
2302
2319
|
}, [W]);
|
|
2303
|
-
const
|
|
2320
|
+
const be = () => ({
|
|
2304
2321
|
"dm-sans": "font-sans-editor",
|
|
2305
2322
|
merriweather: "font-serif-editor",
|
|
2306
2323
|
playfair: "font-display-editor",
|
|
@@ -2311,9 +2328,9 @@ ${o}
|
|
|
2311
2328
|
courier: "font-courier",
|
|
2312
2329
|
times: "font-times"
|
|
2313
2330
|
})[o] || "font-sans-editor", Fe = () => {
|
|
2314
|
-
if (!
|
|
2315
|
-
const
|
|
2316
|
-
return
|
|
2331
|
+
if (!X) return "Not saved yet";
|
|
2332
|
+
const s = Date.now() - X;
|
|
2333
|
+
return s < 6e4 ? "Just now" : s < 36e5 ? `${Math.floor(s / 6e4)} min ago` : new Date(X).toLocaleTimeString();
|
|
2317
2334
|
};
|
|
2318
2335
|
return /* @__PURE__ */ e.jsxs("div", { className: "w-full max-w-4xl mx-auto", children: [
|
|
2319
2336
|
/* @__PURE__ */ e.jsxs("div", { className: "rounded-xl border shadow-toolbar overflow-hidden bg-card border-editor-border", children: [
|
|
@@ -2321,7 +2338,7 @@ ${o}
|
|
|
2321
2338
|
/* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ e.jsxs(
|
|
2322
2339
|
"button",
|
|
2323
2340
|
{
|
|
2324
|
-
onClick: () =>
|
|
2341
|
+
onClick: () => q(!0),
|
|
2325
2342
|
className: "flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",
|
|
2326
2343
|
children: [
|
|
2327
2344
|
/* @__PURE__ */ e.jsx(et, { className: "w-4 h-4" }),
|
|
@@ -2347,7 +2364,7 @@ ${o}
|
|
|
2347
2364
|
/* @__PURE__ */ e.jsxs(
|
|
2348
2365
|
"button",
|
|
2349
2366
|
{
|
|
2350
|
-
onClick: () =>
|
|
2367
|
+
onClick: () => ee(!0),
|
|
2351
2368
|
className: "flex items-center gap-2 px-3 py-1.5 rounded-md text-sm font-medium transition-colors hover:bg-muted text-muted-foreground hover:text-foreground",
|
|
2352
2369
|
children: [
|
|
2353
2370
|
/* @__PURE__ */ e.jsx(rt, { className: "w-4 h-4" }),
|
|
@@ -2358,9 +2375,18 @@ ${o}
|
|
|
2358
2375
|
/* @__PURE__ */ e.jsx(
|
|
2359
2376
|
dr,
|
|
2360
2377
|
{
|
|
2361
|
-
onExportHTML: () =>
|
|
2362
|
-
|
|
2363
|
-
|
|
2378
|
+
onExportHTML: () => {
|
|
2379
|
+
var s;
|
|
2380
|
+
return Le(((s = r.current) == null ? void 0 : s.innerHTML) || "", "document");
|
|
2381
|
+
},
|
|
2382
|
+
onExportMarkdown: () => {
|
|
2383
|
+
var s;
|
|
2384
|
+
return Te(((s = r.current) == null ? void 0 : s.innerHTML) || "", "document");
|
|
2385
|
+
},
|
|
2386
|
+
onExportPDF: () => {
|
|
2387
|
+
var s;
|
|
2388
|
+
return Se(((s = r.current) == null ? void 0 : s.innerHTML) || "", "Document");
|
|
2389
|
+
}
|
|
2364
2390
|
}
|
|
2365
2391
|
)
|
|
2366
2392
|
] })
|
|
@@ -2370,27 +2396,27 @@ ${o}
|
|
|
2370
2396
|
{
|
|
2371
2397
|
formatState: n,
|
|
2372
2398
|
currentFont: o,
|
|
2373
|
-
onFormat:
|
|
2399
|
+
onFormat: J,
|
|
2374
2400
|
onFontChange: Be,
|
|
2375
|
-
onHeadingChange:
|
|
2376
|
-
onUndo:
|
|
2377
|
-
onRedo:
|
|
2401
|
+
onHeadingChange: re,
|
|
2402
|
+
onUndo: le,
|
|
2403
|
+
onRedo: ve,
|
|
2378
2404
|
canUndo: ye,
|
|
2379
2405
|
canRedo: Pe,
|
|
2380
|
-
onInsertLink:
|
|
2406
|
+
onInsertLink: ce
|
|
2381
2407
|
}
|
|
2382
2408
|
),
|
|
2383
2409
|
/* @__PURE__ */ e.jsxs(
|
|
2384
2410
|
"div",
|
|
2385
2411
|
{
|
|
2386
2412
|
ref: r,
|
|
2387
|
-
className: `editor-content p-6 md:p-8 min-h-[500px] focus:outline-none ${
|
|
2413
|
+
className: `editor-content p-6 md:p-8 min-h-[500px] focus:outline-none ${be()} bg-editor`,
|
|
2388
2414
|
contentEditable: !0,
|
|
2389
2415
|
onInput: Ee,
|
|
2390
2416
|
onKeyDown: Re,
|
|
2391
|
-
onPaste:
|
|
2417
|
+
onPaste: ue,
|
|
2392
2418
|
onDrop: We,
|
|
2393
|
-
onDragOver: (
|
|
2419
|
+
onDragOver: (s) => s.preventDefault(),
|
|
2394
2420
|
suppressContentEditableWarning: !0,
|
|
2395
2421
|
"data-placeholder": "Start writing... Type '/' for commands, or use markdown shortcuts like # for headings",
|
|
2396
2422
|
children: [
|
|
@@ -2428,8 +2454,8 @@ ${o}
|
|
|
2428
2454
|
nr,
|
|
2429
2455
|
{
|
|
2430
2456
|
formatState: { bold: n.bold, italic: n.italic, underline: n.underline, strikethrough: n.strikethrough, code: n.code },
|
|
2431
|
-
onFormat:
|
|
2432
|
-
onInsertLink:
|
|
2457
|
+
onFormat: J,
|
|
2458
|
+
onInsertLink: ce,
|
|
2433
2459
|
editorRef: r
|
|
2434
2460
|
}
|
|
2435
2461
|
),
|
|
@@ -2437,16 +2463,16 @@ ${o}
|
|
|
2437
2463
|
ar,
|
|
2438
2464
|
{
|
|
2439
2465
|
isOpen: p,
|
|
2440
|
-
position:
|
|
2441
|
-
searchQuery:
|
|
2442
|
-
onSelect:
|
|
2443
|
-
onClose: () =>
|
|
2466
|
+
position: x,
|
|
2467
|
+
searchQuery: b,
|
|
2468
|
+
onSelect: oe,
|
|
2469
|
+
onClose: () => k(!1)
|
|
2444
2470
|
}
|
|
2445
2471
|
),
|
|
2446
|
-
/* @__PURE__ */ e.jsx(or, { isOpen:
|
|
2447
|
-
/* @__PURE__ */ e.jsx(ir, { isOpen: M, onClose: () => S(!1), onInsert:
|
|
2448
|
-
/* @__PURE__ */ e.jsx(lr, { isOpen:
|
|
2449
|
-
/* @__PURE__ */ e.jsx(cr, { isOpen:
|
|
2472
|
+
/* @__PURE__ */ e.jsx(or, { isOpen: c, onClose: () => l(!1), onInsert: de, selectedText: m }),
|
|
2473
|
+
/* @__PURE__ */ e.jsx(ir, { isOpen: M, onClose: () => S(!1), onInsert: Z }),
|
|
2474
|
+
/* @__PURE__ */ e.jsx(lr, { isOpen: D, onClose: () => ee(!1), onInsert: ge }),
|
|
2475
|
+
/* @__PURE__ */ e.jsx(cr, { isOpen: R, onClose: () => q(!1), versions: Q, onRestore: Ve, onDelete: Ce })
|
|
2450
2476
|
] });
|
|
2451
2477
|
};
|
|
2452
2478
|
export {
|