fable-editor 1.2.1 → 1.2.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/LICENSE +20 -18
- package/README.md +226 -226
- package/dist/angular/README.md +226 -224
- package/dist/angular/core/editor.d.ts +6 -0
- package/dist/angular/core/i18n.d.ts +1 -0
- package/dist/angular/esm2022/core/editor.mjs +98 -81
- package/dist/angular/esm2022/core/i18n.mjs +3 -1
- package/dist/angular/fesm2022/fable-editor.mjs +99 -80
- package/dist/angular/fesm2022/fable-editor.mjs.map +1 -1
- package/dist/core/editor.d.ts +6 -0
- package/dist/core/editor.d.ts.map +1 -1
- package/dist/core/i18n.d.ts +1 -0
- package/dist/core/i18n.d.ts.map +1 -1
- package/dist/core/index.cjs +3 -3
- package/dist/core/index.mjs +420 -411
- package/dist/react/index.cjs +12 -12
- package/dist/react/index.mjs +645 -636
- package/package.json +113 -113
package/dist/react/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ce, { forwardRef as _e, useRef as z, useImperativeHandle as Fe, useEffect as ot } from "react";
|
|
2
2
|
var Et = { exports: {} }, J = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
@@ -10,18 +10,18 @@ var Et = { exports: {} }, J = {};
|
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/
|
|
12
12
|
var Qt;
|
|
13
|
-
function
|
|
13
|
+
function $e() {
|
|
14
14
|
if (Qt) return J;
|
|
15
15
|
Qt = 1;
|
|
16
|
-
var u =
|
|
17
|
-
function
|
|
16
|
+
var u = ce, t = Symbol.for("react.element"), e = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, s = u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
|
+
function n(r, o, c) {
|
|
18
18
|
var d, p = {}, m = null, b = null;
|
|
19
19
|
c !== void 0 && (m = "" + c), o.key !== void 0 && (m = "" + o.key), o.ref !== void 0 && (b = o.ref);
|
|
20
|
-
for (d in o) i.call(o, d) && !
|
|
20
|
+
for (d in o) i.call(o, d) && !l.hasOwnProperty(d) && (p[d] = o[d]);
|
|
21
21
|
if (r && r.defaultProps) for (d in o = r.defaultProps, o) p[d] === void 0 && (p[d] = o[d]);
|
|
22
22
|
return { $$typeof: t, type: r, key: m, ref: b, props: p, _owner: s.current };
|
|
23
23
|
}
|
|
24
|
-
return J.Fragment = e, J.jsx =
|
|
24
|
+
return J.Fragment = e, J.jsx = n, J.jsxs = n, J;
|
|
25
25
|
}
|
|
26
26
|
var tt = {};
|
|
27
27
|
/**
|
|
@@ -34,9 +34,9 @@ var tt = {};
|
|
|
34
34
|
* LICENSE file in the root directory of this source tree.
|
|
35
35
|
*/
|
|
36
36
|
var Kt;
|
|
37
|
-
function
|
|
37
|
+
function je() {
|
|
38
38
|
return Kt || (Kt = 1, process.env.NODE_ENV !== "production" && function() {
|
|
39
|
-
var u =
|
|
39
|
+
var u = ce, t = Symbol.for("react.element"), e = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), n = Symbol.for("react.provider"), r = Symbol.for("react.context"), o = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), m = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), y = Symbol.iterator, g = "@@iterator";
|
|
40
40
|
function x(a) {
|
|
41
41
|
if (a === null || typeof a != "object")
|
|
42
42
|
return null;
|
|
@@ -48,36 +48,36 @@ function _e() {
|
|
|
48
48
|
{
|
|
49
49
|
for (var f = arguments.length, v = new Array(f > 1 ? f - 1 : 0), T = 1; T < f; T++)
|
|
50
50
|
v[T - 1] = arguments[T];
|
|
51
|
-
|
|
51
|
+
A("error", a, v);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function A(a, f, v) {
|
|
55
55
|
{
|
|
56
|
-
var T = w.ReactDebugCurrentFrame,
|
|
57
|
-
|
|
58
|
-
var
|
|
56
|
+
var T = w.ReactDebugCurrentFrame, L = T.getStackAddendum();
|
|
57
|
+
L !== "" && (f += "%s", v = v.concat([L]));
|
|
58
|
+
var I = v.map(function(M) {
|
|
59
59
|
return String(M);
|
|
60
60
|
});
|
|
61
|
-
|
|
61
|
+
I.unshift("Warning: " + f), Function.prototype.apply.call(console[a], console, I);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
var H = !1, $ = !1, O = !1, _ = !1, et = !1, Mt;
|
|
65
65
|
Mt = Symbol.for("react.module.reference");
|
|
66
|
-
function
|
|
67
|
-
return !!(typeof a == "string" || typeof a == "function" || a === i || a ===
|
|
66
|
+
function de(a) {
|
|
67
|
+
return !!(typeof a == "string" || typeof a == "function" || a === i || a === l || et || a === s || a === c || a === d || _ || a === b || H || $ || O || typeof a == "object" && a !== null && (a.$$typeof === m || a.$$typeof === p || a.$$typeof === n || a.$$typeof === r || a.$$typeof === o || // This needs to include all possible module reference object
|
|
68
68
|
// types supported by any Flight configuration anywhere since
|
|
69
69
|
// we don't know which Flight build this will end up being used
|
|
70
70
|
// with.
|
|
71
71
|
a.$$typeof === Mt || a.getModuleId !== void 0));
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function pe(a, f, v) {
|
|
74
74
|
var T = a.displayName;
|
|
75
75
|
if (T)
|
|
76
76
|
return T;
|
|
77
|
-
var
|
|
78
|
-
return
|
|
77
|
+
var L = f.displayName || f.name || "";
|
|
78
|
+
return L !== "" ? v + "(" + L + ")" : v;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function kt(a) {
|
|
81
81
|
return a.displayName || "Context";
|
|
82
82
|
}
|
|
83
83
|
function W(a) {
|
|
@@ -92,7 +92,7 @@ function _e() {
|
|
|
92
92
|
return "Fragment";
|
|
93
93
|
case e:
|
|
94
94
|
return "Portal";
|
|
95
|
-
case
|
|
95
|
+
case l:
|
|
96
96
|
return "Profiler";
|
|
97
97
|
case s:
|
|
98
98
|
return "StrictMode";
|
|
@@ -105,19 +105,19 @@ function _e() {
|
|
|
105
105
|
switch (a.$$typeof) {
|
|
106
106
|
case r:
|
|
107
107
|
var f = a;
|
|
108
|
-
return
|
|
109
|
-
case
|
|
108
|
+
return kt(f) + ".Consumer";
|
|
109
|
+
case n:
|
|
110
110
|
var v = a;
|
|
111
|
-
return
|
|
111
|
+
return kt(v._context) + ".Provider";
|
|
112
112
|
case o:
|
|
113
|
-
return
|
|
113
|
+
return pe(a, a.render, "ForwardRef");
|
|
114
114
|
case p:
|
|
115
115
|
var T = a.displayName || null;
|
|
116
116
|
return T !== null ? T : W(a.type) || "Memo";
|
|
117
117
|
case m: {
|
|
118
|
-
var
|
|
118
|
+
var L = a, I = L._payload, M = L._init;
|
|
119
119
|
try {
|
|
120
|
-
return W(M(
|
|
120
|
+
return W(M(I));
|
|
121
121
|
} catch {
|
|
122
122
|
return null;
|
|
123
123
|
}
|
|
@@ -125,18 +125,18 @@ function _e() {
|
|
|
125
125
|
}
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
128
|
-
var V = Object.assign, Q = 0,
|
|
129
|
-
function
|
|
128
|
+
var V = Object.assign, Q = 0, Lt, Ht, It, At, qt, Rt, Pt;
|
|
129
|
+
function Bt() {
|
|
130
130
|
}
|
|
131
|
-
|
|
132
|
-
function
|
|
131
|
+
Bt.__reactDisabledLog = !0;
|
|
132
|
+
function ue() {
|
|
133
133
|
{
|
|
134
134
|
if (Q === 0) {
|
|
135
|
-
|
|
135
|
+
Lt = console.log, Ht = console.info, It = console.warn, At = console.error, qt = console.group, Rt = console.groupCollapsed, Pt = console.groupEnd;
|
|
136
136
|
var a = {
|
|
137
137
|
configurable: !0,
|
|
138
138
|
enumerable: !0,
|
|
139
|
-
value:
|
|
139
|
+
value: Bt,
|
|
140
140
|
writable: !0
|
|
141
141
|
};
|
|
142
142
|
Object.defineProperties(console, {
|
|
@@ -152,7 +152,7 @@ function _e() {
|
|
|
152
152
|
Q++;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function me() {
|
|
156
156
|
{
|
|
157
157
|
if (Q--, Q === 0) {
|
|
158
158
|
var a = {
|
|
@@ -162,16 +162,16 @@ function _e() {
|
|
|
162
162
|
};
|
|
163
163
|
Object.defineProperties(console, {
|
|
164
164
|
log: V({}, a, {
|
|
165
|
-
value:
|
|
165
|
+
value: Lt
|
|
166
166
|
}),
|
|
167
167
|
info: V({}, a, {
|
|
168
168
|
value: Ht
|
|
169
169
|
}),
|
|
170
170
|
warn: V({}, a, {
|
|
171
|
-
value:
|
|
171
|
+
value: It
|
|
172
172
|
}),
|
|
173
173
|
error: V({}, a, {
|
|
174
|
-
value:
|
|
174
|
+
value: At
|
|
175
175
|
}),
|
|
176
176
|
group: V({}, a, {
|
|
177
177
|
value: qt
|
|
@@ -193,8 +193,8 @@ function _e() {
|
|
|
193
193
|
if (mt === void 0)
|
|
194
194
|
try {
|
|
195
195
|
throw Error();
|
|
196
|
-
} catch (
|
|
197
|
-
var T =
|
|
196
|
+
} catch (L) {
|
|
197
|
+
var T = L.stack.trim().match(/\n( *(at )?)/);
|
|
198
198
|
mt = T && T[1] || "";
|
|
199
199
|
}
|
|
200
200
|
return `
|
|
@@ -203,10 +203,10 @@ function _e() {
|
|
|
203
203
|
}
|
|
204
204
|
var ft = !1, st;
|
|
205
205
|
{
|
|
206
|
-
var
|
|
207
|
-
st = new
|
|
206
|
+
var fe = typeof WeakMap == "function" ? WeakMap : Map;
|
|
207
|
+
st = new fe();
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function Dt(a, f) {
|
|
210
210
|
if (!a || ft)
|
|
211
211
|
return "";
|
|
212
212
|
{
|
|
@@ -216,10 +216,10 @@ function _e() {
|
|
|
216
216
|
}
|
|
217
217
|
var T;
|
|
218
218
|
ft = !0;
|
|
219
|
-
var
|
|
219
|
+
var L = Error.prepareStackTrace;
|
|
220
220
|
Error.prepareStackTrace = void 0;
|
|
221
|
-
var
|
|
222
|
-
|
|
221
|
+
var I;
|
|
222
|
+
I = ut.current, ut.current = null, ue();
|
|
223
223
|
try {
|
|
224
224
|
if (f) {
|
|
225
225
|
var M = function() {
|
|
@@ -255,14 +255,14 @@ function _e() {
|
|
|
255
255
|
} catch (N) {
|
|
256
256
|
if (N && T && typeof N.stack == "string") {
|
|
257
257
|
for (var S = N.stack.split(`
|
|
258
|
-
`),
|
|
259
|
-
`), R = S.length - 1, P =
|
|
258
|
+
`), D = T.stack.split(`
|
|
259
|
+
`), R = S.length - 1, P = D.length - 1; R >= 1 && P >= 0 && S[R] !== D[P]; )
|
|
260
260
|
P--;
|
|
261
261
|
for (; R >= 1 && P >= 0; R--, P--)
|
|
262
|
-
if (S[R] !==
|
|
262
|
+
if (S[R] !== D[P]) {
|
|
263
263
|
if (R !== 1 || P !== 1)
|
|
264
264
|
do
|
|
265
|
-
if (R--, P--, P < 0 || S[R] !==
|
|
265
|
+
if (R--, P--, P < 0 || S[R] !== D[P]) {
|
|
266
266
|
var F = `
|
|
267
267
|
` + S[R].replace(" at new ", " at ");
|
|
268
268
|
return a.displayName && F.includes("<anonymous>") && (F = F.replace("<anonymous>", a.displayName)), typeof a == "function" && st.set(a, F), F;
|
|
@@ -272,23 +272,23 @@ function _e() {
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
} finally {
|
|
275
|
-
ft = !1, ut.current =
|
|
275
|
+
ft = !1, ut.current = I, me(), Error.prepareStackTrace = L;
|
|
276
276
|
}
|
|
277
277
|
var G = a ? a.displayName || a.name : "", U = G ? it(G) : "";
|
|
278
278
|
return typeof a == "function" && st.set(a, U), U;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
return
|
|
280
|
+
function ge(a, f, v) {
|
|
281
|
+
return Dt(a, !1);
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function ve(a) {
|
|
284
284
|
var f = a.prototype;
|
|
285
285
|
return !!(f && f.isReactComponent);
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function lt(a, f, v) {
|
|
288
288
|
if (a == null)
|
|
289
289
|
return "";
|
|
290
290
|
if (typeof a == "function")
|
|
291
|
-
return
|
|
291
|
+
return Dt(a, ve(a));
|
|
292
292
|
if (typeof a == "string")
|
|
293
293
|
return it(a);
|
|
294
294
|
switch (a) {
|
|
@@ -300,13 +300,13 @@ function _e() {
|
|
|
300
300
|
if (typeof a == "object")
|
|
301
301
|
switch (a.$$typeof) {
|
|
302
302
|
case o:
|
|
303
|
-
return
|
|
303
|
+
return ge(a.render);
|
|
304
304
|
case p:
|
|
305
|
-
return
|
|
305
|
+
return lt(a.type, f, v);
|
|
306
306
|
case m: {
|
|
307
|
-
var T = a,
|
|
307
|
+
var T = a, L = T._payload, I = T._init;
|
|
308
308
|
try {
|
|
309
|
-
return
|
|
309
|
+
return lt(I(L), f, v);
|
|
310
310
|
} catch {
|
|
311
311
|
}
|
|
312
312
|
}
|
|
@@ -314,43 +314,43 @@ function _e() {
|
|
|
314
314
|
return "";
|
|
315
315
|
}
|
|
316
316
|
var K = Object.prototype.hasOwnProperty, Nt = {}, Zt = w.ReactDebugCurrentFrame;
|
|
317
|
-
function
|
|
317
|
+
function nt(a) {
|
|
318
318
|
if (a) {
|
|
319
|
-
var f = a._owner, v =
|
|
319
|
+
var f = a._owner, v = lt(a.type, a._source, f ? f.type : null);
|
|
320
320
|
Zt.setExtraStackFrame(v);
|
|
321
321
|
} else
|
|
322
322
|
Zt.setExtraStackFrame(null);
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function be(a, f, v, T, L) {
|
|
325
325
|
{
|
|
326
|
-
var
|
|
326
|
+
var I = Function.call.bind(K);
|
|
327
327
|
for (var M in a)
|
|
328
|
-
if (
|
|
328
|
+
if (I(a, M)) {
|
|
329
329
|
var S = void 0;
|
|
330
330
|
try {
|
|
331
331
|
if (typeof a[M] != "function") {
|
|
332
|
-
var
|
|
333
|
-
throw
|
|
332
|
+
var D = Error((T || "React class") + ": " + v + " type `" + M + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof a[M] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
333
|
+
throw D.name = "Invariant Violation", D;
|
|
334
334
|
}
|
|
335
335
|
S = a[M](f, M, T, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
336
336
|
} catch (R) {
|
|
337
337
|
S = R;
|
|
338
338
|
}
|
|
339
|
-
S && !(S instanceof Error) && (
|
|
339
|
+
S && !(S instanceof Error) && (nt(L), E("%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).", T || "React class", v, M, typeof S), nt(null)), S instanceof Error && !(S.message in Nt) && (Nt[S.message] = !0, nt(L), E("Failed %s type: %s", v, S.message), nt(null));
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
var
|
|
343
|
+
var ye = Array.isArray;
|
|
344
344
|
function gt(a) {
|
|
345
|
-
return
|
|
345
|
+
return ye(a);
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function xe(a) {
|
|
348
348
|
{
|
|
349
349
|
var f = typeof Symbol == "function" && Symbol.toStringTag, v = f && a[Symbol.toStringTag] || a.constructor.name || "Object";
|
|
350
350
|
return v;
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function Ce(a) {
|
|
354
354
|
try {
|
|
355
355
|
return Ot(a), !1;
|
|
356
356
|
} catch {
|
|
@@ -361,16 +361,16 @@ function _e() {
|
|
|
361
361
|
return "" + a;
|
|
362
362
|
}
|
|
363
363
|
function _t(a) {
|
|
364
|
-
if (
|
|
365
|
-
return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
364
|
+
if (Ce(a))
|
|
365
|
+
return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", xe(a)), Ot(a);
|
|
366
366
|
}
|
|
367
|
-
var Ft = w.ReactCurrentOwner,
|
|
367
|
+
var Ft = w.ReactCurrentOwner, we = {
|
|
368
368
|
key: !0,
|
|
369
369
|
ref: !0,
|
|
370
370
|
__self: !0,
|
|
371
371
|
__source: !0
|
|
372
372
|
}, $t, jt;
|
|
373
|
-
function
|
|
373
|
+
function Te(a) {
|
|
374
374
|
if (K.call(a, "ref")) {
|
|
375
375
|
var f = Object.getOwnPropertyDescriptor(a, "ref").get;
|
|
376
376
|
if (f && f.isReactWarning)
|
|
@@ -378,7 +378,7 @@ function _e() {
|
|
|
378
378
|
}
|
|
379
379
|
return a.ref !== void 0;
|
|
380
380
|
}
|
|
381
|
-
function
|
|
381
|
+
function Ee(a) {
|
|
382
382
|
if (K.call(a, "key")) {
|
|
383
383
|
var f = Object.getOwnPropertyDescriptor(a, "key").get;
|
|
384
384
|
if (f && f.isReactWarning)
|
|
@@ -386,10 +386,10 @@ function _e() {
|
|
|
386
386
|
}
|
|
387
387
|
return a.key !== void 0;
|
|
388
388
|
}
|
|
389
|
-
function
|
|
389
|
+
function Se(a, f) {
|
|
390
390
|
typeof a.ref == "string" && Ft.current;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function Me(a, f) {
|
|
393
393
|
{
|
|
394
394
|
var v = function() {
|
|
395
395
|
$t || ($t = !0, E("%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)", f));
|
|
@@ -400,7 +400,7 @@ function _e() {
|
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function ke(a, f) {
|
|
404
404
|
{
|
|
405
405
|
var v = function() {
|
|
406
406
|
jt || (jt = !0, E("%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)", f));
|
|
@@ -411,7 +411,7 @@ function _e() {
|
|
|
411
411
|
});
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
var
|
|
414
|
+
var Le = function(a, f, v, T, L, I, M) {
|
|
415
415
|
var S = {
|
|
416
416
|
// This tag allows us to uniquely identify this as a React Element
|
|
417
417
|
$$typeof: t,
|
|
@@ -421,7 +421,7 @@ function _e() {
|
|
|
421
421
|
ref: v,
|
|
422
422
|
props: M,
|
|
423
423
|
// Record the component responsible for creating this element.
|
|
424
|
-
_owner:
|
|
424
|
+
_owner: I
|
|
425
425
|
};
|
|
426
426
|
return S._store = {}, Object.defineProperty(S._store, "validated", {
|
|
427
427
|
configurable: !1,
|
|
@@ -437,31 +437,31 @@ function _e() {
|
|
|
437
437
|
configurable: !1,
|
|
438
438
|
enumerable: !1,
|
|
439
439
|
writable: !1,
|
|
440
|
-
value:
|
|
440
|
+
value: L
|
|
441
441
|
}), Object.freeze && (Object.freeze(S.props), Object.freeze(S)), S;
|
|
442
442
|
};
|
|
443
|
-
function
|
|
443
|
+
function He(a, f, v, T, L) {
|
|
444
444
|
{
|
|
445
|
-
var
|
|
446
|
-
v !== void 0 && (_t(v), S = "" + v),
|
|
447
|
-
for (
|
|
448
|
-
K.call(f,
|
|
445
|
+
var I, M = {}, S = null, D = null;
|
|
446
|
+
v !== void 0 && (_t(v), S = "" + v), Ee(f) && (_t(f.key), S = "" + f.key), Te(f) && (D = f.ref, Se(f, L));
|
|
447
|
+
for (I in f)
|
|
448
|
+
K.call(f, I) && !we.hasOwnProperty(I) && (M[I] = f[I]);
|
|
449
449
|
if (a && a.defaultProps) {
|
|
450
450
|
var R = a.defaultProps;
|
|
451
|
-
for (
|
|
452
|
-
M[
|
|
451
|
+
for (I in R)
|
|
452
|
+
M[I] === void 0 && (M[I] = R[I]);
|
|
453
453
|
}
|
|
454
|
-
if (S ||
|
|
454
|
+
if (S || D) {
|
|
455
455
|
var P = typeof a == "function" ? a.displayName || a.name || "Unknown" : a;
|
|
456
|
-
S &&
|
|
456
|
+
S && Me(M, P), D && ke(M, P);
|
|
457
457
|
}
|
|
458
|
-
return
|
|
458
|
+
return Le(a, S, D, L, T, Ft.current, M);
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
var vt = w.ReactCurrentOwner, Wt = w.ReactDebugCurrentFrame;
|
|
462
462
|
function Y(a) {
|
|
463
463
|
if (a) {
|
|
464
|
-
var f = a._owner, v =
|
|
464
|
+
var f = a._owner, v = lt(a.type, a._source, f ? f.type : null);
|
|
465
465
|
Wt.setExtraStackFrame(v);
|
|
466
466
|
} else
|
|
467
467
|
Wt.setExtraStackFrame(null);
|
|
@@ -483,11 +483,11 @@ Check the render method of \`` + a + "`.";
|
|
|
483
483
|
return "";
|
|
484
484
|
}
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function Ie(a) {
|
|
487
487
|
return "";
|
|
488
488
|
}
|
|
489
489
|
var Ut = {};
|
|
490
|
-
function
|
|
490
|
+
function Ae(a) {
|
|
491
491
|
{
|
|
492
492
|
var f = Vt();
|
|
493
493
|
if (!f) {
|
|
@@ -504,7 +504,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
504
504
|
if (!a._store || a._store.validated || a.key != null)
|
|
505
505
|
return;
|
|
506
506
|
a._store.validated = !0;
|
|
507
|
-
var v =
|
|
507
|
+
var v = Ae(f);
|
|
508
508
|
if (Ut[v])
|
|
509
509
|
return;
|
|
510
510
|
Ut[v] = !0;
|
|
@@ -524,14 +524,14 @@ Check the top-level render call using <` + v + ">.");
|
|
|
524
524
|
else if (yt(a))
|
|
525
525
|
a._store && (a._store.validated = !0);
|
|
526
526
|
else if (a) {
|
|
527
|
-
var
|
|
528
|
-
if (typeof
|
|
529
|
-
for (var
|
|
527
|
+
var L = x(a);
|
|
528
|
+
if (typeof L == "function" && L !== a.entries)
|
|
529
|
+
for (var I = L.call(a), M; !(M = I.next()).done; )
|
|
530
530
|
yt(M.value) && zt(M.value, f);
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function qe(a) {
|
|
535
535
|
{
|
|
536
536
|
var f = a.type;
|
|
537
537
|
if (f == null || typeof f == "string")
|
|
@@ -547,16 +547,16 @@ Check the top-level render call using <` + v + ">.");
|
|
|
547
547
|
return;
|
|
548
548
|
if (v) {
|
|
549
549
|
var T = W(f);
|
|
550
|
-
|
|
550
|
+
be(v, a.props, "prop", T, a);
|
|
551
551
|
} else if (f.PropTypes !== void 0 && !bt) {
|
|
552
552
|
bt = !0;
|
|
553
|
-
var
|
|
554
|
-
E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",
|
|
553
|
+
var L = W(f);
|
|
554
|
+
E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", L || "Unknown");
|
|
555
555
|
}
|
|
556
556
|
typeof f.getDefaultProps == "function" && !f.getDefaultProps.isReactClassApproved && E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
|
-
function
|
|
559
|
+
function Re(a) {
|
|
560
560
|
{
|
|
561
561
|
for (var f = Object.keys(a.props), v = 0; v < f.length; v++) {
|
|
562
562
|
var T = f[v];
|
|
@@ -569,18 +569,18 @@ Check the top-level render call using <` + v + ">.");
|
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
571
|
var Yt = {};
|
|
572
|
-
function Gt(a, f, v, T,
|
|
572
|
+
function Gt(a, f, v, T, L, I) {
|
|
573
573
|
{
|
|
574
|
-
var M =
|
|
574
|
+
var M = de(a);
|
|
575
575
|
if (!M) {
|
|
576
576
|
var S = "";
|
|
577
577
|
(a === void 0 || typeof a == "object" && a !== null && Object.keys(a).length === 0) && (S += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
578
|
-
var
|
|
579
|
-
|
|
578
|
+
var D = Ie();
|
|
579
|
+
D ? S += D : S += Vt();
|
|
580
580
|
var R;
|
|
581
581
|
a === null ? R = "null" : gt(a) ? R = "array" : a !== void 0 && a.$$typeof === t ? (R = "<" + (W(a.type) || "Unknown") + " />", S = " Did you accidentally export a JSX literal instead of a component?") : R = typeof a, E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", R, S);
|
|
582
582
|
}
|
|
583
|
-
var P =
|
|
583
|
+
var P = He(a, f, v, L, I);
|
|
584
584
|
if (P == null)
|
|
585
585
|
return P;
|
|
586
586
|
if (M) {
|
|
@@ -597,35 +597,35 @@ Check the top-level render call using <` + v + ">.");
|
|
|
597
597
|
Xt(F, a);
|
|
598
598
|
}
|
|
599
599
|
if (K.call(f, "key")) {
|
|
600
|
-
var U = W(a), N = Object.keys(f).filter(function(
|
|
601
|
-
return
|
|
600
|
+
var U = W(a), N = Object.keys(f).filter(function(Oe) {
|
|
601
|
+
return Oe !== "key";
|
|
602
602
|
}), xt = N.length > 0 ? "{key: someKey, " + N.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
603
603
|
if (!Yt[U + xt]) {
|
|
604
|
-
var
|
|
604
|
+
var Ze = N.length > 0 ? "{" + N.join(": ..., ") + ": ...}" : "{}";
|
|
605
605
|
E(`A props object containing a "key" prop is being spread into JSX:
|
|
606
606
|
let props = %s;
|
|
607
607
|
<%s {...props} />
|
|
608
608
|
React keys must be passed directly to JSX without using spread:
|
|
609
609
|
let props = %s;
|
|
610
|
-
<%s key={someKey} {...props} />`, xt, U,
|
|
610
|
+
<%s key={someKey} {...props} />`, xt, U, Ze, U), Yt[U + xt] = !0;
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
|
-
return a === i ?
|
|
613
|
+
return a === i ? Re(P) : qe(P), P;
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
function
|
|
616
|
+
function Pe(a, f, v) {
|
|
617
617
|
return Gt(a, f, v, !0);
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function Be(a, f, v) {
|
|
620
620
|
return Gt(a, f, v, !1);
|
|
621
621
|
}
|
|
622
|
-
var
|
|
623
|
-
tt.Fragment = i, tt.jsx =
|
|
622
|
+
var De = Be, Ne = Pe;
|
|
623
|
+
tt.Fragment = i, tt.jsx = De, tt.jsxs = Ne;
|
|
624
624
|
}()), tt;
|
|
625
625
|
}
|
|
626
|
-
process.env.NODE_ENV === "production" ? Et.exports =
|
|
627
|
-
var
|
|
628
|
-
const
|
|
626
|
+
process.env.NODE_ENV === "production" ? Et.exports = $e() : Et.exports = je();
|
|
627
|
+
var We = Et.exports;
|
|
628
|
+
const Ve = {
|
|
629
629
|
en: {
|
|
630
630
|
dir: "ltr",
|
|
631
631
|
file: "File",
|
|
@@ -680,6 +680,7 @@ const $e = {
|
|
|
680
680
|
aligncenter: "Align center",
|
|
681
681
|
alignright: "Align right",
|
|
682
682
|
alignjustify: "Justify",
|
|
683
|
+
align: "Align",
|
|
683
684
|
numlist: "Numbered list",
|
|
684
685
|
bullist: "Bullet list",
|
|
685
686
|
forecolor: "Text color",
|
|
@@ -871,6 +872,7 @@ const $e = {
|
|
|
871
872
|
aligncenter: "توسيط",
|
|
872
873
|
alignright: "محاذاة لليمين",
|
|
873
874
|
alignjustify: "ضبط",
|
|
875
|
+
align: "محاذاة",
|
|
874
876
|
numlist: "قائمة رقمية",
|
|
875
877
|
bullist: "قائمة نقطية",
|
|
876
878
|
forecolor: "لون النص",
|
|
@@ -1010,9 +1012,9 @@ const $e = {
|
|
|
1010
1012
|
}
|
|
1011
1013
|
};
|
|
1012
1014
|
function Ct(u) {
|
|
1013
|
-
return
|
|
1015
|
+
return Ve[u];
|
|
1014
1016
|
}
|
|
1015
|
-
const
|
|
1017
|
+
const Ue = "undo redo | preview print | importword revhistory | fontfamily fontsize | fontsizeincrease fontsizedecrease | bold italic underline strikethrough | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent | link blockquote code changecase lineheight wordspacing letterspacing | removeformat | blocks | ltr rtl | quickimage quickvideo quicktable codesample template charmap emoji | fullscreen sourcecode", ze = "file edit view insert format tools table help", Xe = [
|
|
1016
1018
|
["Andale Mono", "andale mono,times"],
|
|
1017
1019
|
["Arial", "arial,helvetica,sans-serif"],
|
|
1018
1020
|
["Arial Black", "arial black,avant garde"],
|
|
@@ -1032,7 +1034,7 @@ const je = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
1032
1034
|
["Verdana", "verdana,geneva"],
|
|
1033
1035
|
["Webdings", "webdings"],
|
|
1034
1036
|
["Wingdings", "wingdings,zapf dingbats"]
|
|
1035
|
-
],
|
|
1037
|
+
], Ye = ["8px", "9px", "10px", "11px", "12px", "14px", "16px", "18px", "20px", "24px", "28px", "32px", "36px", "48px", "72px", "96px"], Ge = 1, Qe = 100, Jt = ["1", "1.15", "1.4", "1.5", "1.75", "2", "2.5", "3"], te = ["1px", "2px", "4px", "6px", "8px", "12px"], ee = ["0.5px", "1px", "1.5px", "2px", "3px", "4px"], ie = [
|
|
1036
1038
|
["plain", "Plain text"],
|
|
1037
1039
|
["html", "HTML/XML"],
|
|
1038
1040
|
["css", "CSS"],
|
|
@@ -1049,7 +1051,7 @@ const je = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
1049
1051
|
["rust", "Rust"],
|
|
1050
1052
|
["sql", "SQL"],
|
|
1051
1053
|
["bash", "Bash/Shell"]
|
|
1052
|
-
],
|
|
1054
|
+
], se = [
|
|
1053
1055
|
["p", "para"],
|
|
1054
1056
|
["h1", "heading1"],
|
|
1055
1057
|
["h2", "heading2"],
|
|
@@ -2149,7 +2151,7 @@ const je = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
2149
2151
|
"🇲🇦"
|
|
2150
2152
|
]
|
|
2151
2153
|
}
|
|
2152
|
-
],
|
|
2154
|
+
], k = (u, t) => `<svg viewBox="${t || "0 0 24 24"}">${u}</svg>`, C = (u) => k(`<path class="f" d="${u}"/>`, "0 -960 960 960"), rt = (u, t = 7.5) => k(
|
|
2153
2155
|
'<path d="M10 6h10M10 12h10M10 18h10"/>' + u.map(
|
|
2154
2156
|
(e, i) => `<text x="2.5" y="${8.4 + i * 6}" font-size="${t}" stroke="none" fill="#222f3e" font-family="Arial">${e}</text>`
|
|
2155
2157
|
).join("")
|
|
@@ -2196,7 +2198,7 @@ const je = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
2196
2198
|
bullist: C(
|
|
2197
2199
|
"M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"
|
|
2198
2200
|
),
|
|
2199
|
-
chev:
|
|
2201
|
+
chev: k('<path d="M2 3.5 6 7.5 10 3.5"/>', "0 0 12 11"),
|
|
2200
2202
|
backcolor: C(
|
|
2201
2203
|
"M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"
|
|
2202
2204
|
),
|
|
@@ -2206,7 +2208,7 @@ const je = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
2206
2208
|
indent: C(
|
|
2207
2209
|
"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"
|
|
2208
2210
|
),
|
|
2209
|
-
more:
|
|
2211
|
+
more: k(
|
|
2210
2212
|
'<circle class="f" cx="5" cy="12" r="1.7"/><circle class="f" cx="12" cy="12" r="1.7"/><circle class="f" cx="19" cy="12" r="1.7"/>'
|
|
2211
2213
|
),
|
|
2212
2214
|
image: C(
|
|
@@ -2218,17 +2220,17 @@ const je = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
2218
2220
|
tableic: C(
|
|
2219
2221
|
"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"
|
|
2220
2222
|
),
|
|
2221
|
-
hric:
|
|
2223
|
+
hric: k('<path d="M4 12h16"/>'),
|
|
2222
2224
|
charic: C(
|
|
2223
2225
|
"M120-120v-120h200q-84-45-132-125t-48-175q0-142 99-241t241-99q142 0 241 99t99 241q0 95-48 175T640-240h200v120H520v-204q78-14 129-75t51-141q0-92-64-156t-156-64q-92 0-156 64t-64 156q0 80 51 141t129 75v204H120Z"
|
|
2224
2226
|
),
|
|
2225
|
-
dateic:
|
|
2227
|
+
dateic: k(
|
|
2226
2228
|
'<rect x="4" y="6" width="16" height="14" rx="1.5"/><path d="M4 10h16M8 4v4M16 4v4"/>'
|
|
2227
2229
|
),
|
|
2228
2230
|
pbic: C(
|
|
2229
2231
|
"M240-80q-33 0-56.5-23.5T160-160v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-80H240Zm-80-440v-280q0-33 23.5-56.5T240-880h320l240 240v120h-80v-80H520v-200H240v280h-80Zm200 160v-80h240v80H360Zm320 0v-80h240v80H680Zm-640 0v-80h240v80H40Zm440-160Zm0 240Z"
|
|
2230
2232
|
),
|
|
2231
|
-
nbspic:
|
|
2233
|
+
nbspic: k('<path d="M6 12v4h12v-4"/>'),
|
|
2232
2234
|
srcic: C(
|
|
2233
2235
|
"M240-280 40-480l200-200 56 56-143 144 143 144-56 56Zm178 132-76-24 200-640 76 24-200 640Zm302-132-56-56 143-144-143-144 56-56 200 200-200 200Z"
|
|
2234
2236
|
),
|
|
@@ -2256,11 +2258,11 @@ const je = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
2256
2258
|
subscriptic: C(
|
|
2257
2259
|
"M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"
|
|
2258
2260
|
),
|
|
2259
|
-
newic:
|
|
2260
|
-
helpic:
|
|
2261
|
+
newic: k('<path d="M6 3h8l5 5v13H6z"/><path d="M14 3v5h5"/>'),
|
|
2262
|
+
helpic: k(
|
|
2261
2263
|
'<circle cx="12" cy="12" r="8.5"/><path d="M9.6 9.6a2.5 2.5 0 1 1 3.4 2.6c-.8.3-1 .9-1 1.8"/><circle class="f" cx="12" cy="16.6" r="1.1"/>'
|
|
2262
2264
|
),
|
|
2263
|
-
wcic:
|
|
2265
|
+
wcic: k('<path d="M4 6h16M4 10h16M4 14h9"/><path d="M15 17.5l2 2 3.6-4"/>'),
|
|
2264
2266
|
rowbefore: C(
|
|
2265
2267
|
"M200-160h560v-240H200v240Zm640 80H120v-720h160v80h-80v240h560v-240h-80v-80h160v720ZM480-480Zm0 80v-80 80Zm0 0Zm-40-240v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80Z"
|
|
2266
2268
|
),
|
|
@@ -2312,44 +2314,44 @@ const je = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
2312
2314
|
historyic: C(
|
|
2313
2315
|
"M480-120q-138 0-240.5-91.5T122-440h82q14 104 92.5 172T480-200q117 0 198.5-81.5T760-480q0-117-81.5-198.5T480-760q-69 0-129 32t-101 88h110v80H120v-240h80v94q51-64 124.5-99T480-840q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-480q0 75-28.5 140.5t-77 114q-48.5 48.5-114 77T480-120Zm112-192L440-464v-216h80v184l128 128-56 56Z"
|
|
2314
2316
|
),
|
|
2315
|
-
wordic:
|
|
2317
|
+
wordic: k(
|
|
2316
2318
|
'<path d="M6 3h8l5 5v13H6z"/><path d="M14 3v5h5"/><text x="8" y="17" font-size="8.5" stroke="none" fill="#222f3e" font-family="Arial" font-weight="bold">W</text>'
|
|
2317
2319
|
),
|
|
2318
2320
|
draftic: C(
|
|
2319
2321
|
"M480-160q-134 0-227-93t-93-227q0-134 93-227t227-93q69 0 132 28.5T720-690v-110h80v280H520v-80h168q-32-56-87.5-88T480-720q-100 0-170 70t-70 170q0 100 70 170t170 70q77 0 139-44t87-116h84q-28 106-114 173t-196 67Z"
|
|
2320
2322
|
),
|
|
2321
|
-
trash:
|
|
2323
|
+
trash: k(
|
|
2322
2324
|
'<path d="M5 7h14M10 7V5h4v2M7.5 7l1 13h7l1-13"/>'
|
|
2323
2325
|
),
|
|
2324
|
-
templateic:
|
|
2326
|
+
templateic: k(
|
|
2325
2327
|
'<rect x="4" y="4" width="16" height="16" rx="1.5"/><rect x="6.5" y="6.5" width="5" height="5" rx=".5"/><path d="M14 7.5h3.5M14 10h3.5M6.5 14h11M6.5 17h11"/>'
|
|
2326
2328
|
),
|
|
2327
|
-
tplleft:
|
|
2329
|
+
tplleft: k(
|
|
2328
2330
|
'<rect x="3" y="5" width="8" height="8" rx=".8"/><path d="M13.5 6.5H21M13.5 9.5H21M13.5 12.5H21M3 15.5h18M3 18.5h18"/>'
|
|
2329
2331
|
),
|
|
2330
|
-
tplright:
|
|
2332
|
+
tplright: k(
|
|
2331
2333
|
'<rect x="13" y="5" width="8" height="8" rx=".8"/><path d="M3 6.5h7.5M3 9.5h7.5M3 12.5h7.5M3 15.5h18M3 18.5h18"/>'
|
|
2332
2334
|
),
|
|
2333
|
-
tpltop:
|
|
2335
|
+
tpltop: k(
|
|
2334
2336
|
'<rect x="5" y="3" width="14" height="9" rx=".8"/><path d="M3 15h18M3 18h18M3 21h12"/>'
|
|
2335
2337
|
),
|
|
2336
|
-
tplcenter:
|
|
2338
|
+
tplcenter: k(
|
|
2337
2339
|
'<path d="M3 4h18M3 7h18M3 10h12"/><rect x="5" y="12.5" width="14" height="9" rx=".8"/>'
|
|
2338
2340
|
),
|
|
2339
|
-
rotateleft:
|
|
2341
|
+
rotateleft: k(
|
|
2340
2342
|
'<polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/>'
|
|
2341
2343
|
),
|
|
2342
|
-
rotateright:
|
|
2344
|
+
rotateright: k(
|
|
2343
2345
|
'<polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/>'
|
|
2344
2346
|
),
|
|
2345
|
-
fliphorizontal:
|
|
2347
|
+
fliphorizontal: k(
|
|
2346
2348
|
'<path d="M12 3v18"/><path d="M7 8l-4 4 4 4"/><path d="M17 8l4 4-4 4"/>'
|
|
2347
2349
|
),
|
|
2348
|
-
flipvertical:
|
|
2350
|
+
flipvertical: k(
|
|
2349
2351
|
'<path d="M3 12h18"/><path d="M8 7l4-4 4 4"/><path d="M8 17l4 4 4-4"/>'
|
|
2350
2352
|
),
|
|
2351
|
-
check:
|
|
2352
|
-
palette:
|
|
2353
|
+
check: k('<path d="M5 12.5 9.5 17 19 7"/>'),
|
|
2354
|
+
palette: k(
|
|
2353
2355
|
'<path d="M12 3a9 9 0 1 0 0 18h1.2a2 2 0 0 0 2-2 2 2 0 0 1 2-2H18a3 3 0 0 0 3-3c0-6.1-4.5-11-9-11z"/><circle class="f" cx="7.8" cy="10.2" r="1.3"/><circle class="f" cx="11.6" cy="7.3" r="1.3"/><circle class="f" cx="15.8" cy="9.6" r="1.3"/><circle class="f" cx="9" cy="14.8" r="1.3"/>'
|
|
2354
2356
|
),
|
|
2355
2357
|
ul_circle: C(
|
|
@@ -2362,20 +2364,20 @@ const je = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
2362
2364
|
ol_roman: rt(["i", "ii", "iii"], 6.5),
|
|
2363
2365
|
ol_alphau: rt(["A", "B", "C"]),
|
|
2364
2366
|
ol_romanu: rt(["I", "II", "III"], 6.5),
|
|
2365
|
-
video:
|
|
2366
|
-
editic:
|
|
2367
|
-
letterspacing:
|
|
2367
|
+
video: k('<rect x="3" y="6" width="13" height="12" rx="1.5"/><path d="M16 10l5-3v10l-5-3z"/>'),
|
|
2368
|
+
editic: k('<path d="M4 20l1-4.5L15.5 5 19 8.5 8.5 19 4 20z"/><path d="M13.5 6.5l4 4"/>'),
|
|
2369
|
+
letterspacing: k(
|
|
2368
2370
|
'<text x="2.5" y="13" font-size="12" stroke="none" fill="#222f3e" font-family="Arial" font-weight="bold">A</text><text x="13" y="13" font-size="12" stroke="none" fill="#222f3e" font-family="Arial" font-weight="bold">B</text><path d="M7 18.5h10"/><path class="f" d="M7.5 18.5 4.5 16.6v3.8z"/><path class="f" d="M16.5 18.5l3-1.9v3.8z"/>'
|
|
2369
2371
|
),
|
|
2370
|
-
emojiic:
|
|
2372
|
+
emojiic: k(
|
|
2371
2373
|
'<circle cx="12" cy="12" r="8.5"/><path d="M8.6 14.3a4.6 4.6 0 0 0 6.8 0"/><path d="M9.2 9.6v.7M14.8 9.6v.7"/>'
|
|
2372
2374
|
),
|
|
2373
|
-
inlinecodeic:
|
|
2374
|
-
moverowup:
|
|
2375
|
-
moverowdown:
|
|
2376
|
-
movecolleft:
|
|
2377
|
-
movecolright:
|
|
2378
|
-
codesampleic:
|
|
2375
|
+
inlinecodeic: k('<path d="M8.5 8 4.5 12l4 4M15.5 8l4 4-4 4"/><path d="M13 6l-2 12"/>'),
|
|
2376
|
+
moverowup: k('<rect x="4" y="15.5" width="16" height="5" rx="1"/><path d="M12 12.5V4M8.5 7.5 12 4l3.5 3.5"/>'),
|
|
2377
|
+
moverowdown: k('<rect x="4" y="3.5" width="16" height="5" rx="1"/><path d="M12 11.5V20M8.5 16.5 12 20l3.5-3.5"/>'),
|
|
2378
|
+
movecolleft: k('<rect x="15.5" y="4" width="5" height="16" rx="1"/><path d="M12.5 12H4M7.5 8.5 4 12l3.5 3.5"/>'),
|
|
2379
|
+
movecolright: k('<rect x="3.5" y="4" width="5" height="16" rx="1"/><path d="M11.5 12H20M16.5 8.5 20 12l-3.5 3.5"/>'),
|
|
2380
|
+
codesampleic: k(
|
|
2379
2381
|
'<rect x="3.5" y="4" width="17" height="16" rx="2"/><path d="M3.5 8.5h17"/><path d="M9.5 12 7 14.25l2.5 2.25M14.5 12l2.5 2.25-2.5 2.25"/>'
|
|
2380
2382
|
)
|
|
2381
2383
|
}, ii = /* @__PURE__ */ new Set([
|
|
@@ -2476,7 +2478,7 @@ const je = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
2476
2478
|
"box-sizing",
|
|
2477
2479
|
"list-style-type",
|
|
2478
2480
|
"white-space"
|
|
2479
|
-
]),
|
|
2481
|
+
]), le = {
|
|
2480
2482
|
"*": ["dir", "lang", "colspan", "rowspan"],
|
|
2481
2483
|
a: ["href", "target", "rel", "title"],
|
|
2482
2484
|
img: ["src", "alt", "width", "height", "title"],
|
|
@@ -2492,16 +2494,16 @@ function pt(u) {
|
|
|
2492
2494
|
s < 1 || (t[i.slice(0, s).trim().toLowerCase()] = i.slice(s + 1).trim());
|
|
2493
2495
|
}), t;
|
|
2494
2496
|
}
|
|
2495
|
-
function
|
|
2497
|
+
function li(u) {
|
|
2496
2498
|
return u.replace(/<!--\[if !supportLists\]-->([\s\S]*?)<!--\[endif\]-->/gi, "$1").replace(/<!--\[if !supportLists\]>([\s\S]*?)<!\[endif\]-->/gi, "$1").replace(/<!\[if !supportLists\]>([\s\S]*?)<!\[endif\]>/gi, "$1").replace(/<!--\[if [\s\S]*?<!\[endif\]-->/gi, "").replace(/<!--[\s\S]*?-->/g, "").replace(/<(script|style|xml|title)[\s\S]*?<\/\1>/gi, "").replace(/<\/?(meta|link)[^>]*>/gi, "").replace(/<\?xml[\s\S]*?\?>/gi, "").replace(/<\/?(o|v|w|m|st1):[^>]*>/gi, "");
|
|
2497
2499
|
}
|
|
2498
|
-
function
|
|
2500
|
+
function ni(u) {
|
|
2499
2501
|
return /^[0-9]+[\.\)،]/.test(u) ? { ordered: !0 } : /^[٠-٩۰-۹]+/.test(u) ? { ordered: !0, style: "arabic-indic" } : /^[ivxlc]{2,}[\.\)]/.test(u) ? { ordered: !0, style: "lower-roman" } : /^[IVXLC]{2,}[\.\)]/.test(u) ? { ordered: !0, style: "upper-roman" } : /^[a-z][\.\)]/.test(u) ? { ordered: !0, style: "lower-alpha" } : /^[A-Z][\.\)]/.test(u) ? { ordered: !0, style: "upper-alpha" } : /^[ء-ي][\.\)،-]/.test(u) ? { ordered: !0, style: "arabic-indic" } : { ordered: !1 };
|
|
2500
2502
|
}
|
|
2501
2503
|
function oi(u) {
|
|
2502
2504
|
const t = (s) => {
|
|
2503
|
-
const
|
|
2504
|
-
return /mso-list\s*:(?!\s*ignore)/i.test(
|
|
2505
|
+
const l = (s.getAttribute("style") || "") + " " + (s.className || "");
|
|
2506
|
+
return /mso-list\s*:(?!\s*ignore)/i.test(l) || /MsoListParagraph/i.test(l);
|
|
2505
2507
|
}, e = [];
|
|
2506
2508
|
let i = null;
|
|
2507
2509
|
Array.from(u.body.querySelectorAll("p")).forEach((s) => {
|
|
@@ -2509,28 +2511,28 @@ function oi(u) {
|
|
|
2509
2511
|
i = null;
|
|
2510
2512
|
return;
|
|
2511
2513
|
}
|
|
2512
|
-
const
|
|
2513
|
-
i &&
|
|
2514
|
+
const l = s.previousElementSibling;
|
|
2515
|
+
i && l && i[i.length - 1] === l ? i.push(s) : (i = [s], e.push(i));
|
|
2514
2516
|
}), e.forEach((s) => {
|
|
2515
|
-
const
|
|
2517
|
+
const l = [], n = s[0];
|
|
2516
2518
|
s.forEach((r) => {
|
|
2517
|
-
var w, E,
|
|
2519
|
+
var w, E, A;
|
|
2518
2520
|
const c = +(((w = (r.getAttribute("style") || "").match(/level(\d+)/i)) == null ? void 0 : w[1]) || 1), d = Array.from(r.querySelectorAll("span")).find(
|
|
2519
2521
|
(H) => /mso-list\s*:\s*ignore/i.test(H.getAttribute("style") || "")
|
|
2520
|
-
), p = d ? ((E = d.textContent) == null ? void 0 : E.trim()) || "" : (((
|
|
2521
|
-
for (d && d.remove();
|
|
2522
|
-
if (!
|
|
2522
|
+
), p = d ? ((E = d.textContent) == null ? void 0 : E.trim()) || "" : (((A = r.textContent) == null ? void 0 : A.trim().match(/^\S{1,4}/)) || [""])[0], { ordered: m, style: b } = ni(p);
|
|
2523
|
+
for (d && d.remove(); l.length && l[l.length - 1].level > c; ) l.pop();
|
|
2524
|
+
if (!l.length || l[l.length - 1].level < c) {
|
|
2523
2525
|
const H = u.createElement(m ? "ol" : "ul");
|
|
2524
|
-
if (m && b && (H.style.listStyleType = b),
|
|
2525
|
-
const $ =
|
|
2526
|
+
if (m && b && (H.style.listStyleType = b), l.length) {
|
|
2527
|
+
const $ = l[l.length - 1].list;
|
|
2526
2528
|
($.lastElementChild || $).appendChild(H);
|
|
2527
2529
|
} else
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
+
n.parentNode.insertBefore(H, n);
|
|
2531
|
+
l.push({ list: H, level: c });
|
|
2530
2532
|
}
|
|
2531
2533
|
const y = u.createElement("li"), g = pt(r), x = ["text-align", "direction", "unicode-bidi", "color", "font-size", "font-family", "background-color"].filter((H) => g[H]).map((H) => H + ":" + g[H]).join(";");
|
|
2532
2534
|
for (x && y.setAttribute("style", x), r.getAttribute("dir") && y.setAttribute("dir", r.getAttribute("dir")); r.firstChild; ) y.appendChild(r.firstChild);
|
|
2533
|
-
|
|
2535
|
+
l[l.length - 1].list.appendChild(y), r.remove();
|
|
2534
2536
|
});
|
|
2535
2537
|
});
|
|
2536
2538
|
}
|
|
@@ -2548,8 +2550,8 @@ function ai(u) {
|
|
|
2548
2550
|
const e = t, i = e.getAttribute("align").toLowerCase();
|
|
2549
2551
|
e.tagName.toLowerCase() === "table" ? i === "center" ? (e.style.marginLeft = e.style.marginLeft || "auto", e.style.marginRight = e.style.marginRight || "auto") : i === "right" ? e.style.marginLeft = e.style.marginLeft || "auto" : i === "left" && (e.style.marginRight = e.style.marginRight || "auto") : ["left", "right", "center", "justify"].includes(i) && (e.style.textAlign = e.style.textAlign || i, Array.from(e.children).forEach((s) => {
|
|
2550
2552
|
if (s.tagName.toLowerCase() !== "table") return;
|
|
2551
|
-
const
|
|
2552
|
-
i === "center" ? (
|
|
2553
|
+
const l = s;
|
|
2554
|
+
i === "center" ? (l.style.marginLeft = l.style.marginLeft || "auto", l.style.marginRight = l.style.marginRight || "auto") : i === "right" ? l.style.marginLeft = l.style.marginLeft || "auto" : i === "left" && (l.style.marginRight = l.style.marginRight || "auto");
|
|
2553
2555
|
})), e.removeAttribute("align");
|
|
2554
2556
|
}), u.querySelectorAll("center table").forEach((t) => {
|
|
2555
2557
|
const e = t;
|
|
@@ -2592,10 +2594,10 @@ function ht(u, t) {
|
|
|
2592
2594
|
i.remove();
|
|
2593
2595
|
return;
|
|
2594
2596
|
}
|
|
2595
|
-
const
|
|
2597
|
+
const l = /* @__PURE__ */ new Set([...le["*"] || [], ...le[s] || []]);
|
|
2596
2598
|
if (Array.from(i.attributes).forEach((o) => {
|
|
2597
2599
|
const c = o.name.toLowerCase();
|
|
2598
|
-
c !== "style" && !
|
|
2600
|
+
c !== "style" && !l.has(c) && i.removeAttribute(o.name);
|
|
2599
2601
|
}), s === "a") {
|
|
2600
2602
|
const o = i.getAttribute("href") || "";
|
|
2601
2603
|
/^(https?:|mailto:|tel:|#)/i.test(o) || i.removeAttribute("href");
|
|
@@ -2608,8 +2610,8 @@ function ht(u, t) {
|
|
|
2608
2610
|
return;
|
|
2609
2611
|
}
|
|
2610
2612
|
}
|
|
2611
|
-
const
|
|
2612
|
-
for (const [o, c] of Object.entries(
|
|
2613
|
+
const n = pt(i), r = [];
|
|
2614
|
+
for (const [o, c] of Object.entries(n))
|
|
2613
2615
|
si.has(o) && (/expression|javascript|url\s*\(\s*['"]?\s*file:/i.test(c) || o === "font-weight" && /^(400|normal)$/i.test(c) || o === "font-style" && /^normal$/i.test(c) || o === "text-decoration" && /^none$/i.test(c) || r.push(o + ":" + c));
|
|
2614
2616
|
if (r.length ? i.setAttribute("style", r.join(";")) : i.removeAttribute("style"), i.removeAttribute("class"), ht(i, t), s === "span" && !i.attributes.length) {
|
|
2615
2617
|
for (; i.firstChild; ) i.parentNode.insertBefore(i.firstChild, i);
|
|
@@ -2623,14 +2625,14 @@ function ci(u) {
|
|
|
2623
2625
|
for (; i = e.exec(u); ) {
|
|
2624
2626
|
let s = i[1].replace(/<!--|-->/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
2625
2627
|
s = s.replace(/@media[^{]*\{(?:[^{}]*\{[^{}]*\})*[^{}]*\}/gi, ""), s = s.replace(/@[\w-]+[^{]*\{[^{}]*\}/g, "");
|
|
2626
|
-
let
|
|
2627
|
-
const
|
|
2628
|
-
for (;
|
|
2629
|
-
const r =
|
|
2628
|
+
let l;
|
|
2629
|
+
const n = /([^{}]+)\{([^}]*)\}/g;
|
|
2630
|
+
for (; l = n.exec(s); ) {
|
|
2631
|
+
const r = l[2].split(";").map((o) => {
|
|
2630
2632
|
const c = o.indexOf(":");
|
|
2631
2633
|
return c < 1 ? null : [o.slice(0, c).trim().toLowerCase(), o.slice(c + 1).trim()];
|
|
2632
2634
|
}).filter((o) => !!o && !!o[1]);
|
|
2633
|
-
r.length &&
|
|
2635
|
+
r.length && l[1].split(",").map((o) => o.trim()).filter((o) => o && !o.startsWith("@")).forEach((o) => t.push({ sel: o, decls: r }));
|
|
2634
2636
|
}
|
|
2635
2637
|
}
|
|
2636
2638
|
return t;
|
|
@@ -2639,47 +2641,47 @@ function hi(u, t) {
|
|
|
2639
2641
|
if (!t.length) return;
|
|
2640
2642
|
const e = /* @__PURE__ */ new Map();
|
|
2641
2643
|
t.forEach(({ sel: i, decls: s }) => {
|
|
2642
|
-
let
|
|
2644
|
+
let l;
|
|
2643
2645
|
try {
|
|
2644
|
-
|
|
2646
|
+
l = u.querySelectorAll(i);
|
|
2645
2647
|
} catch {
|
|
2646
2648
|
return;
|
|
2647
2649
|
}
|
|
2648
|
-
|
|
2649
|
-
let r = e.get(
|
|
2650
|
-
r || (r = {}, e.set(
|
|
2650
|
+
l.forEach((n) => {
|
|
2651
|
+
let r = e.get(n);
|
|
2652
|
+
r || (r = {}, e.set(n, r)), s.forEach(([o, c]) => {
|
|
2651
2653
|
r[o] = c;
|
|
2652
2654
|
});
|
|
2653
2655
|
});
|
|
2654
2656
|
}), e.forEach((i, s) => {
|
|
2655
|
-
const
|
|
2657
|
+
const l = pt(s), n = s.hasAttribute("dir"), r = s.hasAttribute("align"), o = Object.entries(i).filter(([p]) => !(p in l || (p === "direction" || p === "unicode-bidi") && n || p === "text-align" && (r || n) || (p === "background" || p === "background-color") && s.hasAttribute("bgcolor")));
|
|
2656
2658
|
if (!o.length) return;
|
|
2657
2659
|
const c = o.map(([p, m]) => p + ":" + m).join(";"), d = s.getAttribute("style");
|
|
2658
2660
|
s.setAttribute("style", d ? c + ";" + d : c);
|
|
2659
2661
|
});
|
|
2660
2662
|
}
|
|
2661
|
-
function
|
|
2663
|
+
function he(u) {
|
|
2662
2664
|
return u.replace(/[ﭐ-﷿ﹰ-ﻼ]+/g, (t) => t.normalize("NFKC"));
|
|
2663
2665
|
}
|
|
2664
2666
|
function di(u) {
|
|
2665
2667
|
const t = u.createTreeWalker(u.body, NodeFilter.SHOW_TEXT, null);
|
|
2666
2668
|
let e;
|
|
2667
2669
|
for (; e = t.nextNode(); )
|
|
2668
|
-
/[ﭐ-﷿ﹰ-ﻼ]/.test(e.nodeValue || "") && (e.nodeValue =
|
|
2670
|
+
/[ﭐ-﷿ﹰ-ﻼ]/.test(e.nodeValue || "") && (e.nodeValue = he(e.nodeValue || ""));
|
|
2669
2671
|
}
|
|
2670
2672
|
function pi(u, t = "ltr") {
|
|
2671
|
-
const e = ci(u), i = new DOMParser().parseFromString(
|
|
2673
|
+
const e = ci(u), i = new DOMParser().parseFromString(li(u), "text/html");
|
|
2672
2674
|
hi(i, e), /class="?Mso|mso-|urn:schemas-microsoft-com/i.test(i.body.innerHTML) && oi(i), ri(i), ai(i), ht(i.body, i), di(i);
|
|
2673
|
-
const s = (
|
|
2674
|
-
var
|
|
2675
|
-
return
|
|
2675
|
+
const s = (l) => {
|
|
2676
|
+
var n;
|
|
2677
|
+
return l && l.tagName === "P" && !((n = l.textContent) != null && n.trim()) && !l.querySelector("img,table");
|
|
2676
2678
|
};
|
|
2677
2679
|
for (; s(i.body.firstElementChild); ) i.body.firstElementChild.remove();
|
|
2678
2680
|
for (; s(i.body.lastElementChild); ) i.body.lastElementChild.remove();
|
|
2679
2681
|
return i.body.innerHTML.trim();
|
|
2680
2682
|
}
|
|
2681
2683
|
function ui(u) {
|
|
2682
|
-
const t =
|
|
2684
|
+
const t = he(u).replace(/\r/g, ""), e = (i) => i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
2683
2685
|
return /\n/.test(t) ? t.split(/\n{2,}/).map((i) => `<p dir="auto">${e(i).replace(/\n/g, "<br>") || "<br>"}</p>`).join("") : e(t);
|
|
2684
2686
|
}
|
|
2685
2687
|
function mi(u) {
|
|
@@ -2692,24 +2694,24 @@ function mi(u) {
|
|
|
2692
2694
|
}
|
|
2693
2695
|
if (i < 0) throw new Error("EOCD not found");
|
|
2694
2696
|
const s = t.getUint16(i + 10, !0);
|
|
2695
|
-
let
|
|
2696
|
-
const
|
|
2697
|
-
for (let r = 0; r < s && t.getUint32(
|
|
2698
|
-
const o = t.getUint16(
|
|
2699
|
-
e.set(y, { name: y, method: o, compSize: c, localOffset: b }),
|
|
2697
|
+
let l = t.getUint32(i + 16, !0);
|
|
2698
|
+
const n = new TextDecoder();
|
|
2699
|
+
for (let r = 0; r < s && t.getUint32(l, !0) === 33639248; r++) {
|
|
2700
|
+
const o = t.getUint16(l + 10, !0), c = t.getUint32(l + 20, !0), d = t.getUint16(l + 28, !0), p = t.getUint16(l + 30, !0), m = t.getUint16(l + 32, !0), b = t.getUint32(l + 42, !0), y = n.decode(new Uint8Array(u, l + 46, d));
|
|
2701
|
+
e.set(y, { name: y, method: o, compSize: c, localOffset: b }), l += 46 + d + p + m;
|
|
2700
2702
|
}
|
|
2701
2703
|
return e;
|
|
2702
2704
|
}
|
|
2703
|
-
async function
|
|
2705
|
+
async function ne(u, t) {
|
|
2704
2706
|
const e = new DataView(u, t.localOffset);
|
|
2705
2707
|
if (e.getUint32(0, !0) !== 67324752) throw new Error("Bad local header");
|
|
2706
|
-
const i = e.getUint16(26, !0), s = e.getUint16(28, !0),
|
|
2707
|
-
if (t.method === 0) return
|
|
2708
|
+
const i = e.getUint16(26, !0), s = e.getUint16(28, !0), l = t.localOffset + 30 + i + s, n = new Uint8Array(u.slice(l, l + t.compSize));
|
|
2709
|
+
if (t.method === 0) return n;
|
|
2708
2710
|
if (t.method !== 8) throw new Error("Unsupported compression method " + t.method);
|
|
2709
|
-
const r = new Blob([
|
|
2711
|
+
const r = new Blob([n]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
|
|
2710
2712
|
return new Uint8Array(await new Response(r).arrayBuffer());
|
|
2711
2713
|
}
|
|
2712
|
-
const
|
|
2714
|
+
const oe = (u) => u.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), dt = (u, t) => Array.from(u.children).filter((e) => e.localName === t), B = (u, ...t) => {
|
|
2713
2715
|
let e = u;
|
|
2714
2716
|
for (const i of t) {
|
|
2715
2717
|
if (!e) return null;
|
|
@@ -2722,11 +2724,11 @@ const se = (u) => u.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, "
|
|
|
2722
2724
|
if (e.localName === t) return e.value;
|
|
2723
2725
|
return "";
|
|
2724
2726
|
}, at = (u, t) => {
|
|
2725
|
-
const e = u ?
|
|
2727
|
+
const e = u ? B(u, t) : null;
|
|
2726
2728
|
if (!e) return !1;
|
|
2727
2729
|
const i = q(e);
|
|
2728
2730
|
return i !== "false" && i !== "0";
|
|
2729
|
-
},
|
|
2731
|
+
}, re = {
|
|
2730
2732
|
yellow: "#FFFF00",
|
|
2731
2733
|
green: "#00FF00",
|
|
2732
2734
|
cyan: "#00FFFF",
|
|
@@ -2763,40 +2765,40 @@ class vi {
|
|
|
2763
2765
|
}
|
|
2764
2766
|
convertBody(t) {
|
|
2765
2767
|
let e = "", i = [];
|
|
2766
|
-
const s = (
|
|
2767
|
-
for (; i.length >
|
|
2768
|
+
const s = (l) => {
|
|
2769
|
+
for (; i.length > l; ) e += `</${i.pop()}>`;
|
|
2768
2770
|
};
|
|
2769
|
-
for (const
|
|
2770
|
-
if (
|
|
2771
|
-
const
|
|
2772
|
-
if (
|
|
2773
|
-
const r =
|
|
2771
|
+
for (const l of Array.from(t.children))
|
|
2772
|
+
if (l.localName === "p") {
|
|
2773
|
+
const n = this.paraList(l);
|
|
2774
|
+
if (n) {
|
|
2775
|
+
const r = n.ilvl + 1;
|
|
2774
2776
|
for (; i.length > r; ) e += `</${i.pop()}>`;
|
|
2775
|
-
for (i.length === r && i[r - 1] !==
|
|
2776
|
-
e += `<${
|
|
2777
|
-
e += `<li>${this.runsOf(
|
|
2777
|
+
for (i.length === r && i[r - 1] !== n.type && (e += `</${i.pop()}>`); i.length < r; )
|
|
2778
|
+
e += `<${n.type}>`, i.push(n.type);
|
|
2779
|
+
e += `<li>${this.runsOf(l) || "<br>"}</li>`;
|
|
2778
2780
|
continue;
|
|
2779
2781
|
}
|
|
2780
|
-
s(0), e += this.convertPara(
|
|
2781
|
-
} else
|
|
2782
|
+
s(0), e += this.convertPara(l);
|
|
2783
|
+
} else l.localName === "tbl" ? (s(0), e += this.convertTable(l)) : l.localName;
|
|
2782
2784
|
return s(0), e || "<p><br></p>";
|
|
2783
2785
|
}
|
|
2784
2786
|
paraList(t) {
|
|
2785
|
-
const e =
|
|
2787
|
+
const e = B(t, "pPr", "numPr");
|
|
2786
2788
|
if (!e) return null;
|
|
2787
|
-
const i = q(
|
|
2789
|
+
const i = q(B(e, "numId"));
|
|
2788
2790
|
if (!i || i === "0") return null;
|
|
2789
|
-
const s = parseInt(q(
|
|
2791
|
+
const s = parseInt(q(B(e, "ilvl")) || "0", 10) || 0;
|
|
2790
2792
|
return { type: this.numFmt.get(i) || "ul", ilvl: Math.min(s, 8) };
|
|
2791
2793
|
}
|
|
2792
2794
|
convertPara(t) {
|
|
2793
|
-
const e =
|
|
2795
|
+
const e = B(t, "pPr"), i = q(B(t, "pPr", "pStyle"));
|
|
2794
2796
|
let s = "p";
|
|
2795
|
-
const
|
|
2796
|
-
|
|
2797
|
-
const
|
|
2798
|
-
r === "center" ?
|
|
2799
|
-
const o = this.runsOf(t), c =
|
|
2797
|
+
const l = /^Heading([1-6])$/i.exec(i);
|
|
2798
|
+
l ? s = "h" + l[1] : /^Title$/i.test(i) && (s = "h1");
|
|
2799
|
+
const n = [], r = q(B(t, "pPr", "jc"));
|
|
2800
|
+
r === "center" ? n.push("text-align:center") : r === "right" || r === "end" ? n.push("text-align:right") : (r === "both" || r === "distribute") && n.push("text-align:justify"), e && B(e, "bidi") && n.push("direction:rtl");
|
|
2801
|
+
const o = this.runsOf(t), c = n.length ? ` style="${n.join(";")}"` : "";
|
|
2800
2802
|
return `<${s}${c}>${o || "<br>"}</${s}>`;
|
|
2801
2803
|
}
|
|
2802
2804
|
runsOf(t) {
|
|
@@ -2805,28 +2807,28 @@ class vi {
|
|
|
2805
2807
|
if (i.localName === "r") e += this.convertRun(i);
|
|
2806
2808
|
else if (i.localName === "hyperlink") {
|
|
2807
2809
|
let s = this.rels.get(q(i, "id")) || "";
|
|
2808
|
-
const
|
|
2809
|
-
!s &&
|
|
2810
|
-
const
|
|
2811
|
-
e += s ? `<a href="${
|
|
2810
|
+
const l = q(i, "anchor");
|
|
2811
|
+
!s && l && (s = "#" + l);
|
|
2812
|
+
const n = this.runsOf(i);
|
|
2813
|
+
e += s ? `<a href="${oe(s)}">${n}</a>` : n;
|
|
2812
2814
|
} else (i.localName === "smartTag" || i.localName === "ins") && (e += this.runsOf(i));
|
|
2813
2815
|
return e;
|
|
2814
2816
|
}
|
|
2815
2817
|
convertRun(t) {
|
|
2816
|
-
const e =
|
|
2818
|
+
const e = B(t, "rPr");
|
|
2817
2819
|
let i = "";
|
|
2818
2820
|
for (const p of Array.from(t.children))
|
|
2819
|
-
p.localName === "t" ? i +=
|
|
2821
|
+
p.localName === "t" ? i += oe(p.textContent || "") : p.localName === "br" || p.localName === "cr" ? i += "<br>" : p.localName === "tab" ? i += " " : (p.localName === "drawing" || p.localName === "pict" || p.localName === "object") && (i += this.convertImage(p));
|
|
2820
2822
|
if (!i) return "";
|
|
2821
|
-
const s = [],
|
|
2822
|
-
|
|
2823
|
-
const
|
|
2824
|
-
|
|
2825
|
-
const r = parseFloat(q(e ?
|
|
2823
|
+
const s = [], l = q(e ? B(e, "color") : null);
|
|
2824
|
+
l && l !== "auto" && s.push("color:#" + l);
|
|
2825
|
+
const n = q(e ? B(e, "highlight") : null);
|
|
2826
|
+
n && re[n] && s.push("background-color:" + re[n]);
|
|
2827
|
+
const r = parseFloat(q(e ? B(e, "sz") : null));
|
|
2826
2828
|
r && s.push("font-size:" + Math.round(r / 2 * (4 / 3)) + "px");
|
|
2827
|
-
const o = e ?
|
|
2828
|
-
c && s.push(`font-family:'${c}'`), s.length && (i = `<span style="${s.join(";")}">${i}</span>`), at(e, "b") && (i = `<strong>${i}</strong>`), at(e, "i") && (i = `<em>${i}</em>`), at(e, "u") && q(
|
|
2829
|
-
const d = q(e ?
|
|
2829
|
+
const o = e ? B(e, "rFonts") : null, c = q(o, "ascii") || q(o, "cs");
|
|
2830
|
+
c && s.push(`font-family:'${c}'`), s.length && (i = `<span style="${s.join(";")}">${i}</span>`), at(e, "b") && (i = `<strong>${i}</strong>`), at(e, "i") && (i = `<em>${i}</em>`), at(e, "u") && q(B(e, "u")) !== "none" && (i = `<u>${i}</u>`), at(e, "strike") && (i = `<s>${i}</s>`);
|
|
2831
|
+
const d = q(e ? B(e, "vertAlign") : null);
|
|
2830
2832
|
return d === "superscript" ? i = `<sup>${i}</sup>` : d === "subscript" && (i = `<sub>${i}</sub>`), i;
|
|
2831
2833
|
}
|
|
2832
2834
|
convertImage(t) {
|
|
@@ -2839,21 +2841,21 @@ class vi {
|
|
|
2839
2841
|
for (const o of Array.from(r.children)) s(o);
|
|
2840
2842
|
};
|
|
2841
2843
|
if (s(t), !e) return "";
|
|
2842
|
-
const
|
|
2843
|
-
if (!
|
|
2844
|
-
const
|
|
2845
|
-
return `<img src="${
|
|
2844
|
+
const l = this.images.get(e);
|
|
2845
|
+
if (!l) return "";
|
|
2846
|
+
const n = i ? ` width="${i}"` : "";
|
|
2847
|
+
return `<img src="${l}" alt=""${n}>`;
|
|
2846
2848
|
}
|
|
2847
2849
|
convertTable(t) {
|
|
2848
2850
|
let e = '<table style="border-collapse:collapse;width:100%"><tbody>';
|
|
2849
2851
|
for (const i of dt(t, "tr")) {
|
|
2850
2852
|
e += "<tr>";
|
|
2851
2853
|
for (const s of dt(i, "tc")) {
|
|
2852
|
-
const
|
|
2854
|
+
const l = parseInt(q(B(s, "tcPr", "gridSpan")) || "1", 10) || 1, n = l > 1 ? ` colspan="${l}"` : "";
|
|
2853
2855
|
let r = "";
|
|
2854
2856
|
for (const o of Array.from(s.children))
|
|
2855
2857
|
o.localName === "p" ? r += this.convertPara(o) : o.localName === "tbl" && (r += this.convertTable(o));
|
|
2856
|
-
e += `<td style="border:1px solid #b9c2cc"${
|
|
2858
|
+
e += `<td style="border:1px solid #b9c2cc"${n}>${r || "<br>"}</td>`;
|
|
2857
2859
|
}
|
|
2858
2860
|
e += "</tr>";
|
|
2859
2861
|
}
|
|
@@ -2863,11 +2865,11 @@ class vi {
|
|
|
2863
2865
|
async function bi(u) {
|
|
2864
2866
|
const t = u instanceof ArrayBuffer ? u : await u.arrayBuffer(), e = mi(t), i = new TextDecoder(), s = async (y) => {
|
|
2865
2867
|
const g = e.get(y);
|
|
2866
|
-
return g ? new DOMParser().parseFromString(i.decode(await
|
|
2867
|
-
},
|
|
2868
|
+
return g ? new DOMParser().parseFromString(i.decode(await ne(t, g)), "application/xml") : null;
|
|
2869
|
+
}, l = await s("word/document.xml"), n = l == null ? void 0 : l.getElementsByTagName("*");
|
|
2868
2870
|
let r = null;
|
|
2869
|
-
if (
|
|
2870
|
-
for (const y of Array.from(
|
|
2871
|
+
if (n) {
|
|
2872
|
+
for (const y of Array.from(n))
|
|
2871
2873
|
if (y.localName === "body") {
|
|
2872
2874
|
r = y;
|
|
2873
2875
|
break;
|
|
@@ -2885,10 +2887,10 @@ async function bi(u) {
|
|
|
2885
2887
|
for (const [y, g] of c) {
|
|
2886
2888
|
const x = g.startsWith("/") ? g.slice(1) : "word/" + g.replace(/^\.\//, ""), w = e.get(x);
|
|
2887
2889
|
if (!w) continue;
|
|
2888
|
-
const E = (x.split(".").pop() || "").toLowerCase(),
|
|
2889
|
-
if (
|
|
2890
|
+
const E = (x.split(".").pop() || "").toLowerCase(), A = fi[E];
|
|
2891
|
+
if (A)
|
|
2890
2892
|
try {
|
|
2891
|
-
p.set(y, `data:${
|
|
2893
|
+
p.set(y, `data:${A};base64,${gi(await ne(t, w))}`);
|
|
2892
2894
|
} catch {
|
|
2893
2895
|
}
|
|
2894
2896
|
}
|
|
@@ -2897,12 +2899,12 @@ async function bi(u) {
|
|
|
2897
2899
|
const y = /* @__PURE__ */ new Map(), g = Array.from(b.getElementsByTagName("*"));
|
|
2898
2900
|
for (const x of g) {
|
|
2899
2901
|
if (x.localName !== "abstractNum") continue;
|
|
2900
|
-
const w = q(x, "abstractNumId"), E = dt(x, "lvl").find((H) => q(H, "ilvl") === "0") || dt(x, "lvl")[0],
|
|
2901
|
-
y.set(w,
|
|
2902
|
+
const w = q(x, "abstractNumId"), E = dt(x, "lvl").find((H) => q(H, "ilvl") === "0") || dt(x, "lvl")[0], A = E ? q(B(E, "numFmt")) : "";
|
|
2903
|
+
y.set(w, A === "bullet" ? "ul" : "ol");
|
|
2902
2904
|
}
|
|
2903
2905
|
for (const x of g) {
|
|
2904
2906
|
if (x.localName !== "num") continue;
|
|
2905
|
-
const w = q(x, "numId"), E = q(
|
|
2907
|
+
const w = q(x, "numId"), E = q(B(x, "abstractNumId"));
|
|
2906
2908
|
m.set(w, y.get(E) || "ul");
|
|
2907
2909
|
}
|
|
2908
2910
|
}
|
|
@@ -2919,7 +2921,7 @@ const yi = ["nw", "ne", "sw", "se"], wt = ["img-left", "img-right", "img-top", "
|
|
|
2919
2921
|
"img-top": h.tpltop,
|
|
2920
2922
|
"img-center": h.tplcenter
|
|
2921
2923
|
}, Ci = ".tox,.pop,.tblctx,.imgctx,.selctx,.dlg";
|
|
2922
|
-
let Z = null, X = null, St = 0,
|
|
2924
|
+
let Z = null, X = null, St = 0, ae = !1;
|
|
2923
2925
|
function ct() {
|
|
2924
2926
|
clearTimeout(St), X = null, Z && Z.classList.remove("show");
|
|
2925
2927
|
}
|
|
@@ -2931,15 +2933,15 @@ function wi(u) {
|
|
|
2931
2933
|
St = window.setTimeout(() => {
|
|
2932
2934
|
if (X !== u || !document.contains(u)) return;
|
|
2933
2935
|
Z || (Z = document.createElement("div"), Z.className = "etip", document.body.appendChild(Z)), Z.textContent = t, Z.classList.add("show");
|
|
2934
|
-
const i = u.getBoundingClientRect(), s = Z.offsetWidth,
|
|
2935
|
-
let
|
|
2936
|
-
|
|
2936
|
+
const i = u.getBoundingClientRect(), s = Z.offsetWidth, l = Z.offsetHeight;
|
|
2937
|
+
let n = i.left + i.width / 2 - s / 2;
|
|
2938
|
+
n = Math.max(6, Math.min(n, innerWidth - s - 6));
|
|
2937
2939
|
let r = i.bottom + 7;
|
|
2938
|
-
r +
|
|
2940
|
+
r + l > innerHeight - 6 && (r = i.top - l - 7), Z.style.left = n + "px", Z.style.top = r + "px";
|
|
2939
2941
|
}, e);
|
|
2940
2942
|
}
|
|
2941
2943
|
function Ti() {
|
|
2942
|
-
|
|
2944
|
+
ae || (ae = !0, document.addEventListener("mouseover", (u) => {
|
|
2943
2945
|
const t = u.target, e = t.closest ? t.closest("[title],[data-tip]") : null;
|
|
2944
2946
|
if (!e || !e.closest(Ci) || e.closest(".earea")) {
|
|
2945
2947
|
e !== X && ct();
|
|
@@ -2968,7 +2970,7 @@ let Ei = (j = class {
|
|
|
2968
2970
|
statusbar: t.statusbar ?? !0,
|
|
2969
2971
|
readonly: t.readonly ?? !1,
|
|
2970
2972
|
draftKey: t.draftKey ?? (typeof location < "u" ? location.pathname : "default"),
|
|
2971
|
-
fontFamilyFormats: t.fontFamilyFormats ??
|
|
2973
|
+
fontFamilyFormats: t.fontFamilyFormats ?? Xe,
|
|
2972
2974
|
imageFileTypes: t.imageFileTypes ?? ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/bmp", "image/webp"],
|
|
2973
2975
|
videoFileTypes: t.videoFileTypes ?? ["video/mp4", "video/webm", "video/ogg"]
|
|
2974
2976
|
}, this.imageUploadHandler = t.imageUploadHandler, this.onImageUploadError = t.onImageUploadError, this.videoUploadHandler = t.videoUploadHandler, this.onVideoUploadError = t.onVideoUploadError, this.contentStyle = t.contentStyle, this.applyTheme(t), this.lang = this.options.language, this.draftStorageKey = "tmclone-draft:" + this.options.draftKey, this.initDOM(), this.bindEvents(), this.initUI(), this.recordRevision(), this.options.onReady(this);
|
|
@@ -3012,14 +3014,14 @@ let Ei = (j = class {
|
|
|
3012
3014
|
}
|
|
3013
3015
|
bindGrip(t) {
|
|
3014
3016
|
let e = 0, i = 0;
|
|
3015
|
-
const s = (
|
|
3016
|
-
e =
|
|
3017
|
-
const
|
|
3017
|
+
const s = (l) => {
|
|
3018
|
+
e = l.clientY, i = this.ed.offsetHeight, l.preventDefault();
|
|
3019
|
+
const n = (o) => {
|
|
3018
3020
|
this.ed.style.height = Math.max(120, i + o.clientY - e) + "px";
|
|
3019
3021
|
}, r = () => {
|
|
3020
|
-
window.removeEventListener("mousemove",
|
|
3022
|
+
window.removeEventListener("mousemove", n), window.removeEventListener("mouseup", r);
|
|
3021
3023
|
};
|
|
3022
|
-
window.addEventListener("mousemove",
|
|
3024
|
+
window.addEventListener("mousemove", n), window.addEventListener("mouseup", r);
|
|
3023
3025
|
};
|
|
3024
3026
|
t.addEventListener("mousedown", s), this.listeners.push(() => t.removeEventListener("mousedown", s));
|
|
3025
3027
|
}
|
|
@@ -3037,11 +3039,11 @@ let Ei = (j = class {
|
|
|
3037
3039
|
}), this.on(this.ed, "keydown", (t) => {
|
|
3038
3040
|
t.altKey && t.key === "0" && (t.preventDefault(), this.helpDlg()), (t.key === "Delete" || t.key === "Backspace") && this.phActive && (t.preventDefault(), this.removeImgPlaceholder()), (t.key === "Delete" || t.key === "Backspace") && this.vphActive && (t.preventDefault(), this.removeVphPlaceholder()), t.key === "`" && !t.ctrlKey && !t.metaKey && !t.altKey && this.tryCodeTyping(t);
|
|
3039
3041
|
}), this.on(this.ed, "paste", (t) => this.handlePaste(t)), this.on(this.ed, "drop", (t) => {
|
|
3040
|
-
var
|
|
3042
|
+
var l, n, r, o;
|
|
3041
3043
|
t.preventDefault();
|
|
3042
|
-
const e = t.target, i = (
|
|
3044
|
+
const e = t.target, i = (l = e.closest) == null ? void 0 : l.call(e, ".img-ph:not(.vid-ph)");
|
|
3043
3045
|
if (i && this.ed.contains(i) && !this.options.readonly) {
|
|
3044
|
-
const c = Array.from(((
|
|
3046
|
+
const c = Array.from(((n = t.dataTransfer) == null ? void 0 : n.files) || []).find((d) => d.type.startsWith("image/"));
|
|
3045
3047
|
c && this.readImageFileInto(c, i);
|
|
3046
3048
|
return;
|
|
3047
3049
|
}
|
|
@@ -3056,10 +3058,10 @@ let Ei = (j = class {
|
|
|
3056
3058
|
i && this.ed.contains(i) ? this.selectTableForResize(i) : this.clearTableHandles();
|
|
3057
3059
|
const s = (p = e.closest) == null ? void 0 : p.call(e, ".img-ph:not(.vid-ph)");
|
|
3058
3060
|
s && this.ed.contains(s) && !this.options.readonly ? (t.preventDefault(), this.ed.focus(), this.selectImgPlaceholder(s)) : this.clearImgPlaceholderSel();
|
|
3059
|
-
const
|
|
3060
|
-
|
|
3061
|
-
const
|
|
3062
|
-
|
|
3061
|
+
const l = (m = e.closest) == null ? void 0 : m.call(e, ".vid-ph");
|
|
3062
|
+
l && this.ed.contains(l) && !this.options.readonly ? (t.preventDefault(), this.ed.focus(), this.selectVphPlaceholder(l)) : this.clearVphPlaceholderSel();
|
|
3063
|
+
const n = (b = e.closest) == null ? void 0 : b.call(e, ".tpl");
|
|
3064
|
+
n && this.ed.contains(n) && !this.options.readonly ? this.selectTemplate(n) : this.clearTplSel();
|
|
3063
3065
|
const r = (y = e.closest) == null ? void 0 : y.call(e, "pre.code-block");
|
|
3064
3066
|
r && this.ed.contains(r) && !this.options.readonly ? (t.preventDefault(), this.selectCodeEl(r)) : this.clearCodeSel();
|
|
3065
3067
|
const o = (g = e.closest) == null ? void 0 : g.call(e, "img");
|
|
@@ -3072,11 +3074,11 @@ let Ei = (j = class {
|
|
|
3072
3074
|
const e = (s = (i = t.target).closest) == null ? void 0 : s.call(i, "img");
|
|
3073
3075
|
e && this.ed.contains(e) && (this.cancelImgHide(), this.selectImage(e));
|
|
3074
3076
|
}), this.on(this.ed, "mouseout", (t) => {
|
|
3075
|
-
var s,
|
|
3076
|
-
const e = (
|
|
3077
|
+
var s, l, n, r;
|
|
3078
|
+
const e = (l = (s = t.target).closest) == null ? void 0 : l.call(s, "img");
|
|
3077
3079
|
if (!e) return;
|
|
3078
3080
|
const i = t.relatedTarget;
|
|
3079
|
-
i && ((
|
|
3081
|
+
i && ((n = this.imgCtx) != null && n.contains(i) || this.imgHandles.some((o) => o.contains(i)) || ((r = i.closest) == null ? void 0 : r.call(i, "img")) === e) || this.scheduleImgHide();
|
|
3080
3082
|
}), this.on(this.ed, "scroll", () => {
|
|
3081
3083
|
this.positionTableHandles(), this.positionImageHandles(), this.positionImgPhCtx(), this.positionTplCtx(), this.positionVphCtx(), this.positionVidCtx(), this.positionCodeCtx();
|
|
3082
3084
|
}), this.onWin(
|
|
@@ -3253,9 +3255,9 @@ let Ei = (j = class {
|
|
|
3253
3255
|
i.className = "revlist";
|
|
3254
3256
|
const s = document.createElement("div");
|
|
3255
3257
|
s.className = "revprev";
|
|
3256
|
-
const
|
|
3257
|
-
|
|
3258
|
-
let
|
|
3258
|
+
const l = document.createElement("button");
|
|
3259
|
+
l.type = "button", l.className = "revrestore", l.textContent = this.t("restore");
|
|
3260
|
+
let n = this.revisions.length - 1;
|
|
3259
3261
|
const r = new Intl.DateTimeFormat(this.lang === "ar" ? "ar-AE" : "en-GB", {
|
|
3260
3262
|
year: "numeric",
|
|
3261
3263
|
month: "short",
|
|
@@ -3264,10 +3266,10 @@ let Ei = (j = class {
|
|
|
3264
3266
|
minute: "2-digit",
|
|
3265
3267
|
second: "2-digit"
|
|
3266
3268
|
}), o = {}, c = (d) => {
|
|
3267
|
-
|
|
3269
|
+
n = d, this.revisions.forEach((p, m) => {
|
|
3268
3270
|
var b;
|
|
3269
3271
|
return (b = o[m]) == null ? void 0 : b.classList.toggle("on", m === d);
|
|
3270
|
-
}), s.innerHTML = this.revisions[d].html,
|
|
3272
|
+
}), s.innerHTML = this.revisions[d].html, l.disabled = d === this.revisions.length - 1;
|
|
3271
3273
|
};
|
|
3272
3274
|
for (let d = this.revisions.length - 1; d >= 0; d--) {
|
|
3273
3275
|
const p = this.revisions[d], m = document.createElement("button");
|
|
@@ -3275,10 +3277,10 @@ let Ei = (j = class {
|
|
|
3275
3277
|
const b = (new DOMParser().parseFromString(p.html, "text/html").body.textContent || "").trim(), y = b ? b.split(/\s+/).length : 0, g = d === this.revisions.length - 1;
|
|
3276
3278
|
m.innerHTML = `<span>${g ? this.t("currentver") : r.format(new Date(p.time))}</span><span class="wc">${y} ${this.t("words")}</span>`, m.addEventListener("click", () => c(d)), o[d] = m, i.appendChild(m);
|
|
3277
3279
|
}
|
|
3278
|
-
i.append(
|
|
3279
|
-
const d = this.revisions[
|
|
3280
|
+
i.append(l), l.addEventListener("click", () => {
|
|
3281
|
+
const d = this.revisions[n];
|
|
3280
3282
|
d && (this.recordRevision(), this.setContent(d.html), this.recordRevision(), this.closeDlg());
|
|
3281
|
-
}), e.append(i, s), t.appendChild(e), c(
|
|
3283
|
+
}), e.append(i, s), t.appendChild(e), c(n);
|
|
3282
3284
|
});
|
|
3283
3285
|
}
|
|
3284
3286
|
/* ---------------------------------------------------------- popups / menus */
|
|
@@ -3297,10 +3299,10 @@ let Ei = (j = class {
|
|
|
3297
3299
|
o.target.tagName !== "INPUT" && o.preventDefault();
|
|
3298
3300
|
}), document.body.appendChild(i);
|
|
3299
3301
|
const s = e.getBoundingClientRect();
|
|
3300
|
-
let
|
|
3301
|
-
|
|
3302
|
+
let n = this.dir() === "rtl" ? s.left - i.offsetWidth + 2 : s.right - 2;
|
|
3303
|
+
n = Math.max(8, Math.min(n + scrollX, scrollX + innerWidth - i.offsetWidth - 8));
|
|
3302
3304
|
let r = s.top + scrollY - 6;
|
|
3303
|
-
r = Math.max(8 + scrollY, Math.min(r, scrollY + innerHeight - i.offsetHeight - 8)), i.style.left =
|
|
3305
|
+
r = Math.max(8 + scrollY, Math.min(r, scrollY + innerHeight - i.offsetHeight - 8)), i.style.left = n + "px", i.style.top = r + "px", this.openSubEl = i;
|
|
3304
3306
|
}
|
|
3305
3307
|
popup(t, e, i) {
|
|
3306
3308
|
if (this.openPop && this.popAnchor === t) {
|
|
@@ -3310,9 +3312,9 @@ let Ei = (j = class {
|
|
|
3310
3312
|
this.closePop();
|
|
3311
3313
|
const s = document.createElement("div");
|
|
3312
3314
|
s.className = "pop" + (i ? " " + i : ""), s.dir = this.dir(), e(s), document.body.appendChild(s);
|
|
3313
|
-
const
|
|
3314
|
-
s.style.minWidth = Math.max(160, Math.round(
|
|
3315
|
-
let r = this.dir() === "rtl" ?
|
|
3315
|
+
const l = t.getBoundingClientRect();
|
|
3316
|
+
s.style.minWidth = Math.max(160, Math.round(l.width)) + "px", s.style.top = l.bottom + scrollY + 2 + "px";
|
|
3317
|
+
let r = this.dir() === "rtl" ? l.right - s.offsetWidth : l.left;
|
|
3316
3318
|
r = Math.max(8, Math.min(r + scrollX, scrollX + innerWidth - s.offsetWidth - 8)), s.style.left = r + "px", s.addEventListener("mousedown", (o) => {
|
|
3317
3319
|
o.target.tagName !== "INPUT" && o.preventDefault();
|
|
3318
3320
|
}), this.openPop = s, this.popAnchor = t, t.classList.add("open");
|
|
@@ -3323,22 +3325,22 @@ let Ei = (j = class {
|
|
|
3323
3325
|
t.insertAdjacentHTML("beforeend", '<div class="sep"></div>');
|
|
3324
3326
|
return;
|
|
3325
3327
|
}
|
|
3326
|
-
const s = !!(i.sub || i.subBuild),
|
|
3327
|
-
|
|
3328
|
+
const s = !!(i.sub || i.subBuild), l = document.createElement("button");
|
|
3329
|
+
l.className = "mi" + (i.on ? " on" : ""), l.innerHTML = `<span class="ic">${i.icon || ""}</span><span class="prev" ${i.previewStyle ? `style="${i.previewStyle}"` : ""}>${i.label}</span>${i.shortcut ? `<span class="sc">${i.shortcut}</span>` : ""}${s ? `<span class="subarrow">${h.chev}</span>` : ""}`, l.addEventListener("click", () => {
|
|
3328
3330
|
i.action && (this.closePop(), i.action());
|
|
3329
|
-
}),
|
|
3330
|
-
var
|
|
3331
|
-
s ? this.openSubFor(i,
|
|
3332
|
-
}),
|
|
3333
|
-
var
|
|
3334
|
-
return (
|
|
3335
|
-
}), t.appendChild(
|
|
3331
|
+
}), l.addEventListener("mouseenter", () => {
|
|
3332
|
+
var n;
|
|
3333
|
+
s ? this.openSubFor(i, l) : this.openSubEl && t !== this.openSubEl && this.closeSub(), (n = i.hover) == null || n.call(i, !0);
|
|
3334
|
+
}), l.addEventListener("mouseleave", () => {
|
|
3335
|
+
var n;
|
|
3336
|
+
return (n = i.hover) == null ? void 0 : n.call(i, !1);
|
|
3337
|
+
}), t.appendChild(l);
|
|
3336
3338
|
});
|
|
3337
3339
|
}
|
|
3338
3340
|
/* ---------------------------------------------------------- toolbar builders */
|
|
3339
3341
|
tbtn(t, e, i, s) {
|
|
3340
|
-
const
|
|
3341
|
-
return
|
|
3342
|
+
const l = document.createElement("button");
|
|
3343
|
+
return l.className = "tbtn", l.type = "button", l.title = e, l.innerHTML = t, s && (l.dataset.id = s), l.addEventListener("mousedown", (n) => n.preventDefault()), l.addEventListener("click", i), l;
|
|
3342
3344
|
}
|
|
3343
3345
|
/** Font-size increase / decrease step button. */
|
|
3344
3346
|
stepBtn(t) {
|
|
@@ -3347,19 +3349,19 @@ let Ei = (j = class {
|
|
|
3347
3349
|
}
|
|
3348
3350
|
/** Toolbar icon button that opens a popup menu anchored to itself. */
|
|
3349
3351
|
menuTbtn(t, e, i, s) {
|
|
3350
|
-
const
|
|
3351
|
-
return
|
|
3352
|
+
const l = this.tbtn(t, e, () => i(l), s);
|
|
3353
|
+
return l.classList.add("hasmenu"), l.insertAdjacentHTML("beforeend", h.chev), l.addEventListener("mousedown", () => this.saveSel()), l;
|
|
3352
3354
|
}
|
|
3353
3355
|
/** Quick text-color chips plus a "more" chip that opens the full palette. */
|
|
3354
3356
|
colorChips() {
|
|
3355
3357
|
const t = (s) => {
|
|
3356
|
-
const
|
|
3357
|
-
return
|
|
3358
|
-
|
|
3359
|
-
}),
|
|
3358
|
+
const l = document.createElement("button");
|
|
3359
|
+
return l.type = "button", l.className = "cchip", l.title = s, l.addEventListener("mousedown", (n) => {
|
|
3360
|
+
n.preventDefault(), this.saveSel();
|
|
3361
|
+
}), l;
|
|
3360
3362
|
}, e = Ke.map((s) => {
|
|
3361
|
-
const
|
|
3362
|
-
return
|
|
3363
|
+
const l = t(this.t("forecolor"));
|
|
3364
|
+
return l.style.background = s, l.addEventListener("click", () => this.applyColor("fore", s)), l;
|
|
3363
3365
|
}), i = t(this.t("forecolor"));
|
|
3364
3366
|
return i.classList.add("more"), i.dataset.cb = "fore", i.innerHTML = h.chev, i.addEventListener("click", () => this.colorMenu(i, "fore")), [...e, i];
|
|
3365
3367
|
}
|
|
@@ -3370,18 +3372,18 @@ let Ei = (j = class {
|
|
|
3370
3372
|
}), e;
|
|
3371
3373
|
}
|
|
3372
3374
|
tsel(t, e, i, s) {
|
|
3373
|
-
const
|
|
3374
|
-
return
|
|
3375
|
-
|
|
3376
|
-
}),
|
|
3375
|
+
const l = document.createElement("button");
|
|
3376
|
+
return l.className = "tsel " + t, l.type = "button", l.dataset.id = e, l.innerHTML = `<span class="lbl empty">${i || ""}</span>${h.chev}`, l.addEventListener("mousedown", (n) => {
|
|
3377
|
+
n.preventDefault(), this.saveSel();
|
|
3378
|
+
}), l.addEventListener("click", () => s(l)), l;
|
|
3377
3379
|
}
|
|
3378
3380
|
setListStyle(t, e) {
|
|
3379
|
-
var
|
|
3381
|
+
var l, n;
|
|
3380
3382
|
this.restoreSel();
|
|
3381
3383
|
const i = window.getSelection();
|
|
3382
3384
|
if (!i) return;
|
|
3383
|
-
let s = (
|
|
3384
|
-
s || (this.exec(t === "ol" ? "insertOrderedList" : "insertUnorderedList"), s = (
|
|
3385
|
+
let s = (l = this.closestBlock(i.anchorNode)) == null ? void 0 : l.closest(t);
|
|
3386
|
+
s || (this.exec(t === "ol" ? "insertOrderedList" : "insertUnorderedList"), s = (n = this.closestBlock(i.anchorNode)) == null ? void 0 : n.closest(t)), s && (s.style.listStyleType = e), this.saveSel(), this.onChange();
|
|
3385
3387
|
}
|
|
3386
3388
|
listMenu(t, e) {
|
|
3387
3389
|
var c;
|
|
@@ -3393,7 +3395,7 @@ let Ei = (j = class {
|
|
|
3393
3395
|
] : [
|
|
3394
3396
|
["circle", h.ul_circle],
|
|
3395
3397
|
["square", h.ul_square]
|
|
3396
|
-
],
|
|
3398
|
+
], l = this.tArr(e === "ol" ? "liststyles_ol" : "liststyles_ul").slice(1), n = window.getSelection(), r = n ? (c = this.closestBlock(n.anchorNode)) == null ? void 0 : c.closest(e) : null, o = r ? r.style.listStyleType : "";
|
|
3397
3399
|
this.popup(t, (d) => {
|
|
3398
3400
|
this.menuItems(d, [
|
|
3399
3401
|
{
|
|
@@ -3406,7 +3408,7 @@ let Ei = (j = class {
|
|
|
3406
3408
|
const p = document.createElement("div");
|
|
3407
3409
|
p.className = "mi-grid", s.forEach(([m, b], y) => {
|
|
3408
3410
|
const g = document.createElement("button");
|
|
3409
|
-
g.className = "mi" + (o === m ? " on" : ""), g.innerHTML = `<span class="ic">${b}</span><span class="prev">${
|
|
3411
|
+
g.className = "mi" + (o === m ? " on" : ""), g.innerHTML = `<span class="ic">${b}</span><span class="prev">${l[y]}</span>`, g.addEventListener("click", () => {
|
|
3410
3412
|
this.closePop(), this.setListStyle(e, m);
|
|
3411
3413
|
}), p.appendChild(g);
|
|
3412
3414
|
}), d.appendChild(p);
|
|
@@ -3423,10 +3425,10 @@ let Ei = (j = class {
|
|
|
3423
3425
|
this.closePop(), i(p);
|
|
3424
3426
|
}), s.appendChild(m);
|
|
3425
3427
|
}), t.appendChild(s), t.insertAdjacentHTML("beforeend", '<div class="sep"></div>');
|
|
3426
|
-
const
|
|
3427
|
-
|
|
3428
|
-
const
|
|
3429
|
-
r.className = "cswatch cur", r.title = this.t("currentcolor"), r.style.background =
|
|
3428
|
+
const l = document.createElement("div");
|
|
3429
|
+
l.className = "cfoot";
|
|
3430
|
+
const n = /^#[0-9a-f]{6}$/i.test(e) ? e : "#000000", r = document.createElement("div");
|
|
3431
|
+
r.className = "cswatch cur", r.title = this.t("currentcolor"), r.style.background = n, r.innerHTML = h.check;
|
|
3430
3432
|
const o = document.createElement("button");
|
|
3431
3433
|
o.type = "button", o.className = "cswatch nocolor", o.title = this.t("removecolor"), o.addEventListener("click", () => {
|
|
3432
3434
|
this.closePop(), i(null);
|
|
@@ -3434,16 +3436,16 @@ let Ei = (j = class {
|
|
|
3434
3436
|
const c = document.createElement("label");
|
|
3435
3437
|
c.className = "cswatch cwheel", c.title = this.t("customcolor"), c.innerHTML = h.palette;
|
|
3436
3438
|
const d = document.createElement("input");
|
|
3437
|
-
d.type = "color", d.value =
|
|
3439
|
+
d.type = "color", d.value = n, d.addEventListener("change", () => {
|
|
3438
3440
|
this.closePop(), i(d.value);
|
|
3439
|
-
}), c.appendChild(d),
|
|
3441
|
+
}), c.appendChild(d), l.append(r, o, c), t.appendChild(l);
|
|
3440
3442
|
}
|
|
3441
3443
|
colorMenu(t, e) {
|
|
3442
3444
|
this.popup(
|
|
3443
3445
|
t,
|
|
3444
3446
|
(i) => {
|
|
3445
3447
|
const s = e === "fore" ? this.foreColor : this.backColor;
|
|
3446
|
-
this.buildPaletteInto(i, s, (
|
|
3448
|
+
this.buildPaletteInto(i, s, (l) => this.applyColor(e, l));
|
|
3447
3449
|
},
|
|
3448
3450
|
e === "fore" ? "pop-forecolor" : "pop-backcolor"
|
|
3449
3451
|
);
|
|
@@ -3454,30 +3456,26 @@ let Ei = (j = class {
|
|
|
3454
3456
|
syncColorSwatches(t) {
|
|
3455
3457
|
t.querySelectorAll("[data-cb=fore]").forEach((e) => e.style.background = this.foreColor), t.querySelectorAll("[data-cb=back]").forEach((e) => e.style.background = this.backColor);
|
|
3456
3458
|
}
|
|
3459
|
+
fontItems() {
|
|
3460
|
+
return this.options.fontFamilyFormats.map(([t, e]) => ({
|
|
3461
|
+
label: t,
|
|
3462
|
+
previewStyle: `font-family:${e}`,
|
|
3463
|
+
on: this.currentFont() === t,
|
|
3464
|
+
action: () => this.exec("fontName", e)
|
|
3465
|
+
}));
|
|
3466
|
+
}
|
|
3457
3467
|
fontMenu(t) {
|
|
3458
|
-
this.popup(t, (e) =>
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
}))
|
|
3467
|
-
);
|
|
3468
|
-
});
|
|
3468
|
+
this.popup(t, (e) => this.menuItems(e, this.fontItems()));
|
|
3469
|
+
}
|
|
3470
|
+
sizeItems() {
|
|
3471
|
+
return Ye.map((t) => ({
|
|
3472
|
+
label: t,
|
|
3473
|
+
on: this.currentSize() === t,
|
|
3474
|
+
action: () => this.applyFontSize(t)
|
|
3475
|
+
}));
|
|
3469
3476
|
}
|
|
3470
3477
|
sizeMenu(t) {
|
|
3471
|
-
this.popup(t, (e) =>
|
|
3472
|
-
this.menuItems(
|
|
3473
|
-
e,
|
|
3474
|
-
Ue.map((i) => ({
|
|
3475
|
-
label: i,
|
|
3476
|
-
on: this.currentSize() === i,
|
|
3477
|
-
action: () => this.applyFontSize(i)
|
|
3478
|
-
}))
|
|
3479
|
-
);
|
|
3480
|
-
});
|
|
3478
|
+
this.popup(t, (e) => this.menuItems(e, this.sizeItems()));
|
|
3481
3479
|
}
|
|
3482
3480
|
/** Font sizing needs a non-collapsed range. With a bare caret, grow the
|
|
3483
3481
|
selection to the word under it; in an empty spot, select a zero-width
|
|
@@ -3486,16 +3484,16 @@ let Ei = (j = class {
|
|
|
3486
3484
|
const t = window.getSelection();
|
|
3487
3485
|
if (!t) return;
|
|
3488
3486
|
if (!t.rangeCount) {
|
|
3489
|
-
const
|
|
3490
|
-
|
|
3487
|
+
const n = document.createRange();
|
|
3488
|
+
n.selectNodeContents(this.ed), n.collapse(!0), t.addRange(n);
|
|
3491
3489
|
}
|
|
3492
3490
|
if (!t.isCollapsed) return;
|
|
3493
3491
|
const e = t.getRangeAt(0), i = e.startContainer;
|
|
3494
3492
|
if (i.nodeType === 3) {
|
|
3495
|
-
const
|
|
3493
|
+
const n = i.data;
|
|
3496
3494
|
let r = e.startOffset, o = e.startOffset;
|
|
3497
|
-
for (; r > 0 && /\S/.test(
|
|
3498
|
-
for (; o <
|
|
3495
|
+
for (; r > 0 && /\S/.test(n[r - 1]); ) r--;
|
|
3496
|
+
for (; o < n.length && /\S/.test(n[o]); ) o++;
|
|
3499
3497
|
if (o > r) {
|
|
3500
3498
|
const c = document.createRange();
|
|
3501
3499
|
c.setStart(i, r), c.setEnd(i, o), t.removeAllRanges(), t.addRange(c), this.savedRange = c.cloneRange();
|
|
@@ -3504,8 +3502,8 @@ let Ei = (j = class {
|
|
|
3504
3502
|
}
|
|
3505
3503
|
const s = document.createTextNode("");
|
|
3506
3504
|
e.insertNode(s);
|
|
3507
|
-
const
|
|
3508
|
-
|
|
3505
|
+
const l = document.createRange();
|
|
3506
|
+
l.setStart(s, 0), l.setEnd(s, 1), t.removeAllRanges(), t.addRange(l), this.savedRange = l.cloneRange();
|
|
3509
3507
|
}
|
|
3510
3508
|
applyFontSize(t) {
|
|
3511
3509
|
this.restoreSel(), this.ensureSizeTarget(), document.execCommand("styleWithCSS", !1, "false"), document.execCommand("fontSize", !1, "7");
|
|
@@ -3523,7 +3521,7 @@ let Ei = (j = class {
|
|
|
3523
3521
|
this.saveSel(), this.refreshState(), this.onChange();
|
|
3524
3522
|
}
|
|
3525
3523
|
stepFontSize(t) {
|
|
3526
|
-
const e = parseInt(this.currentSize(), 10) || 14, i = Math.min(
|
|
3524
|
+
const e = parseInt(this.currentSize(), 10) || 14, i = Math.min(Qe, Math.max(Ge, e + t));
|
|
3527
3525
|
i !== e && this.applyFontSize(i + "px");
|
|
3528
3526
|
}
|
|
3529
3527
|
/* ------------------------------------------------ case / spacing / link */
|
|
@@ -3531,10 +3529,10 @@ let Ei = (j = class {
|
|
|
3531
3529
|
this.restoreSel();
|
|
3532
3530
|
const e = window.getSelection();
|
|
3533
3531
|
if (!e || !e.rangeCount || e.isCollapsed) return;
|
|
3534
|
-
const i = e.getRangeAt(0), s = document.createTreeWalker(this.ed, NodeFilter.SHOW_TEXT),
|
|
3535
|
-
let
|
|
3536
|
-
for (;
|
|
3537
|
-
|
|
3532
|
+
const i = e.getRangeAt(0), s = document.createTreeWalker(this.ed, NodeFilter.SHOW_TEXT), l = [];
|
|
3533
|
+
let n;
|
|
3534
|
+
for (; n = s.nextNode(); ) i.intersectsNode(n) && l.push(n);
|
|
3535
|
+
l.forEach((r) => {
|
|
3538
3536
|
const o = r === i.startContainer ? i.startOffset : 0, c = r === i.endContainer ? i.endOffset : r.data.length;
|
|
3539
3537
|
if (c <= o) return;
|
|
3540
3538
|
const d = r.data.slice(o, c);
|
|
@@ -3542,64 +3540,46 @@ let Ei = (j = class {
|
|
|
3542
3540
|
t === "lower" ? p = d.toLowerCase() : t === "upper" ? p = d.toUpperCase() : p = d.replace(/(^|\s)(\S)/g, (m, b, y) => b + y.toUpperCase()), r.replaceData(o, c - o, p);
|
|
3543
3541
|
}), this.saveSel(), this.refreshState(), this.onChange();
|
|
3544
3542
|
}
|
|
3543
|
+
caseItems() {
|
|
3544
|
+
return [
|
|
3545
|
+
{ label: this.t("lowercase"), icon: h.lowercaseic, action: () => this.transformCase("lower") },
|
|
3546
|
+
{ label: this.t("uppercase"), icon: h.uppercaseic, action: () => this.transformCase("upper") },
|
|
3547
|
+
{ label: this.t("capitalize"), icon: h.capitalizeic, action: () => this.transformCase("capitalize") }
|
|
3548
|
+
];
|
|
3549
|
+
}
|
|
3545
3550
|
caseMenu(t) {
|
|
3546
|
-
this.popup(t, (e) =>
|
|
3547
|
-
this.menuItems(e, [
|
|
3548
|
-
{ label: this.t("lowercase"), icon: h.lowercaseic, action: () => this.transformCase("lower") },
|
|
3549
|
-
{ label: this.t("uppercase"), icon: h.uppercaseic, action: () => this.transformCase("upper") },
|
|
3550
|
-
{ label: this.t("capitalize"), icon: h.capitalizeic, action: () => this.transformCase("capitalize") }
|
|
3551
|
-
]);
|
|
3552
|
-
});
|
|
3551
|
+
this.popup(t, (e) => this.menuItems(e, this.caseItems()));
|
|
3553
3552
|
}
|
|
3554
3553
|
applyBlockStyle(t, e) {
|
|
3555
3554
|
this.restoreSel();
|
|
3556
3555
|
const i = this.selectedBlocks(), s = t === "lineHeight" ? "line-height" : t === "wordSpacing" ? "word-spacing" : "letter-spacing";
|
|
3557
|
-
i.forEach((
|
|
3558
|
-
e ?
|
|
3556
|
+
i.forEach((l) => {
|
|
3557
|
+
e ? l.style[t] = e : l.style.removeProperty(s);
|
|
3559
3558
|
}), this.saveSel(), this.onChange();
|
|
3560
3559
|
}
|
|
3561
3560
|
currentBlockStyle(t) {
|
|
3562
3561
|
const e = window.getSelection(), i = e ? this.closestBlock(e.anchorNode) : null;
|
|
3563
3562
|
return i && i.style[t] || "";
|
|
3564
3563
|
}
|
|
3564
|
+
blockStyleItems(t, e) {
|
|
3565
|
+
const i = this.currentBlockStyle(t);
|
|
3566
|
+
return [
|
|
3567
|
+
{ label: this.t("normal"), on: !i, action: () => this.applyBlockStyle(t, "") },
|
|
3568
|
+
...e.map((s) => ({
|
|
3569
|
+
label: s,
|
|
3570
|
+
on: i === s,
|
|
3571
|
+
action: () => this.applyBlockStyle(t, s)
|
|
3572
|
+
}))
|
|
3573
|
+
];
|
|
3574
|
+
}
|
|
3565
3575
|
lineHeightMenu(t) {
|
|
3566
|
-
|
|
3567
|
-
this.popup(t, (i) => {
|
|
3568
|
-
this.menuItems(i, [
|
|
3569
|
-
{ label: this.t("normal"), on: !e, action: () => this.applyBlockStyle("lineHeight", "") },
|
|
3570
|
-
...Ye.map((s) => ({
|
|
3571
|
-
label: s,
|
|
3572
|
-
on: e === s,
|
|
3573
|
-
action: () => this.applyBlockStyle("lineHeight", s)
|
|
3574
|
-
}))
|
|
3575
|
-
]);
|
|
3576
|
-
});
|
|
3576
|
+
this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("lineHeight", Jt)));
|
|
3577
3577
|
}
|
|
3578
3578
|
wordSpacingMenu(t) {
|
|
3579
|
-
|
|
3580
|
-
this.popup(t, (i) => {
|
|
3581
|
-
this.menuItems(i, [
|
|
3582
|
-
{ label: this.t("normal"), on: !e, action: () => this.applyBlockStyle("wordSpacing", "") },
|
|
3583
|
-
...Ge.map((s) => ({
|
|
3584
|
-
label: s,
|
|
3585
|
-
on: e === s,
|
|
3586
|
-
action: () => this.applyBlockStyle("wordSpacing", s)
|
|
3587
|
-
}))
|
|
3588
|
-
]);
|
|
3589
|
-
});
|
|
3579
|
+
this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("wordSpacing", te)));
|
|
3590
3580
|
}
|
|
3591
3581
|
letterSpacingMenu(t) {
|
|
3592
|
-
|
|
3593
|
-
this.popup(t, (i) => {
|
|
3594
|
-
this.menuItems(i, [
|
|
3595
|
-
{ label: this.t("normal"), on: !e, action: () => this.applyBlockStyle("letterSpacing", "") },
|
|
3596
|
-
...Qe.map((s) => ({
|
|
3597
|
-
label: s,
|
|
3598
|
-
on: e === s,
|
|
3599
|
-
action: () => this.applyBlockStyle("letterSpacing", s)
|
|
3600
|
-
}))
|
|
3601
|
-
]);
|
|
3602
|
-
});
|
|
3582
|
+
this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("letterSpacing", ee)));
|
|
3603
3583
|
}
|
|
3604
3584
|
closestAnchor() {
|
|
3605
3585
|
const t = window.getSelection();
|
|
@@ -3620,8 +3600,8 @@ let Ei = (j = class {
|
|
|
3620
3600
|
action: () => {
|
|
3621
3601
|
const s = document.createRange();
|
|
3622
3602
|
s.selectNodeContents(t);
|
|
3623
|
-
const
|
|
3624
|
-
|
|
3603
|
+
const l = window.getSelection();
|
|
3604
|
+
l && (l.removeAllRanges(), l.addRange(s)), document.execCommand("unlink"), this.closeDlg(), this.onChange();
|
|
3625
3605
|
}
|
|
3626
3606
|
}), i.push(
|
|
3627
3607
|
{ label: this.t("cancel"), action: () => this.closeDlg() },
|
|
@@ -3636,33 +3616,44 @@ let Ei = (j = class {
|
|
|
3636
3616
|
return;
|
|
3637
3617
|
}
|
|
3638
3618
|
this.restoreSel();
|
|
3639
|
-
const
|
|
3640
|
-
!
|
|
3619
|
+
const l = window.getSelection();
|
|
3620
|
+
!l || l.isCollapsed ? document.execCommand("insertHTML", !1, `<a href="${s.replace(/"/g, """)}">${s.replace(/&/g, "&").replace(/</g, "<")}</a>`) : (document.execCommand("styleWithCSS", !1, "false"), document.execCommand("createLink", !1, s)), this.saveSel(), this.onChange();
|
|
3641
3621
|
}
|
|
3642
3622
|
}
|
|
3643
3623
|
), this.dialog(
|
|
3644
3624
|
this.t("linkttl"),
|
|
3645
3625
|
(s) => {
|
|
3646
|
-
const
|
|
3647
|
-
|
|
3648
|
-
const
|
|
3649
|
-
|
|
3626
|
+
const l = document.createElement("div");
|
|
3627
|
+
l.style.cssText = "display:flex;align-items:center;gap:10px;margin:10px 0;min-width:360px";
|
|
3628
|
+
const n = document.createElement("span");
|
|
3629
|
+
n.style.cssText = "width:60px;color:#556;flex:none", n.textContent = this.t("linkurl"), e = document.createElement("input"), e.type = "url", e.placeholder = "https://", e.style.cssText = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", e.value = (t == null ? void 0 : t.getAttribute("href")) || "", l.append(n, e), s.appendChild(l), setTimeout(() => e.focus(), 0);
|
|
3650
3630
|
},
|
|
3651
3631
|
i
|
|
3652
3632
|
);
|
|
3653
3633
|
}
|
|
3634
|
+
blockItems() {
|
|
3635
|
+
return se.map(([t]) => ({
|
|
3636
|
+
label: this.blockLabel(t),
|
|
3637
|
+
previewStyle: t.startsWith("h") ? `font-weight:700;font-size:${22 - 2 * +t[1]}px` : t === "pre" ? "font-family:monospace" : "",
|
|
3638
|
+
on: this.currentBlock() === t,
|
|
3639
|
+
action: () => this.exec("formatBlock", "<" + t + ">")
|
|
3640
|
+
}));
|
|
3641
|
+
}
|
|
3654
3642
|
blocksMenu(t) {
|
|
3655
|
-
this.popup(t, (e) =>
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
)
|
|
3665
|
-
|
|
3643
|
+
this.popup(t, (e) => this.menuItems(e, this.blockItems()));
|
|
3644
|
+
}
|
|
3645
|
+
alignItems() {
|
|
3646
|
+
return [
|
|
3647
|
+
["justifyLeft", "alignleft", h.alignleft],
|
|
3648
|
+
["justifyCenter", "aligncenter", h.aligncenter],
|
|
3649
|
+
["justifyRight", "alignright", h.alignright],
|
|
3650
|
+
["justifyFull", "alignjustify", h.alignjustify]
|
|
3651
|
+
].map(([e, i, s]) => ({
|
|
3652
|
+
label: this.t(i),
|
|
3653
|
+
icon: s,
|
|
3654
|
+
on: document.queryCommandState(e),
|
|
3655
|
+
action: () => this.exec(e)
|
|
3656
|
+
}));
|
|
3666
3657
|
}
|
|
3667
3658
|
blockLabel(t) {
|
|
3668
3659
|
return t === "p" ? this.t("para") : t === "pre" ? this.t("pre") : this.t("heading") + " " + t[1];
|
|
@@ -3676,19 +3667,19 @@ let Ei = (j = class {
|
|
|
3676
3667
|
i.className = "tgridwrap";
|
|
3677
3668
|
const s = document.createElement("div");
|
|
3678
3669
|
s.className = "tgrid";
|
|
3679
|
-
const
|
|
3680
|
-
|
|
3681
|
-
const
|
|
3670
|
+
const l = document.createElement("div");
|
|
3671
|
+
l.className = "tgridlbl", l.textContent = "1 × 1";
|
|
3672
|
+
const n = [];
|
|
3682
3673
|
for (let r = 0; r < 8; r++)
|
|
3683
3674
|
for (let o = 0; o < 10; o++) {
|
|
3684
3675
|
const c = document.createElement("span");
|
|
3685
3676
|
c.dataset.r = String(r), c.dataset.c = String(o), c.addEventListener("mouseenter", () => {
|
|
3686
|
-
|
|
3677
|
+
n.forEach((d) => d.classList.toggle("hot", +d.dataset.r <= r && +d.dataset.c <= o)), l.textContent = o + 1 + " × " + (r + 1);
|
|
3687
3678
|
}), c.addEventListener("click", () => {
|
|
3688
3679
|
this.closePop(), this.insertTable(r + 1, o + 1), e == null || e();
|
|
3689
|
-
}),
|
|
3680
|
+
}), n.push(c), s.appendChild(c);
|
|
3690
3681
|
}
|
|
3691
|
-
i.append(s,
|
|
3682
|
+
i.append(s, l), t.appendChild(i);
|
|
3692
3683
|
}
|
|
3693
3684
|
}
|
|
3694
3685
|
insertTable(t, e) {
|
|
@@ -3696,7 +3687,7 @@ let Ei = (j = class {
|
|
|
3696
3687
|
let i = '<table style="border-collapse:collapse;width:100%;table-layout:fixed"><tbody>';
|
|
3697
3688
|
for (let s = 0; s < t; s++) {
|
|
3698
3689
|
i += "<tr>";
|
|
3699
|
-
for (let
|
|
3690
|
+
for (let l = 0; l < e; l++) i += '<td style="border:1px solid #b9c2cc"><br></td>';
|
|
3700
3691
|
i += "</tr>";
|
|
3701
3692
|
}
|
|
3702
3693
|
i += "</tbody></table><p><br></p>", document.execCommand("insertHTML", !1, i), this.saveSel(), this.onChange();
|
|
@@ -3771,16 +3762,16 @@ let Ei = (j = class {
|
|
|
3771
3762
|
}
|
|
3772
3763
|
buildToolbar() {
|
|
3773
3764
|
this.toolbar.innerHTML = "";
|
|
3774
|
-
const t = this.options.toolbar === !0 ?
|
|
3765
|
+
const t = this.options.toolbar === !0 ? Ue : this.options.toolbar, e = this.buildToolbarRegistry();
|
|
3775
3766
|
this.parseToolbarString(t).forEach((i) => {
|
|
3776
3767
|
const s = [];
|
|
3777
|
-
i.forEach((
|
|
3778
|
-
const
|
|
3779
|
-
if (!
|
|
3780
|
-
console.warn(`FableEditor: unknown toolbar item "${
|
|
3768
|
+
i.forEach((l) => {
|
|
3769
|
+
const n = e[l];
|
|
3770
|
+
if (!n) {
|
|
3771
|
+
console.warn(`FableEditor: unknown toolbar item "${l}"`);
|
|
3781
3772
|
return;
|
|
3782
3773
|
}
|
|
3783
|
-
const r =
|
|
3774
|
+
const r = n();
|
|
3784
3775
|
Array.isArray(r) ? s.push(...r) : s.push(r);
|
|
3785
3776
|
}), s.length && this.toolbar.appendChild(this.group(...s));
|
|
3786
3777
|
}), this.tbrMore = this.tbtn(h.more, this.t("more"), () => {
|
|
@@ -3875,10 +3866,28 @@ let Ei = (j = class {
|
|
|
3875
3866
|
this.mItem("superscript", h.superscriptic, () => this.exec("superscript")),
|
|
3876
3867
|
this.mItem("subscript", h.subscriptic, () => this.exec("subscript")),
|
|
3877
3868
|
this.mItem("code", h.inlinecodeic, () => this.toggleInlineCode()),
|
|
3869
|
+
this.mItem("quote", h.quote, () => this.toggleBlock("blockquote")),
|
|
3870
|
+
"|",
|
|
3871
|
+
{ label: this.t("fontfamily"), subBuild: (s) => this.menuItems(s, this.fontItems()) },
|
|
3872
|
+
{ label: this.t("fontsize"), subBuild: (s) => this.menuItems(s, this.sizeItems()) },
|
|
3873
|
+
{ label: this.t("blocks"), subBuild: (s) => this.menuItems(s, this.blockItems()) },
|
|
3874
|
+
{ label: this.t("align"), subBuild: (s) => this.menuItems(s, this.alignItems()) },
|
|
3875
|
+
{ label: this.t("lineheight"), icon: h.lineheight, subBuild: (s) => this.menuItems(s, this.blockStyleItems("lineHeight", Jt)) },
|
|
3876
|
+
{ label: this.t("wordspacing"), icon: h.wordspacing, subBuild: (s) => this.menuItems(s, this.blockStyleItems("wordSpacing", te)) },
|
|
3877
|
+
{ label: this.t("letterspacing"), icon: h.letterspacing, subBuild: (s) => this.menuItems(s, this.blockStyleItems("letterSpacing", ee)) },
|
|
3878
|
+
"|",
|
|
3879
|
+
{ label: this.t("forecolor"), icon: h.palette, subBuild: (s) => this.buildPaletteInto(s, this.foreColor, (l) => this.applyColor("fore", l)) },
|
|
3880
|
+
{ label: this.t("backcolor"), icon: h.backcolor, subBuild: (s) => this.buildPaletteInto(s, this.backColor, (l) => this.applyColor("back", l)) },
|
|
3881
|
+
"|",
|
|
3882
|
+
this.mItem("bullist", h.bullist, () => this.exec("insertUnorderedList")),
|
|
3883
|
+
this.mItem("numlist", h.numlist, () => this.exec("insertOrderedList")),
|
|
3884
|
+
this.mItem("outdent", h.outdent, () => this.exec("outdent")),
|
|
3885
|
+
this.mItem("indent", h.indent, () => this.exec("indent")),
|
|
3886
|
+
"|",
|
|
3887
|
+
this.mItem("ltr", h.ltr, () => this.setDir("ltr")),
|
|
3888
|
+
this.mItem("rtl", h.rtl, () => this.setDir("rtl")),
|
|
3878
3889
|
"|",
|
|
3879
|
-
this.
|
|
3880
|
-
this.mItem("uppercase", h.uppercaseic, () => this.transformCase("upper")),
|
|
3881
|
-
this.mItem("capitalize", h.capitalizeic, () => this.transformCase("capitalize")),
|
|
3890
|
+
{ label: this.t("changecase"), icon: h.caseic, sub: this.caseItems() },
|
|
3882
3891
|
"|",
|
|
3883
3892
|
this.mItem("clearformat", h.clearformatic, () => this.exec("removeFormat"))
|
|
3884
3893
|
],
|
|
@@ -3935,17 +3944,17 @@ let Ei = (j = class {
|
|
|
3935
3944
|
{ label: this.t("deltable"), icon: h.trash, action: () => this.tableOp("deltable") }
|
|
3936
3945
|
],
|
|
3937
3946
|
help: [this.mItem("helpttl", h.helpic, () => this.helpDlg(), "Alt+0")]
|
|
3938
|
-
}, e = this.options.menubar === !0 ?
|
|
3947
|
+
}, e = this.options.menubar === !0 ? ze : this.options.menubar, i = /* @__PURE__ */ new Set();
|
|
3939
3948
|
e.split(/\s+/).filter(Boolean).forEach((s) => {
|
|
3940
3949
|
if (i.has(s)) return;
|
|
3941
3950
|
if (i.add(s), !t[s]) {
|
|
3942
3951
|
console.warn(`FableEditor: unknown menubar item "${s}"`);
|
|
3943
3952
|
return;
|
|
3944
3953
|
}
|
|
3945
|
-
const
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
}),
|
|
3954
|
+
const l = document.createElement("button");
|
|
3955
|
+
l.type = "button", l.textContent = this.t(s), l.dataset.menuKey = s, l.addEventListener("mousedown", (n) => {
|
|
3956
|
+
n.preventDefault(), this.saveSel();
|
|
3957
|
+
}), l.addEventListener("click", () => this.popup(l, (n) => this.menuItems(n, t[s]))), this.menubar.appendChild(l);
|
|
3949
3958
|
});
|
|
3950
3959
|
}
|
|
3951
3960
|
/* ---------------------------------------------------------- table ops */
|
|
@@ -3956,7 +3965,7 @@ let Ei = (j = class {
|
|
|
3956
3965
|
if (!e) return;
|
|
3957
3966
|
const i = ((o = this.closestBlock(e.anchorNode)) == null ? void 0 : o.closest("td,th")) || (e.anchorNode && e.anchorNode.nodeType === 1 ? (d = (c = e.anchorNode).closest) == null ? void 0 : d.call(c, "td,th") : null);
|
|
3958
3967
|
if (!i) return;
|
|
3959
|
-
const s = i.parentElement,
|
|
3968
|
+
const s = i.parentElement, l = i.closest("table"), n = Array.from(s.children).indexOf(i), r = () => {
|
|
3960
3969
|
const p = s.cloneNode(!1);
|
|
3961
3970
|
return Array.from(s.children).forEach((m) => {
|
|
3962
3971
|
const b = document.createElement("td"), y = m.getAttribute("style");
|
|
@@ -3965,15 +3974,15 @@ let Ei = (j = class {
|
|
|
3965
3974
|
};
|
|
3966
3975
|
if (t === "rowabove" && s.before(r()), t === "rowbelow" && s.after(r()), t === "delrow") {
|
|
3967
3976
|
const p = s.parentElement;
|
|
3968
|
-
s.remove(), p.querySelector("tr") ||
|
|
3977
|
+
s.remove(), p.querySelector("tr") || l.remove();
|
|
3969
3978
|
}
|
|
3970
|
-
(t === "colbefore" || t === "colafter") &&
|
|
3971
|
-
const m = p.children[Math.min(
|
|
3979
|
+
(t === "colbefore" || t === "colafter") && l.querySelectorAll("tr").forEach((p) => {
|
|
3980
|
+
const m = p.children[Math.min(n, p.children.length - 1)], b = document.createElement("td"), y = m.getAttribute("style");
|
|
3972
3981
|
y && b.setAttribute("style", y), b.style.removeProperty("width"), b.style.removeProperty("background-color"), b.innerHTML = "<br>", t === "colbefore" ? m.before(b) : m.after(b);
|
|
3973
|
-
}), t === "delcol" && (
|
|
3982
|
+
}), t === "delcol" && (l.querySelectorAll("tr").forEach((p) => {
|
|
3974
3983
|
var m;
|
|
3975
|
-
return (m = p.children[
|
|
3976
|
-
}),
|
|
3984
|
+
return (m = p.children[n]) == null ? void 0 : m.remove();
|
|
3985
|
+
}), l.querySelector("td,th") || l.remove()), t === "deltable" && l.remove(), this.onChange(), this.positionTableHandles();
|
|
3977
3986
|
}
|
|
3978
3987
|
/** Reorders the current row/column: 'rowup'/'rowdown' swap the caret's row with
|
|
3979
3988
|
* its neighbour, 'colleft'/'colright' move the caret's column one position in
|
|
@@ -3982,7 +3991,7 @@ let Ei = (j = class {
|
|
|
3982
3991
|
this.restoreSel();
|
|
3983
3992
|
const e = this.currentCell();
|
|
3984
3993
|
if (!e) return;
|
|
3985
|
-
const i = e.parentElement, s = e.closest("table"),
|
|
3994
|
+
const i = e.parentElement, s = e.closest("table"), l = Array.from(i.children).indexOf(e);
|
|
3986
3995
|
if (t === "rowup") {
|
|
3987
3996
|
const o = i.previousElementSibling;
|
|
3988
3997
|
o && o.before(i);
|
|
@@ -3991,17 +4000,17 @@ let Ei = (j = class {
|
|
|
3991
4000
|
const o = i.nextElementSibling;
|
|
3992
4001
|
o && o.after(i);
|
|
3993
4002
|
}
|
|
3994
|
-
t === "colleft" &&
|
|
3995
|
-
const c = o.children[
|
|
4003
|
+
t === "colleft" && l > 0 && s.querySelectorAll("tr").forEach((o) => {
|
|
4004
|
+
const c = o.children[l], d = o.children[l - 1];
|
|
3996
4005
|
c && d && d.before(c);
|
|
3997
4006
|
}), t === "colright" && s.querySelectorAll("tr").forEach((o) => {
|
|
3998
|
-
const c = o.children[
|
|
4007
|
+
const c = o.children[l], d = o.children[l + 1];
|
|
3999
4008
|
c && d && d.after(c);
|
|
4000
4009
|
});
|
|
4001
|
-
const
|
|
4002
|
-
|
|
4010
|
+
const n = document.createRange();
|
|
4011
|
+
n.selectNodeContents(e), n.collapse(!0);
|
|
4003
4012
|
const r = window.getSelection();
|
|
4004
|
-
r && (r.removeAllRanges(), r.addRange(
|
|
4013
|
+
r && (r.removeAllRanges(), r.addRange(n)), this.saveSel(), this.onChange(), this.positionTableHandles(), this.positionCellMarker();
|
|
4005
4014
|
}
|
|
4006
4015
|
/** Align the whole table via auto margins — same semantics as the align
|
|
4007
4016
|
* field in the table-properties dialog. */
|
|
@@ -4013,12 +4022,12 @@ let Ei = (j = class {
|
|
|
4013
4022
|
* build header rows (the toolbar's backcolor highlights text, not cells). */
|
|
4014
4023
|
buildCellFillInto(t) {
|
|
4015
4024
|
const e = (s) => {
|
|
4016
|
-
const
|
|
4017
|
-
if (!
|
|
4025
|
+
const l = this.currentCell();
|
|
4026
|
+
if (!l) {
|
|
4018
4027
|
alert(this.t("nocell"));
|
|
4019
4028
|
return;
|
|
4020
4029
|
}
|
|
4021
|
-
this.setOrClear(
|
|
4030
|
+
this.setOrClear(l, "background-color", s || ""), this.onChange();
|
|
4022
4031
|
}, i = this.currentCell();
|
|
4023
4032
|
this.buildPaletteInto(t, this.cssToHex(i ? i.style.backgroundColor : ""), e);
|
|
4024
4033
|
}
|
|
@@ -4038,26 +4047,26 @@ let Ei = (j = class {
|
|
|
4038
4047
|
tablePropsDlg() {
|
|
4039
4048
|
const t = this.tblActive;
|
|
4040
4049
|
if (!t) return;
|
|
4041
|
-
let e, i, s,
|
|
4050
|
+
let e, i, s, l, n;
|
|
4042
4051
|
const r = "display:flex;align-items:center;gap:10px;margin:10px 0", o = "width:120px;color:#556;flex:none", c = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", d = t.querySelector("td,th"), p = t.style.width || "", m = d && d.style.padding ? parseFloat(d.style.padding) : "", b = t.style.borderSpacing ? parseFloat(t.style.borderSpacing) : "", y = t.style.borderWidth ? parseFloat(t.style.borderWidth) : "", g = t.style.marginLeft, x = t.style.marginRight, w = g === "auto" && x === "auto" ? "center" : g === "auto" ? "right" : x === "auto" && g === "0" ? "left" : "";
|
|
4043
4052
|
this.dialog(
|
|
4044
4053
|
this.t("tablepropsttl"),
|
|
4045
4054
|
(E) => {
|
|
4046
|
-
const
|
|
4055
|
+
const A = (H, $) => {
|
|
4047
4056
|
const O = document.createElement("div");
|
|
4048
4057
|
O.style.cssText = r;
|
|
4049
4058
|
const _ = document.createElement("span");
|
|
4050
4059
|
_.style.cssText = o, _.textContent = this.t(H), O.append(_, $), E.appendChild(O);
|
|
4051
4060
|
};
|
|
4052
|
-
e = document.createElement("input"), e.type = "text", e.style.cssText = c, e.placeholder = "e.g. 600px or 100%", e.value = p,
|
|
4061
|
+
e = document.createElement("input"), e.type = "text", e.style.cssText = c, e.placeholder = "e.g. 600px or 100%", e.value = p, A("tblwidth", e), i = document.createElement("input"), i.type = "number", i.min = "0", i.style.cssText = c, i.value = String(m), A("tblcellpadding", i), s = document.createElement("input"), s.type = "number", s.min = "0", s.style.cssText = c, s.value = String(b), A("tblcellspacing", s), l = document.createElement("input"), l.type = "number", l.min = "0", l.style.cssText = c, l.value = String(y), A("tblborder", l), n = document.createElement("select"), n.style.cssText = c, [
|
|
4053
4062
|
["", "alignnone"],
|
|
4054
4063
|
["left", "alignleft"],
|
|
4055
4064
|
["center", "aligncenter"],
|
|
4056
4065
|
["right", "alignright"]
|
|
4057
4066
|
].forEach(([H, $]) => {
|
|
4058
4067
|
const O = document.createElement("option");
|
|
4059
|
-
O.value = H, O.textContent = this.t($), H === w && (O.selected = !0),
|
|
4060
|
-
}),
|
|
4068
|
+
O.value = H, O.textContent = this.t($), H === w && (O.selected = !0), n.appendChild(O);
|
|
4069
|
+
}), A("tblalign", n);
|
|
4061
4070
|
},
|
|
4062
4071
|
[
|
|
4063
4072
|
{ label: this.t("cancel"), action: () => this.closeDlg() },
|
|
@@ -4069,8 +4078,8 @@ let Ei = (j = class {
|
|
|
4069
4078
|
width: e.value.trim(),
|
|
4070
4079
|
cellpadding: i.value.trim(),
|
|
4071
4080
|
cellspacing: s.value.trim(),
|
|
4072
|
-
border:
|
|
4073
|
-
align:
|
|
4081
|
+
border: l.value.trim(),
|
|
4082
|
+
align: n.value
|
|
4074
4083
|
}), this.closeDlg(), this.onChange(), this.positionTableHandles();
|
|
4075
4084
|
}
|
|
4076
4085
|
}
|
|
@@ -4099,8 +4108,8 @@ let Ei = (j = class {
|
|
|
4099
4108
|
formRow(t, e, i) {
|
|
4100
4109
|
const s = document.createElement("div");
|
|
4101
4110
|
s.style.cssText = "display:flex;align-items:center;gap:10px;margin:10px 0;min-width:360px";
|
|
4102
|
-
const
|
|
4103
|
-
|
|
4111
|
+
const l = document.createElement("span");
|
|
4112
|
+
l.style.cssText = "width:120px;color:#556;flex:none", l.textContent = e, s.append(l, i), t.appendChild(s);
|
|
4104
4113
|
}
|
|
4105
4114
|
formInput(t, e = "") {
|
|
4106
4115
|
const i = document.createElement("input");
|
|
@@ -4108,9 +4117,9 @@ let Ei = (j = class {
|
|
|
4108
4117
|
}
|
|
4109
4118
|
formSelect(t, e) {
|
|
4110
4119
|
const i = document.createElement("select");
|
|
4111
|
-
return i.style.cssText = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit;background:#fff", t.forEach(([s,
|
|
4112
|
-
const
|
|
4113
|
-
|
|
4120
|
+
return i.style.cssText = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit;background:#fff", t.forEach(([s, l]) => {
|
|
4121
|
+
const n = document.createElement("option");
|
|
4122
|
+
n.value = s, n.textContent = l, s === e && (n.selected = !0), i.appendChild(n);
|
|
4114
4123
|
}), i;
|
|
4115
4124
|
}
|
|
4116
4125
|
formBg(t) {
|
|
@@ -4118,10 +4127,10 @@ let Ei = (j = class {
|
|
|
4118
4127
|
e.style.cssText = "flex:1;display:flex;align-items:center;gap:8px";
|
|
4119
4128
|
const i = this.toHexColor(t), s = document.createElement("input");
|
|
4120
4129
|
s.type = "color", s.value = i || "#ffffff", s.style.cssText = "width:36px;height:29px;border:1px solid #cfd6df;border-radius:4px;padding:1px;background:none;cursor:pointer";
|
|
4121
|
-
const
|
|
4122
|
-
|
|
4123
|
-
const
|
|
4124
|
-
return
|
|
4130
|
+
const l = document.createElement("label");
|
|
4131
|
+
l.style.cssText = "display:flex;align-items:center;gap:6px;cursor:pointer;color:#556";
|
|
4132
|
+
const n = document.createElement("input");
|
|
4133
|
+
return n.type = "checkbox", n.checked = !!i, l.append(n, document.createTextNode(this.t("fill"))), s.addEventListener("input", () => n.checked = !0), e.append(s, l), { wrap: e, color: s, fill: n };
|
|
4125
4134
|
}
|
|
4126
4135
|
setOrClear(t, e, i) {
|
|
4127
4136
|
i ? t.style.setProperty(e, /^(width|height)$/.test(e) && /^\d+$/.test(i) ? i + "px" : i) : t.style.removeProperty(e);
|
|
@@ -4132,7 +4141,7 @@ let Ei = (j = class {
|
|
|
4132
4141
|
alert(this.t("nocell"));
|
|
4133
4142
|
return;
|
|
4134
4143
|
}
|
|
4135
|
-
let e, i, s,
|
|
4144
|
+
let e, i, s, l, n;
|
|
4136
4145
|
this.dialog(
|
|
4137
4146
|
this.t("cellprops").replace("…", ""),
|
|
4138
4147
|
(r) => {
|
|
@@ -4144,7 +4153,7 @@ let Ei = (j = class {
|
|
|
4144
4153
|
["right", this.t("alignright")]
|
|
4145
4154
|
],
|
|
4146
4155
|
t.style.textAlign || ""
|
|
4147
|
-
), this.formRow(r, this.t("tblalign"), s),
|
|
4156
|
+
), this.formRow(r, this.t("tblalign"), s), l = this.formSelect(
|
|
4148
4157
|
[
|
|
4149
4158
|
["", this.t("alignnone")],
|
|
4150
4159
|
["top", this.t("valigntop")],
|
|
@@ -4152,7 +4161,7 @@ let Ei = (j = class {
|
|
|
4152
4161
|
["bottom", this.t("valignbottom")]
|
|
4153
4162
|
],
|
|
4154
4163
|
t.style.verticalAlign || ""
|
|
4155
|
-
), this.formRow(r, this.t("valign"),
|
|
4164
|
+
), this.formRow(r, this.t("valign"), l), n = this.formBg(t.style.backgroundColor || ""), this.formRow(r, this.t("backcolor"), n.wrap);
|
|
4156
4165
|
},
|
|
4157
4166
|
[
|
|
4158
4167
|
{ label: this.t("cancel"), action: () => this.closeDlg() },
|
|
@@ -4160,7 +4169,7 @@ let Ei = (j = class {
|
|
|
4160
4169
|
label: this.t("save"),
|
|
4161
4170
|
primary: !0,
|
|
4162
4171
|
action: () => {
|
|
4163
|
-
this.setOrClear(t, "width", e.value.trim()), this.setOrClear(t, "height", i.value.trim()), this.setOrClear(t, "text-align", s.value), this.setOrClear(t, "vertical-align",
|
|
4172
|
+
this.setOrClear(t, "width", e.value.trim()), this.setOrClear(t, "height", i.value.trim()), this.setOrClear(t, "text-align", s.value), this.setOrClear(t, "vertical-align", l.value), this.setOrClear(t, "background-color", n.fill.checked ? n.color.value : ""), this.closeDlg(), this.onChange(), this.positionTableHandles();
|
|
4164
4173
|
}
|
|
4165
4174
|
}
|
|
4166
4175
|
]
|
|
@@ -4176,8 +4185,8 @@ let Ei = (j = class {
|
|
|
4176
4185
|
let i, s;
|
|
4177
4186
|
this.dialog(
|
|
4178
4187
|
this.t("rowprops").replace("…", ""),
|
|
4179
|
-
(
|
|
4180
|
-
i = this.formInput(e.style.height, "e.g. 40px"), this.formRow(
|
|
4188
|
+
(l) => {
|
|
4189
|
+
i = this.formInput(e.style.height, "e.g. 40px"), this.formRow(l, this.t("tblheight"), i), s = this.formBg(e.style.backgroundColor || ""), this.formRow(l, this.t("backcolor"), s.wrap);
|
|
4181
4190
|
},
|
|
4182
4191
|
[
|
|
4183
4192
|
{ label: this.t("cancel"), action: () => this.closeDlg() },
|
|
@@ -4197,12 +4206,12 @@ let Ei = (j = class {
|
|
|
4197
4206
|
alert(this.t("nocell"));
|
|
4198
4207
|
return;
|
|
4199
4208
|
}
|
|
4200
|
-
const e = t.parentElement, i = t.closest("table"), s = Array.from(e.children).indexOf(t),
|
|
4201
|
-
let
|
|
4209
|
+
const e = t.parentElement, i = t.closest("table"), s = Array.from(e.children).indexOf(t), l = Array.from(i.rows).map((o) => o.cells[s]).filter(Boolean);
|
|
4210
|
+
let n, r;
|
|
4202
4211
|
this.dialog(
|
|
4203
4212
|
this.t("colprops").replace("…", ""),
|
|
4204
4213
|
(o) => {
|
|
4205
|
-
|
|
4214
|
+
n = this.formInput(t.style.width, "e.g. 120px / 25%"), this.formRow(o, this.t("tblwidth"), n), r = this.formBg(t.style.backgroundColor || ""), this.formRow(o, this.t("backcolor"), r.wrap);
|
|
4206
4215
|
},
|
|
4207
4216
|
[
|
|
4208
4217
|
{ label: this.t("cancel"), action: () => this.closeDlg() },
|
|
@@ -4210,8 +4219,8 @@ let Ei = (j = class {
|
|
|
4210
4219
|
label: this.t("save"),
|
|
4211
4220
|
primary: !0,
|
|
4212
4221
|
action: () => {
|
|
4213
|
-
|
|
4214
|
-
this.setOrClear(o, "width",
|
|
4222
|
+
l.forEach((o) => {
|
|
4223
|
+
this.setOrClear(o, "width", n.value.trim()), this.setOrClear(o, "background-color", r.fill.checked ? r.color.value : "");
|
|
4215
4224
|
}), this.closeDlg(), this.onChange(), this.positionTableHandles();
|
|
4216
4225
|
}
|
|
4217
4226
|
}
|
|
@@ -4226,11 +4235,11 @@ let Ei = (j = class {
|
|
|
4226
4235
|
this.closeDlg(), this.closePop(), this.dlgOvl = document.createElement("div"), this.dlgOvl.className = "ovl";
|
|
4227
4236
|
const s = document.createElement("div");
|
|
4228
4237
|
s.className = "dlg", s.dir = this.dir(), s.innerHTML = `<header><span>${t}</span><button type="button">×</button></header>
|
|
4229
|
-
<div class="body"></div><footer></footer>`, s.querySelector("header button").onclick = () => this.closeDlg(), e(s.querySelector(".body")), (i || [{ label: this.t("close"), primary: !0, action: () => this.closeDlg() }]).forEach((
|
|
4230
|
-
const
|
|
4231
|
-
|
|
4232
|
-
}), this.dlgOvl.appendChild(s), this.dlgOvl.addEventListener("mousedown", (
|
|
4233
|
-
|
|
4238
|
+
<div class="body"></div><footer></footer>`, s.querySelector("header button").onclick = () => this.closeDlg(), e(s.querySelector(".body")), (i || [{ label: this.t("close"), primary: !0, action: () => this.closeDlg() }]).forEach((l) => {
|
|
4239
|
+
const n = document.createElement("button");
|
|
4240
|
+
n.type = "button", n.textContent = l.label, l.primary && (n.className = "pri"), n.onclick = l.action, s.querySelector("footer").appendChild(n);
|
|
4241
|
+
}), this.dlgOvl.appendChild(s), this.dlgOvl.addEventListener("mousedown", (l) => {
|
|
4242
|
+
l.target === this.dlgOvl && this.closeDlg();
|
|
4234
4243
|
}), document.body.appendChild(this.dlgOvl);
|
|
4235
4244
|
}
|
|
4236
4245
|
sourceDlg() {
|
|
@@ -4286,16 +4295,16 @@ let Ei = (j = class {
|
|
|
4286
4295
|
* fixed category tabs on the left, the active category's glyphs on the right. */
|
|
4287
4296
|
glyphPickerDlg(t, e, i) {
|
|
4288
4297
|
this.saveSel(), this.dialog(t, (s) => {
|
|
4289
|
-
const n = document.createElement("div");
|
|
4290
|
-
n.className = "chmap";
|
|
4291
4298
|
const l = document.createElement("div");
|
|
4292
|
-
l.className = "
|
|
4299
|
+
l.className = "chmap";
|
|
4300
|
+
const n = document.createElement("div");
|
|
4301
|
+
n.className = "chtabs";
|
|
4293
4302
|
const r = document.createElement("div");
|
|
4294
4303
|
r.className = "chpanel";
|
|
4295
4304
|
const o = document.createElement("div");
|
|
4296
4305
|
o.className = "chgrid" + (i ? " emgrid" : ""), r.appendChild(o);
|
|
4297
4306
|
const c = (d) => {
|
|
4298
|
-
|
|
4307
|
+
n.querySelectorAll("button").forEach((p, m) => p.classList.toggle("on", m === d)), o.innerHTML = "", e[d].chars.forEach((p) => {
|
|
4299
4308
|
const m = document.createElement("button");
|
|
4300
4309
|
m.type = "button", m.textContent = p, m.onclick = () => {
|
|
4301
4310
|
this.closeDlg(), this.exec("insertText", p);
|
|
@@ -4304,8 +4313,8 @@ let Ei = (j = class {
|
|
|
4304
4313
|
};
|
|
4305
4314
|
e.forEach((d, p) => {
|
|
4306
4315
|
const m = document.createElement("button");
|
|
4307
|
-
m.type = "button", m.textContent = this.t(d.key), m.addEventListener("click", () => c(p)),
|
|
4308
|
-
}),
|
|
4316
|
+
m.type = "button", m.textContent = this.t(d.key), m.addEventListener("click", () => c(p)), n.appendChild(m);
|
|
4317
|
+
}), l.append(n, r), s.appendChild(l), c(0);
|
|
4309
4318
|
});
|
|
4310
4319
|
}
|
|
4311
4320
|
charMap() {
|
|
@@ -4374,20 +4383,20 @@ let Ei = (j = class {
|
|
|
4374
4383
|
const i = document.createElement("button");
|
|
4375
4384
|
i.type = "button", i.className = "txtbtn", i.textContent = this.t("insertimg");
|
|
4376
4385
|
const s = () => {
|
|
4377
|
-
const
|
|
4378
|
-
if (!
|
|
4379
|
-
if (!/^(https?:|data:image\/|blob:)/i.test(
|
|
4386
|
+
const l = e.value.trim(), n = this.phActive;
|
|
4387
|
+
if (!n) return;
|
|
4388
|
+
if (!/^(https?:|data:image\/|blob:)/i.test(l)) {
|
|
4380
4389
|
e.classList.add("err"), e.focus();
|
|
4381
4390
|
return;
|
|
4382
4391
|
}
|
|
4383
4392
|
i.disabled = !0, e.disabled = !0;
|
|
4384
4393
|
const r = new Image();
|
|
4385
|
-
r.onload = () => this.replacePlaceholderWithImage(
|
|
4394
|
+
r.onload = () => this.replacePlaceholderWithImage(n, l, ""), r.onerror = () => {
|
|
4386
4395
|
i.disabled = !1, e.disabled = !1, e.classList.add("err"), e.focus();
|
|
4387
|
-
}, r.src =
|
|
4396
|
+
}, r.src = l;
|
|
4388
4397
|
};
|
|
4389
|
-
i.addEventListener("click", s), e.addEventListener("input", () => e.classList.remove("err")), e.addEventListener("keydown", (
|
|
4390
|
-
|
|
4398
|
+
i.addEventListener("click", s), e.addEventListener("input", () => e.classList.remove("err")), e.addEventListener("keydown", (l) => {
|
|
4399
|
+
l.key === "Enter" ? (l.preventDefault(), s()) : l.key === "Escape" && (l.stopPropagation(), this.renderPhCtxButtons());
|
|
4391
4400
|
}), t.append(e, i), this.positionImgPhCtx(), e.focus();
|
|
4392
4401
|
}
|
|
4393
4402
|
readImageFileInto(t, e) {
|
|
@@ -4407,11 +4416,11 @@ let Ei = (j = class {
|
|
|
4407
4416
|
const i = t.name.replace(/"/g, "");
|
|
4408
4417
|
e.classList.remove("upload-error"), e.classList.add("uploading");
|
|
4409
4418
|
const s = e.querySelector("span");
|
|
4410
|
-
s && (s.textContent = this.t("uploading")), this.imageUploadHandler(t).then((
|
|
4411
|
-
this.ed.contains(e) && this.replacePlaceholderWithImage(e,
|
|
4412
|
-
}).catch((
|
|
4413
|
-
var
|
|
4414
|
-
this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (
|
|
4419
|
+
s && (s.textContent = this.t("uploading")), this.imageUploadHandler(t).then((l) => {
|
|
4420
|
+
this.ed.contains(e) && this.replacePlaceholderWithImage(e, l, i);
|
|
4421
|
+
}).catch((l) => {
|
|
4422
|
+
var n;
|
|
4423
|
+
this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (n = this.onImageUploadError) == null || n.call(this, l, t));
|
|
4415
4424
|
});
|
|
4416
4425
|
}
|
|
4417
4426
|
replacePlaceholderWithImage(t, e, i) {
|
|
@@ -4427,8 +4436,8 @@ let Ei = (j = class {
|
|
|
4427
4436
|
const t = this.phActive.getBoundingClientRect(), e = this.phCtx.offsetWidth, i = this.phCtx.offsetHeight;
|
|
4428
4437
|
let s = t.left + scrollX + (t.width - e) / 2;
|
|
4429
4438
|
s = Math.max(8 + scrollX, Math.min(s, scrollX + innerWidth - e - 8));
|
|
4430
|
-
let
|
|
4431
|
-
t.bottom + 8 + i > innerHeight - 4 && (
|
|
4439
|
+
let l = t.bottom + scrollY + 8;
|
|
4440
|
+
t.bottom + 8 + i > innerHeight - 4 && (l = Math.max(this.ctxMinTop(), t.top + scrollY - i - 8)), this.phCtx.style.left = s + "px", this.phCtx.style.top = l + "px";
|
|
4432
4441
|
}
|
|
4433
4442
|
/* ---------------------------------------------------------- video upload placeholder */
|
|
4434
4443
|
pickVideo() {
|
|
@@ -4474,25 +4483,25 @@ let Ei = (j = class {
|
|
|
4474
4483
|
const i = document.createElement("button");
|
|
4475
4484
|
i.type = "button", i.className = "txtbtn", i.textContent = this.t("insertvideo");
|
|
4476
4485
|
const s = () => {
|
|
4477
|
-
const
|
|
4478
|
-
if (!
|
|
4479
|
-
if (!/^(https?:|data:video\/|blob:)/i.test(
|
|
4486
|
+
const l = e.value.trim(), n = this.vphActive;
|
|
4487
|
+
if (!n) return;
|
|
4488
|
+
if (!/^(https?:|data:video\/|blob:)/i.test(l)) {
|
|
4480
4489
|
e.classList.add("err"), e.focus();
|
|
4481
4490
|
return;
|
|
4482
4491
|
}
|
|
4483
|
-
const r = this.videoEmbedUrl(
|
|
4492
|
+
const r = this.videoEmbedUrl(l);
|
|
4484
4493
|
if (r) {
|
|
4485
|
-
this.replacePlaceholderWithEmbed(
|
|
4494
|
+
this.replacePlaceholderWithEmbed(n, r);
|
|
4486
4495
|
return;
|
|
4487
4496
|
}
|
|
4488
4497
|
i.disabled = !0, e.disabled = !0;
|
|
4489
4498
|
const o = document.createElement("video");
|
|
4490
|
-
o.preload = "metadata", o.onloadedmetadata = () => this.replacePlaceholderWithVideo(
|
|
4499
|
+
o.preload = "metadata", o.onloadedmetadata = () => this.replacePlaceholderWithVideo(n, l, ""), o.onerror = () => {
|
|
4491
4500
|
i.disabled = !1, e.disabled = !1, e.classList.add("err"), e.focus();
|
|
4492
|
-
}, o.src =
|
|
4501
|
+
}, o.src = l;
|
|
4493
4502
|
};
|
|
4494
|
-
i.addEventListener("click", s), e.addEventListener("input", () => e.classList.remove("err")), e.addEventListener("keydown", (
|
|
4495
|
-
|
|
4503
|
+
i.addEventListener("click", s), e.addEventListener("input", () => e.classList.remove("err")), e.addEventListener("keydown", (l) => {
|
|
4504
|
+
l.key === "Enter" ? (l.preventDefault(), s()) : l.key === "Escape" && (l.stopPropagation(), this.renderVphCtxButtons());
|
|
4496
4505
|
}), t.append(e, i), this.positionVphCtx(), e.focus();
|
|
4497
4506
|
}
|
|
4498
4507
|
readVideoFileInto(t, e) {
|
|
@@ -4512,11 +4521,11 @@ let Ei = (j = class {
|
|
|
4512
4521
|
const i = t.name.replace(/"/g, "");
|
|
4513
4522
|
e.classList.remove("upload-error"), e.classList.add("uploading");
|
|
4514
4523
|
const s = e.querySelector("span");
|
|
4515
|
-
s && (s.textContent = this.t("uploading")), this.videoUploadHandler(t).then((
|
|
4516
|
-
this.ed.contains(e) && this.replacePlaceholderWithVideo(e,
|
|
4517
|
-
}).catch((
|
|
4518
|
-
var
|
|
4519
|
-
this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (
|
|
4524
|
+
s && (s.textContent = this.t("uploading")), this.videoUploadHandler(t).then((l) => {
|
|
4525
|
+
this.ed.contains(e) && this.replacePlaceholderWithVideo(e, l, i);
|
|
4526
|
+
}).catch((l) => {
|
|
4527
|
+
var n;
|
|
4528
|
+
this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (n = this.onVideoUploadError) == null || n.call(this, l, t));
|
|
4520
4529
|
});
|
|
4521
4530
|
}
|
|
4522
4531
|
replacePlaceholderWithVideo(t, e, i) {
|
|
@@ -4537,8 +4546,8 @@ let Ei = (j = class {
|
|
|
4537
4546
|
const t = this.vphActive.getBoundingClientRect(), e = this.vphCtx.offsetWidth, i = this.vphCtx.offsetHeight;
|
|
4538
4547
|
let s = t.left + scrollX + (t.width - e) / 2;
|
|
4539
4548
|
s = Math.max(8 + scrollX, Math.min(s, scrollX + innerWidth - e - 8));
|
|
4540
|
-
let
|
|
4541
|
-
t.bottom + 8 + i > innerHeight - 4 && (
|
|
4549
|
+
let l = t.bottom + scrollY + 8;
|
|
4550
|
+
t.bottom + 8 + i > innerHeight - 4 && (l = Math.max(this.ctxMinTop(), t.top + scrollY - i - 8)), this.vphCtx.style.left = s + "px", this.vphCtx.style.top = l + "px";
|
|
4542
4551
|
}
|
|
4543
4552
|
/* ---------------------------------------------------------- video toolbar (post-insert) */
|
|
4544
4553
|
cancelVidHide() {
|
|
@@ -4560,14 +4569,14 @@ let Ei = (j = class {
|
|
|
4560
4569
|
(d = this.vidCtx) == null || d.replaceWith(c), this.vidCtx = c, this.positionVidCtx();
|
|
4561
4570
|
}, s = (c) => {
|
|
4562
4571
|
this.setVideoAlign(t, c), i();
|
|
4563
|
-
},
|
|
4572
|
+
}, l = t.style.float === "left", n = t.style.float === "right", r = !l && !n && t.style.marginLeft === "auto" && t.style.marginRight === "auto", o = (c, d, p, m) => {
|
|
4564
4573
|
const b = this.ctxBtn(c, d, m);
|
|
4565
4574
|
return b.classList.toggle("on", p), b;
|
|
4566
4575
|
};
|
|
4567
4576
|
return e.append(
|
|
4568
|
-
o(h.alignleft, this.t("alignleft"),
|
|
4577
|
+
o(h.alignleft, this.t("alignleft"), l, () => s("left")),
|
|
4569
4578
|
o(h.aligncenter, this.t("aligncenter"), r, () => s("center")),
|
|
4570
|
-
o(h.alignright, this.t("alignright"),
|
|
4579
|
+
o(h.alignright, this.t("alignright"), n, () => s("right")),
|
|
4571
4580
|
this.ctxSep(),
|
|
4572
4581
|
o(h.trash, this.t("deletevideo"), !1, () => {
|
|
4573
4582
|
t.remove(), this.clearVidHandles(), this.onChange();
|
|
@@ -4589,8 +4598,8 @@ let Ei = (j = class {
|
|
|
4589
4598
|
const e = this.vidCtx.offsetWidth, i = this.vidCtx.offsetHeight;
|
|
4590
4599
|
let s = t.left + scrollX + (t.width - e) / 2;
|
|
4591
4600
|
s = Math.max(8 + scrollX, Math.min(s, scrollX + innerWidth - e - 8));
|
|
4592
|
-
let
|
|
4593
|
-
|
|
4601
|
+
let l = t.top + scrollY - i - 8;
|
|
4602
|
+
l < this.ctxMinTop() && (l = t.bottom + scrollY + 8), this.vidCtx.style.left = s + "px", this.vidCtx.style.top = l + "px";
|
|
4594
4603
|
}
|
|
4595
4604
|
/* ---------------------------------------------------------- video dialog / embeds */
|
|
4596
4605
|
/** Maps a page URL from a known video host to its iframe player URL. Returns
|
|
@@ -4609,7 +4618,7 @@ let Ei = (j = class {
|
|
|
4609
4618
|
* (videoUploadHandler when configured, else inline base64). */
|
|
4610
4619
|
videoDlg() {
|
|
4611
4620
|
this.saveSel();
|
|
4612
|
-
let t, e, i, s,
|
|
4621
|
+
let t, e, i, s, l, n;
|
|
4613
4622
|
const r = (c, d) => {
|
|
4614
4623
|
const p = document.createElement("div");
|
|
4615
4624
|
p.className = "dfield";
|
|
@@ -4629,8 +4638,8 @@ let Ei = (j = class {
|
|
|
4629
4638
|
w.type = "button", w.textContent = this.t(g);
|
|
4630
4639
|
const E = document.createElement("div");
|
|
4631
4640
|
E.className = "dtabpanel", x(E);
|
|
4632
|
-
const
|
|
4633
|
-
p.push(E), w.addEventListener("click", () => b(
|
|
4641
|
+
const A = p.length;
|
|
4642
|
+
p.push(E), w.addEventListener("click", () => b(A)), d.appendChild(w);
|
|
4634
4643
|
}, b = (g) => {
|
|
4635
4644
|
d.querySelectorAll("button").forEach((x, w) => x.classList.toggle("on", w === g)), p.forEach((x, w) => x.style.display = w === g ? "" : "none");
|
|
4636
4645
|
};
|
|
@@ -4661,13 +4670,13 @@ let Ei = (j = class {
|
|
|
4661
4670
|
_.onload = () => $(_.result), _.readAsDataURL(H);
|
|
4662
4671
|
}
|
|
4663
4672
|
}), x.append(t, w, E), t.style.flex = "1", g.appendChild(r("vidsource", x));
|
|
4664
|
-
const
|
|
4665
|
-
|
|
4673
|
+
const A = document.createElement("div");
|
|
4674
|
+
A.className = "drow", e = document.createElement("input"), e.type = "number", e.value = "560", i = document.createElement("input"), i.type = "number", i.value = "314", A.append(r("tblwidth", e), r("tblheight", i)), g.appendChild(A);
|
|
4666
4675
|
}), m("vidembed", (g) => {
|
|
4667
4676
|
const x = document.createElement("p");
|
|
4668
4677
|
x.textContent = this.t("vidembedhint"), x.style.cssText = "margin:0 0 8px;color:#556;font-size:13.5px", s = document.createElement("textarea"), s.style.cssText = "width:100%;box-sizing:border-box;height:160px", g.append(x, s);
|
|
4669
4678
|
}), m("vidadvanced", (g) => {
|
|
4670
|
-
|
|
4679
|
+
l = o(), n = o(), g.append(r("vidaltsource", l), r("vidposter", n));
|
|
4671
4680
|
});
|
|
4672
4681
|
const y = document.createElement("div");
|
|
4673
4682
|
y.className = "dtabbody", p.forEach((g) => y.appendChild(g)), c.append(d, y), b(0), setTimeout(() => t.focus(), 0);
|
|
@@ -4688,7 +4697,7 @@ let Ei = (j = class {
|
|
|
4688
4697
|
if (b)
|
|
4689
4698
|
document.execCommand("insertHTML", !1, this.videoEmbedHTML(b, p, m));
|
|
4690
4699
|
else {
|
|
4691
|
-
const y =
|
|
4700
|
+
const y = l.value.trim(), g = n.value.trim();
|
|
4692
4701
|
document.execCommand(
|
|
4693
4702
|
"insertHTML",
|
|
4694
4703
|
!1,
|
|
@@ -4727,16 +4736,16 @@ let Ei = (j = class {
|
|
|
4727
4736
|
const i = e.firstChild, s = e.lastChild;
|
|
4728
4737
|
for (; e.firstChild; ) e.parentNode.insertBefore(e.firstChild, e);
|
|
4729
4738
|
if (e.remove(), i && s) {
|
|
4730
|
-
const
|
|
4731
|
-
|
|
4739
|
+
const l = document.createRange();
|
|
4740
|
+
l.setStartBefore(i), l.setEndAfter(s), t.removeAllRanges(), t.addRange(l);
|
|
4732
4741
|
}
|
|
4733
4742
|
} else {
|
|
4734
4743
|
const i = t.getRangeAt(0);
|
|
4735
4744
|
if (i.collapsed || this.closestBlock(i.startContainer) !== this.closestBlock(i.endContainer)) return;
|
|
4736
4745
|
const s = document.createElement("code");
|
|
4737
4746
|
s.appendChild(i.extractContents()), i.insertNode(s);
|
|
4738
|
-
const
|
|
4739
|
-
|
|
4747
|
+
const l = document.createRange();
|
|
4748
|
+
l.selectNodeContents(s), t.removeAllRanges(), t.addRange(l);
|
|
4740
4749
|
}
|
|
4741
4750
|
this.saveSel(), this.refreshState(), this.onChange();
|
|
4742
4751
|
}
|
|
@@ -4748,15 +4757,15 @@ let Ei = (j = class {
|
|
|
4748
4757
|
if (!e || !e.isCollapsed || !e.anchorNode) return;
|
|
4749
4758
|
const i = e.anchorNode;
|
|
4750
4759
|
if (i.nodeType !== Node.TEXT_NODE || !this.ed.contains(i) || (d = i.parentElement) != null && d.closest("code, pre")) return;
|
|
4751
|
-
const
|
|
4752
|
-
if (!
|
|
4753
|
-
const
|
|
4754
|
-
if (/^\s|\s$/.test(
|
|
4760
|
+
const l = (i.textContent || "").slice(0, e.anchorOffset).match(/(?:^|[^`])`([^`]+)$/);
|
|
4761
|
+
if (!l) return;
|
|
4762
|
+
const n = l[1];
|
|
4763
|
+
if (/^\s|\s$/.test(n)) return;
|
|
4755
4764
|
t.preventDefault();
|
|
4756
4765
|
const r = document.createRange();
|
|
4757
|
-
r.setStart(i, e.anchorOffset -
|
|
4766
|
+
r.setStart(i, e.anchorOffset - n.length - 1), r.setEnd(i, e.anchorOffset), r.deleteContents();
|
|
4758
4767
|
const o = document.createElement("code");
|
|
4759
|
-
o.textContent =
|
|
4768
|
+
o.textContent = n, r.insertNode(o);
|
|
4760
4769
|
const c = document.createRange();
|
|
4761
4770
|
c.setStartAfter(o), c.collapse(!0), e.removeAllRanges(), e.addRange(c), this.saveSel(), this.onChange();
|
|
4762
4771
|
}
|
|
@@ -4768,24 +4777,24 @@ let Ei = (j = class {
|
|
|
4768
4777
|
let i = e;
|
|
4769
4778
|
const s = document.createElement("div");
|
|
4770
4779
|
s.className = "dsel";
|
|
4771
|
-
const
|
|
4772
|
-
|
|
4773
|
-
const
|
|
4774
|
-
|
|
4780
|
+
const l = document.createElement("button");
|
|
4781
|
+
l.type = "button", l.className = "dsel-btn";
|
|
4782
|
+
const n = document.createElement("span");
|
|
4783
|
+
n.className = "lbl", n.textContent = ((o = t.find(([c]) => c === e)) == null ? void 0 : o[1]) || "", l.append(n), l.insertAdjacentHTML("beforeend", h.chev);
|
|
4775
4784
|
const r = document.createElement("div");
|
|
4776
4785
|
return r.className = "dsel-list", t.forEach(([c, d]) => {
|
|
4777
4786
|
const p = document.createElement("button");
|
|
4778
4787
|
p.type = "button", p.textContent = d, p.classList.toggle("on", c === i), p.addEventListener("click", () => {
|
|
4779
|
-
i = c,
|
|
4788
|
+
i = c, n.textContent = d, r.querySelectorAll("button").forEach((m) => m.classList.toggle("on", m === p)), s.classList.remove("open"), l.focus();
|
|
4780
4789
|
}), r.appendChild(p);
|
|
4781
|
-
}),
|
|
4790
|
+
}), l.addEventListener("click", () => {
|
|
4782
4791
|
var c;
|
|
4783
4792
|
s.classList.toggle("open"), s.classList.contains("open") && ((c = r.querySelector(".on")) == null || c.scrollIntoView({ block: "nearest" }));
|
|
4784
4793
|
}), s.addEventListener("focusout", (c) => {
|
|
4785
4794
|
s.contains(c.relatedTarget) || s.classList.remove("open");
|
|
4786
4795
|
}), s.addEventListener("keydown", (c) => {
|
|
4787
|
-
c.key === "Escape" && s.classList.contains("open") && (c.stopPropagation(), s.classList.remove("open"),
|
|
4788
|
-
}), s.append(
|
|
4796
|
+
c.key === "Escape" && s.classList.contains("open") && (c.stopPropagation(), s.classList.remove("open"), l.focus());
|
|
4797
|
+
}), s.append(l, r), { el: s, value: () => i };
|
|
4789
4798
|
}
|
|
4790
4799
|
/** Insert/edit-code-sample dialog: language dropdown + monospace textarea to
|
|
4791
4800
|
* paste or type code into. Inserts a non-editable <pre class="code-block">
|
|
@@ -4797,10 +4806,10 @@ let Ei = (j = class {
|
|
|
4797
4806
|
this.t("codedlgttl"),
|
|
4798
4807
|
(s) => {
|
|
4799
4808
|
var r;
|
|
4800
|
-
const
|
|
4801
|
-
|
|
4802
|
-
const
|
|
4803
|
-
|
|
4809
|
+
const l = document.createElement("div");
|
|
4810
|
+
l.className = "dfield";
|
|
4811
|
+
const n = document.createElement("label");
|
|
4812
|
+
n.textContent = this.t("codelang"), e = this.dlgSelect(ie, (t == null ? void 0 : t.dataset.lang) || "plain"), l.append(n, e.el), i = document.createElement("textarea"), i.className = "code-input", i.spellcheck = !1, i.value = ((r = t == null ? void 0 : t.querySelector("code")) == null ? void 0 : r.textContent) || "", i.placeholder = "const answer = 42;", s.append(l, i), setTimeout(() => i.focus(), 0);
|
|
4804
4813
|
},
|
|
4805
4814
|
[
|
|
4806
4815
|
{ label: this.t("cancel"), action: () => this.closeDlg() },
|
|
@@ -4809,10 +4818,10 @@ let Ei = (j = class {
|
|
|
4809
4818
|
primary: !0,
|
|
4810
4819
|
action: () => {
|
|
4811
4820
|
var r;
|
|
4812
|
-
const s = i.value.replace(/\s+$/, ""),
|
|
4821
|
+
const s = i.value.replace(/\s+$/, ""), l = e.value(), n = ((r = ie.find(([o]) => o === l)) == null ? void 0 : r[1]) || l;
|
|
4813
4822
|
if (this.closeDlg(), !!s.trim()) {
|
|
4814
4823
|
if (t) {
|
|
4815
|
-
t.dataset.lang =
|
|
4824
|
+
t.dataset.lang = l, t.setAttribute("data-lang-label", n);
|
|
4816
4825
|
const o = t.querySelector("code") || t;
|
|
4817
4826
|
o.textContent = s, this.clearCodeSel(), this.onChange();
|
|
4818
4827
|
return;
|
|
@@ -4820,7 +4829,7 @@ let Ei = (j = class {
|
|
|
4820
4829
|
this.restoreSel(), document.execCommand(
|
|
4821
4830
|
"insertHTML",
|
|
4822
4831
|
!1,
|
|
4823
|
-
`<pre class="code-block" contenteditable="false" data-lang="${
|
|
4832
|
+
`<pre class="code-block" contenteditable="false" data-lang="${l}" data-lang-label="${this.escapeAttr(n)}"><code>${this.escHtml(s)}</code></pre><p><br></p>`
|
|
4824
4833
|
), this.onChange();
|
|
4825
4834
|
}
|
|
4826
4835
|
}
|
|
@@ -4847,9 +4856,9 @@ let Ei = (j = class {
|
|
|
4847
4856
|
), e.addEventListener("mousedown", (i) => i.preventDefault()), document.body.appendChild(e), e;
|
|
4848
4857
|
}
|
|
4849
4858
|
copyCodeBlock(t) {
|
|
4850
|
-
var s,
|
|
4859
|
+
var s, l;
|
|
4851
4860
|
const e = ((s = t.querySelector("code")) == null ? void 0 : s.textContent) ?? t.textContent ?? "";
|
|
4852
|
-
if ((
|
|
4861
|
+
if ((l = navigator.clipboard) != null && l.writeText) {
|
|
4853
4862
|
navigator.clipboard.writeText(e).catch(() => {
|
|
4854
4863
|
});
|
|
4855
4864
|
return;
|
|
@@ -4867,8 +4876,8 @@ let Ei = (j = class {
|
|
|
4867
4876
|
const e = this.codeCtx.offsetWidth, i = this.codeCtx.offsetHeight;
|
|
4868
4877
|
let s = t.left + scrollX + (t.width - e) / 2;
|
|
4869
4878
|
s = Math.max(8 + scrollX, Math.min(s, scrollX + innerWidth - e - 8));
|
|
4870
|
-
let
|
|
4871
|
-
|
|
4879
|
+
let l = t.top + scrollY - i - 8;
|
|
4880
|
+
l < this.ctxMinTop() && (l = t.bottom + scrollY + 8), this.codeCtx.style.left = s + "px", this.codeCtx.style.top = l + "px";
|
|
4872
4881
|
}
|
|
4873
4882
|
/* ---------------------------------------------------------- templates */
|
|
4874
4883
|
templateMenu(t) {
|
|
@@ -4877,16 +4886,16 @@ let Ei = (j = class {
|
|
|
4877
4886
|
/** Miniature div-based mockup of a layout, mirroring what the block looks
|
|
4878
4887
|
like in the editor: grey box = image slot, bars = heading/paragraph. */
|
|
4879
4888
|
tplPreviewHTML(t) {
|
|
4880
|
-
const e = '<span class="pv-img"></span>', i = '<span class="pv-h"></span>', s = (o) => `<span class="pv-l" style="width:${o}%"></span>`,
|
|
4881
|
-
return t === "img-left" ? `<span class="pv">${
|
|
4889
|
+
const e = '<span class="pv-img"></span>', i = '<span class="pv-h"></span>', s = (o) => `<span class="pv-l" style="width:${o}%"></span>`, l = (o) => `<span class="pv-col">${o}</span>`, n = (o) => `<span class="pv-row">${o}</span>`, r = l(i + s(100) + s(88));
|
|
4890
|
+
return t === "img-left" ? `<span class="pv">${n(e + r)}${s(100)}${s(72)}</span>` : t === "img-right" ? `<span class="pv">${n(r + e)}${s(100)}${s(72)}</span>` : t === "img-top" ? `<span class="pv pv-c">${e}${i}${s(100)}${s(72)}</span>` : `<span class="pv pv-c">${i}${s(100)}${s(72)}${e}</span>`;
|
|
4882
4891
|
}
|
|
4883
4892
|
buildTemplatePickInto(t, e) {
|
|
4884
4893
|
const i = document.createElement("div");
|
|
4885
4894
|
i.className = "tplpick", wt.forEach((s) => {
|
|
4886
|
-
const
|
|
4887
|
-
|
|
4895
|
+
const l = document.createElement("button");
|
|
4896
|
+
l.type = "button", l.className = "tpltile", l.title = this.t(Tt[s]), l.innerHTML = this.tplPreviewHTML(s) + `<span class="tpllbl">${this.t(Tt[s])}</span>`, l.addEventListener("click", () => {
|
|
4888
4897
|
this.closePop(), this.insertTemplate(s), e == null || e();
|
|
4889
|
-
}), i.appendChild(
|
|
4898
|
+
}), i.appendChild(l);
|
|
4890
4899
|
}), t.appendChild(i);
|
|
4891
4900
|
}
|
|
4892
4901
|
insertTemplate(t) {
|
|
@@ -4911,7 +4920,7 @@ let Ei = (j = class {
|
|
|
4911
4920
|
setTplLayout(t) {
|
|
4912
4921
|
const e = this.tplActive;
|
|
4913
4922
|
if (!e) return;
|
|
4914
|
-
wt.forEach((
|
|
4923
|
+
wt.forEach((l) => e.classList.remove("tpl-" + l)), e.classList.add("tpl-" + t);
|
|
4915
4924
|
const i = e.querySelector(":scope > .tpl-media"), s = e.querySelector(":scope > .tpl-text");
|
|
4916
4925
|
i && s && (t === "img-center" ? e.appendChild(i) : e.insertBefore(i, s)), this.renderTplCtxButtons(), this.positionImgPhCtx(), this.positionImageHandles(), this.onChange();
|
|
4917
4926
|
}
|
|
@@ -4928,8 +4937,8 @@ let Ei = (j = class {
|
|
|
4928
4937
|
const t = this.tplActive.getBoundingClientRect(), e = this.tplCtx.offsetWidth, i = this.tplCtx.offsetHeight;
|
|
4929
4938
|
let s = t.left + scrollX + (t.width - e) / 2;
|
|
4930
4939
|
s = Math.max(8 + scrollX, Math.min(s, scrollX + innerWidth - e - 8));
|
|
4931
|
-
let
|
|
4932
|
-
|
|
4940
|
+
let l = t.top + scrollY - i - 8;
|
|
4941
|
+
l < this.ctxMinTop() && (l = t.bottom + scrollY + 8), this.tplCtx.style.left = s + "px", this.tplCtx.style.top = l + "px";
|
|
4933
4942
|
}
|
|
4934
4943
|
pickWordDoc() {
|
|
4935
4944
|
this.docInput.value = "", this.docInput.click();
|
|
@@ -4942,8 +4951,8 @@ let Ei = (j = class {
|
|
|
4942
4951
|
}
|
|
4943
4952
|
/* ---------------------------------------------------------- table resize */
|
|
4944
4953
|
clearTableHandles() {
|
|
4945
|
-
var t, e, i, s,
|
|
4946
|
-
(t = this.tblCorner) == null || t.remove(), this.tblCorner = null, this.tblColBars.forEach((
|
|
4954
|
+
var t, e, i, s, l;
|
|
4955
|
+
(t = this.tblCorner) == null || t.remove(), this.tblCorner = null, this.tblColBars.forEach((n) => n.remove()), this.tblColBars = [], (e = this.tblCtx) == null || e.remove(), this.tblCtx = null, (i = this.tblCellMark) == null || i.remove(), this.tblCellMark = null, (s = this.tblOpMark) == null || s.remove(), this.tblOpMark = null, this.tblOpMarkKind = null, (l = this.tblActive) == null || l.classList.remove("tbl-selected"), this.tblActive = null;
|
|
4947
4956
|
}
|
|
4948
4957
|
/** Blue outline around the cell that holds the caret, so it is clear
|
|
4949
4958
|
which cell / row / column the table operations will target. */
|
|
@@ -4970,8 +4979,8 @@ let Ei = (j = class {
|
|
|
4970
4979
|
return;
|
|
4971
4980
|
}
|
|
4972
4981
|
this.tblOpMark || (this.tblOpMark = document.createElement("div"), this.tblOpMark.className = "tbl-opmark", document.body.appendChild(this.tblOpMark));
|
|
4973
|
-
const i = this.tblActive.getBoundingClientRect(), s = e.getBoundingClientRect(),
|
|
4974
|
-
this.tblOpMark.style.left =
|
|
4982
|
+
const i = this.tblActive.getBoundingClientRect(), s = e.getBoundingClientRect(), l = e.parentElement.getBoundingClientRect(), n = t === "row" ? l.left : s.left, r = t === "row" ? l.top : i.top, o = t === "row" ? l.width : s.width, c = t === "row" ? l.height : i.height;
|
|
4983
|
+
this.tblOpMark.style.left = n + scrollX + "px", this.tblOpMark.style.top = r + scrollY + "px", this.tblOpMark.style.width = o + "px", this.tblOpMark.style.height = c + "px";
|
|
4975
4984
|
}
|
|
4976
4985
|
/** Lowest allowed top for floating context toolbars — keeps them from
|
|
4977
4986
|
covering the editor menubar/toolbar when the target sits on the first line. */
|
|
@@ -4979,8 +4988,8 @@ let Ei = (j = class {
|
|
|
4979
4988
|
return Math.max(scrollY + 4, this.ed.getBoundingClientRect().top + scrollY - 2);
|
|
4980
4989
|
}
|
|
4981
4990
|
ctxBtn(t, e, i, s) {
|
|
4982
|
-
const
|
|
4983
|
-
return
|
|
4991
|
+
const l = document.createElement("button");
|
|
4992
|
+
return l.type = "button", l.title = e, l.innerHTML = t, s && (l.dataset.id = s), l.addEventListener("mousedown", (n) => n.preventDefault()), l.addEventListener("click", i), l;
|
|
4984
4993
|
}
|
|
4985
4994
|
ctxSep() {
|
|
4986
4995
|
const t = document.createElement("div");
|
|
@@ -4989,7 +4998,7 @@ let Ei = (j = class {
|
|
|
4989
4998
|
buildTableCtxToolbar() {
|
|
4990
4999
|
const t = document.createElement("div");
|
|
4991
5000
|
t.className = "tblctx", t.dir = this.dir();
|
|
4992
|
-
const e = (s,
|
|
5001
|
+
const e = (s, l) => (s.addEventListener("mouseenter", () => this.setOpTarget(l)), s.addEventListener("mouseleave", () => this.setOpTarget(null)), s), i = this.ctxBtn(h.palette, this.t("cellbg"), () => this.cellFillMenu(i));
|
|
4993
5002
|
return t.append(
|
|
4994
5003
|
e(this.ctxBtn(h.rowbefore, this.t("rowabove"), () => this.tableOp("rowabove")), "row"),
|
|
4995
5004
|
e(this.ctxBtn(h.rowafter, this.t("rowbelow"), () => this.tableOp("rowbelow")), "row"),
|
|
@@ -5017,20 +5026,20 @@ let Ei = (j = class {
|
|
|
5017
5026
|
this.clearTableHandles();
|
|
5018
5027
|
return;
|
|
5019
5028
|
}
|
|
5020
|
-
const t = this.ed.getAttribute("dir") === "rtl", e = this.tblActive.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX,
|
|
5021
|
-
if (this.tblCorner && (this.tblCorner.style.top =
|
|
5029
|
+
const t = this.ed.getAttribute("dir") === "rtl", e = this.tblActive.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX, n = e.bottom + scrollY;
|
|
5030
|
+
if (this.tblCorner && (this.tblCorner.style.top = n - 5 + "px", this.tblCorner.style.left = (t ? s - 5 : l - 5) + "px", this.tblCorner.style.cursor = t ? "nesw-resize" : "nwse-resize"), this.tblCtx) {
|
|
5022
5031
|
const o = this.tblCtx.offsetWidth, c = this.tblCtx.offsetHeight;
|
|
5023
|
-
let d = s + (
|
|
5032
|
+
let d = s + (l - s) / 2 - o / 2;
|
|
5024
5033
|
d = Math.max(8 + scrollX, Math.min(d, scrollX + innerWidth - o - 8));
|
|
5025
5034
|
let p = i - c - 8;
|
|
5026
|
-
p < this.ctxMinTop() && (p =
|
|
5035
|
+
p < this.ctxMinTop() && (p = n + 8), this.tblCtx.style.left = d + "px", this.tblCtx.style.top = p + "px";
|
|
5027
5036
|
}
|
|
5028
5037
|
this.tblColBars.forEach((o) => o.remove()), this.tblColBars = [];
|
|
5029
5038
|
const r = this.tblActive.rows[0];
|
|
5030
5039
|
if (r)
|
|
5031
5040
|
for (let o = 0; o < r.cells.length - 1; o++) {
|
|
5032
5041
|
const c = r.cells[o].getBoundingClientRect(), d = (t ? c.left : c.right) + scrollX, p = document.createElement("div");
|
|
5033
|
-
p.className = "tbl-colbar", p.style.top = i + "px", p.style.left = d + "px", p.style.height =
|
|
5042
|
+
p.className = "tbl-colbar", p.style.top = i + "px", p.style.left = d + "px", p.style.height = n - i + "px", document.body.appendChild(p), p.addEventListener("mousedown", (m) => this.startColBarDrag(m, o)), this.tblColBars.push(p);
|
|
5034
5043
|
}
|
|
5035
5044
|
this.positionCellMarker(), this.positionOpMark();
|
|
5036
5045
|
}
|
|
@@ -5047,13 +5056,13 @@ let Ei = (j = class {
|
|
|
5047
5056
|
t.preventDefault();
|
|
5048
5057
|
const e = this.tblActive;
|
|
5049
5058
|
if (!e) return;
|
|
5050
|
-
const i = this.ed.getAttribute("dir") === "rtl", s = t.clientX,
|
|
5051
|
-
e.style.tableLayout = e.style.tableLayout || "fixed", this.withNoTextSelect((
|
|
5059
|
+
const i = this.ed.getAttribute("dir") === "rtl", s = t.clientX, l = e.getBoundingClientRect().width;
|
|
5060
|
+
e.style.tableLayout = e.style.tableLayout || "fixed", this.withNoTextSelect((n) => {
|
|
5052
5061
|
const r = (c) => {
|
|
5053
5062
|
const d = i ? -(c.clientX - s) : c.clientX - s;
|
|
5054
|
-
e.style.width = Math.max(60, Math.round(
|
|
5063
|
+
e.style.width = Math.max(60, Math.round(l + d)) + "px", this.positionTableHandles();
|
|
5055
5064
|
}, o = () => {
|
|
5056
|
-
window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", o),
|
|
5065
|
+
window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", o), n(), this.onChange();
|
|
5057
5066
|
};
|
|
5058
5067
|
window.addEventListener("mousemove", r), window.addEventListener("mouseup", o);
|
|
5059
5068
|
});
|
|
@@ -5062,13 +5071,13 @@ let Ei = (j = class {
|
|
|
5062
5071
|
t.preventDefault(), t.stopPropagation();
|
|
5063
5072
|
const i = this.tblActive;
|
|
5064
5073
|
if (!i) return;
|
|
5065
|
-
const s = this.ed.getAttribute("dir") === "rtl",
|
|
5066
|
-
if (!
|
|
5067
|
-
const o = t.clientX, c =
|
|
5074
|
+
const s = this.ed.getAttribute("dir") === "rtl", l = Array.from(i.rows), n = l.map((p) => p.cells[e]).filter(Boolean), r = l.map((p) => p.cells[e + 1]).filter(Boolean);
|
|
5075
|
+
if (!n.length || !r.length) return;
|
|
5076
|
+
const o = t.clientX, c = n[0].getBoundingClientRect().width, d = r[0].getBoundingClientRect().width;
|
|
5068
5077
|
i.style.tableLayout = "fixed", this.withNoTextSelect((p) => {
|
|
5069
5078
|
const m = (y) => {
|
|
5070
5079
|
const g = (s ? -1 : 1) * (y.clientX - o);
|
|
5071
|
-
|
|
5080
|
+
n.forEach((x) => x.style.width = Math.max(24, Math.round(c + g)) + "px"), r.forEach((x) => x.style.width = Math.max(24, Math.round(d - g)) + "px"), this.positionTableHandles();
|
|
5072
5081
|
}, b = () => {
|
|
5073
5082
|
window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", b), p(), this.onChange();
|
|
5074
5083
|
};
|
|
@@ -5101,14 +5110,14 @@ let Ei = (j = class {
|
|
|
5101
5110
|
(d = this.imgCtx) == null || d.replaceWith(c), this.imgCtx = c, this.positionImageHandles();
|
|
5102
5111
|
}, s = (c) => {
|
|
5103
5112
|
this.setImageAlign(t, c), i();
|
|
5104
|
-
},
|
|
5113
|
+
}, l = t.style.float === "left", n = t.style.float === "right", r = !l && !n && t.style.marginLeft === "auto" && t.style.marginRight === "auto", o = (c, d, p, m) => {
|
|
5105
5114
|
const b = this.ctxBtn(c, d, m);
|
|
5106
5115
|
return b.classList.toggle("on", p), b;
|
|
5107
5116
|
};
|
|
5108
5117
|
return e.append(
|
|
5109
|
-
o(h.alignleft, this.t("alignleft"),
|
|
5118
|
+
o(h.alignleft, this.t("alignleft"), l, () => s("left")),
|
|
5110
5119
|
o(h.aligncenter, this.t("aligncenter"), r, () => s("center")),
|
|
5111
|
-
o(h.alignright, this.t("alignright"),
|
|
5120
|
+
o(h.alignright, this.t("alignright"), n, () => s("right")),
|
|
5112
5121
|
this.ctxSep(),
|
|
5113
5122
|
o(h.rotateleft, this.t("rotateleft"), !1, () => {
|
|
5114
5123
|
this.rotateImage(t, -90), i();
|
|
@@ -5150,21 +5159,21 @@ let Ei = (j = class {
|
|
|
5150
5159
|
this.clearImageHandles();
|
|
5151
5160
|
return;
|
|
5152
5161
|
}
|
|
5153
|
-
const t = this.imgActive.getBoundingClientRect(), e = t.top + scrollY, i = t.left + scrollX, s = t.right + scrollX,
|
|
5162
|
+
const t = this.imgActive.getBoundingClientRect(), e = t.top + scrollY, i = t.left + scrollX, s = t.right + scrollX, l = t.bottom + scrollY, n = {
|
|
5154
5163
|
nw: [i, e],
|
|
5155
5164
|
ne: [s, e],
|
|
5156
|
-
sw: [i,
|
|
5157
|
-
se: [s,
|
|
5165
|
+
sw: [i, l],
|
|
5166
|
+
se: [s, l]
|
|
5158
5167
|
};
|
|
5159
5168
|
if (this.imgHandles.forEach((r) => {
|
|
5160
|
-
const [o, c] =
|
|
5169
|
+
const [o, c] = n[r.dataset.corner];
|
|
5161
5170
|
r.style.left = o - 5 + "px", r.style.top = c - 5 + "px";
|
|
5162
5171
|
}), this.imgCtx) {
|
|
5163
5172
|
const r = this.imgCtx.offsetWidth, o = this.imgCtx.offsetHeight;
|
|
5164
5173
|
let c = i + (s - i) / 2 - r / 2;
|
|
5165
5174
|
c = Math.max(8 + scrollX, Math.min(c, scrollX + innerWidth - r - 8));
|
|
5166
5175
|
let d = e - o - 8;
|
|
5167
|
-
d < this.ctxMinTop() && (d =
|
|
5176
|
+
d < this.ctxMinTop() && (d = l + 8), this.imgCtx.style.left = c + "px", this.imgCtx.style.top = d + "px";
|
|
5168
5177
|
}
|
|
5169
5178
|
}
|
|
5170
5179
|
startImageResizeDrag(t, e) {
|
|
@@ -5172,10 +5181,10 @@ let Ei = (j = class {
|
|
|
5172
5181
|
const i = this.imgActive;
|
|
5173
5182
|
if (!i) return;
|
|
5174
5183
|
this.cancelImgHide();
|
|
5175
|
-
const s = t.clientX,
|
|
5184
|
+
const s = t.clientX, l = i.getBoundingClientRect().width, n = e === "nw" || e === "sw" ? -1 : 1;
|
|
5176
5185
|
this.withNoTextSelect((r) => {
|
|
5177
5186
|
const o = (d) => {
|
|
5178
|
-
i.style.width = Math.max(24, Math.round(
|
|
5187
|
+
i.style.width = Math.max(24, Math.round(l + n * (d.clientX - s))) + "px", i.style.height = "auto", this.positionImageHandles();
|
|
5179
5188
|
}, c = () => {
|
|
5180
5189
|
window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", c), r(), this.onChange();
|
|
5181
5190
|
};
|
|
@@ -5212,7 +5221,7 @@ let Ei = (j = class {
|
|
|
5212
5221
|
() => this.colorMenu(e, "fore")
|
|
5213
5222
|
), i = this.ctxBtn(h.backcolor, this.t("backcolor"), () => this.colorMenu(i, "back"));
|
|
5214
5223
|
(r = i.querySelector("svg")) == null || r.insertAdjacentHTML("afterend", '<span class="colorbar" data-cb="back"></span>');
|
|
5215
|
-
const s = this.ctxBtn(h.caseic, this.t("changecase"), () => this.caseMenu(s)),
|
|
5224
|
+
const s = this.ctxBtn(h.caseic, this.t("changecase"), () => this.caseMenu(s)), l = this.ctxBtn(h.lineheight, this.t("lineheight"), () => this.lineHeightMenu(l)), n = this.ctxBtn(h.wordspacing, this.t("wordspacing"), () => this.wordSpacingMenu(n));
|
|
5216
5225
|
return t.append(
|
|
5217
5226
|
this.ctxBtn(h.bold, this.t("bold"), () => this.exec("bold"), "bold"),
|
|
5218
5227
|
this.ctxBtn(h.italic, this.t("italic"), () => this.exec("italic"), "italic"),
|
|
@@ -5226,17 +5235,17 @@ let Ei = (j = class {
|
|
|
5226
5235
|
this.ctxSep(),
|
|
5227
5236
|
this.ctxBtn(h.link, this.t("linkttl"), () => this.linkDlg()),
|
|
5228
5237
|
s,
|
|
5229
|
-
|
|
5230
|
-
|
|
5238
|
+
l,
|
|
5239
|
+
n
|
|
5231
5240
|
), t.addEventListener("mousedown", (o) => o.preventDefault()), document.body.appendChild(t), this.syncColorSwatches(t), t;
|
|
5232
5241
|
}
|
|
5233
5242
|
positionSelToolbar(t) {
|
|
5234
5243
|
if (!this.selCtx) return;
|
|
5235
|
-
const e = t.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX,
|
|
5236
|
-
let c = s + (
|
|
5244
|
+
const e = t.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX, n = e.bottom + scrollY, r = this.selCtx.offsetWidth, o = this.selCtx.offsetHeight;
|
|
5245
|
+
let c = s + (l - s) / 2 - r / 2;
|
|
5237
5246
|
c = Math.max(8 + scrollX, Math.min(c, scrollX + innerWidth - r - 8));
|
|
5238
5247
|
let d = i - o - 8;
|
|
5239
|
-
d < this.ctxMinTop() && (d =
|
|
5248
|
+
d < this.ctxMinTop() && (d = n + 8), this.selCtx.style.left = c + "px", this.selCtx.style.top = d + "px";
|
|
5240
5249
|
}
|
|
5241
5250
|
repositionSelToolbar() {
|
|
5242
5251
|
if (!this.selCtx) return;
|
|
@@ -5288,13 +5297,13 @@ let Ei = (j = class {
|
|
|
5288
5297
|
const m = p.querySelector("[data-id=code]");
|
|
5289
5298
|
m && m.classList.toggle("on", e && !!this.closestInlineCode());
|
|
5290
5299
|
});
|
|
5291
|
-
const
|
|
5292
|
-
(c = this.toolbar.querySelector("[data-id=ltr]")) == null || c.classList.toggle("on", e &&
|
|
5300
|
+
const l = t ? this.closestBlock(t.anchorNode) : null, n = ((o = l == null ? void 0 : l.closest("[dir]")) == null ? void 0 : o.getAttribute("dir")) || this.ed.getAttribute("dir") || this.dir();
|
|
5301
|
+
(c = this.toolbar.querySelector("[data-id=ltr]")) == null || c.classList.toggle("on", e && n === "ltr"), (d = this.toolbar.querySelector("[data-id=rtl]")) == null || d.classList.toggle("on", e && n === "rtl");
|
|
5293
5302
|
const r = (p, m, b) => {
|
|
5294
5303
|
const y = this.toolbar.querySelector(`[data-id=${p}] .lbl`);
|
|
5295
5304
|
y && (y.textContent = m || b || "", y.classList.toggle("empty", !m));
|
|
5296
5305
|
};
|
|
5297
|
-
r("fontsel", this.currentFont()), r("sizesel", this.currentSize().replace("px", "")), e && r("blocksel",
|
|
5306
|
+
r("fontsel", this.currentFont()), r("sizesel", this.currentSize().replace("px", "")), e && r("blocksel", se.some((p) => p[0] === i) ? this.blockLabel(i) : this.t("para")), this.sbWords.textContent = this.countWords() + " " + this.t("words");
|
|
5298
5307
|
}
|
|
5299
5308
|
countWords() {
|
|
5300
5309
|
const t = (this.ed.textContent || "").trim();
|
|
@@ -5305,18 +5314,18 @@ let Ei = (j = class {
|
|
|
5305
5314
|
const e = t.clipboardData;
|
|
5306
5315
|
if (!e) return;
|
|
5307
5316
|
t.preventDefault();
|
|
5308
|
-
const i = e.getData("text/html"), s = Array.from(e.items).find((
|
|
5317
|
+
const i = e.getData("text/html"), s = Array.from(e.items).find((l) => l.type.startsWith("image/"));
|
|
5309
5318
|
if (s && !i) {
|
|
5310
|
-
const
|
|
5311
|
-
|
|
5312
|
-
document.execCommand("insertHTML", !1, `<img src="${
|
|
5313
|
-
},
|
|
5319
|
+
const l = new FileReader();
|
|
5320
|
+
l.onload = () => {
|
|
5321
|
+
document.execCommand("insertHTML", !1, `<img src="${l.result}" alt="">`), this.onChange();
|
|
5322
|
+
}, l.readAsDataURL(s.getAsFile());
|
|
5314
5323
|
return;
|
|
5315
5324
|
}
|
|
5316
5325
|
if (!i) {
|
|
5317
|
-
const
|
|
5318
|
-
if (
|
|
5319
|
-
document.execCommand("insertHTML", !1, this.videoEmbedHTML(
|
|
5326
|
+
const l = e.getData("text/plain"), n = /^\S+$/.test(l.trim()) ? this.videoEmbedUrl(l.trim()) : null;
|
|
5327
|
+
if (n) {
|
|
5328
|
+
document.execCommand("insertHTML", !1, this.videoEmbedHTML(n)), this.onChange();
|
|
5320
5329
|
return;
|
|
5321
5330
|
}
|
|
5322
5331
|
}
|
|
@@ -5327,10 +5336,10 @@ let Ei = (j = class {
|
|
|
5327
5336
|
this.closePop(), this.closeDlg(), this.clearTableHandles(), this.clearImgPlaceholderSel(), this.clearVphPlaceholderSel(), this.clearVidHandles(), this.clearCodeSel(), this.shell.dir = this.dir(), this.ed.dir = this.dir(), this.options.menubar ? this.buildMenubar() : this.menubar.style.display = "none", this.options.toolbar ? this.buildToolbar() : this.toolbar.style.display = "none", this.sbHelp.textContent = this.t("statushelp"), this.refreshState();
|
|
5328
5337
|
}
|
|
5329
5338
|
}, j.instanceCounter = 0, j.TBR_COLLAPSE_MAX = 992, j);
|
|
5330
|
-
const Si =
|
|
5331
|
-
({ value: u, defaultValue: t, onChange: e, onReady: i, className: s, style:
|
|
5339
|
+
const Si = _e(
|
|
5340
|
+
({ value: u, defaultValue: t, onChange: e, onReady: i, className: s, style: l, ...n }, r) => {
|
|
5332
5341
|
const o = z(null), c = z(null), d = z(!1), p = z(u ?? t), m = z(null), b = z(e), y = z(i);
|
|
5333
|
-
return b.current = e, y.current = i,
|
|
5342
|
+
return b.current = e, y.current = i, Fe(r, () => ({
|
|
5334
5343
|
getContent: () => {
|
|
5335
5344
|
var g;
|
|
5336
5345
|
return ((g = c.current) == null ? void 0 : g.getContent()) ?? "";
|
|
@@ -5380,7 +5389,7 @@ const Si = Ne(
|
|
|
5380
5389
|
var w;
|
|
5381
5390
|
return (w = y.current) == null ? void 0 : w.call(y, x);
|
|
5382
5391
|
},
|
|
5383
|
-
...
|
|
5392
|
+
...n
|
|
5384
5393
|
});
|
|
5385
5394
|
return c.current = g, () => {
|
|
5386
5395
|
g.destroy(), c.current = null;
|
|
@@ -5406,14 +5415,14 @@ const Si = Ne(
|
|
|
5406
5415
|
if (m.current === null) return;
|
|
5407
5416
|
const E = w.relatedTarget;
|
|
5408
5417
|
if (E && g.contains(E)) return;
|
|
5409
|
-
const
|
|
5410
|
-
m.current = null, p.current =
|
|
5418
|
+
const A = m.current;
|
|
5419
|
+
m.current = null, p.current = A, (H = c.current) == null || H.setContent(A);
|
|
5411
5420
|
};
|
|
5412
5421
|
return g.addEventListener("focusout", x), () => g.removeEventListener("focusout", x);
|
|
5413
5422
|
}, []), ot(() => {
|
|
5414
5423
|
var g;
|
|
5415
|
-
|
|
5416
|
-
}, [
|
|
5424
|
+
n.language && ((g = c.current) == null || g.setLanguage(n.language));
|
|
5425
|
+
}, [n.language]), /* @__PURE__ */ We.jsx("div", { ref: o, className: s, style: l });
|
|
5417
5426
|
}
|
|
5418
5427
|
);
|
|
5419
5428
|
Si.displayName = "FableEditor";
|