react-text-forge 1.2.7 → 1.2.8
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/react-text-forge.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Text as le, Range as ve, Node as ae, Element as
|
|
2
|
-
import ge, { useRef as he, createContext as Se, useContext as Ae, useState as
|
|
1
|
+
import { Text as le, Range as ve, Node as ae, Element as J, createEditor as Ye, Transforms as A, Editor as L, Path as ue } from "slate";
|
|
2
|
+
import ge, { useRef as he, createContext as Se, useContext as Ae, useState as P, useEffect as ee, forwardRef as ye, useId as at, useMemo as lt, useCallback as Fe } from "react";
|
|
3
3
|
import { ReactEditor as Le, withReact as ot, Slate as it, Editable as ct } from "slate-react";
|
|
4
4
|
import { withHistory as ut } from "slate-history";
|
|
5
5
|
import { SketchPicker as dt } from "react-color";
|
|
@@ -115,7 +115,7 @@ var xe = /* @__PURE__ */ new WeakSet(), Ce = (t) => {
|
|
|
115
115
|
le.isText(o) && xe.has(o) && xe.has(l) && le.equals(o, l, {
|
|
116
116
|
loose: !0
|
|
117
117
|
}) ? o.text += l.text : e.push(l);
|
|
118
|
-
} else if (
|
|
118
|
+
} else if (J.isElement(s))
|
|
119
119
|
e.push(s);
|
|
120
120
|
else if (s instanceof Te) {
|
|
121
121
|
var p = e[e.length - 1];
|
|
@@ -178,22 +178,22 @@ var Nt = (t) => (e, r, n) => {
|
|
|
178
178
|
var s = [], o;
|
|
179
179
|
for (var c of n)
|
|
180
180
|
ve.isRange(c) ? o = c : s.push(c);
|
|
181
|
-
var l = Ce(s), p = {},
|
|
182
|
-
Object.assign(
|
|
183
|
-
for (var [g, y] of ae.texts(
|
|
184
|
-
var f = bt(g),
|
|
181
|
+
var l = Ce(s), p = {}, k = t();
|
|
182
|
+
Object.assign(k, r), k.children = l;
|
|
183
|
+
for (var [g, y] of ae.texts(k)) {
|
|
184
|
+
var f = bt(g), C = vt(g);
|
|
185
185
|
if (f != null) {
|
|
186
|
-
var [
|
|
186
|
+
var [_] = f;
|
|
187
187
|
p.anchor = {
|
|
188
188
|
path: y,
|
|
189
|
-
offset:
|
|
189
|
+
offset: _
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
|
-
if (
|
|
193
|
-
var [
|
|
192
|
+
if (C != null) {
|
|
193
|
+
var [E] = C;
|
|
194
194
|
p.focus = {
|
|
195
195
|
path: y,
|
|
196
|
-
offset:
|
|
196
|
+
offset: E
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
199
|
}
|
|
@@ -201,7 +201,7 @@ var Nt = (t) => (e, r, n) => {
|
|
|
201
201
|
throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<anchor />`. For collapsed selections, use `<cursor />` instead.");
|
|
202
202
|
if (!p.anchor && p.focus)
|
|
203
203
|
throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<focus />`. For collapsed selections, use `<cursor />` instead.");
|
|
204
|
-
return o != null ?
|
|
204
|
+
return o != null ? k.selection = o : ve.isRange(p) && (k.selection = p), k;
|
|
205
205
|
};
|
|
206
206
|
function ze(t, e) {
|
|
207
207
|
var r = Object.keys(t);
|
|
@@ -246,8 +246,8 @@ var Et = {
|
|
|
246
246
|
if (!p)
|
|
247
247
|
throw new Error("No hyperscript creator found for tag: <".concat(n, ">"));
|
|
248
248
|
s == null && (s = {}), ft(s) || (c = [s].concat(c), s = {}), c = c.filter((g) => !!g).flat();
|
|
249
|
-
var
|
|
250
|
-
return
|
|
249
|
+
var k = p(n, s, c);
|
|
250
|
+
return k;
|
|
251
251
|
};
|
|
252
252
|
return e;
|
|
253
253
|
}, Lt = (t) => {
|
|
@@ -260,7 +260,7 @@ var Et = {
|
|
|
260
260
|
for (var n in t)
|
|
261
261
|
r();
|
|
262
262
|
return e;
|
|
263
|
-
},
|
|
263
|
+
}, z = St();
|
|
264
264
|
/**
|
|
265
265
|
* @license
|
|
266
266
|
* Copyright (c) 2025 Jahylis
|
|
@@ -304,33 +304,33 @@ const gr = (t) => {
|
|
|
304
304
|
};
|
|
305
305
|
switch (o.nodeName) {
|
|
306
306
|
case "P":
|
|
307
|
-
return
|
|
307
|
+
return z("element", { type: "paragraph" }, c);
|
|
308
308
|
case "PRE":
|
|
309
|
-
return
|
|
309
|
+
return z("element", { type: "code" }, c);
|
|
310
310
|
case "UL":
|
|
311
|
-
return
|
|
311
|
+
return z("element", { type: "bullet-list" }, c);
|
|
312
312
|
case "OL":
|
|
313
|
-
return
|
|
313
|
+
return z("element", { type: "numbered-list" }, c);
|
|
314
314
|
case "LI":
|
|
315
|
-
return
|
|
315
|
+
return z("element", { type: "list-item" }, c);
|
|
316
316
|
case "H1":
|
|
317
|
-
return
|
|
317
|
+
return z("element", { type: "h1" }, c);
|
|
318
318
|
case "H2":
|
|
319
|
-
return
|
|
319
|
+
return z("element", { type: "h2" }, c);
|
|
320
320
|
case "BLOCKQUOTE":
|
|
321
|
-
return
|
|
321
|
+
return z("element", { type: "blockquote" }, c);
|
|
322
322
|
case "IMG":
|
|
323
|
-
return
|
|
323
|
+
return z("element", { type: "image", url: o.getAttribute("src") });
|
|
324
324
|
case "TABLE":
|
|
325
|
-
return
|
|
325
|
+
return z("element", { type: "table" }, c);
|
|
326
326
|
case "TR":
|
|
327
|
-
return
|
|
327
|
+
return z("element", { type: "table-row" }, c);
|
|
328
328
|
case "TD":
|
|
329
|
-
return
|
|
329
|
+
return z("element", { type: "table-cell" }, c);
|
|
330
330
|
case "A":
|
|
331
|
-
return
|
|
331
|
+
return z("element", { type: "link", url: o.getAttribute("href") }, c);
|
|
332
332
|
default:
|
|
333
|
-
return c.map((p) => typeof p == "string" ?
|
|
333
|
+
return c.map((p) => typeof p == "string" ? z("text", l, p) : p);
|
|
334
334
|
}
|
|
335
335
|
};
|
|
336
336
|
return Array.from(r.body.childNodes).map(n).flat().filter(Boolean);
|
|
@@ -422,11 +422,11 @@ function Mt() {
|
|
|
422
422
|
return h.$$typeof === F ? null : h.displayName || h.name || null;
|
|
423
423
|
if (typeof h == "string") return h;
|
|
424
424
|
switch (h) {
|
|
425
|
-
case
|
|
425
|
+
case E:
|
|
426
426
|
return "Fragment";
|
|
427
|
-
case
|
|
427
|
+
case T:
|
|
428
428
|
return "Profiler";
|
|
429
|
-
case
|
|
429
|
+
case N:
|
|
430
430
|
return "StrictMode";
|
|
431
431
|
case x:
|
|
432
432
|
return "Suspense";
|
|
@@ -439,7 +439,7 @@ function Mt() {
|
|
|
439
439
|
switch (typeof h.tag == "number" && console.error(
|
|
440
440
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
441
441
|
), h.$$typeof) {
|
|
442
|
-
case
|
|
442
|
+
case _:
|
|
443
443
|
return "Portal";
|
|
444
444
|
case u:
|
|
445
445
|
return (h.displayName || "Context") + ".Provider";
|
|
@@ -448,9 +448,9 @@ function Mt() {
|
|
|
448
448
|
case m:
|
|
449
449
|
var $ = h.render;
|
|
450
450
|
return h = h.displayName, h || (h = $.displayName || $.name || "", h = h !== "" ? "ForwardRef(" + h + ")" : "ForwardRef"), h;
|
|
451
|
-
case
|
|
451
|
+
case j:
|
|
452
452
|
return $ = h.displayName || null, $ !== null ? $ : t(h.type) || "Memo";
|
|
453
|
-
case
|
|
453
|
+
case d:
|
|
454
454
|
$ = h._payload, h = h._init;
|
|
455
455
|
try {
|
|
456
456
|
return t(h($));
|
|
@@ -471,8 +471,8 @@ function Mt() {
|
|
|
471
471
|
}
|
|
472
472
|
if ($) {
|
|
473
473
|
$ = console;
|
|
474
|
-
var
|
|
475
|
-
return
|
|
474
|
+
var R = $.error, q = typeof Symbol == "function" && Symbol.toStringTag && h[Symbol.toStringTag] || h.constructor.name || "Object";
|
|
475
|
+
return R.call(
|
|
476
476
|
$,
|
|
477
477
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
478
478
|
q
|
|
@@ -480,8 +480,8 @@ function Mt() {
|
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
function n(h) {
|
|
483
|
-
if (h ===
|
|
484
|
-
if (typeof h == "object" && h !== null && h.$$typeof ===
|
|
483
|
+
if (h === E) return "<>";
|
|
484
|
+
if (typeof h == "object" && h !== null && h.$$typeof === d)
|
|
485
485
|
return "<...>";
|
|
486
486
|
try {
|
|
487
487
|
var $ = t(h);
|
|
@@ -491,45 +491,45 @@ function Mt() {
|
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
function s() {
|
|
494
|
-
var h =
|
|
494
|
+
var h = S.A;
|
|
495
495
|
return h === null ? null : h.getOwner();
|
|
496
496
|
}
|
|
497
497
|
function o() {
|
|
498
498
|
return Error("react-stack-top-frame");
|
|
499
499
|
}
|
|
500
500
|
function c(h) {
|
|
501
|
-
if (
|
|
501
|
+
if (M.call(h, "key")) {
|
|
502
502
|
var $ = Object.getOwnPropertyDescriptor(h, "key").get;
|
|
503
503
|
if ($ && $.isReactWarning) return !1;
|
|
504
504
|
}
|
|
505
505
|
return h.key !== void 0;
|
|
506
506
|
}
|
|
507
507
|
function l(h, $) {
|
|
508
|
-
function
|
|
509
|
-
|
|
508
|
+
function R() {
|
|
509
|
+
X || (X = !0, console.error(
|
|
510
510
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
511
511
|
$
|
|
512
512
|
));
|
|
513
513
|
}
|
|
514
|
-
|
|
515
|
-
get:
|
|
514
|
+
R.isReactWarning = !0, Object.defineProperty(h, "key", {
|
|
515
|
+
get: R,
|
|
516
516
|
configurable: !0
|
|
517
517
|
});
|
|
518
518
|
}
|
|
519
519
|
function p() {
|
|
520
520
|
var h = t(this.type);
|
|
521
|
-
return
|
|
521
|
+
return I[h] || (I[h] = !0, console.error(
|
|
522
522
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
523
523
|
)), h = this.props.ref, h !== void 0 ? h : null;
|
|
524
524
|
}
|
|
525
|
-
function
|
|
526
|
-
return
|
|
527
|
-
$$typeof:
|
|
525
|
+
function k(h, $, R, q, V, Y, ne, se) {
|
|
526
|
+
return R = Y.ref, h = {
|
|
527
|
+
$$typeof: C,
|
|
528
528
|
type: h,
|
|
529
529
|
key: $,
|
|
530
|
-
props:
|
|
530
|
+
props: Y,
|
|
531
531
|
_owner: V
|
|
532
|
-
}, (
|
|
532
|
+
}, (R !== void 0 ? R : null) !== null ? Object.defineProperty(h, "ref", {
|
|
533
533
|
enumerable: !1,
|
|
534
534
|
get: p
|
|
535
535
|
}) : Object.defineProperty(h, "ref", { enumerable: !1, value: null }), h._store = {}, Object.defineProperty(h._store, "validated", {
|
|
@@ -554,11 +554,11 @@ function Mt() {
|
|
|
554
554
|
value: se
|
|
555
555
|
}), Object.freeze && (Object.freeze(h.props), Object.freeze(h)), h;
|
|
556
556
|
}
|
|
557
|
-
function g(h, $,
|
|
557
|
+
function g(h, $, R, q, V, Y, ne, se) {
|
|
558
558
|
var D = $.children;
|
|
559
559
|
if (D !== void 0)
|
|
560
560
|
if (q)
|
|
561
|
-
if (
|
|
561
|
+
if (Z(D)) {
|
|
562
562
|
for (q = 0; q < D.length; q++)
|
|
563
563
|
y(D[q]);
|
|
564
564
|
Object.freeze && Object.freeze(D);
|
|
@@ -567,12 +567,12 @@ function Mt() {
|
|
|
567
567
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
568
568
|
);
|
|
569
569
|
else y(D);
|
|
570
|
-
if (
|
|
570
|
+
if (M.call($, "key")) {
|
|
571
571
|
D = t(h);
|
|
572
572
|
var re = Object.keys($).filter(function(ie) {
|
|
573
573
|
return ie !== "key";
|
|
574
574
|
});
|
|
575
|
-
q = 0 < re.length ? "{key: someKey, " + re.join(": ..., ") + ": ...}" : "{key: someKey}",
|
|
575
|
+
q = 0 < re.length ? "{key: someKey, " + re.join(": ..., ") + ": ...}" : "{key: someKey}", K[D + q] || (re = 0 < re.length ? "{" + re.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
576
576
|
`A props object containing a "key" prop is being spread into JSX:
|
|
577
577
|
let props = %s;
|
|
578
578
|
<%s {...props} />
|
|
@@ -583,31 +583,31 @@ React keys must be passed directly to JSX without using spread:
|
|
|
583
583
|
D,
|
|
584
584
|
re,
|
|
585
585
|
D
|
|
586
|
-
),
|
|
586
|
+
), K[D + q] = !0);
|
|
587
587
|
}
|
|
588
|
-
if (D = null,
|
|
589
|
-
|
|
588
|
+
if (D = null, R !== void 0 && (r(R), D = "" + R), c($) && (r($.key), D = "" + $.key), "key" in $) {
|
|
589
|
+
R = {};
|
|
590
590
|
for (var oe in $)
|
|
591
|
-
oe !== "key" && (
|
|
592
|
-
} else
|
|
591
|
+
oe !== "key" && (R[oe] = $[oe]);
|
|
592
|
+
} else R = $;
|
|
593
593
|
return D && l(
|
|
594
|
-
|
|
594
|
+
R,
|
|
595
595
|
typeof h == "function" ? h.displayName || h.name || "Unknown" : h
|
|
596
|
-
),
|
|
596
|
+
), k(
|
|
597
597
|
h,
|
|
598
598
|
D,
|
|
599
|
-
|
|
599
|
+
Y,
|
|
600
600
|
V,
|
|
601
601
|
s(),
|
|
602
|
-
|
|
602
|
+
R,
|
|
603
603
|
ne,
|
|
604
604
|
se
|
|
605
605
|
);
|
|
606
606
|
}
|
|
607
607
|
function y(h) {
|
|
608
|
-
typeof h == "object" && h !== null && h.$$typeof ===
|
|
608
|
+
typeof h == "object" && h !== null && h.$$typeof === C && h._store && (h._store.validated = 1);
|
|
609
609
|
}
|
|
610
|
-
var f = ge,
|
|
610
|
+
var f = ge, C = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), N = Symbol.for("react.strict_mode"), T = Symbol.for("react.profiler"), i = Symbol.for("react.consumer"), u = Symbol.for("react.context"), m = Symbol.for("react.forward_ref"), x = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), j = Symbol.for("react.memo"), d = Symbol.for("react.lazy"), b = Symbol.for("react.activity"), F = Symbol.for("react.client.reference"), S = f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, Z = Array.isArray, G = console.createTask ? console.createTask : function() {
|
|
611
611
|
return null;
|
|
612
612
|
};
|
|
613
613
|
f = {
|
|
@@ -615,33 +615,33 @@ React keys must be passed directly to JSX without using spread:
|
|
|
615
615
|
return h();
|
|
616
616
|
}
|
|
617
617
|
};
|
|
618
|
-
var
|
|
618
|
+
var X, I = {}, B = f["react-stack-bottom-frame"].bind(
|
|
619
619
|
f,
|
|
620
620
|
o
|
|
621
|
-
)(), O =
|
|
622
|
-
pe.Fragment =
|
|
623
|
-
var
|
|
621
|
+
)(), O = G(n(o)), K = {};
|
|
622
|
+
pe.Fragment = E, pe.jsx = function(h, $, R, q, V) {
|
|
623
|
+
var Y = 1e4 > S.recentlyCreatedOwnerStacks++;
|
|
624
624
|
return g(
|
|
625
625
|
h,
|
|
626
626
|
$,
|
|
627
|
-
|
|
627
|
+
R,
|
|
628
628
|
!1,
|
|
629
629
|
q,
|
|
630
630
|
V,
|
|
631
|
-
|
|
632
|
-
|
|
631
|
+
Y ? Error("react-stack-top-frame") : B,
|
|
632
|
+
Y ? G(n(h)) : O
|
|
633
633
|
);
|
|
634
|
-
}, pe.jsxs = function(h, $,
|
|
635
|
-
var
|
|
634
|
+
}, pe.jsxs = function(h, $, R, q, V) {
|
|
635
|
+
var Y = 1e4 > S.recentlyCreatedOwnerStacks++;
|
|
636
636
|
return g(
|
|
637
637
|
h,
|
|
638
638
|
$,
|
|
639
|
-
|
|
639
|
+
R,
|
|
640
640
|
!0,
|
|
641
641
|
q,
|
|
642
642
|
V,
|
|
643
|
-
|
|
644
|
-
|
|
643
|
+
Y ? Error("react-stack-top-frame") : B,
|
|
644
|
+
Y ? G(n(h)) : O
|
|
645
645
|
);
|
|
646
646
|
};
|
|
647
647
|
}()), pe;
|
|
@@ -686,7 +686,7 @@ const w = {
|
|
|
686
686
|
* @returns {boolean}
|
|
687
687
|
*/
|
|
688
688
|
isMarkActive(t, e) {
|
|
689
|
-
const r =
|
|
689
|
+
const r = L.marks(t);
|
|
690
690
|
return r ? r[e] === !0 : !1;
|
|
691
691
|
},
|
|
692
692
|
/**
|
|
@@ -696,7 +696,7 @@ const w = {
|
|
|
696
696
|
* @returns {void}
|
|
697
697
|
*/
|
|
698
698
|
toggleMark(t, e) {
|
|
699
|
-
w.isMarkActive(t, e) ?
|
|
699
|
+
w.isMarkActive(t, e) ? L.removeMark(t, e) : (L.addMark(t, e, !0), e === "subscript" ? L.removeMark(t, "superscript") : e === "superscript" && L.removeMark(t, "subscript"));
|
|
700
700
|
},
|
|
701
701
|
/**
|
|
702
702
|
* Permet de définir si le bloc défini est actif
|
|
@@ -705,7 +705,7 @@ const w = {
|
|
|
705
705
|
* @returns {boolean}
|
|
706
706
|
*/
|
|
707
707
|
isBlockActive(t, e) {
|
|
708
|
-
const [r] =
|
|
708
|
+
const [r] = L.nodes(t, {
|
|
709
709
|
match: (n) => n.type === e
|
|
710
710
|
});
|
|
711
711
|
return !!r;
|
|
@@ -716,7 +716,7 @@ const w = {
|
|
|
716
716
|
* @returns {boolean}
|
|
717
717
|
*/
|
|
718
718
|
isSelectionInList(t) {
|
|
719
|
-
const [e] =
|
|
719
|
+
const [e] = L.nodes(t, {
|
|
720
720
|
match: (r) => r.type === "bullet-list" || r.type === "numbered-list"
|
|
721
721
|
});
|
|
722
722
|
return !!e;
|
|
@@ -727,7 +727,7 @@ const w = {
|
|
|
727
727
|
* @returns {string}
|
|
728
728
|
*/
|
|
729
729
|
getListStyleType(t) {
|
|
730
|
-
const [e] =
|
|
730
|
+
const [e] = L.nodes(t, {
|
|
731
731
|
match: (r) => r.type === "list-item"
|
|
732
732
|
});
|
|
733
733
|
return e[0].listStyleType;
|
|
@@ -741,21 +741,21 @@ const w = {
|
|
|
741
741
|
*/
|
|
742
742
|
toggleBlock(t, e, r = null) {
|
|
743
743
|
const n = w.isBlockActive(t, e), s = e === "bullet-list" || e === "numbered-list";
|
|
744
|
-
if ((e === "h1" || e === "h2") &&
|
|
744
|
+
if ((e === "h1" || e === "h2") && L.removeMark(t, "fontSize"), s && w.isSelectionInList(t) && !r) {
|
|
745
745
|
A.unwrapNodes(t, {
|
|
746
|
-
match: (c) => s && !
|
|
746
|
+
match: (c) => s && !L.isEditor(c) && J.isElement(c) && (c.type === "bullet-list" || c.type === "numbered-list"),
|
|
747
747
|
split: !0
|
|
748
748
|
}), A.setNodes(t, { type: "paragraph" });
|
|
749
749
|
return;
|
|
750
750
|
}
|
|
751
751
|
if (r) {
|
|
752
752
|
A.setNodes(t, { listStyleType: r });
|
|
753
|
-
const c =
|
|
753
|
+
const c = L.range(t, t.selection).anchor.path;
|
|
754
754
|
let l = c;
|
|
755
755
|
c.length === 3 ? l = l.slice(0, 1) : c.length === 4 && (l = l.slice(0, 2)), A.setNodes(t, { type: e }, { at: l });
|
|
756
756
|
} else {
|
|
757
757
|
A.unwrapNodes(t, {
|
|
758
|
-
match: (l) => s && !
|
|
758
|
+
match: (l) => s && !L.isEditor(l) && J.isElement(l) && l.type === e,
|
|
759
759
|
split: !0
|
|
760
760
|
});
|
|
761
761
|
const c = {
|
|
@@ -774,7 +774,7 @@ const w = {
|
|
|
774
774
|
* @returns {boolean}
|
|
775
775
|
*/
|
|
776
776
|
isAlignActive(t, e) {
|
|
777
|
-
const [r] =
|
|
777
|
+
const [r] = L.nodes(t, {
|
|
778
778
|
match: (n) => n.align === e
|
|
779
779
|
});
|
|
780
780
|
return !!r;
|
|
@@ -798,7 +798,7 @@ const w = {
|
|
|
798
798
|
* @returns {boolean}
|
|
799
799
|
*/
|
|
800
800
|
canIndent(t, e) {
|
|
801
|
-
const [r] =
|
|
801
|
+
const [r] = L.nodes(t, {
|
|
802
802
|
match: (n) => n.type === "list-item"
|
|
803
803
|
});
|
|
804
804
|
if (r) {
|
|
@@ -816,21 +816,21 @@ const w = {
|
|
|
816
816
|
* @returns {void}
|
|
817
817
|
*/
|
|
818
818
|
handleIndent(t) {
|
|
819
|
-
const [e] =
|
|
819
|
+
const [e] = L.nodes(t, {
|
|
820
820
|
match: (r) => r.type === "list-item"
|
|
821
821
|
});
|
|
822
822
|
if (e) {
|
|
823
|
-
const [, r] = e, n =
|
|
823
|
+
const [, r] = e, n = L.above(t, {
|
|
824
824
|
match: (s) => ["bullet-list", "numbered-list"].includes(s.type)
|
|
825
825
|
})[0].type;
|
|
826
826
|
try {
|
|
827
|
-
const s = ue.parent(ue.parent(r)), o =
|
|
828
|
-
if (
|
|
827
|
+
const s = ue.parent(ue.parent(r)), o = L.node(t, s);
|
|
828
|
+
if (J.isElement(o[0]) && o[0].type === n)
|
|
829
829
|
return;
|
|
830
830
|
const c = { type: n, children: [] }, l = [r[0], r[1] + 1];
|
|
831
831
|
A.insertNodes(t, c, { at: l });
|
|
832
|
-
const p = { ...
|
|
833
|
-
A.insertNodes(t, p, { at:
|
|
832
|
+
const p = { ...L.node(t, r)[0] }, k = [r[0], r[1] + 1, 0];
|
|
833
|
+
A.insertNodes(t, p, { at: k }), A.removeNodes(t, { at: r }), A.setNodes(t, { type: "list-item" }, { at: [r[0], r[1], 0] });
|
|
834
834
|
} catch (s) {
|
|
835
835
|
console.error("Error indenting list item:", s);
|
|
836
836
|
}
|
|
@@ -842,18 +842,18 @@ const w = {
|
|
|
842
842
|
* @returns {void}
|
|
843
843
|
*/
|
|
844
844
|
handleOutdent(t) {
|
|
845
|
-
const [e] =
|
|
845
|
+
const [e] = L.nodes(t, {
|
|
846
846
|
match: (r) => r.type === "list-item"
|
|
847
847
|
});
|
|
848
848
|
if (e) {
|
|
849
|
-
const [, r] = e, n =
|
|
849
|
+
const [, r] = e, n = L.above(t, {
|
|
850
850
|
match: (s) => ["bullet-list", "numbered-list"].includes(s.type)
|
|
851
851
|
})[0].type;
|
|
852
852
|
try {
|
|
853
|
-
const s = ue.parent(r), o =
|
|
854
|
-
|
|
853
|
+
const s = ue.parent(r), o = L.node(t, s);
|
|
854
|
+
J.isElement(o) && o.type === n ? A.liftNodes(t, { at: r }) : A.unwrapNodes(t, {
|
|
855
855
|
at: s,
|
|
856
|
-
match: (c) =>
|
|
856
|
+
match: (c) => J.isElement(c) && c.type === n,
|
|
857
857
|
split: !0
|
|
858
858
|
}), A.setNodes(t, { type: "list-item" }, { at: r });
|
|
859
859
|
} catch (s) {
|
|
@@ -869,8 +869,8 @@ const w = {
|
|
|
869
869
|
isLinkActive(t) {
|
|
870
870
|
const { selection: e } = t;
|
|
871
871
|
if (!e) return !1;
|
|
872
|
-
const [r] =
|
|
873
|
-
match: (n) => !
|
|
872
|
+
const [r] = L.nodes(t, {
|
|
873
|
+
match: (n) => !L.isEditor(n) && ae.isNode(n) && n.type === "link"
|
|
874
874
|
});
|
|
875
875
|
return !!r;
|
|
876
876
|
},
|
|
@@ -915,7 +915,7 @@ const w = {
|
|
|
915
915
|
*/
|
|
916
916
|
removeLink(t) {
|
|
917
917
|
if (t.selection) {
|
|
918
|
-
const { selection: e } = t, [r, n] =
|
|
918
|
+
const { selection: e } = t, [r, n] = L.node(t, e);
|
|
919
919
|
if (r && r.type === "link") {
|
|
920
920
|
const s = r.text, o = ue.parent(n), c = ae.get(t, o);
|
|
921
921
|
A.insertNodes(
|
|
@@ -936,7 +936,7 @@ const w = {
|
|
|
936
936
|
*/
|
|
937
937
|
applyTextColor(t, e) {
|
|
938
938
|
const { selection: r } = t;
|
|
939
|
-
r &&
|
|
939
|
+
r && L.addMark(t, "color", e);
|
|
940
940
|
},
|
|
941
941
|
/**
|
|
942
942
|
* Permet de gérer la couleur de texte du bloc sélectionné
|
|
@@ -946,7 +946,7 @@ const w = {
|
|
|
946
946
|
*/
|
|
947
947
|
applyBackgroundTextColor(t, e) {
|
|
948
948
|
const { selection: r } = t;
|
|
949
|
-
r &&
|
|
949
|
+
r && L.addMark(t, "bgColor", e);
|
|
950
950
|
},
|
|
951
951
|
/**
|
|
952
952
|
* Permet de gérer la taille de police bloc sélectionné
|
|
@@ -956,7 +956,7 @@ const w = {
|
|
|
956
956
|
*/
|
|
957
957
|
applyFontSize(t, e) {
|
|
958
958
|
const { selection: r } = t;
|
|
959
|
-
r &&
|
|
959
|
+
r && L.addMark(t, "fontSize", e);
|
|
960
960
|
},
|
|
961
961
|
/**
|
|
962
962
|
* Permet de gérer la police d'écriture bloc sélectionné
|
|
@@ -966,7 +966,7 @@ const w = {
|
|
|
966
966
|
*/
|
|
967
967
|
applyFontFamily(t, e) {
|
|
968
968
|
const { selection: r } = t;
|
|
969
|
-
r &&
|
|
969
|
+
r && L.addMark(t, "fontFamily", e);
|
|
970
970
|
},
|
|
971
971
|
/**
|
|
972
972
|
* Permet de vérifier si la sélection se situe dans un code
|
|
@@ -975,8 +975,8 @@ const w = {
|
|
|
975
975
|
* @returns {boolean}
|
|
976
976
|
*/
|
|
977
977
|
isSelectionInCode(t) {
|
|
978
|
-
const [e] =
|
|
979
|
-
match: (r) =>
|
|
978
|
+
const [e] = L.nodes(t, {
|
|
979
|
+
match: (r) => J.isElement(r) && r.type === "code"
|
|
980
980
|
});
|
|
981
981
|
return !!e;
|
|
982
982
|
},
|
|
@@ -987,8 +987,8 @@ const w = {
|
|
|
987
987
|
* @returns {boolean}
|
|
988
988
|
*/
|
|
989
989
|
getCurrentCodeLanguage(t) {
|
|
990
|
-
const [e] =
|
|
991
|
-
match: (r) =>
|
|
990
|
+
const [e] = L.nodes(t, {
|
|
991
|
+
match: (r) => J.isElement(r) && r.type === "code"
|
|
992
992
|
});
|
|
993
993
|
return e ? e[0].language : "plaintext";
|
|
994
994
|
},
|
|
@@ -1001,7 +1001,7 @@ const w = {
|
|
|
1001
1001
|
handleCode(t, e) {
|
|
1002
1002
|
const { selection: r } = t;
|
|
1003
1003
|
if (r) {
|
|
1004
|
-
const [n] =
|
|
1004
|
+
const [n] = L.nodes(t, {
|
|
1005
1005
|
match: (s) => s.type === "paragraph"
|
|
1006
1006
|
});
|
|
1007
1007
|
if (n) {
|
|
@@ -1012,7 +1012,7 @@ const w = {
|
|
|
1012
1012
|
};
|
|
1013
1013
|
A.setNodes(t, c, { at: s }), A.select(t, s);
|
|
1014
1014
|
} else {
|
|
1015
|
-
const [s] =
|
|
1015
|
+
const [s] = L.nodes(t, {
|
|
1016
1016
|
match: (o) => o.type === "code"
|
|
1017
1017
|
});
|
|
1018
1018
|
if (s) {
|
|
@@ -1040,7 +1040,7 @@ const w = {
|
|
|
1040
1040
|
A.setNodes(
|
|
1041
1041
|
t,
|
|
1042
1042
|
{ type: e ? "paragraph" : "blockquote" },
|
|
1043
|
-
{ match: (r) =>
|
|
1043
|
+
{ match: (r) => J.isElement(r) && L.isBlock(t, r) }
|
|
1044
1044
|
);
|
|
1045
1045
|
},
|
|
1046
1046
|
/**
|
|
@@ -1050,8 +1050,8 @@ const w = {
|
|
|
1050
1050
|
* @returns {boolean}
|
|
1051
1051
|
*/
|
|
1052
1052
|
isBlockquoteActive(t) {
|
|
1053
|
-
const [e] =
|
|
1054
|
-
match: (r) =>
|
|
1053
|
+
const [e] = L.nodes(t, {
|
|
1054
|
+
match: (r) => J.isElement(r) && r.type === "blockquote"
|
|
1055
1055
|
});
|
|
1056
1056
|
return !!e;
|
|
1057
1057
|
},
|
|
@@ -1070,9 +1070,9 @@ const w = {
|
|
|
1070
1070
|
children: [{ text: e }]
|
|
1071
1071
|
}, { selection: n } = t;
|
|
1072
1072
|
if (!n) return;
|
|
1073
|
-
const [s, o] =
|
|
1074
|
-
|
|
1075
|
-
const c =
|
|
1073
|
+
const [s, o] = L.parent(t, n);
|
|
1074
|
+
J.isElement(s) && (s.type === "paragraph" || s.type === "code") && ae.string(s) === "" && A.removeNodes(t, { at: o }), A.insertNodes(t, r);
|
|
1075
|
+
const c = L.end(t, []);
|
|
1076
1076
|
A.select(t, c);
|
|
1077
1077
|
},
|
|
1078
1078
|
/**
|
|
@@ -1105,11 +1105,11 @@ const w = {
|
|
|
1105
1105
|
const s = new Image(), o = new FileReader();
|
|
1106
1106
|
o.onload = (c) => {
|
|
1107
1107
|
n.type === "image/svg+xml" ? this.insertImage(e, c.target.result) : (s.src = c.target.result, s.onload = () => {
|
|
1108
|
-
const p = document.createElement("canvas"),
|
|
1109
|
-
let f = s.width,
|
|
1110
|
-
f >
|
|
1111
|
-
const
|
|
1112
|
-
this.insertImage(e,
|
|
1108
|
+
const p = document.createElement("canvas"), k = p.getContext("2d"), g = 800, y = 600;
|
|
1109
|
+
let f = s.width, C = s.height;
|
|
1110
|
+
f > C ? f > g && (C *= g / f, f = g) : C > y && (f *= y / C, C = y), p.width = f, p.height = C, k.drawImage(s, 0, 0, f, C);
|
|
1111
|
+
const _ = p.toDataURL("image/jpeg");
|
|
1112
|
+
this.insertImage(e, _);
|
|
1113
1113
|
}, s.onerror = () => {
|
|
1114
1114
|
console.error("Failed to load image.");
|
|
1115
1115
|
});
|
|
@@ -1145,7 +1145,7 @@ const w = {
|
|
|
1145
1145
|
* @returns {boolean}
|
|
1146
1146
|
*/
|
|
1147
1147
|
isSelectionInTable(t) {
|
|
1148
|
-
const [e] =
|
|
1148
|
+
const [e] = L.nodes(t, {
|
|
1149
1149
|
match: (r) => r.type === "table"
|
|
1150
1150
|
});
|
|
1151
1151
|
return !!e;
|
|
@@ -1156,7 +1156,7 @@ const w = {
|
|
|
1156
1156
|
* @returns {void}
|
|
1157
1157
|
*/
|
|
1158
1158
|
getTableFromSelection(t) {
|
|
1159
|
-
const [e] =
|
|
1159
|
+
const [e] = L.nodes(t, {
|
|
1160
1160
|
match: (r) => r.type === "table"
|
|
1161
1161
|
});
|
|
1162
1162
|
return e ? e[0] : null;
|
|
@@ -1197,11 +1197,11 @@ const w = {
|
|
|
1197
1197
|
if (ae.get(t, s)) {
|
|
1198
1198
|
const c = s[s.length - 2];
|
|
1199
1199
|
c !== void 0 ? e.children.forEach((l, p) => {
|
|
1200
|
-
const
|
|
1200
|
+
const k = {
|
|
1201
1201
|
type: "table-cell",
|
|
1202
1202
|
children: [{ text: "" }]
|
|
1203
1203
|
}, g = [...s.slice(0, 1), p, c + 1];
|
|
1204
|
-
g[g.length - 1] <= l.children.length ? A.insertNodes(t,
|
|
1204
|
+
g[g.length - 1] <= l.children.length ? A.insertNodes(t, k, { at: g }) : console.warn(`Cannot insert at path ${g}. Row does not have enough cells.`);
|
|
1205
1205
|
}) : console.error("Column index is undefined, unable to find the selected cell in the row.");
|
|
1206
1206
|
} else
|
|
1207
1207
|
console.error("Selected cell not found.");
|
|
@@ -1239,11 +1239,11 @@ const w = {
|
|
|
1239
1239
|
return;
|
|
1240
1240
|
const s = (n = t.selection) == null ? void 0 : n.anchor.path, o = ae.get(t, s), c = s[s.length - 1];
|
|
1241
1241
|
let l = -1;
|
|
1242
|
-
e.children[c].children.forEach((p,
|
|
1243
|
-
p.children[0] === o && (l =
|
|
1244
|
-
}), l !== -1 && e.children.forEach((p,
|
|
1242
|
+
e.children[c].children.forEach((p, k) => {
|
|
1243
|
+
p.children[0] === o && (l = k);
|
|
1244
|
+
}), l !== -1 && e.children.forEach((p, k) => {
|
|
1245
1245
|
if (p.children.length > l) {
|
|
1246
|
-
const g = [s[0],
|
|
1246
|
+
const g = [s[0], k, l];
|
|
1247
1247
|
ae.get(t, g) ? A.removeNodes(t, { at: g }) : console.error(`Invalid path: ${g}`);
|
|
1248
1248
|
}
|
|
1249
1249
|
});
|
|
@@ -1265,8 +1265,8 @@ const w = {
|
|
|
1265
1265
|
findNearestTable(t) {
|
|
1266
1266
|
const { selection: e } = t;
|
|
1267
1267
|
if (!e) return null;
|
|
1268
|
-
const r = [], n =
|
|
1269
|
-
match: (c) =>
|
|
1268
|
+
const r = [], n = L.nodes(t, {
|
|
1269
|
+
match: (c) => J.isElement(c) && c.type === "table",
|
|
1270
1270
|
at: [],
|
|
1271
1271
|
mode: "all"
|
|
1272
1272
|
// Parcourir tous les nœuds
|
|
@@ -1419,7 +1419,7 @@ const Bt = ({ attributes: t, children: e }) => /* @__PURE__ */ a.jsx("blockquote
|
|
|
1419
1419
|
*
|
|
1420
1420
|
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
1421
1421
|
*/
|
|
1422
|
-
function
|
|
1422
|
+
function H(t) {
|
|
1423
1423
|
let e, r, n;
|
|
1424
1424
|
if (t.startsWith("#"))
|
|
1425
1425
|
t = t.replace(/^#/, ""), e = parseInt(t.substring(0, 2), 16) / 255, r = parseInt(t.substring(2, 4), 16) / 255, n = parseInt(t.substring(4, 6), 16) / 255;
|
|
@@ -1437,16 +1437,16 @@ const Qe = Se({
|
|
|
1437
1437
|
},
|
|
1438
1438
|
isDarkTheme: !1
|
|
1439
1439
|
}), Dt = ({ showTheme: t, backgroundDarkColor: e, borderDarkColor: r, imageDarkColor: n, children: s }) => {
|
|
1440
|
-
const [o, c] =
|
|
1440
|
+
const [o, c] = P("light");
|
|
1441
1441
|
ee(() => {
|
|
1442
1442
|
if (t) {
|
|
1443
1443
|
const p = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1444
1444
|
c(p.matches ? "dark" : "light");
|
|
1445
|
-
const
|
|
1445
|
+
const k = (g) => {
|
|
1446
1446
|
c(g.matches ? "dark" : "light");
|
|
1447
1447
|
};
|
|
1448
|
-
return p.addEventListener("change",
|
|
1449
|
-
p.removeEventListener("change",
|
|
1448
|
+
return p.addEventListener("change", k), () => {
|
|
1449
|
+
p.removeEventListener("change", k);
|
|
1450
1450
|
};
|
|
1451
1451
|
}
|
|
1452
1452
|
}, []), ee(() => {
|
|
@@ -1457,7 +1457,7 @@ const Qe = Se({
|
|
|
1457
1457
|
};
|
|
1458
1458
|
return /* @__PURE__ */ a.jsx(Qe.Provider, { value: { theme: o, toggleTheme: l, showTheme: t, isDarkTheme: o === "dark", backgroundDarkColor: e, borderDarkColor: r, imageDarkColor: n }, children: s });
|
|
1459
1459
|
}, $e = () => Ae(Qe), et = Se(), It = ({ backgroundColor: t, borderColor: e, imageColor: r, editor: n, children: s }) => {
|
|
1460
|
-
const { showTheme: o, isDarkTheme: c, backgroundDarkColor: l, borderDarkColor: p, imageDarkColor:
|
|
1460
|
+
const { showTheme: o, isDarkTheme: c, backgroundDarkColor: l, borderDarkColor: p, imageDarkColor: k } = $e(), g = o && c ? l : t, y = o && c ? p : e, f = o && c ? k : r;
|
|
1461
1461
|
return ee(() => {
|
|
1462
1462
|
document.documentElement.style.setProperty("--background-color", g), document.documentElement.style.setProperty("--border-color", y), document.documentElement.style.setProperty("--image-color", f);
|
|
1463
1463
|
}, [g, y, f]), /* @__PURE__ */ a.jsx(et.Provider, { value: { backgroundColor: g, borderColor: y, editor: n, imageColor: f }, children: /* @__PURE__ */ a.jsx("div", { className: "rtf react-text-forge", style: { backgroundColor: g, borderColor: y }, children: s }) });
|
|
@@ -1476,7 +1476,7 @@ const Qe = Se({
|
|
|
1476
1476
|
{
|
|
1477
1477
|
value: o.value,
|
|
1478
1478
|
onClick: () => t(o.value),
|
|
1479
|
-
style: { backgroundColor: `${o.value === w.getListStyleType(s) ? `color-mix(in srgb, ${e.backgroundColor} 80%, ${
|
|
1479
|
+
style: { backgroundColor: `${o.value === w.getListStyleType(s) ? `color-mix(in srgb, ${e.backgroundColor} 80%, ${H(e.backgroundColor) ? "white" : "black"})` : e.backgroundColor}` },
|
|
1480
1480
|
children: o.label
|
|
1481
1481
|
},
|
|
1482
1482
|
o.value
|
|
@@ -1494,7 +1494,7 @@ const Qe = Se({
|
|
|
1494
1494
|
{
|
|
1495
1495
|
value: o.value,
|
|
1496
1496
|
onClick: () => t(o.value),
|
|
1497
|
-
style: { backgroundColor: `${o.value === w.getListStyleType(s) ? `color-mix(in srgb, ${e.backgroundColor} 80%, ${
|
|
1497
|
+
style: { backgroundColor: `${o.value === w.getListStyleType(s) ? `color-mix(in srgb, ${e.backgroundColor} 80%, ${H(e.backgroundColor) ? "white" : "black"})` : e.backgroundColor}` },
|
|
1498
1498
|
children: o.label
|
|
1499
1499
|
},
|
|
1500
1500
|
o.value
|
|
@@ -1605,10 +1605,10 @@ function W({ format: t, imageColor: e }) {
|
|
|
1605
1605
|
})();
|
|
1606
1606
|
}
|
|
1607
1607
|
const Vt = ({ format: t, isActive: e, onMouseDown: r }) => {
|
|
1608
|
-
const { backgroundColor: n, editor: s, imageColor: o } = U(), [c, l] =
|
|
1608
|
+
const { backgroundColor: n, editor: s, imageColor: o } = U(), [c, l] = P(!1), p = {
|
|
1609
1609
|
backgroundColor: n,
|
|
1610
1610
|
color: o
|
|
1611
|
-
},
|
|
1611
|
+
}, k = (g) => {
|
|
1612
1612
|
w.toggleBlock(s, t === "bulletList" ? "bullet-list" : "numbered-list", g), l(!1);
|
|
1613
1613
|
};
|
|
1614
1614
|
return /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
@@ -1636,31 +1636,31 @@ const Vt = ({ format: t, isActive: e, onMouseDown: r }) => {
|
|
|
1636
1636
|
Ht,
|
|
1637
1637
|
{
|
|
1638
1638
|
selectStyle: p,
|
|
1639
|
-
onChange:
|
|
1639
|
+
onChange: k,
|
|
1640
1640
|
toggleForm: l
|
|
1641
1641
|
}
|
|
1642
1642
|
) : /* @__PURE__ */ a.jsx(
|
|
1643
1643
|
qt,
|
|
1644
1644
|
{
|
|
1645
1645
|
selectStyle: p,
|
|
1646
|
-
onChange:
|
|
1646
|
+
onChange: k,
|
|
1647
1647
|
toggleForm: l
|
|
1648
1648
|
}
|
|
1649
1649
|
))
|
|
1650
1650
|
] });
|
|
1651
1651
|
};
|
|
1652
1652
|
function tt({ disabled: t = !1, elements: e, elementSelected: r, format: n, isOpen: s, setIsOpen: o, onClick: c }) {
|
|
1653
|
-
const { backgroundColor: l, imageColor: p } = U(),
|
|
1653
|
+
const { backgroundColor: l, imageColor: p } = U(), k = () => {
|
|
1654
1654
|
o(!s);
|
|
1655
1655
|
}, g = (y) => {
|
|
1656
1656
|
c(y), o(!1);
|
|
1657
1657
|
};
|
|
1658
1658
|
return /* @__PURE__ */ a.jsxs("div", { className: "rtf dropdown tool", children: [
|
|
1659
|
-
/* @__PURE__ */ a.jsx("button", { onClick:
|
|
1660
|
-
s && /* @__PURE__ */ a.jsx("ul", { style: { backgroundColor: l, color: p }, className: "rtf dropdown-menu", onMouseLeave:
|
|
1659
|
+
/* @__PURE__ */ a.jsx("button", { onClick: k, className: "rtf dropdown-toggle", disabled: t, children: /* @__PURE__ */ a.jsx(W, { format: n, imageColor: p }) }),
|
|
1660
|
+
s && /* @__PURE__ */ a.jsx("ul", { style: { backgroundColor: l, color: p }, className: "rtf dropdown-menu", onMouseLeave: k, children: e.map((y, f) => /* @__PURE__ */ a.jsx(
|
|
1661
1661
|
"li",
|
|
1662
1662
|
{
|
|
1663
|
-
style: { backgroundColor: `${r && y === r ? `color-mix(in srgb, ${l} 80%, ${
|
|
1663
|
+
style: { backgroundColor: `${r && y === r ? `color-mix(in srgb, ${l} 80%, ${H(l) ? "white" : "black"})` : l}` },
|
|
1664
1664
|
onClick: () => g(y),
|
|
1665
1665
|
children: y
|
|
1666
1666
|
},
|
|
@@ -1669,7 +1669,7 @@ function tt({ disabled: t = !1, elements: e, elementSelected: r, format: n, isOp
|
|
|
1669
1669
|
] });
|
|
1670
1670
|
}
|
|
1671
1671
|
const Wt = ({ disabled: t, sizeSelected: e, onSelectSize: r }) => {
|
|
1672
|
-
const [n, s] =
|
|
1672
|
+
const [n, s] = P(!1), o = ["10px", "12px", "14px", "16px", "18px", "20px", "24px", "28px", "36px"];
|
|
1673
1673
|
return /* @__PURE__ */ a.jsx(
|
|
1674
1674
|
tt,
|
|
1675
1675
|
{
|
|
@@ -1683,7 +1683,7 @@ const Wt = ({ disabled: t, sizeSelected: e, onSelectSize: r }) => {
|
|
|
1683
1683
|
}
|
|
1684
1684
|
);
|
|
1685
1685
|
}, Ut = ({ fontFamilySelected: t, onSelectFontFamily: e }) => {
|
|
1686
|
-
const [r, n] =
|
|
1686
|
+
const [r, n] = P(!1), s = ["Arial", "Arial Black", "Bookman", "Comic Sans MS", "Courier", "Courier New", "Garamond", "Georgia", "Helvetica", "Impact", "Palatino", "Times", "Times New Roman", "Trebuchet MS", "Verdana"];
|
|
1687
1687
|
return /* @__PURE__ */ a.jsx(
|
|
1688
1688
|
tt,
|
|
1689
1689
|
{
|
|
@@ -1696,21 +1696,21 @@ const Wt = ({ disabled: t, sizeSelected: e, onSelectSize: r }) => {
|
|
|
1696
1696
|
}
|
|
1697
1697
|
);
|
|
1698
1698
|
}, Zt = ({ onClose: t, initialUrl: e = "", isOpenInNewTab: r }) => {
|
|
1699
|
-
const [n, s] =
|
|
1699
|
+
const [n, s] = P(""), { editor: o, backgroundColor: c, imageColor: l } = U(), [p, k] = P(!1), [g, y] = P(o.selection), f = {
|
|
1700
1700
|
backgroundColor: c,
|
|
1701
1701
|
color: l
|
|
1702
|
-
},
|
|
1703
|
-
color:
|
|
1704
|
-
},
|
|
1705
|
-
backgroundColor: `color-mix(in srgb, ${c} 80%, ${
|
|
1706
|
-
color:
|
|
1707
|
-
}, S = {
|
|
1708
|
-
backgroundColor: c !== "#800020" ? "#800020" : "color-mix(in srgb, #800020 80%, black)",
|
|
1709
|
-
color: j.color
|
|
1702
|
+
}, C = {
|
|
1703
|
+
color: H(c) ? "#FFF" : "#000"
|
|
1704
|
+
}, _ = {
|
|
1705
|
+
backgroundColor: `color-mix(in srgb, ${c} 80%, ${H(c) ? "white" : "black"})`,
|
|
1706
|
+
color: C.color
|
|
1710
1707
|
}, E = {
|
|
1708
|
+
backgroundColor: c !== "#800020" ? "#800020" : "color-mix(in srgb, #800020 80%, black)",
|
|
1709
|
+
color: C.color
|
|
1710
|
+
}, N = {
|
|
1711
1711
|
backgroundColor: c !== "#6c757d" ? "#6c757d" : "color-mix(in srgb, #6c757d 30%, black)",
|
|
1712
|
-
color:
|
|
1713
|
-
},
|
|
1712
|
+
color: C.color
|
|
1713
|
+
}, T = () => {
|
|
1714
1714
|
n && (w.updateLink(o, n, p), t());
|
|
1715
1715
|
}, i = () => {
|
|
1716
1716
|
g && Le.focus(o);
|
|
@@ -1720,7 +1720,7 @@ const Wt = ({ disabled: t, sizeSelected: e, onSelectSize: r }) => {
|
|
|
1720
1720
|
return ee(() => {
|
|
1721
1721
|
o.selection && y(o.selection);
|
|
1722
1722
|
}, []), ee(() => {
|
|
1723
|
-
s(e),
|
|
1723
|
+
s(e), k(r);
|
|
1724
1724
|
}, [e, r]), /* @__PURE__ */ a.jsxs("div", { onMouseLeave: t, style: f, className: "rtf link-form", children: [
|
|
1725
1725
|
/* @__PURE__ */ a.jsx(
|
|
1726
1726
|
"input",
|
|
@@ -1741,17 +1741,17 @@ const Wt = ({ disabled: t, sizeSelected: e, onSelectSize: r }) => {
|
|
|
1741
1741
|
type: "checkbox",
|
|
1742
1742
|
checked: p,
|
|
1743
1743
|
onBlur: i,
|
|
1744
|
-
onChange: () =>
|
|
1744
|
+
onChange: () => k(!p)
|
|
1745
1745
|
}
|
|
1746
1746
|
),
|
|
1747
1747
|
"Ouvrir dans un nouvel onglet"
|
|
1748
1748
|
] }),
|
|
1749
1749
|
/* @__PURE__ */ a.jsxs("div", { className: "rtf link-form-actions", children: [
|
|
1750
1750
|
e ? /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
1751
|
-
/* @__PURE__ */ a.jsx("button", { className: "rtf", style:
|
|
1752
|
-
/* @__PURE__ */ a.jsx("button", { className: "rtf", style:
|
|
1753
|
-
] }) : /* @__PURE__ */ a.jsx("button", { className: "rtf", style:
|
|
1754
|
-
/* @__PURE__ */ a.jsx("button", { className: "rtf", style:
|
|
1751
|
+
/* @__PURE__ */ a.jsx("button", { className: "rtf", style: _, onClick: T, children: "Modifier" }),
|
|
1752
|
+
/* @__PURE__ */ a.jsx("button", { className: "rtf", style: E, onClick: u, children: "Supprimer" })
|
|
1753
|
+
] }) : /* @__PURE__ */ a.jsx("button", { className: "rtf", style: _, onClick: T, children: "Valider" }),
|
|
1754
|
+
/* @__PURE__ */ a.jsx("button", { className: "rtf", style: N, onClick: t, children: "Annuler" })
|
|
1755
1755
|
] })
|
|
1756
1756
|
] });
|
|
1757
1757
|
};
|
|
@@ -1776,10 +1776,10 @@ const Wt = ({ disabled: t, sizeSelected: e, onSelectSize: r }) => {
|
|
|
1776
1776
|
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
1777
1777
|
*/
|
|
1778
1778
|
function Me(t) {
|
|
1779
|
-
const [e, r] =
|
|
1780
|
-
i(!
|
|
1779
|
+
const [e, r] = P(""), [n, s] = P(""), [o, c] = P(!1), [l, p] = P(""), [k, g] = P(""), [y, f] = P("paragraph"), [C, _] = P(!1), [E, N] = P(""), [T, i] = P(!1), u = () => {
|
|
1780
|
+
i(!T);
|
|
1781
1781
|
}, m = () => {
|
|
1782
|
-
|
|
1782
|
+
_(!C);
|
|
1783
1783
|
};
|
|
1784
1784
|
return {
|
|
1785
1785
|
activeBlock: y,
|
|
@@ -1787,25 +1787,25 @@ function Me(t) {
|
|
|
1787
1787
|
setColorMode: s,
|
|
1788
1788
|
openInNewTab: o,
|
|
1789
1789
|
setOpenInNewTab: c,
|
|
1790
|
-
selectedBackgroundColor:
|
|
1790
|
+
selectedBackgroundColor: k,
|
|
1791
1791
|
setSelectedBackgroundColor: g,
|
|
1792
1792
|
selectedColor: l,
|
|
1793
1793
|
setSelectedColor: p,
|
|
1794
|
-
selectedLanguage:
|
|
1795
|
-
setSelectedLanguage:
|
|
1794
|
+
selectedLanguage: E,
|
|
1795
|
+
setSelectedLanguage: N,
|
|
1796
1796
|
selectedLink: e,
|
|
1797
1797
|
setSelectedLink: r,
|
|
1798
|
-
showColorPicker:
|
|
1799
|
-
showLinkForm:
|
|
1798
|
+
showColorPicker: C,
|
|
1799
|
+
showLinkForm: T,
|
|
1800
1800
|
setShowLinkForm: i,
|
|
1801
1801
|
// Fonctions utiles
|
|
1802
1802
|
detectCurrentLanguage: () => {
|
|
1803
1803
|
const { selection: b } = t;
|
|
1804
1804
|
if (b) {
|
|
1805
|
-
const [F] =
|
|
1806
|
-
match: (
|
|
1805
|
+
const [F] = L.nodes(t, {
|
|
1806
|
+
match: (S) => S.type === "code"
|
|
1807
1807
|
});
|
|
1808
|
-
|
|
1808
|
+
N(F ? F[0].language : null);
|
|
1809
1809
|
}
|
|
1810
1810
|
},
|
|
1811
1811
|
toggleLinkForm: u,
|
|
@@ -1822,15 +1822,15 @@ function Me(t) {
|
|
|
1822
1822
|
};
|
|
1823
1823
|
}
|
|
1824
1824
|
function Gt({ selectedColor: t, onSelectColor: e, onClose: r }) {
|
|
1825
|
-
const [n, s] =
|
|
1825
|
+
const [n, s] = P("#ffffff"), { editor: o, backgroundColor: c, borderColor: l, imageColor: p } = U(), k = {
|
|
1826
1826
|
backgroundColor: c,
|
|
1827
1827
|
color: p
|
|
1828
1828
|
}, g = {
|
|
1829
|
-
backgroundColor: `color-mix(in srgb, ${c} 80%, ${
|
|
1830
|
-
color:
|
|
1829
|
+
backgroundColor: `color-mix(in srgb, ${c} 80%, ${H(c) ? "white" : "black"})`,
|
|
1830
|
+
color: H(c) ? "#FFF" : "#000"
|
|
1831
1831
|
}, y = {
|
|
1832
1832
|
backgroundColor: c !== "#6c757d" ? "#6c757d" : "color-mix(in srgb, #6c757d 30%, black)",
|
|
1833
|
-
color:
|
|
1833
|
+
color: H(c) ? "#FFF" : "#000"
|
|
1834
1834
|
}, f = {
|
|
1835
1835
|
default: {
|
|
1836
1836
|
picker: {
|
|
@@ -1840,20 +1840,20 @@ function Gt({ selectedColor: t, onSelectColor: e, onClose: r }) {
|
|
|
1840
1840
|
border: l
|
|
1841
1841
|
}
|
|
1842
1842
|
}
|
|
1843
|
-
},
|
|
1844
|
-
Le.focus(o), s(
|
|
1845
|
-
},
|
|
1843
|
+
}, C = (N) => {
|
|
1844
|
+
Le.focus(o), s(N.hex);
|
|
1845
|
+
}, _ = () => {
|
|
1846
1846
|
n && (e(n), r());
|
|
1847
|
-
},
|
|
1847
|
+
}, E = () => {
|
|
1848
1848
|
e(""), r();
|
|
1849
1849
|
};
|
|
1850
1850
|
return ee(() => {
|
|
1851
1851
|
t && s(t);
|
|
1852
1852
|
}, [t]), /* @__PURE__ */ a.jsxs("div", { onMouseLeave: r, className: "rtf color-picker-popup", children: [
|
|
1853
|
-
/* @__PURE__ */ a.jsx(dt, { styles: f, color: n, onChangeComplete:
|
|
1854
|
-
/* @__PURE__ */ a.jsxs("div", { style:
|
|
1855
|
-
/* @__PURE__ */ a.jsx("button", { className: "rtf", style: g, onClick:
|
|
1856
|
-
/* @__PURE__ */ a.jsx("button", { className: "rtf", style: y, onClick:
|
|
1853
|
+
/* @__PURE__ */ a.jsx(dt, { styles: f, color: n, onChangeComplete: C }),
|
|
1854
|
+
/* @__PURE__ */ a.jsxs("div", { style: k, className: "rtf link-form-actions", children: [
|
|
1855
|
+
/* @__PURE__ */ a.jsx("button", { className: "rtf", style: g, onClick: _, disabled: !n, children: "Appliquer" }),
|
|
1856
|
+
/* @__PURE__ */ a.jsx("button", { className: "rtf", style: y, onClick: E, children: "Annuler" })
|
|
1857
1857
|
] })
|
|
1858
1858
|
] });
|
|
1859
1859
|
}
|
|
@@ -1865,19 +1865,19 @@ const Yt = () => {
|
|
|
1865
1865
|
onMouseDown: (s) => {
|
|
1866
1866
|
s.preventDefault(), w.toggleBlockquote(t);
|
|
1867
1867
|
},
|
|
1868
|
-
style: { backgroundColor: n ? `color-mix(in srgb, ${e} 80%, ${
|
|
1868
|
+
style: { backgroundColor: n ? `color-mix(in srgb, ${e} 80%, ${H(e) ? "white" : "black"})` : "" },
|
|
1869
1869
|
className: "rtf tool",
|
|
1870
1870
|
children: /* @__PURE__ */ a.jsx(W, { format: "blockquote", imageColor: r })
|
|
1871
1871
|
}
|
|
1872
1872
|
);
|
|
1873
1873
|
}, te = ({ text: t, children: e, position: r = "top" }) => {
|
|
1874
1874
|
var g;
|
|
1875
|
-
const [n, s] =
|
|
1875
|
+
const [n, s] = P(!1), { isDarkTheme: o, backgroundDarkColor: c, imageDarkColor: l } = $e(), p = ge.Children.count(e), k = ge.Children.map(e, (y) => y);
|
|
1876
1876
|
return /* @__PURE__ */ a.jsxs(
|
|
1877
1877
|
"div",
|
|
1878
1878
|
{
|
|
1879
1879
|
className: "tooltip-container",
|
|
1880
|
-
style: { display: p === 1 && ((g =
|
|
1880
|
+
style: { display: p === 1 && ((g = k[0].props.style) == null ? void 0 : g.display) === "none" ? "none" : "inline-block" },
|
|
1881
1881
|
onMouseEnter: () => s(!0),
|
|
1882
1882
|
onMouseLeave: () => s(!1),
|
|
1883
1883
|
children: [
|
|
@@ -1896,41 +1896,41 @@ const Yt = () => {
|
|
|
1896
1896
|
}
|
|
1897
1897
|
);
|
|
1898
1898
|
}, Ie = ({ activeMarks: t, format: e, isActive: r, tooltip: n }) => {
|
|
1899
|
-
const [s, o] =
|
|
1900
|
-
activeBlock:
|
|
1899
|
+
const [s, o] = P(""), { backgroundColor: c, editor: l, imageColor: p } = U(), {
|
|
1900
|
+
activeBlock: k,
|
|
1901
1901
|
colorMode: g,
|
|
1902
1902
|
setColorMode: y,
|
|
1903
1903
|
openInNewTab: f,
|
|
1904
|
-
detectCurrentLanguage:
|
|
1905
|
-
handleColorChange:
|
|
1906
|
-
handleBackgroundColorChange:
|
|
1907
|
-
setOpenInNewTab:
|
|
1908
|
-
selectedBackgroundColor:
|
|
1904
|
+
detectCurrentLanguage: C,
|
|
1905
|
+
handleColorChange: _,
|
|
1906
|
+
handleBackgroundColorChange: E,
|
|
1907
|
+
setOpenInNewTab: N,
|
|
1908
|
+
selectedBackgroundColor: T,
|
|
1909
1909
|
setSelectedBackgroundColor: i,
|
|
1910
1910
|
selectedColor: u,
|
|
1911
1911
|
setSelectedColor: m,
|
|
1912
1912
|
selectedLink: x,
|
|
1913
1913
|
setSelectedLink: v,
|
|
1914
|
-
showColorPicker:
|
|
1915
|
-
showLinkForm:
|
|
1914
|
+
showColorPicker: j,
|
|
1915
|
+
showLinkForm: d,
|
|
1916
1916
|
setShowLinkForm: b,
|
|
1917
1917
|
toggleColorPicker: F,
|
|
1918
|
-
toggleLinkForm:
|
|
1919
|
-
} = Me(l),
|
|
1918
|
+
toggleLinkForm: S
|
|
1919
|
+
} = Me(l), M = k === "h1" || k === "h2", Z = ["left", "center", "right"], G = (B) => {
|
|
1920
1920
|
w.applyFontSize(l, B);
|
|
1921
|
-
},
|
|
1921
|
+
}, X = (B) => {
|
|
1922
1922
|
w.applyFontFamily(l, B), o(B);
|
|
1923
|
-
},
|
|
1923
|
+
}, I = () => {
|
|
1924
1924
|
setTimeout(() => Le.focus(l), 0);
|
|
1925
1925
|
};
|
|
1926
1926
|
return ee(() => {
|
|
1927
|
-
|
|
1927
|
+
C();
|
|
1928
1928
|
const { selection: B } = l;
|
|
1929
1929
|
if (B) {
|
|
1930
|
-
const [O] =
|
|
1931
|
-
match: (
|
|
1930
|
+
const [O] = L.nodes(l, {
|
|
1931
|
+
match: (K) => K.type === "link"
|
|
1932
1932
|
});
|
|
1933
|
-
O ? (
|
|
1933
|
+
O ? (N(O[0].target === "_blank"), v(O[0].href)) : (N(!1), v(""));
|
|
1934
1934
|
}
|
|
1935
1935
|
}, [l.selection]), /* @__PURE__ */ a.jsx(te, { text: n, position: "bottom", children: e === "indent" || e === "outdent" ? /* @__PURE__ */ a.jsx("div", { children: /* @__PURE__ */ a.jsx(
|
|
1936
1936
|
"button",
|
|
@@ -1941,7 +1941,7 @@ const Yt = () => {
|
|
|
1941
1941
|
disabled: !r,
|
|
1942
1942
|
children: /* @__PURE__ */ a.jsx(W, { format: e, imageColor: r ? p : `color-mix(in srgb, ${p} 40%, black)` })
|
|
1943
1943
|
}
|
|
1944
|
-
) }) : e === "fontSize" ? /* @__PURE__ */ a.jsx(Wt, { disabled:
|
|
1944
|
+
) }) : e === "fontSize" ? /* @__PURE__ */ a.jsx(Wt, { disabled: M, onSelectSize: G, sizeSelected: r }) : e === "fontFamily" ? /* @__PURE__ */ a.jsx(Ut, { fontFamilySelected: s, onSelectFontFamily: X }) : e === "bulletList" || e === "numberedList" ? /* @__PURE__ */ a.jsx("div", { className: "rtf dropdown", children: /* @__PURE__ */ a.jsx(
|
|
1945
1945
|
Vt,
|
|
1946
1946
|
{
|
|
1947
1947
|
format: e,
|
|
@@ -1955,14 +1955,14 @@ const Yt = () => {
|
|
|
1955
1955
|
"button",
|
|
1956
1956
|
{
|
|
1957
1957
|
onMouseDown: (B) => {
|
|
1958
|
-
B.preventDefault(),
|
|
1958
|
+
B.preventDefault(), I(), S();
|
|
1959
1959
|
},
|
|
1960
1960
|
title: n,
|
|
1961
1961
|
className: `rtf tool tool--${r ? "active" : "inactive"}`,
|
|
1962
1962
|
children: /* @__PURE__ */ a.jsx(W, { format: e, imageColor: p })
|
|
1963
1963
|
}
|
|
1964
1964
|
),
|
|
1965
|
-
|
|
1965
|
+
d && /* @__PURE__ */ a.jsx(
|
|
1966
1966
|
Zt,
|
|
1967
1967
|
{
|
|
1968
1968
|
onClose: () => b(!1),
|
|
@@ -1976,17 +1976,17 @@ const Yt = () => {
|
|
|
1976
1976
|
{
|
|
1977
1977
|
title: n,
|
|
1978
1978
|
onMouseDown: (B) => {
|
|
1979
|
-
B.preventDefault(),
|
|
1979
|
+
B.preventDefault(), I(), e === "color" ? (m(t[e]), y("color"), F()) : (i(t[e]), y("bgColor"), F());
|
|
1980
1980
|
},
|
|
1981
1981
|
className: `rtf tool tool--${r ? "active" : "inactive"}`,
|
|
1982
1982
|
children: /* @__PURE__ */ a.jsx(W, { format: e, imageColor: p })
|
|
1983
1983
|
}
|
|
1984
1984
|
),
|
|
1985
|
-
|
|
1985
|
+
j && /* @__PURE__ */ a.jsx(
|
|
1986
1986
|
Gt,
|
|
1987
1987
|
{
|
|
1988
|
-
selectedColor: g === "color" ? u :
|
|
1989
|
-
onSelectColor: g === "color" ?
|
|
1988
|
+
selectedColor: g === "color" ? u : T,
|
|
1989
|
+
onSelectColor: g === "color" ? _ : E,
|
|
1990
1990
|
onClose: F
|
|
1991
1991
|
}
|
|
1992
1992
|
)
|
|
@@ -1994,10 +1994,10 @@ const Yt = () => {
|
|
|
1994
1994
|
"button",
|
|
1995
1995
|
{
|
|
1996
1996
|
onMouseDown: (B) => {
|
|
1997
|
-
B.preventDefault(),
|
|
1997
|
+
B.preventDefault(), Z.includes(e) ? w.toggleAlign(l, e) : w.toggleMark(l, e);
|
|
1998
1998
|
},
|
|
1999
1999
|
title: n,
|
|
2000
|
-
style: { backgroundColor: r ? `color-mix(in srgb, ${c} 80%, ${
|
|
2000
|
+
style: { backgroundColor: r ? `color-mix(in srgb, ${c} 80%, ${H(c) ? "white" : "black"})` : "" },
|
|
2001
2001
|
className: "rtf tool",
|
|
2002
2002
|
children: /* @__PURE__ */ a.jsx(W, { format: e, imageColor: p })
|
|
2003
2003
|
}
|
|
@@ -2022,16 +2022,16 @@ const Yt = () => {
|
|
|
2022
2022
|
], p = {
|
|
2023
2023
|
backgroundColor: r,
|
|
2024
2024
|
color: n
|
|
2025
|
-
},
|
|
2025
|
+
}, k = (g) => {
|
|
2026
2026
|
const y = g.target.value;
|
|
2027
2027
|
c(y);
|
|
2028
2028
|
};
|
|
2029
|
-
return /* @__PURE__ */ a.jsx(te, { text: t, position: "bottom", children: /* @__PURE__ */ a.jsx("select", { ref: e, className: "rtf", value: o, onChange:
|
|
2029
|
+
return /* @__PURE__ */ a.jsx(te, { text: t, position: "bottom", children: /* @__PURE__ */ a.jsx("select", { ref: e, className: "rtf", value: o, onChange: k, style: p, children: l.map((g) => /* @__PURE__ */ a.jsx("option", { className: "rtf", value: g.type, children: g.name }, g.type)) }) });
|
|
2030
2030
|
}), He = ye((t, e) => {
|
|
2031
|
-
const [r, n] =
|
|
2031
|
+
const [r, n] = P(!1), { backgroundColor: s, editor: o, imageColor: c } = U(), {
|
|
2032
2032
|
selectedLanguage: l,
|
|
2033
2033
|
setSelectedLanguage: p
|
|
2034
|
-
} = Me(o),
|
|
2034
|
+
} = Me(o), k = {
|
|
2035
2035
|
backgroundColor: s,
|
|
2036
2036
|
color: c
|
|
2037
2037
|
}, g = {
|
|
@@ -2050,25 +2050,25 @@ const Yt = () => {
|
|
|
2050
2050
|
// Ajoutez d'autres langages supportés par highlight.js
|
|
2051
2051
|
}, y = () => {
|
|
2052
2052
|
n(!r);
|
|
2053
|
-
}, f = (
|
|
2054
|
-
p(
|
|
2053
|
+
}, f = (C) => {
|
|
2054
|
+
p(C), w.handleCode(o, C), n(!1);
|
|
2055
2055
|
};
|
|
2056
2056
|
return /* @__PURE__ */ a.jsxs("div", { ref: e, className: `rtf dropdown tool ${l && l !== "init" && l !== "" ? "tool--active" : ""}`, children: [
|
|
2057
2057
|
/* @__PURE__ */ a.jsx("button", { className: "rtf dropdown-toggle", onClick: y, children: /* @__PURE__ */ a.jsx(W, { format: "blockCode", imageColor: c }) }),
|
|
2058
|
-
r && /* @__PURE__ */ a.jsxs("ul", { style:
|
|
2058
|
+
r && /* @__PURE__ */ a.jsxs("ul", { style: k, onMouseLeave: y, className: "rtf dropdown-menu", children: [
|
|
2059
2059
|
l && /* @__PURE__ */ a.jsx("li", { onClick: () => f("init"), children: "Réinitialiser" }),
|
|
2060
|
-
Object.keys(g).map((
|
|
2060
|
+
Object.keys(g).map((C) => /* @__PURE__ */ a.jsx(
|
|
2061
2061
|
"li",
|
|
2062
2062
|
{
|
|
2063
|
-
onClick: () => f(
|
|
2063
|
+
onClick: () => f(C),
|
|
2064
2064
|
style: {
|
|
2065
2065
|
cursor: "pointer",
|
|
2066
2066
|
padding: "5px 10px",
|
|
2067
|
-
backgroundColor: l &&
|
|
2067
|
+
backgroundColor: l && C === l ? `color-mix(in srgb, ${s} 80%, ${H(s) ? "white" : "black"})` : s
|
|
2068
2068
|
},
|
|
2069
|
-
children: g[
|
|
2069
|
+
children: g[C]
|
|
2070
2070
|
},
|
|
2071
|
-
|
|
2071
|
+
C
|
|
2072
2072
|
))
|
|
2073
2073
|
] })
|
|
2074
2074
|
] });
|
|
@@ -2088,27 +2088,27 @@ const Yt = () => {
|
|
|
2088
2088
|
/* @__PURE__ */ a.jsx("label", { htmlFor: "file-input", className: "rtf image-upload-label", children: /* @__PURE__ */ a.jsx(W, { format: "image", imageColor: n }) })
|
|
2089
2089
|
] });
|
|
2090
2090
|
}), Xt = ({ onClose: t }) => {
|
|
2091
|
-
const { editor: e, backgroundColor: r } = U(), [n, s] =
|
|
2091
|
+
const { editor: e, backgroundColor: r } = U(), [n, s] = P(0), [o, c] = P(0), l = {
|
|
2092
2092
|
backgroundColor: r,
|
|
2093
|
-
color:
|
|
2093
|
+
color: H(r) ? "#FFF" : "#000"
|
|
2094
2094
|
}, p = (y, f) => {
|
|
2095
2095
|
s(y), c(f);
|
|
2096
|
-
},
|
|
2096
|
+
}, k = (y, f) => {
|
|
2097
2097
|
w.insertTable(e, y + 1, f + 1), t();
|
|
2098
2098
|
}, g = () => {
|
|
2099
2099
|
const y = [];
|
|
2100
2100
|
for (let f = 0; f < 5; f++)
|
|
2101
|
-
for (let
|
|
2102
|
-
const
|
|
2101
|
+
for (let C = 0; C < 5; C++) {
|
|
2102
|
+
const _ = f <= n && C <= o;
|
|
2103
2103
|
y.push(
|
|
2104
2104
|
/* @__PURE__ */ a.jsx(
|
|
2105
2105
|
"div",
|
|
2106
2106
|
{
|
|
2107
|
-
className: `rtf grid-cell ${
|
|
2108
|
-
onMouseEnter: () => p(f,
|
|
2109
|
-
onClick: () =>
|
|
2107
|
+
className: `rtf grid-cell ${_ ? "hovered" : ""}`,
|
|
2108
|
+
onMouseEnter: () => p(f, C),
|
|
2109
|
+
onClick: () => k(f, C)
|
|
2110
2110
|
},
|
|
2111
|
-
`${f}-${
|
|
2111
|
+
`${f}-${C}`
|
|
2112
2112
|
)
|
|
2113
2113
|
);
|
|
2114
2114
|
}
|
|
@@ -2133,7 +2133,7 @@ const Yt = () => {
|
|
|
2133
2133
|
{ name: "deleteColumn", alt: "Supprimer une colonne", onClick: w.deleteColumn }
|
|
2134
2134
|
];
|
|
2135
2135
|
return /* @__PURE__ */ a.jsx(a.Fragment, { children: c.map((l, p) => {
|
|
2136
|
-
var
|
|
2136
|
+
var k, g;
|
|
2137
2137
|
return /* @__PURE__ */ a.jsx(te, { text: t.find((y) => y.format === l.name).tooltip, position: "bottom", children: /* @__PURE__ */ a.jsx(
|
|
2138
2138
|
"button",
|
|
2139
2139
|
{
|
|
@@ -2146,14 +2146,14 @@ const Yt = () => {
|
|
|
2146
2146
|
W,
|
|
2147
2147
|
{
|
|
2148
2148
|
format: l.name,
|
|
2149
|
-
imageColor: o ? w.getTableFromSelection(n) ? l.name === "addRow" ? w.getTableFromSelection(n).children.length >= 5 ? `color-mix(in srgb, ${s} 40%, ${
|
|
2149
|
+
imageColor: o ? w.getTableFromSelection(n) ? l.name === "addRow" ? w.getTableFromSelection(n).children.length >= 5 ? `color-mix(in srgb, ${s} 40%, ${H(s) ? "white" : "black"})` : s : l.name === "addColumn" ? ((k = w.getTableFromSelection(n).children[0]) == null ? void 0 : k.children.length) >= 5 ? `color-mix(in srgb, ${s} 40%, ${H(s) ? "white" : "black"})` : s : l.name === "deleteColumn" ? ((g = w.getTableFromSelection(n).children[0]) == null ? void 0 : g.children.length) === 1 ? `color-mix(in srgb, ${s} 40%, ${H(s) ? "white" : "black"})` : s : l.name === "deleteRow" && w.getTableFromSelection(n).children.length === 1 ? `color-mix(in srgb, ${s} 40%, ${H(s) ? "white" : "black"})` : s : s : `color-mix(in srgb, ${s} 40%, ${H(s) ? "white" : "black"})`
|
|
2150
2150
|
}
|
|
2151
2151
|
)
|
|
2152
2152
|
}
|
|
2153
2153
|
) }, p);
|
|
2154
2154
|
}) });
|
|
2155
2155
|
}), Jt = ({ activeMarks: t }) => {
|
|
2156
|
-
const [e, r] =
|
|
2156
|
+
const [e, r] = P(!1), [n, s] = P([]), o = he(null), c = he({}), { editor: l, imageColor: p, backgroundColor: k } = U(), g = [
|
|
2157
2157
|
{ format: "blockType", tooltip: "Insérer un bloc de texte" },
|
|
2158
2158
|
{ format: "bold", tooltip: "Gras (Ctrl+B)" },
|
|
2159
2159
|
{ format: "underline", tooltip: "Souligné (Ctrl+U)" },
|
|
@@ -2184,22 +2184,22 @@ const Yt = () => {
|
|
|
2184
2184
|
{ format: "code", tooltip: "Bloc de code (Ctrl+E)" },
|
|
2185
2185
|
{ format: "undo", tooltip: "Annuler (Ctrl+Z)" },
|
|
2186
2186
|
{ format: "redo", tooltip: "Rétablir (Ctrl+Y)" }
|
|
2187
|
-
], [y, f] =
|
|
2187
|
+
], [y, f] = P(!1), C = ["deleteTable", "addRow", "addColumn", "deleteRow", "deleteColumn"], _ = () => {
|
|
2188
2188
|
f(!y);
|
|
2189
|
-
},
|
|
2189
|
+
}, E = () => {
|
|
2190
2190
|
document.querySelector(".rtf.toolbar").blur();
|
|
2191
|
-
},
|
|
2191
|
+
}, N = () => r((i) => !i), T = () => {
|
|
2192
2192
|
if (o.current) {
|
|
2193
2193
|
const u = o.current.clientWidth - 15;
|
|
2194
2194
|
if (978 > u) {
|
|
2195
2195
|
let x = 0;
|
|
2196
2196
|
const v = [];
|
|
2197
|
-
g.forEach((
|
|
2198
|
-
const b = c.current[
|
|
2199
|
-
b && (x += (
|
|
2197
|
+
g.forEach((d) => {
|
|
2198
|
+
const b = c.current[d.format];
|
|
2199
|
+
b && (x += (d.format === "blockType" ? b.clientWidth : 25) + 5, x <= u && v.push(d.format));
|
|
2200
2200
|
});
|
|
2201
|
-
const
|
|
2202
|
-
s(
|
|
2201
|
+
const j = g.map((d) => d.format).filter((d) => !v.includes(d));
|
|
2202
|
+
s(j);
|
|
2203
2203
|
} else
|
|
2204
2204
|
s([]);
|
|
2205
2205
|
}
|
|
@@ -2207,13 +2207,13 @@ const Yt = () => {
|
|
|
2207
2207
|
return ee(() => {
|
|
2208
2208
|
if (!o.current) return;
|
|
2209
2209
|
const i = new ResizeObserver(() => {
|
|
2210
|
-
|
|
2210
|
+
T();
|
|
2211
2211
|
});
|
|
2212
2212
|
return i.observe(o.current), () => {
|
|
2213
2213
|
i.disconnect();
|
|
2214
2214
|
};
|
|
2215
2215
|
}, []), /* @__PURE__ */ a.jsxs("div", { className: "rtf toolbar-container", children: [
|
|
2216
|
-
/* @__PURE__ */ a.jsxs("div", { className: "rtf toolbar", onClick:
|
|
2216
|
+
/* @__PURE__ */ a.jsxs("div", { className: "rtf toolbar", onClick: E, ref: o, children: [
|
|
2217
2217
|
/* @__PURE__ */ a.jsx(Kt, { ref: (i) => c.current.blockType = i, tooltip: g.find((i) => i.format === "blockType").tooltip }),
|
|
2218
2218
|
Object.keys(t).map((i, u) => /* @__PURE__ */ a.jsx(
|
|
2219
2219
|
"div",
|
|
@@ -2234,11 +2234,11 @@ const Yt = () => {
|
|
|
2234
2234
|
u
|
|
2235
2235
|
)),
|
|
2236
2236
|
/* @__PURE__ */ a.jsxs("div", { className: "rtf dropdown tool", style: { display: n.includes("table") ? "none" : "flex", padding: n.includes("table") ? 0 : 5 }, children: [
|
|
2237
|
-
/* @__PURE__ */ a.jsx(te, { text: g.find((i) => i.format === "table").tooltip, position: "bottom", children: /* @__PURE__ */ a.jsx("button", { ref: (i) => c.current.table = i, onClick:
|
|
2237
|
+
/* @__PURE__ */ a.jsx(te, { text: g.find((i) => i.format === "table").tooltip, position: "bottom", children: /* @__PURE__ */ a.jsx("button", { ref: (i) => c.current.table = i, onClick: _, className: "rtf dropdown-toggle", children: /* @__PURE__ */ a.jsx(W, { format: "table", imageColor: p }) }) }),
|
|
2238
2238
|
y && !n.includes("table") && /* @__PURE__ */ a.jsx(
|
|
2239
2239
|
Xt,
|
|
2240
2240
|
{
|
|
2241
|
-
onClose:
|
|
2241
|
+
onClose: _
|
|
2242
2242
|
}
|
|
2243
2243
|
)
|
|
2244
2244
|
] }),
|
|
@@ -2261,25 +2261,25 @@ const Yt = () => {
|
|
|
2261
2261
|
onMouseDown: (u) => {
|
|
2262
2262
|
u.preventDefault(), i === "undo" ? l.undo() : i === "redo" ? l.redo() : console.error("Type d'action inconnu !");
|
|
2263
2263
|
},
|
|
2264
|
-
children: /* @__PURE__ */ a.jsx(W, { format: i, imageColor: l.history[i + "s"].length === 0 ? `color-mix(in srgb, ${p} 40%, ${
|
|
2264
|
+
children: /* @__PURE__ */ a.jsx(W, { format: i, imageColor: l.history[i + "s"].length === 0 ? `color-mix(in srgb, ${p} 40%, ${H(p) ? "white" : "black"})` : p })
|
|
2265
2265
|
},
|
|
2266
2266
|
i
|
|
2267
2267
|
) }, i)),
|
|
2268
|
-
n.length > 0 && /* @__PURE__ */ a.jsx(te, { text: "Voir plus", position: "bottom", children: /* @__PURE__ */ a.jsx("button", { className: "rtf tool toolbar-more-button", onClick:
|
|
2268
|
+
n.length > 0 && /* @__PURE__ */ a.jsx(te, { text: "Voir plus", position: "bottom", children: /* @__PURE__ */ a.jsx("button", { className: "rtf tool toolbar-more-button", onClick: N, children: /* @__PURE__ */ a.jsx(W, { format: "more", imageColor: p }) }) })
|
|
2269
2269
|
] }),
|
|
2270
|
-
e && /* @__PURE__ */ a.jsx("div", { className: "rtf toolbar-modal", style: { backgroundColor:
|
|
2270
|
+
e && /* @__PURE__ */ a.jsx("div", { className: "rtf toolbar-modal", style: { backgroundColor: k }, onMouseLeave: () => r(!1), children: n.map((i) => i === "image" || i === "code" || i === "table" || i === "deleteTable" || i === "addRow" || i === "addColumn" || i === "deleteRow" || i === "deleteColumn" ? i === "image" ? /* @__PURE__ */ a.jsx(qe, { ref: (u) => c.current.image = u }, i) : i === "code" ? /* @__PURE__ */ a.jsx(He, { ref: (u) => c.current.code = u }, i) : i === "table" ? /* @__PURE__ */ a.jsx("div", { className: "rtf dropdown tool", children: /* @__PURE__ */ a.jsx(te, { text: g.find((u) => u.format === i).tooltip, position: "bottom", children: /* @__PURE__ */ a.jsx(
|
|
2271
2271
|
"button",
|
|
2272
2272
|
{
|
|
2273
2273
|
className: "rtf dropdown-toggle",
|
|
2274
2274
|
ref: (u) => c.current[i] = u,
|
|
2275
|
-
onClick:
|
|
2275
|
+
onClick: _,
|
|
2276
2276
|
children: /* @__PURE__ */ a.jsx(W, { format: i, imageColor: p })
|
|
2277
2277
|
}
|
|
2278
|
-
) }, i) }) :
|
|
2278
|
+
) }, i) }) : C.includes(i) ? /* @__PURE__ */ a.jsx(
|
|
2279
2279
|
Ve,
|
|
2280
2280
|
{
|
|
2281
2281
|
allButtons: g,
|
|
2282
|
-
hiddenButtons:
|
|
2282
|
+
hiddenButtons: C.filter((u) => u !== i),
|
|
2283
2283
|
ref: c
|
|
2284
2284
|
},
|
|
2285
2285
|
i
|
|
@@ -2335,50 +2335,50 @@ const Qt = (t) => {
|
|
|
2335
2335
|
let c;
|
|
2336
2336
|
switch (n.nodeName) {
|
|
2337
2337
|
case "P":
|
|
2338
|
-
c =
|
|
2338
|
+
c = z("element", { type: "paragraph", align: o.align, size: o.fontSize }, s.length ? s : [{ text: "" }]);
|
|
2339
2339
|
break;
|
|
2340
2340
|
case "PRE":
|
|
2341
|
-
c =
|
|
2341
|
+
c = z("element", { type: "code" }, s.length ? s : [{ text: "" }]);
|
|
2342
2342
|
break;
|
|
2343
2343
|
case "UL":
|
|
2344
|
-
c =
|
|
2344
|
+
c = z("element", { type: "bullet-list" }, s);
|
|
2345
2345
|
break;
|
|
2346
2346
|
case "OL":
|
|
2347
|
-
c =
|
|
2347
|
+
c = z("element", { type: "numbered-list" }, s);
|
|
2348
2348
|
break;
|
|
2349
2349
|
case "LI":
|
|
2350
|
-
c =
|
|
2350
|
+
c = z("element", { type: "list-item" }, s.length ? s : [{ text: "" }]);
|
|
2351
2351
|
break;
|
|
2352
2352
|
case "H1":
|
|
2353
|
-
c =
|
|
2353
|
+
c = z("element", { type: "h1" }, s.length ? s : [{ text: "" }]);
|
|
2354
2354
|
break;
|
|
2355
2355
|
case "H2":
|
|
2356
2356
|
case "H3":
|
|
2357
2357
|
case "H4":
|
|
2358
2358
|
case "H5":
|
|
2359
2359
|
case "H6":
|
|
2360
|
-
c =
|
|
2360
|
+
c = z("element", { type: "h2", align: o.align }, s.length ? s : [{ text: "" }]);
|
|
2361
2361
|
break;
|
|
2362
2362
|
case "BLOCKQUOTE":
|
|
2363
|
-
c =
|
|
2363
|
+
c = z("element", { type: "blockquote", align: o.align }, s.length ? s : [{ text: "" }]);
|
|
2364
2364
|
break;
|
|
2365
2365
|
case "IMG":
|
|
2366
|
-
c =
|
|
2366
|
+
c = z("element", { type: "image", url: n.getAttribute("src") });
|
|
2367
2367
|
break;
|
|
2368
2368
|
case "TABLE":
|
|
2369
|
-
c =
|
|
2369
|
+
c = z("element", { type: "table" }, s);
|
|
2370
2370
|
break;
|
|
2371
2371
|
case "TR":
|
|
2372
|
-
c =
|
|
2372
|
+
c = z("element", { type: "table-row" }, s);
|
|
2373
2373
|
break;
|
|
2374
2374
|
case "TD":
|
|
2375
|
-
c =
|
|
2375
|
+
c = z("element", { type: "table-cell" }, s);
|
|
2376
2376
|
break;
|
|
2377
2377
|
case "A":
|
|
2378
|
-
c =
|
|
2378
|
+
c = z("element", { type: "link", url: n.getAttribute("href") }, s.length ? s : [{ text: "" }]);
|
|
2379
2379
|
break;
|
|
2380
2380
|
default:
|
|
2381
|
-
c = s.map((l) => typeof l == "string" ?
|
|
2381
|
+
c = s.map((l) => typeof l == "string" ? z("text", o, l) : l).filter(Boolean);
|
|
2382
2382
|
}
|
|
2383
2383
|
return c;
|
|
2384
2384
|
};
|
|
@@ -2415,7 +2415,7 @@ const rt = Se({
|
|
|
2415
2415
|
toggleFullscreen: () => {
|
|
2416
2416
|
}
|
|
2417
2417
|
}), rr = ({ children: t }) => {
|
|
2418
|
-
const [e, r] =
|
|
2418
|
+
const [e, r] = P(!1), n = () => {
|
|
2419
2419
|
r(!e);
|
|
2420
2420
|
};
|
|
2421
2421
|
return ee(() => {
|
|
@@ -2443,7 +2443,7 @@ const rt = Se({
|
|
|
2443
2443
|
{
|
|
2444
2444
|
onClick: e,
|
|
2445
2445
|
className: `rtf tool ${t ? "tool--active" : ""}`,
|
|
2446
|
-
style: { backgroundColor: t ? `color-mix(in srgb, ${r} 80%, ${
|
|
2446
|
+
style: { backgroundColor: t ? `color-mix(in srgb, ${r} 80%, ${H(r) ? "white" : "black"})` : "" },
|
|
2447
2447
|
children: /* @__PURE__ */ a.jsx(W, { format: `fullscreen${t ? "Exit" : ""}`, imageColor: n })
|
|
2448
2448
|
}
|
|
2449
2449
|
) }) });
|
|
@@ -2566,8 +2566,8 @@ function ar() {
|
|
|
2566
2566
|
return m[v];
|
|
2567
2567
|
x = /** @type {Record<string, any>} */
|
|
2568
2568
|
{}, m[v] = x;
|
|
2569
|
-
for (var
|
|
2570
|
-
u.hasOwnProperty(
|
|
2569
|
+
for (var j in u)
|
|
2570
|
+
u.hasOwnProperty(j) && (x[j] = i(u[j], m));
|
|
2571
2571
|
return (
|
|
2572
2572
|
/** @type {any} */
|
|
2573
2573
|
x
|
|
@@ -2575,8 +2575,8 @@ function ar() {
|
|
|
2575
2575
|
case "Array":
|
|
2576
2576
|
return v = l.util.objId(u), m[v] ? m[v] : (x = [], m[v] = x, /** @type {Array} */
|
|
2577
2577
|
/** @type {any} */
|
|
2578
|
-
u.forEach(function(
|
|
2579
|
-
x[b] = i(
|
|
2578
|
+
u.forEach(function(d, b) {
|
|
2579
|
+
x[b] = i(d, m);
|
|
2580
2580
|
}), /** @type {any} */
|
|
2581
2581
|
x);
|
|
2582
2582
|
default:
|
|
@@ -2796,28 +2796,28 @@ function ar() {
|
|
|
2796
2796
|
insertBefore: function(i, u, m, x) {
|
|
2797
2797
|
x = x || /** @type {any} */
|
|
2798
2798
|
l.languages;
|
|
2799
|
-
var v = x[i],
|
|
2800
|
-
for (var
|
|
2801
|
-
if (v.hasOwnProperty(
|
|
2802
|
-
if (
|
|
2799
|
+
var v = x[i], j = {};
|
|
2800
|
+
for (var d in v)
|
|
2801
|
+
if (v.hasOwnProperty(d)) {
|
|
2802
|
+
if (d == u)
|
|
2803
2803
|
for (var b in m)
|
|
2804
|
-
m.hasOwnProperty(b) && (
|
|
2805
|
-
m.hasOwnProperty(
|
|
2804
|
+
m.hasOwnProperty(b) && (j[b] = m[b]);
|
|
2805
|
+
m.hasOwnProperty(d) || (j[d] = v[d]);
|
|
2806
2806
|
}
|
|
2807
2807
|
var F = x[i];
|
|
2808
|
-
return x[i] =
|
|
2809
|
-
|
|
2810
|
-
}),
|
|
2808
|
+
return x[i] = j, l.languages.DFS(l.languages, function(S, M) {
|
|
2809
|
+
M === F && S != i && (this[S] = j);
|
|
2810
|
+
}), j;
|
|
2811
2811
|
},
|
|
2812
2812
|
// Traverse a language definition with Depth First Search
|
|
2813
2813
|
DFS: function i(u, m, x, v) {
|
|
2814
2814
|
v = v || {};
|
|
2815
|
-
var
|
|
2816
|
-
for (var
|
|
2817
|
-
if (u.hasOwnProperty(
|
|
2818
|
-
m.call(u,
|
|
2819
|
-
var b = u[
|
|
2820
|
-
F === "Object" && !v[
|
|
2815
|
+
var j = l.util.objId;
|
|
2816
|
+
for (var d in u)
|
|
2817
|
+
if (u.hasOwnProperty(d)) {
|
|
2818
|
+
m.call(u, d, u[d], x || d);
|
|
2819
|
+
var b = u[d], F = l.util.type(b);
|
|
2820
|
+
F === "Object" && !v[j(b)] ? (v[j(b)] = !0, i(b, m, null, v)) : F === "Array" && !v[j(b)] && (v[j(b)] = !0, i(b, m, d, v));
|
|
2821
2821
|
}
|
|
2822
2822
|
}
|
|
2823
2823
|
},
|
|
@@ -2859,8 +2859,8 @@ function ar() {
|
|
|
2859
2859
|
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
|
|
2860
2860
|
};
|
|
2861
2861
|
l.hooks.run("before-highlightall", x), x.elements = Array.prototype.slice.apply(x.container.querySelectorAll(x.selector)), l.hooks.run("before-all-elements-highlight", x);
|
|
2862
|
-
for (var v = 0,
|
|
2863
|
-
l.highlightElement(
|
|
2862
|
+
for (var v = 0, j; j = x.elements[v++]; )
|
|
2863
|
+
l.highlightElement(j, u === !0, x.callback);
|
|
2864
2864
|
},
|
|
2865
2865
|
/**
|
|
2866
2866
|
* Highlights the code inside a single element.
|
|
@@ -2893,18 +2893,18 @@ function ar() {
|
|
|
2893
2893
|
highlightElement: function(i, u, m) {
|
|
2894
2894
|
var x = l.util.getLanguage(i), v = l.languages[x];
|
|
2895
2895
|
l.util.setLanguage(i, x);
|
|
2896
|
-
var
|
|
2897
|
-
|
|
2898
|
-
var
|
|
2896
|
+
var j = i.parentElement;
|
|
2897
|
+
j && j.nodeName.toLowerCase() === "pre" && l.util.setLanguage(j, x);
|
|
2898
|
+
var d = i.textContent, b = {
|
|
2899
2899
|
element: i,
|
|
2900
2900
|
language: x,
|
|
2901
2901
|
grammar: v,
|
|
2902
|
-
code:
|
|
2902
|
+
code: d
|
|
2903
2903
|
};
|
|
2904
|
-
function F(
|
|
2905
|
-
b.highlightedCode =
|
|
2904
|
+
function F(M) {
|
|
2905
|
+
b.highlightedCode = M, l.hooks.run("before-insert", b), b.element.innerHTML = b.highlightedCode, l.hooks.run("after-highlight", b), l.hooks.run("complete", b), m && m.call(b.element);
|
|
2906
2906
|
}
|
|
2907
|
-
if (l.hooks.run("before-sanity-check", b),
|
|
2907
|
+
if (l.hooks.run("before-sanity-check", b), j = b.element.parentElement, j && j.nodeName.toLowerCase() === "pre" && !j.hasAttribute("tabindex") && j.setAttribute("tabindex", "0"), !b.code) {
|
|
2908
2908
|
l.hooks.run("complete", b), m && m.call(b.element);
|
|
2909
2909
|
return;
|
|
2910
2910
|
}
|
|
@@ -2913,10 +2913,10 @@ function ar() {
|
|
|
2913
2913
|
return;
|
|
2914
2914
|
}
|
|
2915
2915
|
if (u && n.Worker) {
|
|
2916
|
-
var
|
|
2917
|
-
|
|
2918
|
-
F(
|
|
2919
|
-
},
|
|
2916
|
+
var S = new Worker(l.filename);
|
|
2917
|
+
S.onmessage = function(M) {
|
|
2918
|
+
F(M.data);
|
|
2919
|
+
}, S.postMessage(JSON.stringify({
|
|
2920
2920
|
language: b.language,
|
|
2921
2921
|
code: b.code,
|
|
2922
2922
|
immediateClose: !0
|
|
@@ -2986,7 +2986,7 @@ function ar() {
|
|
|
2986
2986
|
delete u.rest;
|
|
2987
2987
|
}
|
|
2988
2988
|
var v = new y();
|
|
2989
|
-
return f(v, v.head, i), g(i, v, u, v.head, 0),
|
|
2989
|
+
return f(v, v.head, i), g(i, v, u, v.head, 0), _(v);
|
|
2990
2990
|
},
|
|
2991
2991
|
/**
|
|
2992
2992
|
* @namespace
|
|
@@ -3049,65 +3049,65 @@ function ar() {
|
|
|
3049
3049
|
classes: ["token", u.type],
|
|
3050
3050
|
attributes: {},
|
|
3051
3051
|
language: m
|
|
3052
|
-
},
|
|
3053
|
-
|
|
3054
|
-
var
|
|
3052
|
+
}, j = u.alias;
|
|
3053
|
+
j && (Array.isArray(j) ? Array.prototype.push.apply(v.classes, j) : v.classes.push(j)), l.hooks.run("wrap", v);
|
|
3054
|
+
var d = "";
|
|
3055
3055
|
for (var b in v.attributes)
|
|
3056
|
-
|
|
3057
|
-
return "<" + v.tag + ' class="' + v.classes.join(" ") + '"' +
|
|
3056
|
+
d += " " + b + '="' + (v.attributes[b] || "").replace(/"/g, """) + '"';
|
|
3057
|
+
return "<" + v.tag + ' class="' + v.classes.join(" ") + '"' + d + ">" + v.content + "</" + v.tag + ">";
|
|
3058
3058
|
};
|
|
3059
|
-
function
|
|
3059
|
+
function k(i, u, m, x) {
|
|
3060
3060
|
i.lastIndex = u;
|
|
3061
3061
|
var v = i.exec(m);
|
|
3062
3062
|
if (v && x && v[1]) {
|
|
3063
|
-
var
|
|
3064
|
-
v.index +=
|
|
3063
|
+
var j = v[1].length;
|
|
3064
|
+
v.index += j, v[0] = v[0].slice(j);
|
|
3065
3065
|
}
|
|
3066
3066
|
return v;
|
|
3067
3067
|
}
|
|
3068
|
-
function g(i, u, m, x, v,
|
|
3069
|
-
for (var
|
|
3070
|
-
if (!(!m.hasOwnProperty(
|
|
3071
|
-
var b = m[
|
|
3068
|
+
function g(i, u, m, x, v, j) {
|
|
3069
|
+
for (var d in m)
|
|
3070
|
+
if (!(!m.hasOwnProperty(d) || !m[d])) {
|
|
3071
|
+
var b = m[d];
|
|
3072
3072
|
b = Array.isArray(b) ? b : [b];
|
|
3073
3073
|
for (var F = 0; F < b.length; ++F) {
|
|
3074
|
-
if (
|
|
3074
|
+
if (j && j.cause == d + "," + F)
|
|
3075
3075
|
return;
|
|
3076
|
-
var
|
|
3077
|
-
if (
|
|
3078
|
-
var
|
|
3079
|
-
|
|
3076
|
+
var S = b[F], M = S.inside, Z = !!S.lookbehind, G = !!S.greedy, X = S.alias;
|
|
3077
|
+
if (G && !S.pattern.global) {
|
|
3078
|
+
var I = S.pattern.toString().match(/[imsuy]*$/)[0];
|
|
3079
|
+
S.pattern = RegExp(S.pattern.source, I + "g");
|
|
3080
3080
|
}
|
|
3081
|
-
for (var B =
|
|
3081
|
+
for (var B = S.pattern || S, O = x.next, K = v; O !== u.tail && !(j && K >= j.reach); K += O.value.length, O = O.next) {
|
|
3082
3082
|
var h = O.value;
|
|
3083
3083
|
if (u.length > i.length)
|
|
3084
3084
|
return;
|
|
3085
3085
|
if (!(h instanceof p)) {
|
|
3086
|
-
var $ = 1,
|
|
3087
|
-
if (
|
|
3088
|
-
if (
|
|
3086
|
+
var $ = 1, R;
|
|
3087
|
+
if (G) {
|
|
3088
|
+
if (R = k(B, K, i, Z), !R || R.index >= i.length)
|
|
3089
3089
|
break;
|
|
3090
|
-
var ne =
|
|
3090
|
+
var ne = R.index, q = R.index + R[0].length, V = K;
|
|
3091
3091
|
for (V += O.value.length; ne >= V; )
|
|
3092
3092
|
O = O.next, V += O.value.length;
|
|
3093
|
-
if (V -= O.value.length,
|
|
3093
|
+
if (V -= O.value.length, K = V, O.value instanceof p)
|
|
3094
3094
|
continue;
|
|
3095
|
-
for (var
|
|
3096
|
-
$++, V +=
|
|
3097
|
-
$--, h = i.slice(
|
|
3098
|
-
} else if (
|
|
3095
|
+
for (var Y = O; Y !== u.tail && (V < q || typeof Y.value == "string"); Y = Y.next)
|
|
3096
|
+
$++, V += Y.value.length;
|
|
3097
|
+
$--, h = i.slice(K, V), R.index -= K;
|
|
3098
|
+
} else if (R = k(B, 0, h, Z), !R)
|
|
3099
3099
|
continue;
|
|
3100
|
-
var ne =
|
|
3101
|
-
|
|
3100
|
+
var ne = R.index, se = R[0], D = h.slice(0, ne), re = h.slice(ne + se.length), oe = K + h.length;
|
|
3101
|
+
j && oe > j.reach && (j.reach = oe);
|
|
3102
3102
|
var ie = O.prev;
|
|
3103
|
-
D && (ie = f(u, ie, D),
|
|
3104
|
-
var st = new p(
|
|
3103
|
+
D && (ie = f(u, ie, D), K += D.length), C(u, ie, $);
|
|
3104
|
+
var st = new p(d, M ? l.tokenize(se, M) : se, X, se);
|
|
3105
3105
|
if (O = f(u, ie, st), re && f(u, O, re), $ > 1) {
|
|
3106
3106
|
var je = {
|
|
3107
|
-
cause:
|
|
3107
|
+
cause: d + "," + F,
|
|
3108
3108
|
reach: oe
|
|
3109
3109
|
};
|
|
3110
|
-
g(i, u, m, O.prev,
|
|
3110
|
+
g(i, u, m, O.prev, K, je), j && je.reach > j.reach && (j.reach = je.reach);
|
|
3111
3111
|
}
|
|
3112
3112
|
}
|
|
3113
3113
|
}
|
|
@@ -3122,12 +3122,12 @@ function ar() {
|
|
|
3122
3122
|
var x = u.next, v = { value: m, prev: u, next: x };
|
|
3123
3123
|
return u.next = v, x.prev = v, i.length++, v;
|
|
3124
3124
|
}
|
|
3125
|
-
function
|
|
3125
|
+
function C(i, u, m) {
|
|
3126
3126
|
for (var x = u.next, v = 0; v < m && x !== i.tail; v++)
|
|
3127
3127
|
x = x.next;
|
|
3128
3128
|
u.next = x, x.prev = u, i.length -= v;
|
|
3129
3129
|
}
|
|
3130
|
-
function
|
|
3130
|
+
function _(i) {
|
|
3131
3131
|
for (var u = [], m = i.head.next; m !== i.tail; )
|
|
3132
3132
|
u.push(m.value), m = m.next;
|
|
3133
3133
|
return u;
|
|
@@ -3137,14 +3137,14 @@ function ar() {
|
|
|
3137
3137
|
var u = JSON.parse(i.data), m = u.language, x = u.code, v = u.immediateClose;
|
|
3138
3138
|
n.postMessage(l.highlight(x, l.languages[m], m)), v && n.close();
|
|
3139
3139
|
}, !1)), l;
|
|
3140
|
-
var
|
|
3141
|
-
|
|
3142
|
-
function
|
|
3140
|
+
var E = l.util.currentScript();
|
|
3141
|
+
E && (l.filename = E.src, E.hasAttribute("data-manual") && (l.manual = !0));
|
|
3142
|
+
function N() {
|
|
3143
3143
|
l.manual || l.highlightAll();
|
|
3144
3144
|
}
|
|
3145
3145
|
if (!l.manual) {
|
|
3146
|
-
var
|
|
3147
|
-
|
|
3146
|
+
var T = document.readyState;
|
|
3147
|
+
T === "loading" || T === "interactive" && E && E.defer ? document.addEventListener("DOMContentLoaded", N) : window.requestAnimationFrame ? window.requestAnimationFrame(N) : window.setTimeout(N, 16);
|
|
3148
3148
|
}
|
|
3149
3149
|
return l;
|
|
3150
3150
|
}(e);
|
|
@@ -3526,8 +3526,8 @@ function ar() {
|
|
|
3526
3526
|
if (typeof r > "u" || typeof document > "u")
|
|
3527
3527
|
return;
|
|
3528
3528
|
Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
|
|
3529
|
-
var n = "Loading…", s = function(
|
|
3530
|
-
return "✖ Error " +
|
|
3529
|
+
var n = "Loading…", s = function(E, N) {
|
|
3530
|
+
return "✖ Error " + E + " while fetching file: " + N;
|
|
3531
3531
|
}, o = "✖ Error: File does not exist or is empty", c = {
|
|
3532
3532
|
js: "javascript",
|
|
3533
3533
|
py: "python",
|
|
@@ -3538,52 +3538,52 @@ function ar() {
|
|
|
3538
3538
|
bat: "batch",
|
|
3539
3539
|
h: "c",
|
|
3540
3540
|
tex: "latex"
|
|
3541
|
-
}, l = "data-src-status", p = "loading",
|
|
3542
|
-
function f(
|
|
3541
|
+
}, l = "data-src-status", p = "loading", k = "loaded", g = "failed", y = "pre[data-src]:not([" + l + '="' + k + '"]):not([' + l + '="' + p + '"])';
|
|
3542
|
+
function f(E, N, T) {
|
|
3543
3543
|
var i = new XMLHttpRequest();
|
|
3544
|
-
i.open("GET",
|
|
3545
|
-
i.readyState == 4 && (i.status < 400 && i.responseText ?
|
|
3544
|
+
i.open("GET", E, !0), i.onreadystatechange = function() {
|
|
3545
|
+
i.readyState == 4 && (i.status < 400 && i.responseText ? N(i.responseText) : i.status >= 400 ? T(s(i.status, i.statusText)) : T(o));
|
|
3546
3546
|
}, i.send(null);
|
|
3547
3547
|
}
|
|
3548
|
-
function
|
|
3549
|
-
var
|
|
3550
|
-
if (
|
|
3551
|
-
var
|
|
3552
|
-
return i ? u ? [
|
|
3548
|
+
function C(E) {
|
|
3549
|
+
var N = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(E || "");
|
|
3550
|
+
if (N) {
|
|
3551
|
+
var T = Number(N[1]), i = N[2], u = N[3];
|
|
3552
|
+
return i ? u ? [T, Number(u)] : [T, void 0] : [T, T];
|
|
3553
3553
|
}
|
|
3554
3554
|
}
|
|
3555
|
-
r.hooks.add("before-highlightall", function(
|
|
3556
|
-
|
|
3557
|
-
}), r.hooks.add("before-sanity-check", function(
|
|
3558
|
-
var
|
|
3555
|
+
r.hooks.add("before-highlightall", function(E) {
|
|
3556
|
+
E.selector += ", " + y;
|
|
3557
|
+
}), r.hooks.add("before-sanity-check", function(E) {
|
|
3558
|
+
var N = (
|
|
3559
3559
|
/** @type {HTMLPreElement} */
|
|
3560
|
-
|
|
3560
|
+
E.element
|
|
3561
3561
|
);
|
|
3562
|
-
if (
|
|
3563
|
-
|
|
3564
|
-
var
|
|
3565
|
-
|
|
3566
|
-
var i =
|
|
3562
|
+
if (N.matches(y)) {
|
|
3563
|
+
E.code = "", N.setAttribute(l, p);
|
|
3564
|
+
var T = N.appendChild(document.createElement("CODE"));
|
|
3565
|
+
T.textContent = n;
|
|
3566
|
+
var i = N.getAttribute("data-src"), u = E.language;
|
|
3567
3567
|
if (u === "none") {
|
|
3568
3568
|
var m = (/\.(\w+)$/.exec(i) || [, "none"])[1];
|
|
3569
3569
|
u = c[m] || m;
|
|
3570
3570
|
}
|
|
3571
|
-
r.util.setLanguage(
|
|
3571
|
+
r.util.setLanguage(T, u), r.util.setLanguage(N, u);
|
|
3572
3572
|
var x = r.plugins.autoloader;
|
|
3573
3573
|
x && x.loadLanguages(u), f(
|
|
3574
3574
|
i,
|
|
3575
3575
|
function(v) {
|
|
3576
|
-
|
|
3577
|
-
var
|
|
3578
|
-
if (
|
|
3579
|
-
var
|
|
3580
|
-
b < 0 && (b +=
|
|
3581
|
-
`),
|
|
3576
|
+
N.setAttribute(l, k);
|
|
3577
|
+
var j = C(N.getAttribute("data-range"));
|
|
3578
|
+
if (j) {
|
|
3579
|
+
var d = v.split(/\r\n?|\n/g), b = j[0], F = j[1] == null ? d.length : j[1];
|
|
3580
|
+
b < 0 && (b += d.length), b = Math.max(0, Math.min(b - 1, d.length)), F < 0 && (F += d.length), F = Math.max(0, Math.min(F, d.length)), v = d.slice(b, F).join(`
|
|
3581
|
+
`), N.hasAttribute("data-start") || N.setAttribute("data-start", String(b + 1));
|
|
3582
3582
|
}
|
|
3583
|
-
|
|
3583
|
+
T.textContent = v, r.highlightElement(T);
|
|
3584
3584
|
},
|
|
3585
3585
|
function(v) {
|
|
3586
|
-
|
|
3586
|
+
N.setAttribute(l, g), T.textContent = v;
|
|
3587
3587
|
}
|
|
3588
3588
|
);
|
|
3589
3589
|
}
|
|
@@ -3595,14 +3595,14 @@ function ar() {
|
|
|
3595
3595
|
*
|
|
3596
3596
|
* @param {ParentNode} [container=document]
|
|
3597
3597
|
*/
|
|
3598
|
-
highlight: function(
|
|
3599
|
-
for (var
|
|
3598
|
+
highlight: function(N) {
|
|
3599
|
+
for (var T = (N || document).querySelectorAll(y), i = 0, u; u = T[i++]; )
|
|
3600
3600
|
r.highlightElement(u);
|
|
3601
3601
|
}
|
|
3602
3602
|
};
|
|
3603
|
-
var
|
|
3603
|
+
var _ = !1;
|
|
3604
3604
|
r.fileHighlight = function() {
|
|
3605
|
-
|
|
3605
|
+
_ || (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), _ = !0), r.plugins.fileHighlight.highlight.apply(this, arguments);
|
|
3606
3606
|
};
|
|
3607
3607
|
}();
|
|
3608
3608
|
}(Ne)), Ne.exports;
|
|
@@ -4054,38 +4054,38 @@ or();
|
|
|
4054
4054
|
return;
|
|
4055
4055
|
function y(f) {
|
|
4056
4056
|
if (!(!f || typeof f == "string"))
|
|
4057
|
-
for (var
|
|
4058
|
-
var
|
|
4059
|
-
if (
|
|
4060
|
-
y(
|
|
4057
|
+
for (var C = 0, _ = f.length; C < _; C++) {
|
|
4058
|
+
var E = f[C];
|
|
4059
|
+
if (E.type !== "code") {
|
|
4060
|
+
y(E.content);
|
|
4061
4061
|
continue;
|
|
4062
4062
|
}
|
|
4063
|
-
var
|
|
4064
|
-
if (
|
|
4065
|
-
var i =
|
|
4063
|
+
var N = E.content[1], T = E.content[3];
|
|
4064
|
+
if (N && T && N.type === "code-language" && T.type === "code-block" && typeof N.content == "string") {
|
|
4065
|
+
var i = N.content.replace(/\b#/g, "sharp").replace(/\b\+\+/g, "pp");
|
|
4066
4066
|
i = (/[a-z][\w-]*/i.exec(i) || [""])[0].toLowerCase();
|
|
4067
4067
|
var u = "language-" + i;
|
|
4068
|
-
|
|
4068
|
+
T.alias ? typeof T.alias == "string" ? T.alias = [T.alias, u] : T.alias.push(u) : T.alias = [u];
|
|
4069
4069
|
}
|
|
4070
4070
|
}
|
|
4071
4071
|
}
|
|
4072
4072
|
y(g.tokens);
|
|
4073
4073
|
}), t.hooks.add("wrap", function(g) {
|
|
4074
4074
|
if (g.type === "code-block") {
|
|
4075
|
-
for (var y = "", f = 0,
|
|
4076
|
-
var
|
|
4077
|
-
if (
|
|
4078
|
-
y =
|
|
4075
|
+
for (var y = "", f = 0, C = g.classes.length; f < C; f++) {
|
|
4076
|
+
var _ = g.classes[f], E = /language-(.+)/.exec(_);
|
|
4077
|
+
if (E) {
|
|
4078
|
+
y = E[1];
|
|
4079
4079
|
break;
|
|
4080
4080
|
}
|
|
4081
4081
|
}
|
|
4082
|
-
var
|
|
4083
|
-
if (
|
|
4084
|
-
g.content = t.highlight(
|
|
4082
|
+
var N = t.languages[y];
|
|
4083
|
+
if (N)
|
|
4084
|
+
g.content = t.highlight(k(g.content), N, y);
|
|
4085
4085
|
else if (y && y !== "none" && t.plugins.autoloader) {
|
|
4086
|
-
var
|
|
4087
|
-
g.attributes.id =
|
|
4088
|
-
var i = document.getElementById(
|
|
4086
|
+
var T = "md-" + (/* @__PURE__ */ new Date()).valueOf() + "-" + Math.floor(Math.random() * 1e16);
|
|
4087
|
+
g.attributes.id = T, t.plugins.autoloader.loadLanguages(y, function() {
|
|
4088
|
+
var i = document.getElementById(T);
|
|
4089
4089
|
i && (i.innerHTML = t.highlight(i.textContent, t.languages[y], y));
|
|
4090
4090
|
});
|
|
4091
4091
|
}
|
|
@@ -4097,15 +4097,15 @@ or();
|
|
|
4097
4097
|
gt: ">",
|
|
4098
4098
|
quot: '"'
|
|
4099
4099
|
}, p = String.fromCodePoint || String.fromCharCode;
|
|
4100
|
-
function
|
|
4100
|
+
function k(g) {
|
|
4101
4101
|
var y = g.replace(c, "");
|
|
4102
|
-
return y = y.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi, function(f,
|
|
4103
|
-
if (
|
|
4104
|
-
var
|
|
4105
|
-
return
|
|
4102
|
+
return y = y.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi, function(f, C) {
|
|
4103
|
+
if (C = C.toLowerCase(), C[0] === "#") {
|
|
4104
|
+
var _;
|
|
4105
|
+
return C[1] === "x" ? _ = parseInt(C.slice(2), 16) : _ = Number(C.slice(1)), p(_);
|
|
4106
4106
|
} else {
|
|
4107
|
-
var
|
|
4108
|
-
return
|
|
4107
|
+
var E = l[C];
|
|
4108
|
+
return E || f;
|
|
4109
4109
|
}
|
|
4110
4110
|
}), y;
|
|
4111
4111
|
}
|
|
@@ -4176,11 +4176,11 @@ const hr = ({
|
|
|
4176
4176
|
imageColor: c = "#000",
|
|
4177
4177
|
borderDarkColor: l = "#1A1A1A",
|
|
4178
4178
|
backgroundDarkColor: p = "#444444",
|
|
4179
|
-
imageDarkColor:
|
|
4179
|
+
imageDarkColor: k = "#ffffff",
|
|
4180
4180
|
toggleColor: g = "#2584aa",
|
|
4181
4181
|
raccourcis: y = null
|
|
4182
4182
|
}) => {
|
|
4183
|
-
const [f] =
|
|
4183
|
+
const [f] = P(() => pt(ut(ot(Ye())))), [C, _] = P({
|
|
4184
4184
|
bold: !1,
|
|
4185
4185
|
underline: !1,
|
|
4186
4186
|
italic: !1,
|
|
@@ -4200,30 +4200,30 @@ const hr = ({
|
|
|
4200
4200
|
right: !1,
|
|
4201
4201
|
indent: !1,
|
|
4202
4202
|
outdent: !1
|
|
4203
|
-
}),
|
|
4203
|
+
}), E = lt(
|
|
4204
4204
|
() => t || [
|
|
4205
4205
|
{
|
|
4206
4206
|
type: "paragraph",
|
|
4207
|
-
children: [{ text: "
|
|
4207
|
+
children: [{ text: "" }]
|
|
4208
4208
|
}
|
|
4209
4209
|
],
|
|
4210
4210
|
[]
|
|
4211
|
-
),
|
|
4212
|
-
const
|
|
4213
|
-
if (!
|
|
4214
|
-
const
|
|
4215
|
-
if (
|
|
4216
|
-
const
|
|
4217
|
-
let
|
|
4218
|
-
for (const
|
|
4219
|
-
const
|
|
4220
|
-
typeof
|
|
4221
|
-
anchor: { path:
|
|
4222
|
-
focus: { path:
|
|
4223
|
-
className: `token ${
|
|
4224
|
-
}),
|
|
4211
|
+
), N = he([]), T = ([d, b]) => {
|
|
4212
|
+
const F = [];
|
|
4213
|
+
if (!J.isElement(d)) return F;
|
|
4214
|
+
const S = ae.string(d), M = b[0], Z = N.current[M];
|
|
4215
|
+
if (Z && Z.text == S) return Z.ranges;
|
|
4216
|
+
const G = Ue.tokenize(S, Ue.languages.javascript);
|
|
4217
|
+
let X = 0;
|
|
4218
|
+
for (const I of G) {
|
|
4219
|
+
const B = I.length, O = X + B;
|
|
4220
|
+
typeof I != "string" && F.push({
|
|
4221
|
+
anchor: { path: b, offset: X },
|
|
4222
|
+
focus: { path: b, offset: O },
|
|
4223
|
+
className: `token ${I.type}`
|
|
4224
|
+
}), X = O;
|
|
4225
4225
|
}
|
|
4226
|
-
return
|
|
4226
|
+
return N.current[M] = { text: S, ranges: F }, F;
|
|
4227
4227
|
}, i = Fe((d) => {
|
|
4228
4228
|
switch (d.element.type) {
|
|
4229
4229
|
case "code":
|
|
@@ -4250,98 +4250,107 @@ const hr = ({
|
|
|
4250
4250
|
return /* @__PURE__ */ a.jsx(zt, { ...d });
|
|
4251
4251
|
}
|
|
4252
4252
|
}, []), u = Fe((d) => /* @__PURE__ */ a.jsx(Pt, { ...d }), []), m = Fe(() => {
|
|
4253
|
-
const d =
|
|
4254
|
-
|
|
4255
|
-
const
|
|
4256
|
-
for (const
|
|
4257
|
-
if (
|
|
4258
|
-
const
|
|
4259
|
-
|
|
4260
|
-
} else if (
|
|
4261
|
-
|
|
4262
|
-
else if (
|
|
4263
|
-
|
|
4264
|
-
else if (
|
|
4265
|
-
const
|
|
4266
|
-
let
|
|
4267
|
-
if (
|
|
4268
|
-
const
|
|
4269
|
-
match: (
|
|
4253
|
+
const d = L.marks(f), b = w.isSelectionInList(f);
|
|
4254
|
+
_((F) => {
|
|
4255
|
+
const S = {};
|
|
4256
|
+
for (const M in F)
|
|
4257
|
+
if (M === "bulletList" || M === "numberedList") {
|
|
4258
|
+
const Z = M === "bulletList" ? "bullet-list" : M === "numberedList" ? "numbered-list" : "";
|
|
4259
|
+
S[M] = b && w.isBlockActive(f, Z);
|
|
4260
|
+
} else if (M === "left" || M === "center" || M === "right")
|
|
4261
|
+
S[M] = w.isAlignActive(f, M);
|
|
4262
|
+
else if (M === "indent" || M === "outdent")
|
|
4263
|
+
S[M] = w.canIndent(f, M);
|
|
4264
|
+
else if (M === "href") {
|
|
4265
|
+
const Z = w.isLinkActive(f);
|
|
4266
|
+
let G = "";
|
|
4267
|
+
if (Z) {
|
|
4268
|
+
const X = L.nodes(f, {
|
|
4269
|
+
match: (I) => I.type === "link",
|
|
4270
4270
|
mode: "highest"
|
|
4271
4271
|
// Utilisez 'highest' pour obtenir le nœud le plus spécifique
|
|
4272
4272
|
});
|
|
4273
|
-
for (const [
|
|
4274
|
-
if (
|
|
4275
|
-
|
|
4273
|
+
for (const [I] of X)
|
|
4274
|
+
if (I && I.href) {
|
|
4275
|
+
G = I.href;
|
|
4276
4276
|
break;
|
|
4277
4277
|
}
|
|
4278
|
-
|
|
4278
|
+
G || console.error("No link node with URL property found");
|
|
4279
4279
|
}
|
|
4280
|
-
|
|
4281
|
-
} else
|
|
4282
|
-
return
|
|
4280
|
+
S[M] = G;
|
|
4281
|
+
} else M === "color" ? S[M] = (d == null ? void 0 : d.color) || null : M === "fontSize" ? S[M] = (d == null ? void 0 : d.fontSize) || null : S[M] = (d == null ? void 0 : d[M]) === !0;
|
|
4282
|
+
return S;
|
|
4283
4283
|
});
|
|
4284
4284
|
}, [f]), x = async (d) => {
|
|
4285
4285
|
if (w.isSelectionInCode(f)) {
|
|
4286
|
-
const
|
|
4287
|
-
|
|
4288
|
-
`) ||
|
|
4286
|
+
const F = d.clipboardData.getData("text/plain");
|
|
4287
|
+
F && (F.includes(`
|
|
4288
|
+
`) || F.match(/^\s{2,}/gm)) && (d.preventDefault(), w.insertCodeBlock(f, F));
|
|
4289
4289
|
return;
|
|
4290
4290
|
}
|
|
4291
|
-
const
|
|
4292
|
-
if (
|
|
4291
|
+
const b = d.clipboardData.getData("text/html");
|
|
4292
|
+
if (b) {
|
|
4293
4293
|
d.preventDefault();
|
|
4294
|
-
const
|
|
4295
|
-
f.insertFragment(
|
|
4294
|
+
const F = new DOMParser().parseFromString(b, "text/html"), S = Qt(F.body);
|
|
4295
|
+
f.insertFragment(S);
|
|
4296
4296
|
}
|
|
4297
|
-
}, v = (
|
|
4297
|
+
}, v = () => {
|
|
4298
|
+
A.delete(f, {
|
|
4299
|
+
at: {
|
|
4300
|
+
anchor: L.start(f, []),
|
|
4301
|
+
focus: L.end(f, [])
|
|
4302
|
+
}
|
|
4303
|
+
});
|
|
4304
|
+
}, j = (d) => {
|
|
4298
4305
|
d.shiftKey && w.canIndent(f, "outdent") ? (d.preventDefault(), w.handleOutdent(f)) : w.canIndent(f, "indent") && (d.preventDefault(), w.handleIndent(f));
|
|
4299
4306
|
};
|
|
4300
4307
|
return ee(() => {
|
|
4301
4308
|
if (y !== null) {
|
|
4302
|
-
const d = (
|
|
4303
|
-
Object.keys(y).forEach((
|
|
4304
|
-
const
|
|
4305
|
-
ctrl:
|
|
4306
|
-
shift:
|
|
4307
|
-
alt:
|
|
4308
|
-
meta:
|
|
4309
|
-
},
|
|
4310
|
-
|
|
4309
|
+
const d = (b) => {
|
|
4310
|
+
Object.keys(y).forEach((F) => {
|
|
4311
|
+
const S = F.split("+"), M = S.pop().toLowerCase(), Z = S.map((B) => B.toLowerCase()), G = {
|
|
4312
|
+
ctrl: b.ctrlKey,
|
|
4313
|
+
shift: b.shiftKey,
|
|
4314
|
+
alt: b.altKey,
|
|
4315
|
+
meta: b.metaKey
|
|
4316
|
+
}, X = Z.every((B) => G[B]), I = b.key.toLowerCase() === M;
|
|
4317
|
+
X && I && y[F](b);
|
|
4311
4318
|
});
|
|
4312
4319
|
};
|
|
4313
4320
|
return document.addEventListener("keydown", d), () => {
|
|
4314
4321
|
document.removeEventListener("keydown", d);
|
|
4315
4322
|
};
|
|
4316
4323
|
}
|
|
4317
|
-
}, [y]),
|
|
4324
|
+
}, [y]), ee(() => {
|
|
4325
|
+
t == null && v();
|
|
4326
|
+
}, [t]), /* @__PURE__ */ a.jsx(Dt, { showTheme: n, borderDarkColor: l, backgroundDarkColor: p, imageDarkColor: k, children: /* @__PURE__ */ a.jsx(rr, { children: /* @__PURE__ */ a.jsx(nr, { children: /* @__PURE__ */ a.jsx(It, { backgroundColor: o, borderColor: s, editor: f, imageColor: c, children: /* @__PURE__ */ a.jsxs(
|
|
4318
4327
|
it,
|
|
4319
4328
|
{
|
|
4320
4329
|
editor: f,
|
|
4321
|
-
initialValue:
|
|
4322
|
-
value:
|
|
4330
|
+
initialValue: E,
|
|
4331
|
+
value: t,
|
|
4323
4332
|
onChange: (d) => {
|
|
4324
4333
|
if (m(), f.operations.some(
|
|
4325
|
-
(
|
|
4334
|
+
(F) => F.type !== "set_selection"
|
|
4326
4335
|
)) {
|
|
4327
|
-
const
|
|
4328
|
-
e(d), localStorage.setItem("content",
|
|
4336
|
+
const F = JSON.stringify(d);
|
|
4337
|
+
e(d), localStorage.setItem("content", F);
|
|
4329
4338
|
}
|
|
4330
4339
|
},
|
|
4331
4340
|
children: [
|
|
4332
|
-
/* @__PURE__ */ a.jsx(Jt, { activeMarks:
|
|
4341
|
+
/* @__PURE__ */ a.jsx(Jt, { activeMarks: C }),
|
|
4333
4342
|
/* @__PURE__ */ a.jsx(
|
|
4334
4343
|
ct,
|
|
4335
4344
|
{
|
|
4336
4345
|
className: "rtf rtf__editor",
|
|
4337
|
-
decorate:
|
|
4346
|
+
decorate: T,
|
|
4338
4347
|
renderElement: i,
|
|
4339
4348
|
renderLeaf: u,
|
|
4340
4349
|
style: { borderColor: s, paddingBottom: n || r ? 35 : 10 },
|
|
4341
4350
|
onPaste: x,
|
|
4342
4351
|
onKeyDown: (d) => {
|
|
4343
4352
|
if (d.key === "Tab") {
|
|
4344
|
-
|
|
4353
|
+
j(d);
|
|
4345
4354
|
return;
|
|
4346
4355
|
}
|
|
4347
4356
|
if (d.key === "Enter" && !d.ctrlKey && (w.isSelectionInTable(f) || w.isSelectionInCode(f) || w.isBlockquoteActive(f)) && (d.preventDefault(), f.insertText(`
|
|
@@ -4397,12 +4406,12 @@ const hr = ({
|
|
|
4397
4406
|
}
|
|
4398
4407
|
case "Enter": {
|
|
4399
4408
|
d.preventDefault();
|
|
4400
|
-
const { selection:
|
|
4401
|
-
if (
|
|
4402
|
-
const [
|
|
4403
|
-
match: (
|
|
4409
|
+
const { selection: b } = f;
|
|
4410
|
+
if (b) {
|
|
4411
|
+
const [F] = L.nodes(f, {
|
|
4412
|
+
match: (S) => J.isElement(S) && S.type !== "paragraph"
|
|
4404
4413
|
});
|
|
4405
|
-
|
|
4414
|
+
F && A.insertNodes(f, A.insertNodes(f, {
|
|
4406
4415
|
type: "paragraph",
|
|
4407
4416
|
children: [{ text: "" }]
|
|
4408
4417
|
}));
|