fable-editor 1.3.1 → 1.3.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/dist/angular/core/word-image-paste.d.ts +9 -0
- package/dist/angular/esm2022/core/word-image-paste.mjs +73 -4
- package/dist/angular/fesm2022/fable-editor.mjs +72 -3
- package/dist/angular/fesm2022/fable-editor.mjs.map +1 -1
- package/dist/core/index.cjs +4 -4
- package/dist/core/index.mjs +511 -480
- package/dist/core/word-image-paste.d.ts +9 -0
- package/dist/core/word-image-paste.d.ts.map +1 -1
- package/dist/react/index.cjs +9 -9
- package/dist/react/index.mjs +416 -385
- package/package.json +1 -1
package/dist/react/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import me, { forwardRef as Ye, useRef as z, useImperativeHandle as Ge, useEffect as lt } from "react";
|
|
2
2
|
var Mt = { exports: {} }, J = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
@@ -10,15 +10,15 @@ var Mt = { exports: {} }, J = {};
|
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/
|
|
12
12
|
var Jt;
|
|
13
|
-
function
|
|
13
|
+
function Ke() {
|
|
14
14
|
if (Jt) return J;
|
|
15
15
|
Jt = 1;
|
|
16
|
-
var
|
|
16
|
+
var d = me, t = Symbol.for("react.element"), e = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, s = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
17
|
function l(r, o, a) {
|
|
18
|
-
var
|
|
18
|
+
var u, p = {}, m = null, v = null;
|
|
19
19
|
a !== void 0 && (m = "" + a), o.key !== void 0 && (m = "" + o.key), o.ref !== void 0 && (v = o.ref);
|
|
20
|
-
for (
|
|
21
|
-
if (r && r.defaultProps) for (
|
|
20
|
+
for (u in o) i.call(o, u) && !n.hasOwnProperty(u) && (p[u] = o[u]);
|
|
21
|
+
if (r && r.defaultProps) for (u in o = r.defaultProps, o) p[u] === void 0 && (p[u] = o[u]);
|
|
22
22
|
return { $$typeof: t, type: r, key: m, ref: v, props: p, _owner: s.current };
|
|
23
23
|
}
|
|
24
24
|
return J.Fragment = e, J.jsx = l, J.jsxs = l, J;
|
|
@@ -34,16 +34,16 @@ var tt = {};
|
|
|
34
34
|
* LICENSE file in the root directory of this source tree.
|
|
35
35
|
*/
|
|
36
36
|
var te;
|
|
37
|
-
function
|
|
37
|
+
function Qe() {
|
|
38
38
|
return te || (te = 1, process.env.NODE_ENV !== "production" && function() {
|
|
39
|
-
var
|
|
39
|
+
var d = me, t = Symbol.for("react.element"), e = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), n = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), r = Symbol.for("react.context"), o = Symbol.for("react.forward_ref"), a = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), m = Symbol.for("react.lazy"), v = Symbol.for("react.offscreen"), b = Symbol.iterator, f = "@@iterator";
|
|
40
40
|
function y(c) {
|
|
41
41
|
if (c === null || typeof c != "object")
|
|
42
42
|
return null;
|
|
43
43
|
var g = b && c[b] || c[f];
|
|
44
44
|
return typeof g == "function" ? g : null;
|
|
45
45
|
}
|
|
46
|
-
var C =
|
|
46
|
+
var C = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
47
47
|
function E(c) {
|
|
48
48
|
{
|
|
49
49
|
for (var g = arguments.length, x = new Array(g > 1 ? g - 1 : 0), T = 1; T < g; T++)
|
|
@@ -61,16 +61,16 @@ function Ke() {
|
|
|
61
61
|
H.unshift("Warning: " + g), Function.prototype.apply.call(console[c], console, H);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
var A = !1, $ = !1,
|
|
64
|
+
var A = !1, $ = !1, F = !1, Z = !1, et = !1, kt;
|
|
65
65
|
kt = Symbol.for("react.module.reference");
|
|
66
|
-
function
|
|
67
|
-
return !!(typeof c == "string" || typeof c == "function" || c === i || c === n || et || c === s || c === a || c ===
|
|
66
|
+
function xe(c) {
|
|
67
|
+
return !!(typeof c == "string" || typeof c == "function" || c === i || c === n || et || c === s || c === a || c === u || Z || c === v || A || $ || F || typeof c == "object" && c !== null && (c.$$typeof === m || c.$$typeof === p || c.$$typeof === l || c.$$typeof === r || c.$$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
|
c.$$typeof === kt || c.getModuleId !== void 0));
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function Ce(c, g, x) {
|
|
74
74
|
var T = c.displayName;
|
|
75
75
|
if (T)
|
|
76
76
|
return T;
|
|
@@ -98,7 +98,7 @@ function Ke() {
|
|
|
98
98
|
return "StrictMode";
|
|
99
99
|
case a:
|
|
100
100
|
return "Suspense";
|
|
101
|
-
case
|
|
101
|
+
case u:
|
|
102
102
|
return "SuspenseList";
|
|
103
103
|
}
|
|
104
104
|
if (typeof c == "object")
|
|
@@ -110,7 +110,7 @@ function Ke() {
|
|
|
110
110
|
var x = c;
|
|
111
111
|
return At(x._context) + ".Provider";
|
|
112
112
|
case o:
|
|
113
|
-
return
|
|
113
|
+
return Ce(c, c.render, "ForwardRef");
|
|
114
114
|
case p:
|
|
115
115
|
var T = c.displayName || null;
|
|
116
116
|
return T !== null ? T : W(c.type) || "Memo";
|
|
@@ -129,7 +129,7 @@ function Ke() {
|
|
|
129
129
|
function Nt() {
|
|
130
130
|
}
|
|
131
131
|
Nt.__reactDisabledLog = !0;
|
|
132
|
-
function
|
|
132
|
+
function we() {
|
|
133
133
|
{
|
|
134
134
|
if (K === 0) {
|
|
135
135
|
Ht = console.log, It = console.info, qt = console.warn, Rt = console.error, Pt = console.group, Bt = console.groupCollapsed, Dt = console.groupEnd;
|
|
@@ -152,7 +152,7 @@ function Ke() {
|
|
|
152
152
|
K++;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function Te() {
|
|
156
156
|
{
|
|
157
157
|
if (K--, K === 0) {
|
|
158
158
|
var c = {
|
|
@@ -203,8 +203,8 @@ function Ke() {
|
|
|
203
203
|
}
|
|
204
204
|
var gt = !1, st;
|
|
205
205
|
{
|
|
206
|
-
var
|
|
207
|
-
st = new
|
|
206
|
+
var Ee = typeof WeakMap == "function" ? WeakMap : Map;
|
|
207
|
+
st = new Ee();
|
|
208
208
|
}
|
|
209
209
|
function Ot(c, g) {
|
|
210
210
|
if (!c || gt)
|
|
@@ -219,7 +219,7 @@ function Ke() {
|
|
|
219
219
|
var k = Error.prepareStackTrace;
|
|
220
220
|
Error.prepareStackTrace = void 0;
|
|
221
221
|
var H;
|
|
222
|
-
H = mt.current, mt.current = null,
|
|
222
|
+
H = mt.current, mt.current = null, we();
|
|
223
223
|
try {
|
|
224
224
|
if (g) {
|
|
225
225
|
var M = function() {
|
|
@@ -272,15 +272,15 @@ function Ke() {
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
} finally {
|
|
275
|
-
gt = !1, mt.current = H,
|
|
275
|
+
gt = !1, mt.current = H, Te(), Error.prepareStackTrace = k;
|
|
276
276
|
}
|
|
277
277
|
var G = c ? c.displayName || c.name : "", V = G ? it(G) : "";
|
|
278
278
|
return typeof c == "function" && st.set(c, V), V;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function Se(c, g, x) {
|
|
281
281
|
return Ot(c, !1);
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function Me(c) {
|
|
284
284
|
var g = c.prototype;
|
|
285
285
|
return !!(g && g.isReactComponent);
|
|
286
286
|
}
|
|
@@ -288,19 +288,19 @@ function Ke() {
|
|
|
288
288
|
if (c == null)
|
|
289
289
|
return "";
|
|
290
290
|
if (typeof c == "function")
|
|
291
|
-
return Ot(c,
|
|
291
|
+
return Ot(c, Me(c));
|
|
292
292
|
if (typeof c == "string")
|
|
293
293
|
return it(c);
|
|
294
294
|
switch (c) {
|
|
295
295
|
case a:
|
|
296
296
|
return it("Suspense");
|
|
297
|
-
case
|
|
297
|
+
case u:
|
|
298
298
|
return it("SuspenseList");
|
|
299
299
|
}
|
|
300
300
|
if (typeof c == "object")
|
|
301
301
|
switch (c.$$typeof) {
|
|
302
302
|
case o:
|
|
303
|
-
return
|
|
303
|
+
return Se(c.render);
|
|
304
304
|
case p:
|
|
305
305
|
return nt(c.type, g, x);
|
|
306
306
|
case m: {
|
|
@@ -313,15 +313,15 @@ function Ke() {
|
|
|
313
313
|
}
|
|
314
314
|
return "";
|
|
315
315
|
}
|
|
316
|
-
var Q = Object.prototype.hasOwnProperty,
|
|
316
|
+
var Q = Object.prototype.hasOwnProperty, Ft = {}, Zt = C.ReactDebugCurrentFrame;
|
|
317
317
|
function rt(c) {
|
|
318
318
|
if (c) {
|
|
319
319
|
var g = c._owner, x = nt(c.type, c._source, g ? g.type : null);
|
|
320
|
-
|
|
320
|
+
Zt.setExtraStackFrame(x);
|
|
321
321
|
} else
|
|
322
|
-
|
|
322
|
+
Zt.setExtraStackFrame(null);
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function Le(c, g, x, T, k) {
|
|
325
325
|
{
|
|
326
326
|
var H = Function.call.bind(Q);
|
|
327
327
|
for (var M in c)
|
|
@@ -336,21 +336,21 @@ function Ke() {
|
|
|
336
336
|
} catch (R) {
|
|
337
337
|
S = R;
|
|
338
338
|
}
|
|
339
|
-
S && !(S instanceof Error) && (rt(k), 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", x, M, typeof S), rt(null)), S instanceof Error && !(S.message in
|
|
339
|
+
S && !(S instanceof Error) && (rt(k), 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", x, M, typeof S), rt(null)), S instanceof Error && !(S.message in Ft) && (Ft[S.message] = !0, rt(k), E("Failed %s type: %s", x, S.message), rt(null));
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
var
|
|
343
|
+
var ke = Array.isArray;
|
|
344
344
|
function vt(c) {
|
|
345
|
-
return
|
|
345
|
+
return ke(c);
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function Ae(c) {
|
|
348
348
|
{
|
|
349
349
|
var g = typeof Symbol == "function" && Symbol.toStringTag, x = g && c[Symbol.toStringTag] || c.constructor.name || "Object";
|
|
350
350
|
return x;
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function He(c) {
|
|
354
354
|
try {
|
|
355
355
|
return _t(c), !1;
|
|
356
356
|
} catch {
|
|
@@ -361,16 +361,16 @@ function Ke() {
|
|
|
361
361
|
return "" + c;
|
|
362
362
|
}
|
|
363
363
|
function $t(c) {
|
|
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 (He(c))
|
|
365
|
+
return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ae(c)), _t(c);
|
|
366
366
|
}
|
|
367
|
-
var jt = C.ReactCurrentOwner,
|
|
367
|
+
var jt = C.ReactCurrentOwner, Ie = {
|
|
368
368
|
key: !0,
|
|
369
369
|
ref: !0,
|
|
370
370
|
__self: !0,
|
|
371
371
|
__source: !0
|
|
372
372
|
}, Wt, Ut;
|
|
373
|
-
function
|
|
373
|
+
function qe(c) {
|
|
374
374
|
if (Q.call(c, "ref")) {
|
|
375
375
|
var g = Object.getOwnPropertyDescriptor(c, "ref").get;
|
|
376
376
|
if (g && g.isReactWarning)
|
|
@@ -378,7 +378,7 @@ function Ke() {
|
|
|
378
378
|
}
|
|
379
379
|
return c.ref !== void 0;
|
|
380
380
|
}
|
|
381
|
-
function
|
|
381
|
+
function Re(c) {
|
|
382
382
|
if (Q.call(c, "key")) {
|
|
383
383
|
var g = Object.getOwnPropertyDescriptor(c, "key").get;
|
|
384
384
|
if (g && g.isReactWarning)
|
|
@@ -386,10 +386,10 @@ function Ke() {
|
|
|
386
386
|
}
|
|
387
387
|
return c.key !== void 0;
|
|
388
388
|
}
|
|
389
|
-
function
|
|
389
|
+
function Pe(c, g) {
|
|
390
390
|
typeof c.ref == "string" && jt.current;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function Be(c, g) {
|
|
393
393
|
{
|
|
394
394
|
var x = function() {
|
|
395
395
|
Wt || (Wt = !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)", g));
|
|
@@ -400,7 +400,7 @@ function Ke() {
|
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function De(c, g) {
|
|
404
404
|
{
|
|
405
405
|
var x = function() {
|
|
406
406
|
Ut || (Ut = !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)", g));
|
|
@@ -411,7 +411,7 @@ function Ke() {
|
|
|
411
411
|
});
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
var
|
|
414
|
+
var Ne = function(c, g, x, T, k, H, M) {
|
|
415
415
|
var S = {
|
|
416
416
|
// This tag allows us to uniquely identify this as a React Element
|
|
417
417
|
$$typeof: t,
|
|
@@ -440,12 +440,12 @@ function Ke() {
|
|
|
440
440
|
value: k
|
|
441
441
|
}), Object.freeze && (Object.freeze(S.props), Object.freeze(S)), S;
|
|
442
442
|
};
|
|
443
|
-
function
|
|
443
|
+
function Oe(c, g, x, T, k) {
|
|
444
444
|
{
|
|
445
445
|
var H, M = {}, S = null, D = null;
|
|
446
|
-
x !== void 0 && ($t(x), S = "" + x),
|
|
446
|
+
x !== void 0 && ($t(x), S = "" + x), Re(g) && ($t(g.key), S = "" + g.key), qe(g) && (D = g.ref, Pe(g, k));
|
|
447
447
|
for (H in g)
|
|
448
|
-
Q.call(g, H) && !
|
|
448
|
+
Q.call(g, H) && !Ie.hasOwnProperty(H) && (M[H] = g[H]);
|
|
449
449
|
if (c && c.defaultProps) {
|
|
450
450
|
var R = c.defaultProps;
|
|
451
451
|
for (H in R)
|
|
@@ -453,9 +453,9 @@ function Ke() {
|
|
|
453
453
|
}
|
|
454
454
|
if (S || D) {
|
|
455
455
|
var P = typeof c == "function" ? c.displayName || c.name || "Unknown" : c;
|
|
456
|
-
S &&
|
|
456
|
+
S && Be(M, P), D && De(M, P);
|
|
457
457
|
}
|
|
458
|
-
return
|
|
458
|
+
return Ne(c, S, D, k, T, jt.current, M);
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
var bt = C.ReactCurrentOwner, Vt = C.ReactDebugCurrentFrame;
|
|
@@ -483,7 +483,7 @@ Check the render method of \`` + c + "`.";
|
|
|
483
483
|
return "";
|
|
484
484
|
}
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function Fe(c) {
|
|
487
487
|
return "";
|
|
488
488
|
}
|
|
489
489
|
var Xt = {};
|
|
@@ -531,7 +531,7 @@ Check the top-level render call using <` + x + ">.");
|
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function _e(c) {
|
|
535
535
|
{
|
|
536
536
|
var g = c.type;
|
|
537
537
|
if (g == null || typeof g == "string")
|
|
@@ -547,7 +547,7 @@ Check the top-level render call using <` + x + ">.");
|
|
|
547
547
|
return;
|
|
548
548
|
if (x) {
|
|
549
549
|
var T = W(g);
|
|
550
|
-
|
|
550
|
+
Le(x, c.props, "prop", T, c);
|
|
551
551
|
} else if (g.PropTypes !== void 0 && !yt) {
|
|
552
552
|
yt = !0;
|
|
553
553
|
var k = W(g);
|
|
@@ -556,7 +556,7 @@ Check the top-level render call using <` + x + ">.");
|
|
|
556
556
|
typeof g.getDefaultProps == "function" && !g.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 $e(c) {
|
|
560
560
|
{
|
|
561
561
|
for (var g = Object.keys(c.props), x = 0; x < g.length; x++) {
|
|
562
562
|
var T = g[x];
|
|
@@ -571,16 +571,16 @@ Check the top-level render call using <` + x + ">.");
|
|
|
571
571
|
var Kt = {};
|
|
572
572
|
function Qt(c, g, x, T, k, H) {
|
|
573
573
|
{
|
|
574
|
-
var M =
|
|
574
|
+
var M = xe(c);
|
|
575
575
|
if (!M) {
|
|
576
576
|
var S = "";
|
|
577
577
|
(c === void 0 || typeof c == "object" && c !== null && Object.keys(c).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 D =
|
|
578
|
+
var D = Fe();
|
|
579
579
|
D ? S += D : S += zt();
|
|
580
580
|
var R;
|
|
581
581
|
c === null ? R = "null" : vt(c) ? R = "array" : c !== void 0 && c.$$typeof === t ? (R = "<" + (W(c.type) || "Unknown") + " />", S = " Did you accidentally export a JSX literal instead of a component?") : R = typeof c, 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 = Oe(c, g, x, k, H);
|
|
584
584
|
if (P == null)
|
|
585
585
|
return P;
|
|
586
586
|
if (M) {
|
|
@@ -597,35 +597,35 @@ Check the top-level render call using <` + x + ">.");
|
|
|
597
597
|
Gt(_, c);
|
|
598
598
|
}
|
|
599
599
|
if (Q.call(g, "key")) {
|
|
600
|
-
var V = W(c), N = Object.keys(g).filter(function(
|
|
601
|
-
return
|
|
600
|
+
var V = W(c), N = Object.keys(g).filter(function(Xe) {
|
|
601
|
+
return Xe !== "key";
|
|
602
602
|
}), Ct = N.length > 0 ? "{key: someKey, " + N.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
603
603
|
if (!Kt[V + Ct]) {
|
|
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} />`, Ct, V,
|
|
610
|
+
<%s key={someKey} {...props} />`, Ct, V, ze, V), Kt[V + Ct] = !0;
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
|
-
return c === i ?
|
|
613
|
+
return c === i ? $e(P) : _e(P), P;
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
function
|
|
616
|
+
function je(c, g, x) {
|
|
617
617
|
return Qt(c, g, x, !0);
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function We(c, g, x) {
|
|
620
620
|
return Qt(c, g, x, !1);
|
|
621
621
|
}
|
|
622
|
-
var
|
|
623
|
-
tt.Fragment = i, tt.jsx =
|
|
622
|
+
var Ue = We, Ve = je;
|
|
623
|
+
tt.Fragment = i, tt.jsx = Ue, tt.jsxs = Ve;
|
|
624
624
|
}()), tt;
|
|
625
625
|
}
|
|
626
|
-
process.env.NODE_ENV === "production" ? Mt.exports =
|
|
627
|
-
var
|
|
628
|
-
const
|
|
626
|
+
process.env.NODE_ENV === "production" ? Mt.exports = Ke() : Mt.exports = Qe();
|
|
627
|
+
var Je = Mt.exports;
|
|
628
|
+
const ti = {
|
|
629
629
|
en: {
|
|
630
630
|
dir: "ltr",
|
|
631
631
|
file: "File",
|
|
@@ -1011,10 +1011,10 @@ const Je = {
|
|
|
1011
1011
|
emcat_flags: "أعلام"
|
|
1012
1012
|
}
|
|
1013
1013
|
};
|
|
1014
|
-
function wt(
|
|
1015
|
-
return
|
|
1014
|
+
function wt(d) {
|
|
1015
|
+
return ti[d];
|
|
1016
1016
|
}
|
|
1017
|
-
const
|
|
1017
|
+
const ei = "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", ii = "file edit view insert format tools table help", si = [
|
|
1018
1018
|
["Andale Mono", "andale mono,times"],
|
|
1019
1019
|
["Arial", "arial,helvetica,sans-serif"],
|
|
1020
1020
|
["Arial Black", "arial black,avant garde"],
|
|
@@ -1034,7 +1034,7 @@ const ti = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
1034
1034
|
["Verdana", "verdana,geneva"],
|
|
1035
1035
|
["Webdings", "webdings"],
|
|
1036
1036
|
["Wingdings", "wingdings,zapf dingbats"]
|
|
1037
|
-
],
|
|
1037
|
+
], ni = ["8px", "9px", "10px", "11px", "12px", "14px", "16px", "18px", "20px", "24px", "28px", "32px", "36px", "48px", "72px", "96px"], ri = 1, li = 100, ee = ["1", "1.15", "1.4", "1.5", "1.75", "2", "2.5", "3"], ie = ["1px", "2px", "4px", "6px", "8px", "12px"], se = ["0.5px", "1px", "1.5px", "2px", "3px", "4px"], ne = [
|
|
1038
1038
|
["plain", "Plain text"],
|
|
1039
1039
|
["html", "HTML/XML"],
|
|
1040
1040
|
["css", "CSS"],
|
|
@@ -1060,7 +1060,7 @@ const ti = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
1060
1060
|
["h5", "heading5"],
|
|
1061
1061
|
["h6", "heading6"],
|
|
1062
1062
|
["pre", "pre"]
|
|
1063
|
-
],
|
|
1063
|
+
], oi = ["#F76707", "#4263EB", "#CC5DE8"], ai = [
|
|
1064
1064
|
"#FFFFFF",
|
|
1065
1065
|
"#F4F4F4",
|
|
1066
1066
|
"#E8EAED",
|
|
@@ -1086,7 +1086,7 @@ const ti = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
1086
1086
|
"#8E24AA",
|
|
1087
1087
|
"#C2185B",
|
|
1088
1088
|
"#6D4C41"
|
|
1089
|
-
],
|
|
1089
|
+
], ci = [
|
|
1090
1090
|
{
|
|
1091
1091
|
key: "chcat_currency",
|
|
1092
1092
|
chars: [
|
|
@@ -1426,7 +1426,7 @@ const ti = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
1426
1426
|
"ة"
|
|
1427
1427
|
]
|
|
1428
1428
|
}
|
|
1429
|
-
],
|
|
1429
|
+
], hi = [
|
|
1430
1430
|
{
|
|
1431
1431
|
key: "emcat_smileys",
|
|
1432
1432
|
chars: [
|
|
@@ -2151,8 +2151,8 @@ const ti = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
2151
2151
|
"🇲🇦"
|
|
2152
2152
|
]
|
|
2153
2153
|
}
|
|
2154
|
-
], L = (
|
|
2155
|
-
'<path d="M10 6h10M10 12h10M10 18h10"/>' +
|
|
2154
|
+
], L = (d, t) => `<svg viewBox="${t || "0 0 24 24"}">${d}</svg>`, w = (d) => L(`<path class="f" d="${d}"/>`, "0 -960 960 960"), ot = (d, t = 7.5) => L(
|
|
2155
|
+
'<path d="M10 6h10M10 12h10M10 18h10"/>' + d.map(
|
|
2156
2156
|
(e, i) => `<text x="2.5" y="${8.4 + i * 6}" font-size="${t}" stroke="none" fill="#222f3e" font-family="Arial">${e}</text>`
|
|
2157
2157
|
).join("")
|
|
2158
2158
|
), h = {
|
|
@@ -2380,7 +2380,7 @@ const ti = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
2380
2380
|
codesampleic: L(
|
|
2381
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"/>'
|
|
2382
2382
|
)
|
|
2383
|
-
},
|
|
2383
|
+
}, di = /* @__PURE__ */ new Set([
|
|
2384
2384
|
"p",
|
|
2385
2385
|
"div",
|
|
2386
2386
|
"span",
|
|
@@ -2422,7 +2422,7 @@ const ti = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
2422
2422
|
"figure",
|
|
2423
2423
|
"figcaption",
|
|
2424
2424
|
"mark"
|
|
2425
|
-
]),
|
|
2425
|
+
]), ui = /* @__PURE__ */ new Set([
|
|
2426
2426
|
"text-align",
|
|
2427
2427
|
"direction",
|
|
2428
2428
|
"unicode-bidi",
|
|
@@ -2487,26 +2487,26 @@ const ti = "undo redo | preview print | importword revhistory | fontfamily fonts
|
|
|
2487
2487
|
th: ["width", "valign"],
|
|
2488
2488
|
table: ["width", "cellpadding", "cellspacing"]
|
|
2489
2489
|
};
|
|
2490
|
-
function pt(
|
|
2491
|
-
const t = {}, e =
|
|
2490
|
+
function pt(d) {
|
|
2491
|
+
const t = {}, e = d.getAttribute && d.getAttribute("style");
|
|
2492
2492
|
return e && e.split(";").forEach((i) => {
|
|
2493
2493
|
const s = i.indexOf(":");
|
|
2494
2494
|
s < 1 || (t[i.slice(0, s).trim().toLowerCase()] = i.slice(s + 1).trim());
|
|
2495
2495
|
}), t;
|
|
2496
2496
|
}
|
|
2497
|
-
function
|
|
2498
|
-
return
|
|
2497
|
+
function pi(d) {
|
|
2498
|
+
return d.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, "");
|
|
2499
2499
|
}
|
|
2500
|
-
function
|
|
2501
|
-
return /^[0-9]+[\.\)،]/.test(
|
|
2500
|
+
function mi(d) {
|
|
2501
|
+
return /^[0-9]+[\.\)،]/.test(d) ? { ordered: !0 } : /^[٠-٩۰-۹]+/.test(d) ? { ordered: !0, style: "arabic-indic" } : /^[ivxlc]{2,}[\.\)]/.test(d) ? { ordered: !0, style: "lower-roman" } : /^[IVXLC]{2,}[\.\)]/.test(d) ? { ordered: !0, style: "upper-roman" } : /^[a-z][\.\)]/.test(d) ? { ordered: !0, style: "lower-alpha" } : /^[A-Z][\.\)]/.test(d) ? { ordered: !0, style: "upper-alpha" } : /^[ء-ي][\.\)،-]/.test(d) ? { ordered: !0, style: "arabic-indic" } : { ordered: !1 };
|
|
2502
2502
|
}
|
|
2503
|
-
function
|
|
2503
|
+
function fi(d) {
|
|
2504
2504
|
const t = (s) => {
|
|
2505
2505
|
const n = (s.getAttribute("style") || "") + " " + (s.className || "");
|
|
2506
2506
|
return /mso-list\s*:(?!\s*ignore)/i.test(n) || /MsoListParagraph/i.test(n);
|
|
2507
2507
|
}, e = [];
|
|
2508
2508
|
let i = null;
|
|
2509
|
-
Array.from(
|
|
2509
|
+
Array.from(d.body.querySelectorAll("p")).forEach((s) => {
|
|
2510
2510
|
if (!t(s)) {
|
|
2511
2511
|
i = null;
|
|
2512
2512
|
return;
|
|
@@ -2517,12 +2517,12 @@ function mi(u) {
|
|
|
2517
2517
|
const n = [], l = s[0];
|
|
2518
2518
|
s.forEach((r) => {
|
|
2519
2519
|
var C, E, I;
|
|
2520
|
-
const a = +(((C = (r.getAttribute("style") || "").match(/level(\d+)/i)) == null ? void 0 : C[1]) || 1),
|
|
2520
|
+
const a = +(((C = (r.getAttribute("style") || "").match(/level(\d+)/i)) == null ? void 0 : C[1]) || 1), u = Array.from(r.querySelectorAll("span")).find(
|
|
2521
2521
|
(A) => /mso-list\s*:\s*ignore/i.test(A.getAttribute("style") || "")
|
|
2522
|
-
), p =
|
|
2523
|
-
for (
|
|
2522
|
+
), p = u ? ((E = u.textContent) == null ? void 0 : E.trim()) || "" : (((I = r.textContent) == null ? void 0 : I.trim().match(/^\S{1,4}/)) || [""])[0], { ordered: m, style: v } = mi(p);
|
|
2523
|
+
for (u && u.remove(); n.length && n[n.length - 1].level > a; ) n.pop();
|
|
2524
2524
|
if (!n.length || n[n.length - 1].level < a) {
|
|
2525
|
-
const A =
|
|
2525
|
+
const A = d.createElement(m ? "ol" : "ul");
|
|
2526
2526
|
if (m && v && (A.style.listStyleType = v), n.length) {
|
|
2527
2527
|
const $ = n[n.length - 1].list;
|
|
2528
2528
|
($.lastElementChild || $).appendChild(A);
|
|
@@ -2530,52 +2530,52 @@ function mi(u) {
|
|
|
2530
2530
|
l.parentNode.insertBefore(A, l);
|
|
2531
2531
|
n.push({ list: A, level: a });
|
|
2532
2532
|
}
|
|
2533
|
-
const b =
|
|
2533
|
+
const b = d.createElement("li"), f = pt(r), y = ["text-align", "direction", "unicode-bidi", "color", "font-size", "font-family", "background-color"].filter((A) => f[A]).map((A) => A + ":" + f[A]).join(";");
|
|
2534
2534
|
for (y && b.setAttribute("style", y), r.getAttribute("dir") && b.setAttribute("dir", r.getAttribute("dir")); r.firstChild; ) b.appendChild(r.firstChild);
|
|
2535
2535
|
n[n.length - 1].list.appendChild(b), r.remove();
|
|
2536
2536
|
});
|
|
2537
2537
|
});
|
|
2538
2538
|
}
|
|
2539
|
-
function
|
|
2540
|
-
|
|
2539
|
+
function gi(d) {
|
|
2540
|
+
d.querySelectorAll('b[id^="docs-internal-guid"]').forEach((t) => {
|
|
2541
2541
|
for (; t.firstChild; ) t.parentNode.insertBefore(t.firstChild, t);
|
|
2542
2542
|
t.remove();
|
|
2543
2543
|
});
|
|
2544
2544
|
}
|
|
2545
|
-
function
|
|
2546
|
-
|
|
2545
|
+
function vi(d) {
|
|
2546
|
+
d.querySelectorAll("table").forEach((t) => {
|
|
2547
2547
|
const e = t;
|
|
2548
2548
|
pt(e)["border-collapse"] || (e.style.borderCollapse = "collapse");
|
|
2549
|
-
}),
|
|
2549
|
+
}), d.querySelectorAll("[align]").forEach((t) => {
|
|
2550
2550
|
const e = t, i = e.getAttribute("align").toLowerCase();
|
|
2551
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) => {
|
|
2552
2552
|
if (s.tagName.toLowerCase() !== "table") return;
|
|
2553
2553
|
const n = s;
|
|
2554
2554
|
i === "center" ? (n.style.marginLeft = n.style.marginLeft || "auto", n.style.marginRight = n.style.marginRight || "auto") : i === "right" ? n.style.marginLeft = n.style.marginLeft || "auto" : i === "left" && (n.style.marginRight = n.style.marginRight || "auto");
|
|
2555
2555
|
})), e.removeAttribute("align");
|
|
2556
|
-
}),
|
|
2556
|
+
}), d.querySelectorAll("center table").forEach((t) => {
|
|
2557
2557
|
const e = t;
|
|
2558
2558
|
e.style.marginLeft = e.style.marginLeft || "auto", e.style.marginRight = e.style.marginRight || "auto";
|
|
2559
|
-
}),
|
|
2559
|
+
}), d.querySelectorAll("[bgcolor]").forEach((t) => {
|
|
2560
2560
|
const e = t;
|
|
2561
2561
|
e.style.backgroundColor = e.style.backgroundColor || e.getAttribute("bgcolor"), e.removeAttribute("bgcolor");
|
|
2562
2562
|
});
|
|
2563
2563
|
}
|
|
2564
|
-
function dt(
|
|
2565
|
-
Array.from(
|
|
2564
|
+
function dt(d, t) {
|
|
2565
|
+
Array.from(d.childNodes).forEach((e) => {
|
|
2566
2566
|
if (e.nodeType === Node.COMMENT_NODE) {
|
|
2567
2567
|
e.remove();
|
|
2568
2568
|
return;
|
|
2569
2569
|
}
|
|
2570
2570
|
if (e.nodeType !== Node.ELEMENT_NODE) return;
|
|
2571
2571
|
const i = e, s = i.tagName.toLowerCase();
|
|
2572
|
-
if (!
|
|
2572
|
+
if (!di.has(s)) {
|
|
2573
2573
|
if (s === "font") {
|
|
2574
2574
|
const o = t.createElement("span");
|
|
2575
2575
|
i.getAttribute("style") && o.setAttribute("style", i.getAttribute("style")), i.getAttribute("color") && (o.style.color = i.getAttribute("color")), i.getAttribute("face") && (o.style.fontFamily = i.getAttribute("face"));
|
|
2576
2576
|
const a = i.getAttribute("size");
|
|
2577
2577
|
if (a && !o.style.fontSize) {
|
|
2578
|
-
const
|
|
2578
|
+
const u = {
|
|
2579
2579
|
1: "8pt",
|
|
2580
2580
|
2: "10pt",
|
|
2581
2581
|
3: "12pt",
|
|
@@ -2584,7 +2584,7 @@ function dt(u, t) {
|
|
|
2584
2584
|
6: "24pt",
|
|
2585
2585
|
7: "36pt"
|
|
2586
2586
|
};
|
|
2587
|
-
|
|
2587
|
+
u[a] && (o.style.fontSize = u[a]);
|
|
2588
2588
|
}
|
|
2589
2589
|
for (; i.firstChild; ) o.appendChild(i.firstChild);
|
|
2590
2590
|
i.replaceWith(o), dt(o, t);
|
|
@@ -2612,17 +2612,17 @@ function dt(u, t) {
|
|
|
2612
2612
|
}
|
|
2613
2613
|
const l = pt(i), r = [];
|
|
2614
2614
|
for (const [o, a] of Object.entries(l))
|
|
2615
|
-
|
|
2615
|
+
ui.has(o) && (/expression|javascript|url\s*\(\s*['"]?\s*file:/i.test(a) || o === "font-weight" && /^(400|normal)$/i.test(a) || o === "font-style" && /^normal$/i.test(a) || o === "text-decoration" && /^none$/i.test(a) || r.push(o + ":" + a));
|
|
2616
2616
|
if (r.length ? i.setAttribute("style", r.join(";")) : i.removeAttribute("style"), i.removeAttribute("class"), dt(i, t), s === "span" && !i.attributes.length) {
|
|
2617
2617
|
for (; i.firstChild; ) i.parentNode.insertBefore(i.firstChild, i);
|
|
2618
2618
|
i.remove();
|
|
2619
2619
|
}
|
|
2620
2620
|
});
|
|
2621
2621
|
}
|
|
2622
|
-
function
|
|
2622
|
+
function bi(d) {
|
|
2623
2623
|
const t = [], e = /<style[^>]*>([\s\S]*?)<\/style>/gi;
|
|
2624
2624
|
let i;
|
|
2625
|
-
for (; i = e.exec(
|
|
2625
|
+
for (; i = e.exec(d); ) {
|
|
2626
2626
|
let s = i[1].replace(/<!--|-->/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
2627
2627
|
s = s.replace(/@media[^{]*\{(?:[^{}]*\{[^{}]*\})*[^{}]*\}/gi, ""), s = s.replace(/@[\w-]+[^{]*\{[^{}]*\}/g, "");
|
|
2628
2628
|
let n;
|
|
@@ -2637,13 +2637,13 @@ function vi(u) {
|
|
|
2637
2637
|
}
|
|
2638
2638
|
return t;
|
|
2639
2639
|
}
|
|
2640
|
-
function
|
|
2640
|
+
function yi(d, t) {
|
|
2641
2641
|
if (!t.length) return;
|
|
2642
2642
|
const e = /* @__PURE__ */ new Map();
|
|
2643
2643
|
t.forEach(({ sel: i, decls: s }) => {
|
|
2644
2644
|
let n;
|
|
2645
2645
|
try {
|
|
2646
|
-
n =
|
|
2646
|
+
n = d.querySelectorAll(i);
|
|
2647
2647
|
} catch {
|
|
2648
2648
|
return;
|
|
2649
2649
|
}
|
|
@@ -2656,22 +2656,22 @@ function bi(u, t) {
|
|
|
2656
2656
|
}), e.forEach((i, s) => {
|
|
2657
2657
|
const n = pt(s), l = s.hasAttribute("dir"), r = s.hasAttribute("align"), o = Object.entries(i).filter(([p]) => !(p in n || (p === "direction" || p === "unicode-bidi") && l || p === "text-align" && (r || l) || (p === "background" || p === "background-color") && s.hasAttribute("bgcolor")));
|
|
2658
2658
|
if (!o.length) return;
|
|
2659
|
-
const a = o.map(([p, m]) => p + ":" + m).join(";"),
|
|
2660
|
-
s.setAttribute("style",
|
|
2659
|
+
const a = o.map(([p, m]) => p + ":" + m).join(";"), u = s.getAttribute("style");
|
|
2660
|
+
s.setAttribute("style", u ? a + ";" + u : a);
|
|
2661
2661
|
});
|
|
2662
2662
|
}
|
|
2663
|
-
function
|
|
2664
|
-
return
|
|
2663
|
+
function fe(d) {
|
|
2664
|
+
return d.replace(/[ﭐ-﷿ﹰ-ﻼ]+/g, (t) => t.normalize("NFKC"));
|
|
2665
2665
|
}
|
|
2666
|
-
function
|
|
2667
|
-
const t =
|
|
2666
|
+
function xi(d) {
|
|
2667
|
+
const t = d.createTreeWalker(d.body, NodeFilter.SHOW_TEXT, null);
|
|
2668
2668
|
let e;
|
|
2669
2669
|
for (; e = t.nextNode(); )
|
|
2670
|
-
/[ﭐ-﷿ﹰ-ﻼ]/.test(e.nodeValue || "") && (e.nodeValue =
|
|
2670
|
+
/[ﭐ-﷿ﹰ-ﻼ]/.test(e.nodeValue || "") && (e.nodeValue = fe(e.nodeValue || ""));
|
|
2671
2671
|
}
|
|
2672
|
-
function
|
|
2673
|
-
const e =
|
|
2674
|
-
|
|
2672
|
+
function Ci(d, t = "ltr") {
|
|
2673
|
+
const e = bi(d), i = new DOMParser().parseFromString(pi(d), "text/html");
|
|
2674
|
+
yi(i, e), /class="?Mso|mso-|urn:schemas-microsoft-com/i.test(i.body.innerHTML) && fi(i), gi(i), vi(i), dt(i.body, i), xi(i);
|
|
2675
2675
|
const s = (n) => {
|
|
2676
2676
|
var l;
|
|
2677
2677
|
return n && n.tagName === "P" && !((l = n.textContent) != null && l.trim()) && !n.querySelector("img,table");
|
|
@@ -2680,23 +2680,23 @@ function xi(u, t = "ltr") {
|
|
|
2680
2680
|
for (; s(i.body.lastElementChild); ) i.body.lastElementChild.remove();
|
|
2681
2681
|
return i.body.innerHTML.trim();
|
|
2682
2682
|
}
|
|
2683
|
-
function
|
|
2684
|
-
const t =
|
|
2683
|
+
function wi(d) {
|
|
2684
|
+
const t = fe(d).replace(/\r/g, ""), e = (i) => i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
2685
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);
|
|
2686
2686
|
}
|
|
2687
|
-
const
|
|
2688
|
-
function oe(
|
|
2687
|
+
const Ti = 10 * 1024 * 1024, ge = /^(https?:|data:image\/|blob:)/i;
|
|
2688
|
+
function oe(d, t) {
|
|
2689
2689
|
const e = [], i = "{\\" + t;
|
|
2690
2690
|
let s = 0;
|
|
2691
|
-
for (; (s =
|
|
2692
|
-
const n =
|
|
2691
|
+
for (; (s = d.indexOf(i, s)) !== -1; ) {
|
|
2692
|
+
const n = d[s + i.length];
|
|
2693
2693
|
if (n && /[a-z0-9]/i.test(n)) {
|
|
2694
2694
|
s += i.length;
|
|
2695
2695
|
continue;
|
|
2696
2696
|
}
|
|
2697
2697
|
let l = 0, r = s;
|
|
2698
|
-
for (; r <
|
|
2699
|
-
const o =
|
|
2698
|
+
for (; r < d.length; r++) {
|
|
2699
|
+
const o = d[r];
|
|
2700
2700
|
if (o === "\\") {
|
|
2701
2701
|
r++;
|
|
2702
2702
|
continue;
|
|
@@ -2705,78 +2705,109 @@ function oe(u, t) {
|
|
|
2705
2705
|
else if (o === "}" && (l--, !l))
|
|
2706
2706
|
break;
|
|
2707
2707
|
}
|
|
2708
|
-
e.push({ start: s, end: r + 1, body:
|
|
2708
|
+
e.push({ start: s, end: r + 1, body: d.slice(s + i.length, r) }), s = r + 1;
|
|
2709
2709
|
}
|
|
2710
2710
|
return e;
|
|
2711
2711
|
}
|
|
2712
|
-
function
|
|
2713
|
-
const t = new Uint8Array(
|
|
2714
|
-
for (let e = 0; e < t.length; e++) t[e] = parseInt(
|
|
2712
|
+
function Ei(d) {
|
|
2713
|
+
const t = new Uint8Array(d.length / 2);
|
|
2714
|
+
for (let e = 0; e < t.length; e++) t[e] = parseInt(d.substr(e * 2, 2), 16);
|
|
2715
2715
|
return t;
|
|
2716
2716
|
}
|
|
2717
|
-
function Tt(
|
|
2717
|
+
function Tt(d) {
|
|
2718
2718
|
let t = "";
|
|
2719
|
-
for (let e = 0; e <
|
|
2719
|
+
for (let e = 0; e < d.length; e++) t += String.fromCharCode(d[e]);
|
|
2720
2720
|
return btoa(t);
|
|
2721
2721
|
}
|
|
2722
|
-
function ae(
|
|
2723
|
-
t: for (let e = 0; e + t.length <=
|
|
2724
|
-
for (let i = 0; i < t.length; i++) if (
|
|
2722
|
+
function ae(d, t) {
|
|
2723
|
+
t: for (let e = 0; e + t.length <= d.length; e++) {
|
|
2724
|
+
for (let i = 0; i < t.length; i++) if (d[e + i] !== t[i]) continue t;
|
|
2725
2725
|
return e;
|
|
2726
2726
|
}
|
|
2727
2727
|
return -1;
|
|
2728
2728
|
}
|
|
2729
|
-
const
|
|
2730
|
-
function
|
|
2729
|
+
const Si = [137, 80, 78, 71], Mi = [255, 216, 255];
|
|
2730
|
+
function Li(d) {
|
|
2731
2731
|
let t = null;
|
|
2732
|
-
if (/\\pngblip/.test(
|
|
2733
|
-
let e =
|
|
2732
|
+
if (/\\pngblip/.test(d) ? t = "image/png" : /\\jpegblip/.test(d) ? t = "image/jpeg" : (/\\wmetafile\d*/.test(d) || /\\emfblip/.test(d)) && (t = "metafile"), !t) return null;
|
|
2733
|
+
let e = d.replace(/\{[^{}]*\}/g, " ").replace(/\\[a-z]+-?\d*\s?/gi, " ").replace(/[^0-9a-fA-F]/g, "");
|
|
2734
2734
|
if (e.length % 2 && (e = e.slice(0, -1)), !e) return null;
|
|
2735
|
-
const i =
|
|
2735
|
+
const i = Ei(e);
|
|
2736
2736
|
if (t === "metafile") {
|
|
2737
|
-
const s = ae(i,
|
|
2737
|
+
const s = ae(i, Si);
|
|
2738
2738
|
if (s >= 0) return "data:image/png;base64," + Tt(i.slice(s));
|
|
2739
|
-
const n = ae(i,
|
|
2739
|
+
const n = ae(i, Mi);
|
|
2740
2740
|
return n >= 0 ? "data:image/jpeg;base64," + Tt(i.slice(n)) : null;
|
|
2741
2741
|
}
|
|
2742
2742
|
return "data:" + t + ";base64," + Tt(i);
|
|
2743
2743
|
}
|
|
2744
|
-
function
|
|
2745
|
-
if (!
|
|
2746
|
-
let t =
|
|
2747
|
-
oe(
|
|
2744
|
+
function ki(d) {
|
|
2745
|
+
if (!d || d.indexOf("\\pict") === -1) return [];
|
|
2746
|
+
let t = d;
|
|
2747
|
+
oe(d, "nonshppict").reverse().forEach((i) => {
|
|
2748
2748
|
t = t.slice(0, i.start) + t.slice(i.end);
|
|
2749
2749
|
});
|
|
2750
|
-
let e =
|
|
2750
|
+
let e = Ti;
|
|
2751
2751
|
return oe(t, "pict").map((i) => {
|
|
2752
2752
|
if (e <= 0) return null;
|
|
2753
|
-
const s =
|
|
2753
|
+
const s = Li(i.body);
|
|
2754
2754
|
return s && (e -= s.length * 0.75), s;
|
|
2755
2755
|
});
|
|
2756
2756
|
}
|
|
2757
|
-
function
|
|
2758
|
-
|
|
2757
|
+
function ce(d) {
|
|
2758
|
+
const t = d.match(/^\s*(-?[\d.]+)\s*(pt|px|in|cm|mm)?\s*$/i);
|
|
2759
|
+
if (!t) return null;
|
|
2760
|
+
const e = parseFloat(t[1]);
|
|
2761
|
+
if (!isFinite(e) || e <= 0) return null;
|
|
2762
|
+
const i = (t[2] || "px").toLowerCase(), s = i === "pt" ? e * 4 / 3 : i === "in" ? e * 96 : i === "cm" ? e * 96 / 2.54 : i === "mm" ? e * 96 / 25.4 : e;
|
|
2763
|
+
return Math.round(s);
|
|
2764
|
+
}
|
|
2765
|
+
function Ai(d, t) {
|
|
2766
|
+
const e = d.match(new RegExp("\\s" + t + `\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, "i"));
|
|
2767
|
+
return e ? e[1] ?? e[2] ?? e[3] ?? "" : "";
|
|
2768
|
+
}
|
|
2769
|
+
function Hi(d) {
|
|
2770
|
+
if (!/<v:imagedata\b/i.test(d)) return d;
|
|
2771
|
+
const t = (i, s) => {
|
|
2772
|
+
const n = Ai(i, "src");
|
|
2773
|
+
if (!n) return null;
|
|
2774
|
+
const l = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2775
|
+
if (new RegExp(`<img\\b[^>]*\\bsrc\\s*=\\s*["']?` + l, "i").test(d)) return null;
|
|
2776
|
+
const r = (s.match(/<v:shape\b[^>]*\sstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/i) || []).slice(1).find(Boolean) || "", o = ce((r.match(/(?:^|;)\s*width\s*:\s*([^;]+)/i) || [])[1] || ""), a = ce((r.match(/(?:^|;)\s*height\s*:\s*([^;]+)/i) || [])[1] || "");
|
|
2777
|
+
return '<img src="' + n.replace(/"/g, """) + '"' + (o ? ' width="' + o + '"' : "") + (a ? ' height="' + a + '"' : "") + ">";
|
|
2778
|
+
};
|
|
2779
|
+
let e = d.replace(/<!--\[if [^\]]*\]>([\s\S]*?)<!\[endif\]-->/gi, (i, s) => {
|
|
2780
|
+
const n = s.match(/<v:imagedata\b[^>]*>/i);
|
|
2781
|
+
return n && t(n[0], s) || i;
|
|
2782
|
+
});
|
|
2783
|
+
return e = e.replace(/<v:shape\b[^>]*>[\s\S]*?<\/v:shape\s*>/gi, (i) => {
|
|
2784
|
+
const s = i.match(/<v:imagedata\b[^>]*>/i);
|
|
2785
|
+
return s && t(s[0], i) || i;
|
|
2786
|
+
}), e.replace(/<v:imagedata\b[^>]*>/gi, (i) => t(i, "") || i);
|
|
2787
|
+
}
|
|
2788
|
+
function ve(d, t) {
|
|
2789
|
+
if (!d || !t.length) return { html: d, injected: [] };
|
|
2759
2790
|
const e = [];
|
|
2760
2791
|
let i = 0;
|
|
2761
|
-
return { html:
|
|
2792
|
+
return { html: Hi(d).replace(/<img\b[^>]*>/gi, (n) => {
|
|
2762
2793
|
const l = (n.match(/\ssrc\s*=\s*["']?([^"'\s>]+)/i) || [])[1] || "";
|
|
2763
|
-
if (
|
|
2794
|
+
if (ge.test(l)) return n;
|
|
2764
2795
|
const r = t[i++];
|
|
2765
2796
|
return r ? (e.push(r), /\ssrc\s*=\s*["']/i.test(n) ? n.replace(/(\ssrc\s*=\s*)(["'])[^"']*\2/i, '$1"' + r + '"') : n.replace(/(\ssrc\s*=\s*)[^\s>]+/i, '$1"' + r + '"')) : n;
|
|
2766
2797
|
}), injected: e };
|
|
2767
2798
|
}
|
|
2768
|
-
function
|
|
2769
|
-
return !
|
|
2799
|
+
function Ii(d, t) {
|
|
2800
|
+
return !d || !t ? { html: d, injected: [] } : ve(d, ki(t));
|
|
2770
2801
|
}
|
|
2771
|
-
function
|
|
2772
|
-
const t =
|
|
2802
|
+
function qi(d) {
|
|
2803
|
+
const t = d.match(/<img\b[^>]*>/gi);
|
|
2773
2804
|
return t ? t.filter((e) => {
|
|
2774
2805
|
const i = (e.match(/\ssrc\s*=\s*["']?([^"'\s>]+)/i) || [])[1] || "";
|
|
2775
|
-
return !
|
|
2806
|
+
return !ge.test(i);
|
|
2776
2807
|
}).length : 0;
|
|
2777
2808
|
}
|
|
2778
|
-
function
|
|
2779
|
-
const e =
|
|
2809
|
+
function Ri(d, t) {
|
|
2810
|
+
const e = d.match(/^data:([^;,]+);base64,(.*)$/);
|
|
2780
2811
|
if (!e) return null;
|
|
2781
2812
|
const i = (e[1].split("/")[1] || "png").replace(/[^a-z0-9]/gi, "") || "png";
|
|
2782
2813
|
try {
|
|
@@ -2787,10 +2818,10 @@ function Hi(u, t) {
|
|
|
2787
2818
|
return null;
|
|
2788
2819
|
}
|
|
2789
2820
|
}
|
|
2790
|
-
function
|
|
2791
|
-
const t = new DataView(
|
|
2821
|
+
function Pi(d) {
|
|
2822
|
+
const t = new DataView(d), e = /* @__PURE__ */ new Map();
|
|
2792
2823
|
let i = -1;
|
|
2793
|
-
for (let r =
|
|
2824
|
+
for (let r = d.byteLength - 22; r >= Math.max(0, d.byteLength - 22 - 65535); r--)
|
|
2794
2825
|
if (t.getUint32(r, !0) === 101010256) {
|
|
2795
2826
|
i = r;
|
|
2796
2827
|
break;
|
|
@@ -2800,38 +2831,38 @@ function Ii(u) {
|
|
|
2800
2831
|
let n = t.getUint32(i + 16, !0);
|
|
2801
2832
|
const l = new TextDecoder();
|
|
2802
2833
|
for (let r = 0; r < s && t.getUint32(n, !0) === 33639248; r++) {
|
|
2803
|
-
const o = t.getUint16(n + 10, !0), a = t.getUint32(n + 20, !0),
|
|
2804
|
-
e.set(b, { name: b, method: o, compSize: a, localOffset: v }), n += 46 +
|
|
2834
|
+
const o = t.getUint16(n + 10, !0), a = t.getUint32(n + 20, !0), u = t.getUint16(n + 28, !0), p = t.getUint16(n + 30, !0), m = t.getUint16(n + 32, !0), v = t.getUint32(n + 42, !0), b = l.decode(new Uint8Array(d, n + 46, u));
|
|
2835
|
+
e.set(b, { name: b, method: o, compSize: a, localOffset: v }), n += 46 + u + p + m;
|
|
2805
2836
|
}
|
|
2806
2837
|
return e;
|
|
2807
2838
|
}
|
|
2808
|
-
async function
|
|
2809
|
-
const e = new DataView(
|
|
2839
|
+
async function he(d, t) {
|
|
2840
|
+
const e = new DataView(d, t.localOffset);
|
|
2810
2841
|
if (e.getUint32(0, !0) !== 67324752) throw new Error("Bad local header");
|
|
2811
|
-
const i = e.getUint16(26, !0), s = e.getUint16(28, !0), n = t.localOffset + 30 + i + s, l = new Uint8Array(
|
|
2842
|
+
const i = e.getUint16(26, !0), s = e.getUint16(28, !0), n = t.localOffset + 30 + i + s, l = new Uint8Array(d.slice(n, n + t.compSize));
|
|
2812
2843
|
if (t.method === 0) return l;
|
|
2813
2844
|
if (t.method !== 8) throw new Error("Unsupported compression method " + t.method);
|
|
2814
2845
|
const r = new Blob([l]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
|
|
2815
2846
|
return new Uint8Array(await new Response(r).arrayBuffer());
|
|
2816
2847
|
}
|
|
2817
|
-
const
|
|
2818
|
-
let e =
|
|
2848
|
+
const de = (d) => d.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), ut = (d, t) => Array.from(d.children).filter((e) => e.localName === t), B = (d, ...t) => {
|
|
2849
|
+
let e = d;
|
|
2819
2850
|
for (const i of t) {
|
|
2820
2851
|
if (!e) return null;
|
|
2821
2852
|
e = Array.from(e.children).find((s) => s.localName === i) || null;
|
|
2822
2853
|
}
|
|
2823
2854
|
return e;
|
|
2824
|
-
}, q = (
|
|
2825
|
-
if (!
|
|
2826
|
-
for (const e of Array.from(
|
|
2855
|
+
}, q = (d, t = "val") => {
|
|
2856
|
+
if (!d) return "";
|
|
2857
|
+
for (const e of Array.from(d.attributes))
|
|
2827
2858
|
if (e.localName === t) return e.value;
|
|
2828
2859
|
return "";
|
|
2829
|
-
}, at = (
|
|
2830
|
-
const e =
|
|
2860
|
+
}, at = (d, t) => {
|
|
2861
|
+
const e = d ? B(d, t) : null;
|
|
2831
2862
|
if (!e) return !1;
|
|
2832
2863
|
const i = q(e);
|
|
2833
2864
|
return i !== "false" && i !== "0";
|
|
2834
|
-
},
|
|
2865
|
+
}, ue = {
|
|
2835
2866
|
yellow: "#FFFF00",
|
|
2836
2867
|
green: "#00FF00",
|
|
2837
2868
|
cyan: "#00FFFF",
|
|
@@ -2848,7 +2879,7 @@ const he = (u) => u.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, "
|
|
|
2848
2879
|
lightGray: "#D3D3D3",
|
|
2849
2880
|
black: "#000000",
|
|
2850
2881
|
white: "#FFFFFF"
|
|
2851
|
-
},
|
|
2882
|
+
}, Bi = {
|
|
2852
2883
|
png: "image/png",
|
|
2853
2884
|
jpg: "image/jpeg",
|
|
2854
2885
|
jpeg: "image/jpeg",
|
|
@@ -2856,13 +2887,13 @@ const he = (u) => u.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, "
|
|
|
2856
2887
|
bmp: "image/bmp",
|
|
2857
2888
|
webp: "image/webp"
|
|
2858
2889
|
};
|
|
2859
|
-
function
|
|
2890
|
+
function Di(d) {
|
|
2860
2891
|
let t = "";
|
|
2861
|
-
for (let e = 0; e <
|
|
2862
|
-
t += String.fromCharCode(...
|
|
2892
|
+
for (let e = 0; e < d.length; e += 32768)
|
|
2893
|
+
t += String.fromCharCode(...d.subarray(e, e + 32768));
|
|
2863
2894
|
return btoa(t);
|
|
2864
2895
|
}
|
|
2865
|
-
class
|
|
2896
|
+
class Ni {
|
|
2866
2897
|
constructor(t, e, i) {
|
|
2867
2898
|
this.rels = t, this.images = e, this.numFmt = i;
|
|
2868
2899
|
}
|
|
@@ -2913,7 +2944,7 @@ class Pi {
|
|
|
2913
2944
|
const n = q(i, "anchor");
|
|
2914
2945
|
!s && n && (s = "#" + n);
|
|
2915
2946
|
const l = this.runsOf(i);
|
|
2916
|
-
e += s ? `<a href="${
|
|
2947
|
+
e += s ? `<a href="${de(s)}">${l}</a>` : l;
|
|
2917
2948
|
} else (i.localName === "smartTag" || i.localName === "ins") && (e += this.runsOf(i));
|
|
2918
2949
|
return e;
|
|
2919
2950
|
}
|
|
@@ -2921,18 +2952,18 @@ class Pi {
|
|
|
2921
2952
|
const e = B(t, "rPr");
|
|
2922
2953
|
let i = "";
|
|
2923
2954
|
for (const p of Array.from(t.children))
|
|
2924
|
-
p.localName === "t" ? i +=
|
|
2955
|
+
p.localName === "t" ? i += de(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));
|
|
2925
2956
|
if (!i) return "";
|
|
2926
2957
|
const s = [], n = q(e ? B(e, "color") : null);
|
|
2927
2958
|
n && n !== "auto" && s.push("color:#" + n);
|
|
2928
2959
|
const l = q(e ? B(e, "highlight") : null);
|
|
2929
|
-
l &&
|
|
2960
|
+
l && ue[l] && s.push("background-color:" + ue[l]);
|
|
2930
2961
|
const r = parseFloat(q(e ? B(e, "sz") : null));
|
|
2931
2962
|
r && s.push("font-size:" + Math.round(r / 2 * (4 / 3)) + "px");
|
|
2932
2963
|
const o = e ? B(e, "rFonts") : null, a = q(o, "ascii") || q(o, "cs");
|
|
2933
2964
|
a && s.push(`font-family:'${a}'`), 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>`);
|
|
2934
|
-
const
|
|
2935
|
-
return
|
|
2965
|
+
const u = q(e ? B(e, "vertAlign") : null);
|
|
2966
|
+
return u === "superscript" ? i = `<sup>${i}</sup>` : u === "subscript" && (i = `<sub>${i}</sub>`), i;
|
|
2936
2967
|
}
|
|
2937
2968
|
convertImage(t) {
|
|
2938
2969
|
let e = "", i = 0;
|
|
@@ -2965,10 +2996,10 @@ class Pi {
|
|
|
2965
2996
|
return e + "</tbody></table>";
|
|
2966
2997
|
}
|
|
2967
2998
|
}
|
|
2968
|
-
async function
|
|
2969
|
-
const t =
|
|
2999
|
+
async function Oi(d) {
|
|
3000
|
+
const t = d instanceof ArrayBuffer ? d : await d.arrayBuffer(), e = Pi(t), i = new TextDecoder(), s = async (b) => {
|
|
2970
3001
|
const f = e.get(b);
|
|
2971
|
-
return f ? new DOMParser().parseFromString(i.decode(await
|
|
3002
|
+
return f ? new DOMParser().parseFromString(i.decode(await he(t, f)), "application/xml") : null;
|
|
2972
3003
|
}, n = await s("word/document.xml"), l = n == null ? void 0 : n.getElementsByTagName("*");
|
|
2973
3004
|
let r = null;
|
|
2974
3005
|
if (l) {
|
|
@@ -2979,9 +3010,9 @@ async function Bi(u) {
|
|
|
2979
3010
|
}
|
|
2980
3011
|
}
|
|
2981
3012
|
if (!r) throw new Error("word/document.xml missing or invalid");
|
|
2982
|
-
const o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(),
|
|
2983
|
-
if (
|
|
2984
|
-
for (const b of Array.from(
|
|
3013
|
+
const o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), u = await s("word/_rels/document.xml.rels");
|
|
3014
|
+
if (u)
|
|
3015
|
+
for (const b of Array.from(u.getElementsByTagName("*"))) {
|
|
2985
3016
|
if (b.localName !== "Relationship") continue;
|
|
2986
3017
|
const f = b.getAttribute("Id") || "", y = b.getAttribute("Target") || "", C = b.getAttribute("Type") || "";
|
|
2987
3018
|
/hyperlink/i.test(C) ? o.set(f, y) : /image/i.test(C) && a.set(f, y);
|
|
@@ -2990,10 +3021,10 @@ async function Bi(u) {
|
|
|
2990
3021
|
for (const [b, f] of a) {
|
|
2991
3022
|
const y = f.startsWith("/") ? f.slice(1) : "word/" + f.replace(/^\.\//, ""), C = e.get(y);
|
|
2992
3023
|
if (!C) continue;
|
|
2993
|
-
const E = (y.split(".").pop() || "").toLowerCase(), I =
|
|
3024
|
+
const E = (y.split(".").pop() || "").toLowerCase(), I = Bi[E];
|
|
2994
3025
|
if (I)
|
|
2995
3026
|
try {
|
|
2996
|
-
p.set(b, `data:${I};base64,${
|
|
3027
|
+
p.set(b, `data:${I};base64,${Di(await he(t, C))}`);
|
|
2997
3028
|
} catch {
|
|
2998
3029
|
}
|
|
2999
3030
|
}
|
|
@@ -3011,87 +3042,87 @@ async function Bi(u) {
|
|
|
3011
3042
|
m.set(C, b.get(E) || "ul");
|
|
3012
3043
|
}
|
|
3013
3044
|
}
|
|
3014
|
-
return new
|
|
3045
|
+
return new Ni(o, p, m).convertBody(r);
|
|
3015
3046
|
}
|
|
3016
|
-
const
|
|
3047
|
+
const Fi = ["nw", "ne", "sw", "se"], Et = ["img-left", "img-right", "img-top", "img-center"], St = {
|
|
3017
3048
|
"img-left": "tplimgleft",
|
|
3018
3049
|
"img-right": "tplimgright",
|
|
3019
3050
|
"img-top": "tplimgtop",
|
|
3020
3051
|
"img-center": "tplimgcenter"
|
|
3021
|
-
},
|
|
3052
|
+
}, Zi = {
|
|
3022
3053
|
"img-left": h.tplleft,
|
|
3023
3054
|
"img-right": h.tplright,
|
|
3024
3055
|
"img-top": h.tpltop,
|
|
3025
3056
|
"img-center": h.tplcenter
|
|
3026
|
-
},
|
|
3027
|
-
let O = null, X = null, Lt = 0,
|
|
3057
|
+
}, _i = ".tox,.pop,.tblctx,.imgctx,.selctx,.dlg";
|
|
3058
|
+
let O = null, X = null, Lt = 0, pe = !1;
|
|
3028
3059
|
function ct() {
|
|
3029
3060
|
clearTimeout(Lt), X = null, O && O.classList.remove("show");
|
|
3030
3061
|
}
|
|
3031
|
-
function
|
|
3032
|
-
const t =
|
|
3062
|
+
function $i(d) {
|
|
3063
|
+
const t = d.dataset.tip;
|
|
3033
3064
|
if (!t) return;
|
|
3034
|
-
X =
|
|
3065
|
+
X = d, clearTimeout(Lt);
|
|
3035
3066
|
const e = O && O.classList.contains("show") ? 60 : 350;
|
|
3036
3067
|
Lt = window.setTimeout(() => {
|
|
3037
|
-
if (X !==
|
|
3068
|
+
if (X !== d || !document.contains(d)) return;
|
|
3038
3069
|
O || (O = document.createElement("div"), O.className = "etip", document.body.appendChild(O)), O.textContent = t, O.classList.add("show");
|
|
3039
|
-
const i =
|
|
3070
|
+
const i = d.getBoundingClientRect(), s = O.offsetWidth, n = O.offsetHeight;
|
|
3040
3071
|
let l = i.left + i.width / 2 - s / 2;
|
|
3041
3072
|
l = Math.max(6, Math.min(l, innerWidth - s - 6));
|
|
3042
3073
|
let r = i.bottom + 7;
|
|
3043
3074
|
r + n > innerHeight - 6 && (r = i.top - n - 7), O.style.left = l + "px", O.style.top = r + "px";
|
|
3044
3075
|
}, e);
|
|
3045
3076
|
}
|
|
3046
|
-
function
|
|
3047
|
-
|
|
3048
|
-
const t =
|
|
3049
|
-
if (!e || !e.closest(
|
|
3077
|
+
function ji() {
|
|
3078
|
+
pe || (pe = !0, document.addEventListener("mouseover", (d) => {
|
|
3079
|
+
const t = d.target, e = t.closest ? t.closest("[title],[data-tip]") : null;
|
|
3080
|
+
if (!e || !e.closest(_i) || e.closest(".earea")) {
|
|
3050
3081
|
e !== X && ct();
|
|
3051
3082
|
return;
|
|
3052
3083
|
}
|
|
3053
3084
|
const i = e.getAttribute("title");
|
|
3054
|
-
i && (e.dataset.tip = i, e.removeAttribute("title"), e.getAttribute("aria-label") || e.setAttribute("aria-label", i)), e !== X &&
|
|
3055
|
-
}), document.addEventListener("mouseout", (
|
|
3056
|
-
X && !X.contains(
|
|
3085
|
+
i && (e.dataset.tip = i, e.removeAttribute("title"), e.getAttribute("aria-label") || e.setAttribute("aria-label", i)), e !== X && $i(e);
|
|
3086
|
+
}), document.addEventListener("mouseout", (d) => {
|
|
3087
|
+
X && !X.contains(d.relatedTarget) && ct();
|
|
3057
3088
|
}), document.addEventListener("mousedown", ct, !0), addEventListener("scroll", ct, !0));
|
|
3058
3089
|
}
|
|
3059
|
-
const
|
|
3060
|
-
function
|
|
3061
|
-
for (const t of
|
|
3062
|
-
if (
|
|
3063
|
-
if (
|
|
3090
|
+
const Wi = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u077F\u0780-\u07BF\u08A0-\u08FF\uFB1D-\uFB4F\uFB50-\uFDFF\uFE70-\uFEFF]/, Ui = new RegExp("\\p{L}", "u"), Vi = "p,div,li,td,th,blockquote,h1,h2,h3,h4,h5,h6,pre,figcaption";
|
|
3091
|
+
function zi(d) {
|
|
3092
|
+
for (const t of d) {
|
|
3093
|
+
if (Wi.test(t)) return "rtl";
|
|
3094
|
+
if (Ui.test(t)) return "ltr";
|
|
3064
3095
|
}
|
|
3065
3096
|
return null;
|
|
3066
3097
|
}
|
|
3067
|
-
const ht = ["top", "right", "bottom", "left"],
|
|
3068
|
-
function
|
|
3098
|
+
const ht = ["top", "right", "bottom", "left"], Xi = /^(none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset)$/i, Yi = /^(thin|medium|thick|[+-]?(\d+\.?\d*|\.\d+)(px|pt|em|rem|ex|ch|cm|mm|in|pc|q)?)$/i, Gi = /^[+-]?0*(\.0*)?(px|pt|em|rem|ex|ch|cm|mm|in|pc|q)?$/i, Ki = /^border-(collapse|spacing|radius|image|block|inline|start|end)/i, Qi = /^border(?:-(top|right|bottom|left))?(?:-(width|style|color))?$/, Ji = /^(inherit|initial|unset|revert|revert-layer)$/i;
|
|
3099
|
+
function be(d) {
|
|
3069
3100
|
const t = [];
|
|
3070
3101
|
let e = 0, i = "";
|
|
3071
|
-
for (const s of
|
|
3102
|
+
for (const s of d)
|
|
3072
3103
|
s === "(" ? e++ : s === ")" && e--, e === 0 && /\s/.test(s) ? (i && t.push(i), i = "") : i += s;
|
|
3073
3104
|
return i && t.push(i), t;
|
|
3074
3105
|
}
|
|
3075
|
-
function
|
|
3076
|
-
const [t, e = t, i = t, s = e] =
|
|
3106
|
+
function ts(d) {
|
|
3107
|
+
const [t, e = t, i = t, s = e] = d;
|
|
3077
3108
|
return [t, e, i, s];
|
|
3078
3109
|
}
|
|
3079
|
-
function
|
|
3110
|
+
function es(d) {
|
|
3080
3111
|
const t = { width: "medium", style: "none", color: "" };
|
|
3081
|
-
return
|
|
3082
|
-
|
|
3112
|
+
return be(d).forEach((e) => {
|
|
3113
|
+
Xi.test(e) ? t.style = e.toLowerCase() : Yi.test(e) ? t.width = e : t.color = e;
|
|
3083
3114
|
}), t;
|
|
3084
3115
|
}
|
|
3085
|
-
function
|
|
3086
|
-
return !
|
|
3116
|
+
function is(d) {
|
|
3117
|
+
return !d || /^currentcolor$/i.test(d) ? "" : /^windowtext$/i.test(d) ? "#000000" : d;
|
|
3087
3118
|
}
|
|
3088
|
-
function
|
|
3089
|
-
if (
|
|
3090
|
-
const t =
|
|
3091
|
-
return t === "none" || t === "hidden" ||
|
|
3119
|
+
function ss(d) {
|
|
3120
|
+
if (d.width === null && d.style === null && d.color === null) return "";
|
|
3121
|
+
const t = d.style ?? "solid";
|
|
3122
|
+
return t === "none" || t === "hidden" || d.width && Gi.test(d.width) ? "none" : [d.width && d.width !== "medium" ? d.width : "", t, is(d.color || "")].filter(Boolean).join(" ");
|
|
3092
3123
|
}
|
|
3093
|
-
function
|
|
3094
|
-
|
|
3124
|
+
function ns(d) {
|
|
3125
|
+
d.querySelectorAll("table,td,th").forEach((t) => {
|
|
3095
3126
|
const e = t.getAttribute("style") || "";
|
|
3096
3127
|
if (!/border/i.test(e)) return;
|
|
3097
3128
|
const i = {
|
|
@@ -3102,17 +3133,17 @@ function es(u) {
|
|
|
3102
3133
|
}, s = [];
|
|
3103
3134
|
let n = !1, l = !1;
|
|
3104
3135
|
if (e.split(";").forEach((a) => {
|
|
3105
|
-
const
|
|
3106
|
-
if (
|
|
3136
|
+
const u = a.indexOf(":");
|
|
3137
|
+
if (u < 1) {
|
|
3107
3138
|
a.trim() && s.push(a.trim());
|
|
3108
3139
|
return;
|
|
3109
3140
|
}
|
|
3110
|
-
const p = a.slice(0,
|
|
3111
|
-
if (!v ||
|
|
3141
|
+
const p = a.slice(0, u).trim().toLowerCase(), m = a.slice(u + 1).trim(), v = Qi.exec(p);
|
|
3142
|
+
if (!v || Ki.test(p)) {
|
|
3112
3143
|
s.push(p + ":" + m);
|
|
3113
3144
|
return;
|
|
3114
3145
|
}
|
|
3115
|
-
if (
|
|
3146
|
+
if (Ji.test(m)) {
|
|
3116
3147
|
l = !0;
|
|
3117
3148
|
return;
|
|
3118
3149
|
}
|
|
@@ -3122,36 +3153,36 @@ function es(u) {
|
|
|
3122
3153
|
if (b)
|
|
3123
3154
|
i[b][f] = m;
|
|
3124
3155
|
else {
|
|
3125
|
-
const y =
|
|
3156
|
+
const y = ts(be(m));
|
|
3126
3157
|
ht.forEach((C, E) => {
|
|
3127
3158
|
i[C][f] = y[E];
|
|
3128
3159
|
});
|
|
3129
3160
|
}
|
|
3130
3161
|
else {
|
|
3131
|
-
const y =
|
|
3162
|
+
const y = es(m);
|
|
3132
3163
|
(b ? [b] : ht.slice()).forEach((C) => {
|
|
3133
3164
|
i[C] = { ...y };
|
|
3134
3165
|
});
|
|
3135
3166
|
}
|
|
3136
3167
|
}), l || !n) return;
|
|
3137
|
-
const r = ht.map((a) =>
|
|
3138
|
-
r.every((a) => a && a === r[0]) ? o.push("border:" + r[0]) : ht.forEach((a,
|
|
3168
|
+
const r = ht.map((a) => ss(i[a])), o = s.slice();
|
|
3169
|
+
r.every((a) => a && a === r[0]) ? o.push("border:" + r[0]) : ht.forEach((a, u) => r[u] && o.push(`border-${a}:` + r[u])), t.setAttribute("style", o.join(";"));
|
|
3139
3170
|
});
|
|
3140
3171
|
}
|
|
3141
|
-
function
|
|
3172
|
+
function ye(d) {
|
|
3142
3173
|
let t = "";
|
|
3143
|
-
return
|
|
3174
|
+
return d.childNodes.forEach((e) => {
|
|
3144
3175
|
if (e.nodeType === Node.TEXT_NODE)
|
|
3145
3176
|
t += e.nodeValue || "";
|
|
3146
3177
|
else if (e.nodeType === Node.ELEMENT_NODE) {
|
|
3147
3178
|
const i = e, s = (i.getAttribute("dir") || "").toLowerCase();
|
|
3148
3179
|
if (s === "rtl" || s === "ltr") return;
|
|
3149
|
-
t +=
|
|
3180
|
+
t += ye(i);
|
|
3150
3181
|
}
|
|
3151
3182
|
}), t;
|
|
3152
3183
|
}
|
|
3153
3184
|
var j;
|
|
3154
|
-
let
|
|
3185
|
+
let rs = (j = class {
|
|
3155
3186
|
constructor(t) {
|
|
3156
3187
|
this.lang = "en", this.contentClass = "fable-content-" + j.instanceCounter++, this.contentStyleEl = null, this.savedRange = null, this.foreColor = "#000000", this.backColor = "#FACC15", this.openPop = null, this.subStack = [], this.popAnchor = null, this.dlgOvl = null, this.tblActive = null, this.tblCorner = null, this.tblColBars = [], this.tblCtx = null, this.tblCellMark = null, this.tblOpMark = null, this.tblOpMarkKind = null, this.imgActive = null, this.imgHandles = [], this.imgCtx = null, this.imgHideTimer = null, this.phActive = null, this.phCtx = null, this.phUploadTarget = null, this.vidActive = null, this.vidCtx = null, this.vidHideTimer = null, this.vphActive = null, this.vphCtx = null, this.vphUploadTarget = null, this.selCtx = null, this.tbrMore = null, this.tbrExpanded = !1, this.codeActive = null, this.codeCtx = null, this.tplActive = null, this.tplCtx = null, this.revisions = [], this.revTimer = null, this.draftTimer = null, this.draftStorageKey = "", this.listeners = [], this.isDestroyed = !1, this.options = {
|
|
3157
3188
|
target: t.target,
|
|
@@ -3167,7 +3198,7 @@ let is = (j = class {
|
|
|
3167
3198
|
statusbar: t.statusbar ?? !0,
|
|
3168
3199
|
readonly: t.readonly ?? !1,
|
|
3169
3200
|
draftKey: t.draftKey ?? (typeof location < "u" ? location.pathname : "default"),
|
|
3170
|
-
fontFamilyFormats: t.fontFamilyFormats ??
|
|
3201
|
+
fontFamilyFormats: t.fontFamilyFormats ?? si,
|
|
3171
3202
|
imageFileTypes: t.imageFileTypes ?? ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/bmp", "image/webp"],
|
|
3172
3203
|
videoFileTypes: t.videoFileTypes ?? ["video/mp4", "video/webm", "video/ogg"]
|
|
3173
3204
|
}, 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.stampExistingImages(), this.options.onReady(this);
|
|
@@ -3193,7 +3224,7 @@ let is = (j = class {
|
|
|
3193
3224
|
</span>
|
|
3194
3225
|
`, this.sbHelp = this.statusbar.querySelector(".mid"), this.sbWords = this.statusbar.querySelector(".words");
|
|
3195
3226
|
const e = this.statusbar.querySelector(".grip");
|
|
3196
|
-
this.bindGrip(e), this.shell.appendChild(this.menubar), this.shell.appendChild(this.toolbar), this.shell.appendChild(this.ed), this.shell.appendChild(this.statusbar), this.contentStyle && (this.contentStyleEl = document.createElement("style"), this.contentStyleEl.textContent = this.scopeContentStyle(this.contentStyle), this.shell.appendChild(this.contentStyleEl)), t.appendChild(this.shell),
|
|
3227
|
+
this.bindGrip(e), this.shell.appendChild(this.menubar), this.shell.appendChild(this.toolbar), this.shell.appendChild(this.ed), this.shell.appendChild(this.statusbar), this.contentStyle && (this.contentStyleEl = document.createElement("style"), this.contentStyleEl.textContent = this.scopeContentStyle(this.contentStyle), this.shell.appendChild(this.contentStyleEl)), t.appendChild(this.shell), ji(), this.options.statusbar || (this.statusbar.style.display = "none"), this.imgInput = document.createElement("input"), this.imgInput.type = "file", this.imgInput.accept = this.options.imageFileTypes.join(","), this.imgInput.style.display = "none", t.appendChild(this.imgInput), this.vidInput = document.createElement("input"), this.vidInput.type = "file", this.vidInput.accept = this.options.videoFileTypes.join(","), this.vidInput.style.display = "none", t.appendChild(this.vidInput), this.docInput = document.createElement("input"), this.docInput.type = "file", this.docInput.accept = ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document", this.docInput.style.display = "none", t.appendChild(this.docInput);
|
|
3197
3228
|
}
|
|
3198
3229
|
/** Theme options land as CSS variables on the document root rather than the editor
|
|
3199
3230
|
* shell, because dialogs, popups and floating context toolbars are appended to
|
|
@@ -3240,18 +3271,18 @@ let is = (j = class {
|
|
|
3240
3271
|
t.preventDefault();
|
|
3241
3272
|
const e = t.target, i = (n = e.closest) == null ? void 0 : n.call(e, ".img-ph:not(.vid-ph)");
|
|
3242
3273
|
if (i && this.ed.contains(i) && !this.options.readonly) {
|
|
3243
|
-
const a = Array.from(((l = t.dataTransfer) == null ? void 0 : l.files) || []).find((
|
|
3274
|
+
const a = Array.from(((l = t.dataTransfer) == null ? void 0 : l.files) || []).find((u) => u.type.startsWith("image/"));
|
|
3244
3275
|
a && this.readImageFileInto(a, i);
|
|
3245
3276
|
return;
|
|
3246
3277
|
}
|
|
3247
3278
|
const s = (r = e.closest) == null ? void 0 : r.call(e, ".vid-ph");
|
|
3248
3279
|
if (s && this.ed.contains(s) && !this.options.readonly) {
|
|
3249
|
-
const a = Array.from(((o = t.dataTransfer) == null ? void 0 : o.files) || []).find((
|
|
3280
|
+
const a = Array.from(((o = t.dataTransfer) == null ? void 0 : o.files) || []).find((u) => u.type.startsWith("video/"));
|
|
3250
3281
|
a && this.readVideoFileInto(a, s);
|
|
3251
3282
|
}
|
|
3252
3283
|
}), this.on(this.ed, "dragover", (t) => t.preventDefault()), this.on(this.ed, "mousedown", (t) => {
|
|
3253
|
-
var
|
|
3254
|
-
const e = t.target, i = (
|
|
3284
|
+
var u, p, m, v, b, f, y;
|
|
3285
|
+
const e = t.target, i = (u = e.closest) == null ? void 0 : u.call(e, "table");
|
|
3255
3286
|
i && this.ed.contains(i) ? this.selectTableForResize(i) : this.clearTableHandles();
|
|
3256
3287
|
const s = (p = e.closest) == null ? void 0 : p.call(e, ".img-ph:not(.vid-ph)");
|
|
3257
3288
|
s && this.ed.contains(s) && !this.options.readonly ? (t.preventDefault(), this.ed.focus(), this.selectImgPlaceholder(s)) : this.clearImgPlaceholderSel();
|
|
@@ -3368,23 +3399,23 @@ let is = (j = class {
|
|
|
3368
3399
|
if (o !== "rtl" && o !== "ltr") return;
|
|
3369
3400
|
const a = o;
|
|
3370
3401
|
i || (i = a), /text-align\s*:/i.test(r.getAttribute("style") || "") || t(r, `text-align:${a === "rtl" ? "right" : "left"}`);
|
|
3371
|
-
}), e.querySelectorAll(
|
|
3402
|
+
}), e.querySelectorAll(Vi).forEach((r) => {
|
|
3372
3403
|
const o = (r.getAttribute("dir") || "").toLowerCase();
|
|
3373
3404
|
if (o === "rtl" || o === "ltr") return;
|
|
3374
|
-
const a =
|
|
3405
|
+
const a = zi(ye(r));
|
|
3375
3406
|
if (!a) return;
|
|
3376
3407
|
i || (i = a), r.setAttribute("dir", a);
|
|
3377
|
-
const
|
|
3378
|
-
t(r,
|
|
3408
|
+
const u = /text-align\s*:/i.test(r.getAttribute("style") || "");
|
|
3409
|
+
t(r, u ? `direction:${a}` : `direction:${a};text-align:${a === "rtl" ? "right" : "left"}`);
|
|
3379
3410
|
});
|
|
3380
3411
|
const s = this.ed.querySelectorAll("img");
|
|
3381
3412
|
e.querySelectorAll("img").forEach((r, o) => {
|
|
3382
3413
|
if (r.closest(".tpl-media")) return;
|
|
3383
|
-
const a = s[o],
|
|
3384
|
-
|
|
3414
|
+
const a = s[o], u = Math.round((a == null ? void 0 : a.getBoundingClientRect().width) || 0);
|
|
3415
|
+
u > 0 && !r.getAttribute("width") && r.setAttribute("width", String(u));
|
|
3385
3416
|
const p = r.getAttribute("style") || "";
|
|
3386
|
-
|
|
3387
|
-
}),
|
|
3417
|
+
u > 0 && !/(^|;)\s*width\s*:/i.test(p) && t(r, `width:${u}px`), /max-width\s*:/i.test(r.getAttribute("style") || "") || t(r, "max-width:100%"), /(^|;)\s*height\s*:/i.test(r.getAttribute("style") || "") || t(r, "height:auto");
|
|
3418
|
+
}), ns(e), e.querySelectorAll("table").forEach((r) => {
|
|
3388
3419
|
const o = r.getAttribute("style") || "";
|
|
3389
3420
|
/border-collapse\s*:/i.test(o) || t(r, "border-collapse:collapse"), !/border-spacing\s*:/i.test(o) && !r.hasAttribute("cellspacing") && r.setAttribute("cellspacing", "0");
|
|
3390
3421
|
});
|
|
@@ -3406,7 +3437,7 @@ let is = (j = class {
|
|
|
3406
3437
|
this.ed.focus();
|
|
3407
3438
|
}
|
|
3408
3439
|
async importWordFile(t) {
|
|
3409
|
-
const e = await
|
|
3440
|
+
const e = await Oi(t);
|
|
3410
3441
|
this.recordRevision(), this.setContent(e), this.recordRevision();
|
|
3411
3442
|
}
|
|
3412
3443
|
restoreDraft() {
|
|
@@ -3524,21 +3555,21 @@ let is = (j = class {
|
|
|
3524
3555
|
hour: "2-digit",
|
|
3525
3556
|
minute: "2-digit",
|
|
3526
3557
|
second: "2-digit"
|
|
3527
|
-
}), o = {}, a = (
|
|
3528
|
-
l =
|
|
3558
|
+
}), o = {}, a = (u) => {
|
|
3559
|
+
l = u, this.revisions.forEach((p, m) => {
|
|
3529
3560
|
var v;
|
|
3530
|
-
return (v = o[m]) == null ? void 0 : v.classList.toggle("on", m ===
|
|
3531
|
-
}), s.innerHTML = this.revisions[
|
|
3561
|
+
return (v = o[m]) == null ? void 0 : v.classList.toggle("on", m === u);
|
|
3562
|
+
}), s.innerHTML = this.revisions[u].html, n.disabled = u === this.revisions.length - 1;
|
|
3532
3563
|
};
|
|
3533
|
-
for (let
|
|
3534
|
-
const p = this.revisions[
|
|
3564
|
+
for (let u = this.revisions.length - 1; u >= 0; u--) {
|
|
3565
|
+
const p = this.revisions[u], m = document.createElement("button");
|
|
3535
3566
|
m.type = "button";
|
|
3536
|
-
const v = (new DOMParser().parseFromString(p.html, "text/html").body.textContent || "").trim(), b = v ? v.split(/\s+/).length : 0, f =
|
|
3537
|
-
m.innerHTML = `<span>${f ? this.t("currentver") : r.format(new Date(p.time))}</span><span class="wc">${b} ${this.t("words")}</span>`, m.addEventListener("click", () => a(
|
|
3567
|
+
const v = (new DOMParser().parseFromString(p.html, "text/html").body.textContent || "").trim(), b = v ? v.split(/\s+/).length : 0, f = u === this.revisions.length - 1;
|
|
3568
|
+
m.innerHTML = `<span>${f ? this.t("currentver") : r.format(new Date(p.time))}</span><span class="wc">${b} ${this.t("words")}</span>`, m.addEventListener("click", () => a(u)), o[u] = m, i.appendChild(m);
|
|
3538
3569
|
}
|
|
3539
3570
|
i.append(n), n.addEventListener("click", () => {
|
|
3540
|
-
const
|
|
3541
|
-
|
|
3571
|
+
const u = this.revisions[l];
|
|
3572
|
+
u && (this.recordRevision(), this.setContent(u.html), this.recordRevision(), this.closeDlg());
|
|
3542
3573
|
}), e.append(i, s), t.appendChild(e), a(l);
|
|
3543
3574
|
});
|
|
3544
3575
|
}
|
|
@@ -3638,7 +3669,7 @@ let is = (j = class {
|
|
|
3638
3669
|
return n.type = "button", n.className = "cchip", n.title = s, n.addEventListener("mousedown", (l) => {
|
|
3639
3670
|
l.preventDefault(), this.saveSel();
|
|
3640
3671
|
}), n;
|
|
3641
|
-
}, e =
|
|
3672
|
+
}, e = oi.map((s) => {
|
|
3642
3673
|
const n = t(this.t("forecolor"));
|
|
3643
3674
|
return n.style.background = s, n.addEventListener("click", () => this.applyColor("fore", s)), n;
|
|
3644
3675
|
}), i = t(this.t("forecolor"));
|
|
@@ -3675,22 +3706,22 @@ let is = (j = class {
|
|
|
3675
3706
|
["circle", h.ul_circle],
|
|
3676
3707
|
["square", h.ul_square]
|
|
3677
3708
|
], n = this.tArr(e === "ol" ? "liststyles_ol" : "liststyles_ul").slice(1), l = window.getSelection(), r = l ? (a = this.closestBlock(l.anchorNode)) == null ? void 0 : a.closest(e) : null, o = r ? r.style.listStyleType : "";
|
|
3678
|
-
this.popup(t, (
|
|
3679
|
-
this.menuItems(
|
|
3709
|
+
this.popup(t, (u) => {
|
|
3710
|
+
this.menuItems(u, [
|
|
3680
3711
|
{
|
|
3681
3712
|
label: this.t(e === "ol" ? "numlist" : "bullist"),
|
|
3682
3713
|
icon: e === "ol" ? h.numlist : h.bullist,
|
|
3683
3714
|
on: document.queryCommandState(i),
|
|
3684
3715
|
action: () => this.exec(i)
|
|
3685
3716
|
}
|
|
3686
|
-
]),
|
|
3717
|
+
]), u.insertAdjacentHTML("beforeend", '<div class="sep"></div>');
|
|
3687
3718
|
const p = document.createElement("div");
|
|
3688
3719
|
p.className = "mi-grid", s.forEach(([m, v], b) => {
|
|
3689
3720
|
const f = document.createElement("button");
|
|
3690
3721
|
f.className = "mi" + (o === m ? " on" : ""), f.innerHTML = `<span class="ic">${v}</span><span class="prev">${n[b]}</span>`, f.addEventListener("click", () => {
|
|
3691
3722
|
this.closePop(), this.setListStyle(e, m);
|
|
3692
3723
|
}), p.appendChild(f);
|
|
3693
|
-
}),
|
|
3724
|
+
}), u.appendChild(p);
|
|
3694
3725
|
});
|
|
3695
3726
|
}
|
|
3696
3727
|
/** Shared color-picker popup body — swatch grid plus the current-color /
|
|
@@ -3698,7 +3729,7 @@ let is = (j = class {
|
|
|
3698
3729
|
* table cell-background menu all show the identical popup. */
|
|
3699
3730
|
buildPaletteInto(t, e, i) {
|
|
3700
3731
|
const s = document.createElement("div");
|
|
3701
|
-
s.className = "cpal",
|
|
3732
|
+
s.className = "cpal", ai.forEach((p) => {
|
|
3702
3733
|
const m = document.createElement("button");
|
|
3703
3734
|
m.type = "button", m.style.background = p, m.title = p, m.addEventListener("click", () => {
|
|
3704
3735
|
this.closePop(), i(p);
|
|
@@ -3714,10 +3745,10 @@ let is = (j = class {
|
|
|
3714
3745
|
});
|
|
3715
3746
|
const a = document.createElement("label");
|
|
3716
3747
|
a.className = "cswatch cwheel", a.title = this.t("customcolor"), a.innerHTML = h.palette;
|
|
3717
|
-
const
|
|
3718
|
-
|
|
3719
|
-
this.closePop(), i(
|
|
3720
|
-
}), a.appendChild(
|
|
3748
|
+
const u = document.createElement("input");
|
|
3749
|
+
u.type = "color", u.value = l, u.addEventListener("change", () => {
|
|
3750
|
+
this.closePop(), i(u.value);
|
|
3751
|
+
}), a.appendChild(u), n.append(r, o, a), t.appendChild(n);
|
|
3721
3752
|
}
|
|
3722
3753
|
colorMenu(t, e) {
|
|
3723
3754
|
this.popup(
|
|
@@ -3747,7 +3778,7 @@ let is = (j = class {
|
|
|
3747
3778
|
this.popup(t, (e) => this.menuItems(e, this.fontItems()));
|
|
3748
3779
|
}
|
|
3749
3780
|
sizeItems() {
|
|
3750
|
-
return
|
|
3781
|
+
return ni.map((t) => ({
|
|
3751
3782
|
label: t,
|
|
3752
3783
|
on: this.currentSize() === t,
|
|
3753
3784
|
action: () => this.applyFontSize(t)
|
|
@@ -3800,7 +3831,7 @@ let is = (j = class {
|
|
|
3800
3831
|
this.saveSel(), this.refreshState(), this.onChange();
|
|
3801
3832
|
}
|
|
3802
3833
|
stepFontSize(t) {
|
|
3803
|
-
const e = parseInt(this.currentSize(), 10) || 14, i = Math.min(
|
|
3834
|
+
const e = parseInt(this.currentSize(), 10) || 14, i = Math.min(li, Math.max(ri, e + t));
|
|
3804
3835
|
i !== e && this.applyFontSize(i + "px");
|
|
3805
3836
|
}
|
|
3806
3837
|
/* ------------------------------------------------ case / spacing / link */
|
|
@@ -3814,9 +3845,9 @@ let is = (j = class {
|
|
|
3814
3845
|
n.forEach((r) => {
|
|
3815
3846
|
const o = r === i.startContainer ? i.startOffset : 0, a = r === i.endContainer ? i.endOffset : r.data.length;
|
|
3816
3847
|
if (a <= o) return;
|
|
3817
|
-
const
|
|
3818
|
-
let p =
|
|
3819
|
-
t === "lower" ? p =
|
|
3848
|
+
const u = r.data.slice(o, a);
|
|
3849
|
+
let p = u;
|
|
3850
|
+
t === "lower" ? p = u.toLowerCase() : t === "upper" ? p = u.toUpperCase() : p = u.replace(/(^|\s)(\S)/g, (m, v, b) => v + b.toUpperCase()), r.replaceData(o, a - o, p);
|
|
3820
3851
|
}), this.saveSel(), this.refreshState(), this.onChange();
|
|
3821
3852
|
}
|
|
3822
3853
|
caseItems() {
|
|
@@ -3953,7 +3984,7 @@ let is = (j = class {
|
|
|
3953
3984
|
for (let o = 0; o < 10; o++) {
|
|
3954
3985
|
const a = document.createElement("span");
|
|
3955
3986
|
a.dataset.r = String(r), a.dataset.c = String(o), a.addEventListener("mouseenter", () => {
|
|
3956
|
-
l.forEach((
|
|
3987
|
+
l.forEach((u) => u.classList.toggle("hot", +u.dataset.r <= r && +u.dataset.c <= o)), n.textContent = o + 1 + " × " + (r + 1);
|
|
3957
3988
|
}), a.addEventListener("click", () => {
|
|
3958
3989
|
this.closePop(), this.insertTable(r + 1, o + 1), e == null || e();
|
|
3959
3990
|
}), l.push(a), s.appendChild(a);
|
|
@@ -4041,7 +4072,7 @@ let is = (j = class {
|
|
|
4041
4072
|
}
|
|
4042
4073
|
buildToolbar() {
|
|
4043
4074
|
this.toolbar.innerHTML = "";
|
|
4044
|
-
const t = this.options.toolbar === !0 ?
|
|
4075
|
+
const t = this.options.toolbar === !0 ? ei : this.options.toolbar, e = this.buildToolbarRegistry();
|
|
4045
4076
|
this.parseToolbarString(t).forEach((i) => {
|
|
4046
4077
|
const s = [];
|
|
4047
4078
|
i.forEach((n) => {
|
|
@@ -4223,7 +4254,7 @@ let is = (j = class {
|
|
|
4223
4254
|
{ label: this.t("deltable"), icon: h.trash, action: () => this.tableOp("deltable") }
|
|
4224
4255
|
],
|
|
4225
4256
|
help: [this.mItem("helpttl", h.helpic, () => this.helpDlg(), "Alt+0")]
|
|
4226
|
-
}, e = this.options.menubar === !0 ?
|
|
4257
|
+
}, e = this.options.menubar === !0 ? ii : this.options.menubar, i = /* @__PURE__ */ new Set();
|
|
4227
4258
|
e.split(/\s+/).filter(Boolean).forEach((s) => {
|
|
4228
4259
|
if (i.has(s)) return;
|
|
4229
4260
|
if (i.add(s), !t[s]) {
|
|
@@ -4238,11 +4269,11 @@ let is = (j = class {
|
|
|
4238
4269
|
}
|
|
4239
4270
|
/* ---------------------------------------------------------- table ops */
|
|
4240
4271
|
tableOp(t) {
|
|
4241
|
-
var o, a,
|
|
4272
|
+
var o, a, u;
|
|
4242
4273
|
this.restoreSel();
|
|
4243
4274
|
const e = window.getSelection();
|
|
4244
4275
|
if (!e) return;
|
|
4245
|
-
const i = ((o = this.closestBlock(e.anchorNode)) == null ? void 0 : o.closest("td,th")) || (e.anchorNode && e.anchorNode.nodeType === 1 ? (
|
|
4276
|
+
const i = ((o = this.closestBlock(e.anchorNode)) == null ? void 0 : o.closest("td,th")) || (e.anchorNode && e.anchorNode.nodeType === 1 ? (u = (a = e.anchorNode).closest) == null ? void 0 : u.call(a, "td,th") : null);
|
|
4246
4277
|
if (!i) return;
|
|
4247
4278
|
const s = i.parentElement, n = i.closest("table"), l = Array.from(s.children).indexOf(i), r = () => {
|
|
4248
4279
|
const p = s.cloneNode(!1);
|
|
@@ -4280,11 +4311,11 @@ let is = (j = class {
|
|
|
4280
4311
|
o && o.after(i);
|
|
4281
4312
|
}
|
|
4282
4313
|
t === "colleft" && n > 0 && s.querySelectorAll("tr").forEach((o) => {
|
|
4283
|
-
const a = o.children[n],
|
|
4284
|
-
a &&
|
|
4314
|
+
const a = o.children[n], u = o.children[n - 1];
|
|
4315
|
+
a && u && u.before(a);
|
|
4285
4316
|
}), t === "colright" && s.querySelectorAll("tr").forEach((o) => {
|
|
4286
|
-
const a = o.children[n],
|
|
4287
|
-
a &&
|
|
4317
|
+
const a = o.children[n], u = o.children[n + 1];
|
|
4318
|
+
a && u && u.after(a);
|
|
4288
4319
|
});
|
|
4289
4320
|
const l = document.createRange();
|
|
4290
4321
|
l.selectNodeContents(e), l.collapse(!0);
|
|
@@ -4327,15 +4358,15 @@ let is = (j = class {
|
|
|
4327
4358
|
const t = this.tblActive;
|
|
4328
4359
|
if (!t) return;
|
|
4329
4360
|
let e, i, s, n, l;
|
|
4330
|
-
const r = "display:flex;align-items:center;gap:10px;margin:10px 0", o = "width:120px;color:#556;flex:none", a = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit",
|
|
4361
|
+
const r = "display:flex;align-items:center;gap:10px;margin:10px 0", o = "width:120px;color:#556;flex:none", a = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", u = t.querySelector("td,th"), p = t.style.width || "", m = u && u.style.padding ? parseFloat(u.style.padding) : "", v = t.style.borderSpacing ? parseFloat(t.style.borderSpacing) : "", b = t.style.borderWidth ? parseFloat(t.style.borderWidth) : "", f = t.style.marginLeft, y = t.style.marginRight, C = f === "auto" && y === "auto" ? "center" : f === "auto" ? "right" : y === "auto" && f === "0" ? "left" : "";
|
|
4331
4362
|
this.dialog(
|
|
4332
4363
|
this.t("tablepropsttl"),
|
|
4333
4364
|
(E) => {
|
|
4334
4365
|
const I = (A, $) => {
|
|
4335
|
-
const
|
|
4336
|
-
|
|
4337
|
-
const
|
|
4338
|
-
|
|
4366
|
+
const F = document.createElement("div");
|
|
4367
|
+
F.style.cssText = r;
|
|
4368
|
+
const Z = document.createElement("span");
|
|
4369
|
+
Z.style.cssText = o, Z.textContent = this.t(A), F.append(Z, $), E.appendChild(F);
|
|
4339
4370
|
};
|
|
4340
4371
|
e = document.createElement("input"), e.type = "text", e.style.cssText = a, e.placeholder = "e.g. 600px or 100%", e.value = p, I("tblwidth", e), i = document.createElement("input"), i.type = "number", i.min = "0", i.style.cssText = a, i.value = String(m), I("tblcellpadding", i), s = document.createElement("input"), s.type = "number", s.min = "0", s.style.cssText = a, s.value = String(v), I("tblcellspacing", s), n = document.createElement("input"), n.type = "number", n.min = "0", n.style.cssText = a, n.value = String(b), I("tblborder", n), l = document.createElement("select"), l.style.cssText = a, [
|
|
4341
4372
|
["", "alignnone"],
|
|
@@ -4343,8 +4374,8 @@ let is = (j = class {
|
|
|
4343
4374
|
["center", "aligncenter"],
|
|
4344
4375
|
["right", "alignright"]
|
|
4345
4376
|
].forEach(([A, $]) => {
|
|
4346
|
-
const
|
|
4347
|
-
|
|
4377
|
+
const F = document.createElement("option");
|
|
4378
|
+
F.value = A, F.textContent = this.t($), A === C && (F.selected = !0), l.appendChild(F);
|
|
4348
4379
|
}), I("tblalign", l);
|
|
4349
4380
|
},
|
|
4350
4381
|
[
|
|
@@ -4586,25 +4617,25 @@ let is = (j = class {
|
|
|
4586
4617
|
r.className = "chpanel";
|
|
4587
4618
|
const o = document.createElement("div");
|
|
4588
4619
|
o.className = "chgrid" + (i ? " emgrid" : ""), r.appendChild(o);
|
|
4589
|
-
const a = (
|
|
4590
|
-
l.querySelectorAll("button").forEach((p, m) => p.classList.toggle("on", m ===
|
|
4620
|
+
const a = (u) => {
|
|
4621
|
+
l.querySelectorAll("button").forEach((p, m) => p.classList.toggle("on", m === u)), o.innerHTML = "", e[u].chars.forEach((p) => {
|
|
4591
4622
|
const m = document.createElement("button");
|
|
4592
4623
|
m.type = "button", m.textContent = p, m.onclick = () => {
|
|
4593
4624
|
this.closeDlg(), this.exec("insertText", p);
|
|
4594
4625
|
}, o.appendChild(m);
|
|
4595
4626
|
}), r.scrollTop = 0;
|
|
4596
4627
|
};
|
|
4597
|
-
e.forEach((
|
|
4628
|
+
e.forEach((u, p) => {
|
|
4598
4629
|
const m = document.createElement("button");
|
|
4599
|
-
m.type = "button", m.textContent = this.t(
|
|
4630
|
+
m.type = "button", m.textContent = this.t(u.key), m.addEventListener("click", () => a(p)), l.appendChild(m);
|
|
4600
4631
|
}), n.append(l, r), s.appendChild(n), a(0);
|
|
4601
4632
|
});
|
|
4602
4633
|
}
|
|
4603
4634
|
charMap() {
|
|
4604
|
-
this.glyphPickerDlg(this.t("charmap").replace("…", ""),
|
|
4635
|
+
this.glyphPickerDlg(this.t("charmap").replace("…", ""), ci, !1);
|
|
4605
4636
|
}
|
|
4606
4637
|
emojiMap() {
|
|
4607
|
-
this.glyphPickerDlg(this.t("emoji").replace("…", ""),
|
|
4638
|
+
this.glyphPickerDlg(this.t("emoji").replace("…", ""), hi, !0);
|
|
4608
4639
|
}
|
|
4609
4640
|
printDoc() {
|
|
4610
4641
|
const t = window.open("", "_blank");
|
|
@@ -4898,13 +4929,13 @@ let is = (j = class {
|
|
|
4898
4929
|
const e = document.createElement("div");
|
|
4899
4930
|
e.className = "imgctx", e.dir = this.dir();
|
|
4900
4931
|
const i = () => {
|
|
4901
|
-
var
|
|
4932
|
+
var u;
|
|
4902
4933
|
const a = this.buildVideoCtxToolbar(t);
|
|
4903
|
-
(
|
|
4934
|
+
(u = this.vidCtx) == null || u.replaceWith(a), this.vidCtx = a, this.positionVidCtx();
|
|
4904
4935
|
}, s = (a) => {
|
|
4905
4936
|
this.setVideoAlign(t, a), i();
|
|
4906
|
-
}, n = t.style.float === "left", l = t.style.float === "right", r = !n && !l && t.style.marginLeft === "auto" && t.style.marginRight === "auto", o = (a,
|
|
4907
|
-
const v = this.ctxBtn(a,
|
|
4937
|
+
}, n = t.style.float === "left", l = t.style.float === "right", r = !n && !l && t.style.marginLeft === "auto" && t.style.marginRight === "auto", o = (a, u, p, m) => {
|
|
4938
|
+
const v = this.ctxBtn(a, u, m);
|
|
4908
4939
|
return v.classList.toggle("on", p), v;
|
|
4909
4940
|
};
|
|
4910
4941
|
return e.append(
|
|
@@ -4953,11 +4984,11 @@ let is = (j = class {
|
|
|
4953
4984
|
videoDlg() {
|
|
4954
4985
|
this.saveSel();
|
|
4955
4986
|
let t, e, i, s, n, l;
|
|
4956
|
-
const r = (a,
|
|
4987
|
+
const r = (a, u) => {
|
|
4957
4988
|
const p = document.createElement("div");
|
|
4958
4989
|
p.className = "dfield";
|
|
4959
4990
|
const m = document.createElement("label");
|
|
4960
|
-
return m.textContent = this.t(a), p.append(m,
|
|
4991
|
+
return m.textContent = this.t(a), p.append(m, u), p;
|
|
4961
4992
|
}, o = () => {
|
|
4962
4993
|
const a = document.createElement("input");
|
|
4963
4994
|
return a.type = "url", a;
|
|
@@ -4965,17 +4996,17 @@ let is = (j = class {
|
|
|
4965
4996
|
this.dialog(
|
|
4966
4997
|
this.t("videodlgttl"),
|
|
4967
4998
|
(a) => {
|
|
4968
|
-
const
|
|
4969
|
-
|
|
4999
|
+
const u = document.createElement("div");
|
|
5000
|
+
u.className = "dtabs";
|
|
4970
5001
|
const p = [], m = (f, y) => {
|
|
4971
5002
|
const C = document.createElement("button");
|
|
4972
5003
|
C.type = "button", C.textContent = this.t(f);
|
|
4973
5004
|
const E = document.createElement("div");
|
|
4974
5005
|
E.className = "dtabpanel", y(E);
|
|
4975
5006
|
const I = p.length;
|
|
4976
|
-
p.push(E), C.addEventListener("click", () => v(I)),
|
|
5007
|
+
p.push(E), C.addEventListener("click", () => v(I)), u.appendChild(C);
|
|
4977
5008
|
}, v = (f) => {
|
|
4978
|
-
|
|
5009
|
+
u.querySelectorAll("button").forEach((y, C) => y.classList.toggle("on", C === f)), p.forEach((y, C) => y.style.display = C === f ? "" : "none");
|
|
4979
5010
|
};
|
|
4980
5011
|
m("vidgeneral", (f) => {
|
|
4981
5012
|
t = o(), t.placeholder = this.t("videourlph");
|
|
@@ -4987,21 +5018,21 @@ let is = (j = class {
|
|
|
4987
5018
|
E.type = "file", E.accept = this.options.videoFileTypes.join(","), E.style.display = "none", C.addEventListener("click", () => {
|
|
4988
5019
|
E.value = "", E.click();
|
|
4989
5020
|
}), E.addEventListener("change", () => {
|
|
4990
|
-
var
|
|
4991
|
-
const A = (
|
|
5021
|
+
var F;
|
|
5022
|
+
const A = (F = E.files) == null ? void 0 : F[0];
|
|
4992
5023
|
if (!A) return;
|
|
4993
5024
|
C.disabled = !0, C.textContent = this.t("uploading");
|
|
4994
|
-
const $ = (
|
|
4995
|
-
t.value =
|
|
5025
|
+
const $ = (Z) => {
|
|
5026
|
+
t.value = Z, C.disabled = !1, C.textContent = this.t("uploadvideo");
|
|
4996
5027
|
};
|
|
4997
5028
|
if (this.videoUploadHandler)
|
|
4998
|
-
this.videoUploadHandler(A).then($).catch((
|
|
5029
|
+
this.videoUploadHandler(A).then($).catch((Z) => {
|
|
4999
5030
|
var et;
|
|
5000
|
-
C.disabled = !1, C.textContent = this.t("uploadfailed"), (et = this.onVideoUploadError) == null || et.call(this,
|
|
5031
|
+
C.disabled = !1, C.textContent = this.t("uploadfailed"), (et = this.onVideoUploadError) == null || et.call(this, Z, A);
|
|
5001
5032
|
});
|
|
5002
5033
|
else {
|
|
5003
|
-
const
|
|
5004
|
-
|
|
5034
|
+
const Z = new FileReader();
|
|
5035
|
+
Z.onload = () => $(Z.result), Z.readAsDataURL(A);
|
|
5005
5036
|
}
|
|
5006
5037
|
}), y.append(t, C, E), t.style.flex = "1", f.appendChild(r("vidsource", y));
|
|
5007
5038
|
const I = document.createElement("div");
|
|
@@ -5013,7 +5044,7 @@ let is = (j = class {
|
|
|
5013
5044
|
n = o(), l = o(), f.append(r("vidaltsource", n), r("vidposter", l));
|
|
5014
5045
|
});
|
|
5015
5046
|
const b = document.createElement("div");
|
|
5016
|
-
b.className = "dtabbody", p.forEach((f) => b.appendChild(f)), a.append(
|
|
5047
|
+
b.className = "dtabbody", p.forEach((f) => b.appendChild(f)), a.append(u, b), v(0), setTimeout(() => t.focus(), 0);
|
|
5017
5048
|
},
|
|
5018
5049
|
[
|
|
5019
5050
|
{ label: this.t("cancel"), action: () => this.closeDlg() },
|
|
@@ -5021,13 +5052,13 @@ let is = (j = class {
|
|
|
5021
5052
|
label: this.t("save"),
|
|
5022
5053
|
primary: !0,
|
|
5023
5054
|
action: () => {
|
|
5024
|
-
const a = s.value.trim(),
|
|
5025
|
-
if (this.closeDlg(), !a && !
|
|
5055
|
+
const a = s.value.trim(), u = t.value.trim(), p = parseInt(e.value, 10) || 560, m = parseInt(i.value, 10) || 314;
|
|
5056
|
+
if (this.closeDlg(), !a && !u) return;
|
|
5026
5057
|
if (this.restoreSel(), a) {
|
|
5027
5058
|
document.execCommand("insertHTML", !1, `<span class="video-embed" contenteditable="false">${a}</span>`), this.onChange();
|
|
5028
5059
|
return;
|
|
5029
5060
|
}
|
|
5030
|
-
const v = this.videoEmbedUrl(
|
|
5061
|
+
const v = this.videoEmbedUrl(u);
|
|
5031
5062
|
if (v)
|
|
5032
5063
|
document.execCommand("insertHTML", !1, this.videoEmbedHTML(v, p, m));
|
|
5033
5064
|
else {
|
|
@@ -5035,7 +5066,7 @@ let is = (j = class {
|
|
|
5035
5066
|
document.execCommand(
|
|
5036
5067
|
"insertHTML",
|
|
5037
5068
|
!1,
|
|
5038
|
-
`<video controls width="${p}" height="${m}"${f ? ` poster="${this.escapeAttr(f)}"` : ""}><source src="${this.escapeAttr(
|
|
5069
|
+
`<video controls width="${p}" height="${m}"${f ? ` poster="${this.escapeAttr(f)}"` : ""}><source src="${this.escapeAttr(u)}">${b ? `<source src="${this.escapeAttr(b)}">` : ""}</video>`
|
|
5039
5070
|
);
|
|
5040
5071
|
}
|
|
5041
5072
|
this.onChange();
|
|
@@ -5086,11 +5117,11 @@ let is = (j = class {
|
|
|
5086
5117
|
/** Typing `snippet` converts to an inline <code> run the moment the closing
|
|
5087
5118
|
* backtick is typed, so code can be marked up without reaching for the toolbar. */
|
|
5088
5119
|
tryCodeTyping(t) {
|
|
5089
|
-
var
|
|
5120
|
+
var u;
|
|
5090
5121
|
const e = window.getSelection();
|
|
5091
5122
|
if (!e || !e.isCollapsed || !e.anchorNode) return;
|
|
5092
5123
|
const i = e.anchorNode;
|
|
5093
|
-
if (i.nodeType !== Node.TEXT_NODE || !this.ed.contains(i) || (
|
|
5124
|
+
if (i.nodeType !== Node.TEXT_NODE || !this.ed.contains(i) || (u = i.parentElement) != null && u.closest("code, pre")) return;
|
|
5094
5125
|
const n = (i.textContent || "").slice(0, e.anchorOffset).match(/(?:^|[^`])`([^`]+)$/);
|
|
5095
5126
|
if (!n) return;
|
|
5096
5127
|
const l = n[1];
|
|
@@ -5116,10 +5147,10 @@ let is = (j = class {
|
|
|
5116
5147
|
const l = document.createElement("span");
|
|
5117
5148
|
l.className = "lbl", l.textContent = ((o = t.find(([a]) => a === e)) == null ? void 0 : o[1]) || "", n.append(l), n.insertAdjacentHTML("beforeend", h.chev);
|
|
5118
5149
|
const r = document.createElement("div");
|
|
5119
|
-
return r.className = "dsel-list", t.forEach(([a,
|
|
5150
|
+
return r.className = "dsel-list", t.forEach(([a, u]) => {
|
|
5120
5151
|
const p = document.createElement("button");
|
|
5121
|
-
p.type = "button", p.textContent =
|
|
5122
|
-
i = a, l.textContent =
|
|
5152
|
+
p.type = "button", p.textContent = u, p.classList.toggle("on", a === i), p.addEventListener("click", () => {
|
|
5153
|
+
i = a, l.textContent = u, r.querySelectorAll("button").forEach((m) => m.classList.toggle("on", m === p)), s.classList.remove("open"), n.focus();
|
|
5123
5154
|
}), r.appendChild(p);
|
|
5124
5155
|
}), n.addEventListener("click", () => {
|
|
5125
5156
|
var a;
|
|
@@ -5247,7 +5278,7 @@ let is = (j = class {
|
|
|
5247
5278
|
renderTplCtxButtons() {
|
|
5248
5279
|
const t = this.tplCtx, e = this.tplActive;
|
|
5249
5280
|
!t || !e || (t.innerHTML = "", Et.forEach((i) => {
|
|
5250
|
-
const s = this.ctxBtn(
|
|
5281
|
+
const s = this.ctxBtn(Zi[i], this.t(St[i]), () => this.setTplLayout(i));
|
|
5251
5282
|
s.classList.toggle("on", e.classList.contains("tpl-" + i)), t.appendChild(s);
|
|
5252
5283
|
}), t.append(this.ctxSep(), this.ctxBtn(h.trash, this.t("deltemplate"), () => this.removeTemplate())), this.positionTplCtx());
|
|
5253
5284
|
}
|
|
@@ -5306,10 +5337,10 @@ let is = (j = class {
|
|
|
5306
5337
|
this.tblOpMarkKind = t, this.positionOpMark();
|
|
5307
5338
|
}
|
|
5308
5339
|
positionOpMark() {
|
|
5309
|
-
var
|
|
5340
|
+
var u;
|
|
5310
5341
|
const t = this.tblOpMarkKind, e = t ? this.currentCell() : null;
|
|
5311
5342
|
if (!t || !e || !this.tblActive || e.closest("table") !== this.tblActive) {
|
|
5312
|
-
(
|
|
5343
|
+
(u = this.tblOpMark) == null || u.remove(), this.tblOpMark = null;
|
|
5313
5344
|
return;
|
|
5314
5345
|
}
|
|
5315
5346
|
this.tblOpMark || (this.tblOpMark = document.createElement("div"), this.tblOpMark.className = "tbl-opmark", document.body.appendChild(this.tblOpMark));
|
|
@@ -5363,17 +5394,17 @@ let is = (j = class {
|
|
|
5363
5394
|
const t = this.ed.getAttribute("dir") === "rtl", e = this.tblActive.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, n = e.right + scrollX, l = e.bottom + scrollY;
|
|
5364
5395
|
if (this.tblCorner && (this.tblCorner.style.top = l - 5 + "px", this.tblCorner.style.left = (t ? s - 5 : n - 5) + "px", this.tblCorner.style.cursor = t ? "nesw-resize" : "nwse-resize"), this.tblCtx) {
|
|
5365
5396
|
const o = this.tblCtx.offsetWidth, a = this.tblCtx.offsetHeight;
|
|
5366
|
-
let
|
|
5367
|
-
|
|
5397
|
+
let u = s + (n - s) / 2 - o / 2;
|
|
5398
|
+
u = Math.max(8 + scrollX, Math.min(u, scrollX + innerWidth - o - 8));
|
|
5368
5399
|
let p = i - a - 8;
|
|
5369
|
-
p < this.ctxMinTop() && (p = l + 8), this.tblCtx.style.left =
|
|
5400
|
+
p < this.ctxMinTop() && (p = l + 8), this.tblCtx.style.left = u + "px", this.tblCtx.style.top = p + "px";
|
|
5370
5401
|
}
|
|
5371
5402
|
this.tblColBars.forEach((o) => o.remove()), this.tblColBars = [];
|
|
5372
5403
|
const r = this.tblActive.rows[0];
|
|
5373
5404
|
if (r)
|
|
5374
5405
|
for (let o = 0; o < r.cells.length - 1; o++) {
|
|
5375
|
-
const a = r.cells[o].getBoundingClientRect(),
|
|
5376
|
-
p.className = "tbl-colbar", p.style.top = i + "px", p.style.left =
|
|
5406
|
+
const a = r.cells[o].getBoundingClientRect(), u = (t ? a.left : a.right) + scrollX, p = document.createElement("div");
|
|
5407
|
+
p.className = "tbl-colbar", p.style.top = i + "px", p.style.left = u + "px", p.style.height = l - i + "px", document.body.appendChild(p), p.addEventListener("mousedown", (m) => this.startColBarDrag(m, o)), this.tblColBars.push(p);
|
|
5377
5408
|
}
|
|
5378
5409
|
this.positionCellMarker(), this.positionOpMark();
|
|
5379
5410
|
}
|
|
@@ -5393,8 +5424,8 @@ let is = (j = class {
|
|
|
5393
5424
|
const i = this.ed.getAttribute("dir") === "rtl", s = t.clientX, n = e.getBoundingClientRect().width;
|
|
5394
5425
|
e.style.tableLayout = e.style.tableLayout || "fixed", this.withNoTextSelect((l) => {
|
|
5395
5426
|
const r = (a) => {
|
|
5396
|
-
const
|
|
5397
|
-
e.style.width = Math.max(60, Math.round(n +
|
|
5427
|
+
const u = i ? -(a.clientX - s) : a.clientX - s;
|
|
5428
|
+
e.style.width = Math.max(60, Math.round(n + u)) + "px", this.positionTableHandles();
|
|
5398
5429
|
}, o = () => {
|
|
5399
5430
|
window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", o), l(), this.onChange();
|
|
5400
5431
|
};
|
|
@@ -5407,11 +5438,11 @@ let is = (j = class {
|
|
|
5407
5438
|
if (!i) return;
|
|
5408
5439
|
const s = this.ed.getAttribute("dir") === "rtl", n = Array.from(i.rows), l = n.map((p) => p.cells[e]).filter(Boolean), r = n.map((p) => p.cells[e + 1]).filter(Boolean);
|
|
5409
5440
|
if (!l.length || !r.length) return;
|
|
5410
|
-
const o = t.clientX, a = l[0].getBoundingClientRect().width,
|
|
5441
|
+
const o = t.clientX, a = l[0].getBoundingClientRect().width, u = r[0].getBoundingClientRect().width;
|
|
5411
5442
|
i.style.tableLayout = "fixed", this.withNoTextSelect((p) => {
|
|
5412
5443
|
const m = (b) => {
|
|
5413
5444
|
const f = (s ? -1 : 1) * (b.clientX - o);
|
|
5414
|
-
l.forEach((y) => y.style.width = Math.max(24, Math.round(a + f)) + "px"), r.forEach((y) => y.style.width = Math.max(24, Math.round(
|
|
5445
|
+
l.forEach((y) => y.style.width = Math.max(24, Math.round(a + f)) + "px"), r.forEach((y) => y.style.width = Math.max(24, Math.round(u - f)) + "px"), this.positionTableHandles();
|
|
5415
5446
|
}, v = () => {
|
|
5416
5447
|
window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", v), p(), this.onChange();
|
|
5417
5448
|
};
|
|
@@ -5430,7 +5461,7 @@ let is = (j = class {
|
|
|
5430
5461
|
this.cancelImgHide(), this.imgHandles.forEach((i) => i.remove()), this.imgHandles = [], (t = this.imgCtx) == null || t.remove(), this.imgCtx = null, (e = this.imgActive) == null || e.classList.remove("img-selected"), this.imgActive = null;
|
|
5431
5462
|
}
|
|
5432
5463
|
selectImage(t) {
|
|
5433
|
-
this.imgActive !== t && (this.clearImageHandles(), this.imgActive = t, t.classList.add("img-selected"), this.imgHandles =
|
|
5464
|
+
this.imgActive !== t && (this.clearImageHandles(), this.imgActive = t, t.classList.add("img-selected"), this.imgHandles = Fi.map((e) => {
|
|
5434
5465
|
const i = document.createElement("div");
|
|
5435
5466
|
return i.className = "img-handle img-handle-" + e, i.dataset.corner = e, i.addEventListener("mousedown", (s) => this.startImageResizeDrag(s, e)), i.addEventListener("mouseenter", () => this.cancelImgHide()), i.addEventListener("mouseleave", () => this.scheduleImgHide()), document.body.appendChild(i), i;
|
|
5436
5467
|
}), this.imgCtx = this.buildImageCtxToolbar(t), this.positionImageHandles());
|
|
@@ -5439,13 +5470,13 @@ let is = (j = class {
|
|
|
5439
5470
|
const e = document.createElement("div");
|
|
5440
5471
|
e.className = "imgctx", e.dir = this.dir();
|
|
5441
5472
|
const i = () => {
|
|
5442
|
-
var
|
|
5473
|
+
var u;
|
|
5443
5474
|
const a = this.buildImageCtxToolbar(t);
|
|
5444
|
-
(
|
|
5475
|
+
(u = this.imgCtx) == null || u.replaceWith(a), this.imgCtx = a, this.positionImageHandles();
|
|
5445
5476
|
}, s = (a) => {
|
|
5446
5477
|
this.setImageAlign(t, a), i();
|
|
5447
|
-
}, n = t.style.float === "left", l = t.style.float === "right", r = !n && !l && t.style.marginLeft === "auto" && t.style.marginRight === "auto", o = (a,
|
|
5448
|
-
const v = this.ctxBtn(a,
|
|
5478
|
+
}, n = t.style.float === "left", l = t.style.float === "right", r = !n && !l && t.style.marginLeft === "auto" && t.style.marginRight === "auto", o = (a, u, p, m) => {
|
|
5479
|
+
const v = this.ctxBtn(a, u, m);
|
|
5449
5480
|
return v.classList.toggle("on", p), v;
|
|
5450
5481
|
};
|
|
5451
5482
|
return e.append(
|
|
@@ -5506,8 +5537,8 @@ let is = (j = class {
|
|
|
5506
5537
|
const r = this.imgCtx.offsetWidth, o = this.imgCtx.offsetHeight;
|
|
5507
5538
|
let a = i + (s - i) / 2 - r / 2;
|
|
5508
5539
|
a = Math.max(8 + scrollX, Math.min(a, scrollX + innerWidth - r - 8));
|
|
5509
|
-
let
|
|
5510
|
-
|
|
5540
|
+
let u = e - o - 8;
|
|
5541
|
+
u < this.ctxMinTop() && (u = n + 8), this.imgCtx.style.left = a + "px", this.imgCtx.style.top = u + "px";
|
|
5511
5542
|
}
|
|
5512
5543
|
}
|
|
5513
5544
|
startImageResizeDrag(t, e) {
|
|
@@ -5517,12 +5548,12 @@ let is = (j = class {
|
|
|
5517
5548
|
this.cancelImgHide();
|
|
5518
5549
|
const s = t.clientX, n = i.getBoundingClientRect().width, l = e === "nw" || e === "sw" ? -1 : 1;
|
|
5519
5550
|
this.withNoTextSelect((r) => {
|
|
5520
|
-
const o = (
|
|
5521
|
-
i.style.width = Math.max(24, Math.round(n + l * (
|
|
5551
|
+
const o = (u) => {
|
|
5552
|
+
i.style.width = Math.max(24, Math.round(n + l * (u.clientX - s))) + "px", i.style.height = "auto", this.positionImageHandles();
|
|
5522
5553
|
}, a = () => {
|
|
5523
5554
|
window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", a), r();
|
|
5524
|
-
const
|
|
5525
|
-
|
|
5555
|
+
const u = parseInt(i.style.width, 10);
|
|
5556
|
+
u > 0 && !i.closest(".tpl-media") && (i.setAttribute("width", String(u)), i.removeAttribute("height")), this.onChange();
|
|
5526
5557
|
};
|
|
5527
5558
|
window.addEventListener("mousemove", o), window.addEventListener("mouseup", a);
|
|
5528
5559
|
});
|
|
@@ -5595,8 +5626,8 @@ let is = (j = class {
|
|
|
5595
5626
|
const e = t.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, n = e.right + scrollX, l = e.bottom + scrollY, r = this.selCtx.offsetWidth, o = this.selCtx.offsetHeight;
|
|
5596
5627
|
let a = s + (n - s) / 2 - r / 2;
|
|
5597
5628
|
a = Math.max(8 + scrollX, Math.min(a, scrollX + innerWidth - r - 8));
|
|
5598
|
-
let
|
|
5599
|
-
|
|
5629
|
+
let u = i - o - 8;
|
|
5630
|
+
u < this.ctxMinTop() && (u = l + 8), this.selCtx.style.left = a + "px", this.selCtx.style.top = u + "px";
|
|
5600
5631
|
}
|
|
5601
5632
|
repositionSelToolbar() {
|
|
5602
5633
|
if (!this.selCtx) return;
|
|
@@ -5629,7 +5660,7 @@ let is = (j = class {
|
|
|
5629
5660
|
return t > 0 ? t + "px" : "";
|
|
5630
5661
|
}
|
|
5631
5662
|
refreshState() {
|
|
5632
|
-
var o, a,
|
|
5663
|
+
var o, a, u;
|
|
5633
5664
|
const t = window.getSelection(), e = t ? this.ed.contains(t.anchorNode) : !1, i = this.currentBlock();
|
|
5634
5665
|
[this.toolbar, this.selCtx].filter(Boolean).forEach((p) => {
|
|
5635
5666
|
[
|
|
@@ -5654,7 +5685,7 @@ let is = (j = class {
|
|
|
5654
5685
|
m && m.classList.toggle("on", e && !!this.closestInlineCode());
|
|
5655
5686
|
});
|
|
5656
5687
|
const n = t ? this.closestBlock(t.anchorNode) : null, l = ((o = n == null ? void 0 : n.closest("[dir]")) == null ? void 0 : o.getAttribute("dir")) || this.ed.getAttribute("dir") || this.dir();
|
|
5657
|
-
(a = this.toolbar.querySelector("[data-id=ltr]")) == null || a.classList.toggle("on", e && l === "ltr"), (
|
|
5688
|
+
(a = this.toolbar.querySelector("[data-id=ltr]")) == null || a.classList.toggle("on", e && l === "ltr"), (u = this.toolbar.querySelector("[data-id=rtl]")) == null || u.classList.toggle("on", e && l === "rtl");
|
|
5658
5689
|
const r = (p, m, v) => {
|
|
5659
5690
|
const b = this.toolbar.querySelector(`[data-id=${p}] .lbl`);
|
|
5660
5691
|
b && (b.textContent = m || v || "", b.classList.toggle("empty", !m));
|
|
@@ -5685,7 +5716,7 @@ let is = (j = class {
|
|
|
5685
5716
|
return;
|
|
5686
5717
|
}
|
|
5687
5718
|
}
|
|
5688
|
-
i ? this.pasteRichHTML(i, e, s) : (document.execCommand("insertHTML", !1,
|
|
5719
|
+
i ? this.pasteRichHTML(i, e, s) : (document.execCommand("insertHTML", !1, wi(e.getData("text/plain"))), this.onChange());
|
|
5689
5720
|
}
|
|
5690
5721
|
/** Rich-HTML paste. Before the (untouched) paste engine runs, pictures Word left
|
|
5691
5722
|
* behind as unreadable file:// refs are pulled out of the clipboard's RTF flavor
|
|
@@ -5697,17 +5728,17 @@ let is = (j = class {
|
|
|
5697
5728
|
let s = [];
|
|
5698
5729
|
const n = e.getData("text/rtf");
|
|
5699
5730
|
if (n) {
|
|
5700
|
-
const l =
|
|
5731
|
+
const l = Ii(t, n);
|
|
5701
5732
|
t = l.html, s = l.injected;
|
|
5702
5733
|
}
|
|
5703
|
-
if (i &&
|
|
5734
|
+
if (i && qi(t) === 1) {
|
|
5704
5735
|
const l = i.getAsFile();
|
|
5705
5736
|
if (l) {
|
|
5706
5737
|
const r = t;
|
|
5707
5738
|
this.saveSel();
|
|
5708
5739
|
const o = new FileReader();
|
|
5709
5740
|
o.onload = () => {
|
|
5710
|
-
const a =
|
|
5741
|
+
const a = ve(r, [o.result]);
|
|
5711
5742
|
this.finishRichPaste(a.html, s.concat(a.injected), !0);
|
|
5712
5743
|
}, o.onerror = () => this.finishRichPaste(r, s, !0), o.readAsDataURL(l);
|
|
5713
5744
|
return;
|
|
@@ -5726,10 +5757,10 @@ let is = (j = class {
|
|
|
5726
5757
|
const s = this.imageUploadHandler, n = e.filter((l, r) => e.indexOf(l) === r);
|
|
5727
5758
|
i || this.saveSel(), Promise.all(
|
|
5728
5759
|
n.map((l, r) => {
|
|
5729
|
-
const o =
|
|
5760
|
+
const o = Ri(l, "pasted-image-" + (r + 1));
|
|
5730
5761
|
return o ? s(o).catch((a) => {
|
|
5731
|
-
var
|
|
5732
|
-
return (
|
|
5762
|
+
var u;
|
|
5763
|
+
return (u = this.onImageUploadError) == null || u.call(this, a, o), l;
|
|
5733
5764
|
}) : Promise.resolve(l);
|
|
5734
5765
|
})
|
|
5735
5766
|
).then((l) => {
|
|
@@ -5742,17 +5773,17 @@ let is = (j = class {
|
|
|
5742
5773
|
/** `deferred` means the insert is happening after an async hop, so the caret the
|
|
5743
5774
|
* paste started from has to be put back first. */
|
|
5744
5775
|
insertPastedHTML(t, e = !1) {
|
|
5745
|
-
e && this.restoreSel(), document.execCommand("insertHTML", !1,
|
|
5776
|
+
e && this.restoreSel(), document.execCommand("insertHTML", !1, Ci(t, this.dir())), e && this.saveSel(), this.onChange();
|
|
5746
5777
|
}
|
|
5747
5778
|
/* ---------------------------------------------------------- init */
|
|
5748
5779
|
initUI() {
|
|
5749
5780
|
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();
|
|
5750
5781
|
}
|
|
5751
5782
|
}, j.instanceCounter = 0, j.TBR_COLLAPSE_MAX = 992, j);
|
|
5752
|
-
const
|
|
5753
|
-
({ value:
|
|
5754
|
-
const o = z(null), a = z(null),
|
|
5755
|
-
return v.current = e, b.current = i,
|
|
5783
|
+
const ls = Ye(
|
|
5784
|
+
({ value: d, defaultValue: t, onChange: e, onReady: i, className: s, style: n, ...l }, r) => {
|
|
5785
|
+
const o = z(null), a = z(null), u = z(!1), p = z(d ?? t), m = z(null), v = z(e), b = z(i);
|
|
5786
|
+
return v.current = e, b.current = i, Ge(r, () => ({
|
|
5756
5787
|
getContent: () => {
|
|
5757
5788
|
var f;
|
|
5758
5789
|
return ((f = a.current) == null ? void 0 : f.getContent()) ?? "";
|
|
@@ -5795,12 +5826,12 @@ const ss = Xe(
|
|
|
5795
5826
|
}
|
|
5796
5827
|
})), lt(() => {
|
|
5797
5828
|
if (!o.current) return;
|
|
5798
|
-
const f = new
|
|
5829
|
+
const f = new rs({
|
|
5799
5830
|
target: o.current,
|
|
5800
5831
|
initialContent: p.current,
|
|
5801
5832
|
onChange: (y) => {
|
|
5802
5833
|
var C;
|
|
5803
|
-
|
|
5834
|
+
u.current = !0, p.current = y, (C = v.current) == null || C.call(v, y);
|
|
5804
5835
|
},
|
|
5805
5836
|
onReady: (y) => {
|
|
5806
5837
|
var C;
|
|
@@ -5813,18 +5844,18 @@ const ss = Xe(
|
|
|
5813
5844
|
};
|
|
5814
5845
|
}, []), lt(() => {
|
|
5815
5846
|
var f, y;
|
|
5816
|
-
if (
|
|
5817
|
-
if (
|
|
5818
|
-
|
|
5847
|
+
if (d !== void 0 && d !== p.current) {
|
|
5848
|
+
if (u.current) {
|
|
5849
|
+
u.current = !1;
|
|
5819
5850
|
return;
|
|
5820
5851
|
}
|
|
5821
5852
|
if ((f = o.current) != null && f.contains(document.activeElement)) {
|
|
5822
|
-
m.current =
|
|
5853
|
+
m.current = d;
|
|
5823
5854
|
return;
|
|
5824
5855
|
}
|
|
5825
|
-
p.current =
|
|
5856
|
+
p.current = d, (y = a.current) == null || y.setContent(d);
|
|
5826
5857
|
}
|
|
5827
|
-
}, [
|
|
5858
|
+
}, [d]), lt(() => {
|
|
5828
5859
|
const f = o.current;
|
|
5829
5860
|
if (!f) return;
|
|
5830
5861
|
const y = (C) => {
|
|
@@ -5839,10 +5870,10 @@ const ss = Xe(
|
|
|
5839
5870
|
}, []), lt(() => {
|
|
5840
5871
|
var f;
|
|
5841
5872
|
l.language && ((f = a.current) == null || f.setLanguage(l.language));
|
|
5842
|
-
}, [l.language]), /* @__PURE__ */
|
|
5873
|
+
}, [l.language]), /* @__PURE__ */ Je.jsx("div", { ref: o, className: s, style: n });
|
|
5843
5874
|
}
|
|
5844
5875
|
);
|
|
5845
|
-
|
|
5876
|
+
ls.displayName = "FableEditor";
|
|
5846
5877
|
export {
|
|
5847
|
-
|
|
5878
|
+
ls as FableEditor
|
|
5848
5879
|
};
|