@arkitektbedriftene/fe-lib 4.3.2 → 4.3.3
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const LinkToolbarButton: ({ getDocs, filePrefix, }: {
|
|
2
|
-
getDocs?: (() => {
|
|
2
|
+
getDocs?: (() => Promise<{
|
|
3
3
|
label: string;
|
|
4
4
|
value: string;
|
|
5
|
-
}[]) | undefined;
|
|
5
|
+
}[]>) | undefined;
|
|
6
6
|
filePrefix?: string | undefined;
|
|
7
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/dist/rich-text.es.js
CHANGED
|
@@ -3,18 +3,18 @@ var Me = (t, r, e) => r in t ? Ce(t, r, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var $ = (t, r, e) => (Me(t, typeof r != "symbol" ? r + "" : r, e), e);
|
|
4
4
|
import { createHeadlessEditor as Bt } from "@lexical/headless";
|
|
5
5
|
import { $generateHtmlFromNodes as Pt } from "@lexical/html";
|
|
6
|
-
import { $getRoot as
|
|
7
|
-
import { trimTextContentFromAnchor as Oe, $setBlocksType as
|
|
6
|
+
import { $getRoot as X, ParagraphNode as Te, $createParagraphNode as G, $createTextNode as z, $setSelection as nt, $getNodeByKey as dt, DecoratorNode as xe, $applyNodeReplacement as Le, SELECTION_CHANGE_COMMAND as V, $getSelection as y, COMMAND_PRIORITY_EDITOR as q, $isRangeSelection as R, $isRootOrShadowRoot as Ft, FORMAT_TEXT_COMMAND as A, COMMAND_PRIORITY_LOW as D, KEY_ARROW_DOWN_COMMAND as _e, KEY_ARROW_UP_COMMAND as we, KEY_ESCAPE_COMMAND as Ht, KEY_SPACE_COMMAND as ye, $getNearestNodeFromDOMNode as mt, KEY_ARROW_LEFT_COMMAND as Se, $isElementNode as Ne, createCommand as Ee, $insertNodes as Re, $createRangeSelection as Ut, COMMAND_PRIORITY_HIGH as Ie, FORMAT_ELEMENT_COMMAND as ht } from "lexical";
|
|
7
|
+
import { trimTextContentFromAnchor as Oe, $setBlocksType as ut, $getSelectionStyleValueForProperty as ze, $patchStyleText as $e, $isAtNodeEnd as yt } from "@lexical/selection";
|
|
8
8
|
import { $dfs as Ae, $getNearestNodeOfType as De, $findMatchingParent as Wt, mergeRegister as ot, isHTMLElement as St, $wrapNodeInElement as Be, mediaFileReader as Pe, isMimeType as Fe } from "@lexical/utils";
|
|
9
9
|
import { LinkNode as j, AutoLinkNode as jt, $isLinkNode as Z, TOGGLE_LINK_COMMAND as it } from "@lexical/link";
|
|
10
|
-
import { ListNode as
|
|
10
|
+
import { ListNode as ft, ListItemNode as Kt, $isListNode as kt, INSERT_UNORDERED_LIST_COMMAND as He, INSERT_ORDERED_LIST_COMMAND as Ue, INSERT_CHECK_LIST_COMMAND as Gt, insertList as We, $isListItemNode as K } from "@lexical/list";
|
|
11
11
|
import { HeadingNode as qt, QuoteNode as Jt, $isHeadingNode as je, $createHeadingNode as Ke, $createQuoteNode as Ge, DRAG_DROP_PASTE as qe } from "@lexical/rich-text";
|
|
12
12
|
import { TableNode as Yt, TableRowNode as Xt, TableCellNode as Vt, INSERT_TABLE_COMMAND as Je, $getTableCellNodeFromLexicalNode as Ye, $deleteTableColumn__EXPERIMENTAL as Xe, $deleteTableRow__EXPERIMENTAL as Ve, $insertTableColumn__EXPERIMENTAL as Nt, $insertTableRow__EXPERIMENTAL as Et } from "@lexical/table";
|
|
13
13
|
import { jsx as n, jsxs as h, Fragment as F } from "react/jsx-runtime";
|
|
14
|
-
import { createContext as Qe, useState as
|
|
15
|
-
import { Box as P, Stack as er, Button as
|
|
14
|
+
import { createContext as Qe, useState as p, useRef as J, useCallback as M, useContext as Ze, useEffect as L, useMemo as Qt, useLayoutEffect as tr } from "react";
|
|
15
|
+
import { Box as P, Stack as er, Button as S, DropdownMenu as at, ToolbarButton as lt, DropdownMenuIconItem as T, ToolbarToggleGroup as tt, ToolbarToggleItem as O, Popover as Zt, PopoverTrigger as te, PopoverContent as ee, OverlayCard as re, Toolbar as rr, ToolbarSeparator as Rt, styled as nr, Spinner as st, Dialog as ne, DialogHeader as or, TextInput as bt, DialogActions as ct, DropdownMenuItem as W, DropdownMenuSeparator as It, NavBar as ir, NavBarItem as gt, Combobox as ar } from "./ui.es.js";
|
|
16
16
|
import { f as lr, g as sr, h as cr, G as f, i as dr, j as hr, k as ur, l as gr } from "./index.esm-fa9e6ea7.js";
|
|
17
|
-
import { useLexicalComposerContext as
|
|
17
|
+
import { useLexicalComposerContext as _ } from "@lexical/react/LexicalComposerContext.js";
|
|
18
18
|
import { LexicalComposer as pr } from "@lexical/react/LexicalComposer.js";
|
|
19
19
|
import { RichTextPlugin as mr } from "@lexical/react/LexicalRichTextPlugin.js";
|
|
20
20
|
import { LexicalErrorBoundary as fr } from "@lexical/react/LexicalErrorBoundary.js";
|
|
@@ -46,7 +46,7 @@ const Sr = ({
|
|
|
46
46
|
maxChars: r,
|
|
47
47
|
maxLines: e
|
|
48
48
|
}) => {
|
|
49
|
-
const o =
|
|
49
|
+
const o = X(), i = o.getTextContent(), a = Sr({ text: i, maxChars: r, maxLines: e }), l = i.length - a, d = o.select().anchor;
|
|
50
50
|
Oe(t, d, l);
|
|
51
51
|
const c = o.getLastChild();
|
|
52
52
|
return c instanceof Te && c.getChildrenSize() === 0 && c.remove(), l;
|
|
@@ -66,7 +66,7 @@ const Sr = ({
|
|
|
66
66
|
}, Tt = (t) => t[0] === "{", Nr = (t) => t !== null && typeof t == "object" && "isEmpty" in t, Er = (t, r) => {
|
|
67
67
|
t.update(
|
|
68
68
|
() => {
|
|
69
|
-
const e =
|
|
69
|
+
const e = X();
|
|
70
70
|
e.clear();
|
|
71
71
|
const o = G();
|
|
72
72
|
o.append(z("")), e.append(o), nt(null);
|
|
@@ -78,7 +78,7 @@ const Sr = ({
|
|
|
78
78
|
}, Rr = (t, r, e) => {
|
|
79
79
|
r.update(
|
|
80
80
|
() => {
|
|
81
|
-
const o =
|
|
81
|
+
const o = X();
|
|
82
82
|
o.clear();
|
|
83
83
|
const i = G();
|
|
84
84
|
i.append(z(t.trim())), o.append(i), nt(null);
|
|
@@ -99,7 +99,7 @@ const Sr = ({
|
|
|
99
99
|
try {
|
|
100
100
|
if (typeof t == "string" && !Tt(t))
|
|
101
101
|
i.update(() => {
|
|
102
|
-
const s =
|
|
102
|
+
const s = X(), d = G();
|
|
103
103
|
d.append(z(t.trim())), s.append(d);
|
|
104
104
|
});
|
|
105
105
|
else {
|
|
@@ -130,7 +130,7 @@ const Sr = ({
|
|
|
130
130
|
try {
|
|
131
131
|
if (typeof t == "string" && !Tt(t))
|
|
132
132
|
i.update(() => {
|
|
133
|
-
const l =
|
|
133
|
+
const l = X(), s = G();
|
|
134
134
|
s.append(z(t.trim())), l.append(s);
|
|
135
135
|
});
|
|
136
136
|
else {
|
|
@@ -188,7 +188,7 @@ const de = Qe({
|
|
|
188
188
|
signUrl: void 0,
|
|
189
189
|
fileUpload: void 0
|
|
190
190
|
}), Ir = ({ onBlur: t }) => {
|
|
191
|
-
const [r, e] =
|
|
191
|
+
const [r, e] = p(!1), o = J(null), i = M(() => {
|
|
192
192
|
e(!0), o.current && window.clearTimeout(o.current);
|
|
193
193
|
}, []), a = M(() => {
|
|
194
194
|
o.current = window.setTimeout(() => {
|
|
@@ -210,37 +210,37 @@ function Or({
|
|
|
210
210
|
height: o,
|
|
211
211
|
nodeKey: i
|
|
212
212
|
}) {
|
|
213
|
-
const { signUrl: a } = H(), [l, s] =
|
|
214
|
-
|
|
215
|
-
const
|
|
213
|
+
const { signUrl: a } = H(), [l, s] = p(a ? "" : t), [d, c] = p(!1), u = J(!1), [g] = _();
|
|
214
|
+
L(() => {
|
|
215
|
+
const m = async () => {
|
|
216
216
|
s(await (a == null ? void 0 : a(t)) ?? t);
|
|
217
217
|
};
|
|
218
|
-
!l && !u.current && (u.current = !0,
|
|
218
|
+
!l && !u.current && (u.current = !0, m());
|
|
219
219
|
}, []);
|
|
220
|
-
const
|
|
221
|
-
C.relatedTarget instanceof HTMLElement && C.relatedTarget.dataset.controls === "true" || c(
|
|
222
|
-
},
|
|
220
|
+
const v = (m) => (C) => {
|
|
221
|
+
C.relatedTarget instanceof HTMLElement && C.relatedTarget.dataset.controls === "true" || c(m);
|
|
222
|
+
}, x = () => {
|
|
223
223
|
g.update(() => {
|
|
224
|
-
const
|
|
225
|
-
|
|
224
|
+
const m = dt(i);
|
|
225
|
+
m && m.remove();
|
|
226
226
|
});
|
|
227
|
-
},
|
|
227
|
+
}, w = () => {
|
|
228
228
|
g.update(() => {
|
|
229
|
-
var
|
|
230
|
-
const
|
|
231
|
-
if (!
|
|
229
|
+
var N;
|
|
230
|
+
const m = dt(i);
|
|
231
|
+
if (!m)
|
|
232
232
|
return;
|
|
233
|
-
const C =
|
|
234
|
-
C && C.insertBefore(
|
|
233
|
+
const C = m.getPreviousSibling() || ((N = m.getParent()) == null ? void 0 : N.getPreviousSibling());
|
|
234
|
+
C && C.insertBefore(m);
|
|
235
235
|
});
|
|
236
|
-
},
|
|
236
|
+
}, k = () => {
|
|
237
237
|
g.update(() => {
|
|
238
|
-
var
|
|
239
|
-
const
|
|
240
|
-
if (!
|
|
238
|
+
var N;
|
|
239
|
+
const m = dt(i);
|
|
240
|
+
if (!m)
|
|
241
241
|
return;
|
|
242
|
-
const C =
|
|
243
|
-
C && C.insertAfter(
|
|
242
|
+
const C = m.getNextSibling() || ((N = m.getParent()) == null ? void 0 : N.getNextSibling());
|
|
243
|
+
C && C.insertAfter(m);
|
|
244
244
|
});
|
|
245
245
|
};
|
|
246
246
|
return l ? /* @__PURE__ */ h(P, { css: { position: "relative", display: "inline-block" }, children: [
|
|
@@ -257,36 +257,36 @@ function Or({
|
|
|
257
257
|
},
|
|
258
258
|
gap: 1,
|
|
259
259
|
"data-controls": "true",
|
|
260
|
-
onMouseLeave:
|
|
260
|
+
onMouseLeave: v(!1),
|
|
261
261
|
children: [
|
|
262
262
|
/* @__PURE__ */ n(
|
|
263
|
-
|
|
263
|
+
S,
|
|
264
264
|
{
|
|
265
265
|
icon: !0,
|
|
266
266
|
size: "sm",
|
|
267
267
|
css: { width: "20px", height: "20px" },
|
|
268
|
-
onClick:
|
|
268
|
+
onClick: x,
|
|
269
269
|
color: "danger",
|
|
270
270
|
children: /* @__PURE__ */ n(lr, {})
|
|
271
271
|
}
|
|
272
272
|
),
|
|
273
273
|
/* @__PURE__ */ n(
|
|
274
|
-
|
|
274
|
+
S,
|
|
275
275
|
{
|
|
276
276
|
icon: !0,
|
|
277
277
|
size: "sm",
|
|
278
278
|
css: { width: "20px", height: "20px" },
|
|
279
|
-
onClick:
|
|
279
|
+
onClick: w,
|
|
280
280
|
children: /* @__PURE__ */ n(sr, {})
|
|
281
281
|
}
|
|
282
282
|
),
|
|
283
283
|
/* @__PURE__ */ n(
|
|
284
|
-
|
|
284
|
+
S,
|
|
285
285
|
{
|
|
286
286
|
icon: !0,
|
|
287
287
|
size: "sm",
|
|
288
288
|
css: { width: "20px", height: "20px" },
|
|
289
|
-
onClick:
|
|
289
|
+
onClick: k,
|
|
290
290
|
children: /* @__PURE__ */ n(cr, {})
|
|
291
291
|
}
|
|
292
292
|
)
|
|
@@ -303,8 +303,8 @@ function Or({
|
|
|
303
303
|
width: e
|
|
304
304
|
},
|
|
305
305
|
className: "ain-rich-text-image",
|
|
306
|
-
onMouseEnter:
|
|
307
|
-
onMouseLeave:
|
|
306
|
+
onMouseEnter: v(!0),
|
|
307
|
+
onMouseLeave: v(!1),
|
|
308
308
|
"data-controls": "true"
|
|
309
309
|
}
|
|
310
310
|
)
|
|
@@ -425,7 +425,7 @@ function io(t) {
|
|
|
425
425
|
const ao = [
|
|
426
426
|
qt,
|
|
427
427
|
Jt,
|
|
428
|
-
|
|
428
|
+
ft,
|
|
429
429
|
Kt,
|
|
430
430
|
jt,
|
|
431
431
|
j,
|
|
@@ -436,7 +436,7 @@ const ao = [
|
|
|
436
436
|
], lo = [
|
|
437
437
|
qt,
|
|
438
438
|
Jt,
|
|
439
|
-
|
|
439
|
+
ft,
|
|
440
440
|
Kt,
|
|
441
441
|
jt,
|
|
442
442
|
j,
|
|
@@ -552,7 +552,7 @@ const on = Tr("div", {
|
|
|
552
552
|
check: /* @__PURE__ */ n(Jr, { size: "1.25rem" }),
|
|
553
553
|
paragraph: /* @__PURE__ */ n(Gr, { size: "1.25rem" }),
|
|
554
554
|
quote: /* @__PURE__ */ n(Vr, { size: "1.25rem" })
|
|
555
|
-
},
|
|
555
|
+
}, E = ({
|
|
556
556
|
blockType: t
|
|
557
557
|
}) => /* @__PURE__ */ h(F, { children: [
|
|
558
558
|
/* @__PURE__ */ n(P, { css: { display: "flex", flex: "0 0 auto" }, children: an[t] }),
|
|
@@ -569,7 +569,7 @@ const on = Tr("div", {
|
|
|
569
569
|
}
|
|
570
570
|
)
|
|
571
571
|
] }), ln = (t) => {
|
|
572
|
-
if (!
|
|
572
|
+
if (!R(t))
|
|
573
573
|
return null;
|
|
574
574
|
const r = t.anchor.getNode();
|
|
575
575
|
let e = r.getKey() === "root" ? r : Wt(r, (o) => {
|
|
@@ -581,24 +581,24 @@ const on = Tr("div", {
|
|
|
581
581
|
element: e
|
|
582
582
|
};
|
|
583
583
|
}, sn = () => {
|
|
584
|
-
const [t] =
|
|
585
|
-
|
|
586
|
-
|
|
584
|
+
const [t] = _(), [r, e] = p("paragraph");
|
|
585
|
+
L(() => t.registerCommand(
|
|
586
|
+
V,
|
|
587
587
|
() => {
|
|
588
|
-
const c =
|
|
588
|
+
const c = y(), u = ln(c);
|
|
589
589
|
if (!u)
|
|
590
590
|
return !1;
|
|
591
|
-
const { element: g, anchorNode:
|
|
592
|
-
if (t.getElementByKey(
|
|
593
|
-
if (
|
|
594
|
-
const
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
),
|
|
598
|
-
e(
|
|
591
|
+
const { element: g, anchorNode: v } = u, x = g.getKey();
|
|
592
|
+
if (t.getElementByKey(x) !== null)
|
|
593
|
+
if (kt(g)) {
|
|
594
|
+
const k = De(
|
|
595
|
+
v,
|
|
596
|
+
ft
|
|
597
|
+
), m = k ? k.getListType() : g.getListType();
|
|
598
|
+
e(m);
|
|
599
599
|
} else {
|
|
600
|
-
const
|
|
601
|
-
|
|
600
|
+
const k = je(g) ? g.getTag() : g.getType();
|
|
601
|
+
k in he && e(k);
|
|
602
602
|
}
|
|
603
603
|
return !1;
|
|
604
604
|
},
|
|
@@ -606,8 +606,8 @@ const on = Tr("div", {
|
|
|
606
606
|
), [t]);
|
|
607
607
|
const o = (c) => {
|
|
608
608
|
r !== c && t.update(() => {
|
|
609
|
-
const u =
|
|
610
|
-
|
|
609
|
+
const u = y();
|
|
610
|
+
R(u) && (ut(u, () => Ke(c)), e(c));
|
|
611
611
|
});
|
|
612
612
|
};
|
|
613
613
|
return /* @__PURE__ */ n(on, { children: /* @__PURE__ */ h(
|
|
@@ -618,7 +618,7 @@ const on = Tr("div", {
|
|
|
618
618
|
{
|
|
619
619
|
dropdown: !0,
|
|
620
620
|
css: { display: "flex", width: "100%", overflow: "hidden" },
|
|
621
|
-
children: /* @__PURE__ */ n(
|
|
621
|
+
children: /* @__PURE__ */ n(E, { blockType: r })
|
|
622
622
|
}
|
|
623
623
|
),
|
|
624
624
|
side: "bottom",
|
|
@@ -626,52 +626,52 @@ const on = Tr("div", {
|
|
|
626
626
|
children: [
|
|
627
627
|
/* @__PURE__ */ n(T, { onClick: () => {
|
|
628
628
|
r !== "paragraph" && t.update(() => {
|
|
629
|
-
const c =
|
|
630
|
-
|
|
629
|
+
const c = y();
|
|
630
|
+
R(c) && (ut(c, () => G()), e("paragraph"));
|
|
631
631
|
});
|
|
632
|
-
}, children: /* @__PURE__ */ n(
|
|
633
|
-
/* @__PURE__ */ n(T, { onClick: () => o("h1"), children: /* @__PURE__ */ n(
|
|
634
|
-
/* @__PURE__ */ n(T, { onClick: () => o("h2"), children: /* @__PURE__ */ n(
|
|
635
|
-
/* @__PURE__ */ n(T, { onClick: () => o("h3"), children: /* @__PURE__ */ n(
|
|
636
|
-
/* @__PURE__ */ n(T, { onClick: () => o("h4"), children: /* @__PURE__ */ n(
|
|
637
|
-
/* @__PURE__ */ n(T, { onClick: () => o("h5"), children: /* @__PURE__ */ n(
|
|
638
|
-
/* @__PURE__ */ n(T, { onClick: () => o("h6"), children: /* @__PURE__ */ n(
|
|
632
|
+
}, children: /* @__PURE__ */ n(E, { blockType: "paragraph" }) }),
|
|
633
|
+
/* @__PURE__ */ n(T, { onClick: () => o("h1"), children: /* @__PURE__ */ n(E, { blockType: "h1" }) }),
|
|
634
|
+
/* @__PURE__ */ n(T, { onClick: () => o("h2"), children: /* @__PURE__ */ n(E, { blockType: "h2" }) }),
|
|
635
|
+
/* @__PURE__ */ n(T, { onClick: () => o("h3"), children: /* @__PURE__ */ n(E, { blockType: "h3" }) }),
|
|
636
|
+
/* @__PURE__ */ n(T, { onClick: () => o("h4"), children: /* @__PURE__ */ n(E, { blockType: "h4" }) }),
|
|
637
|
+
/* @__PURE__ */ n(T, { onClick: () => o("h5"), children: /* @__PURE__ */ n(E, { blockType: "h5" }) }),
|
|
638
|
+
/* @__PURE__ */ n(T, { onClick: () => o("h6"), children: /* @__PURE__ */ n(E, { blockType: "h6" }) }),
|
|
639
639
|
/* @__PURE__ */ n(T, { onClick: () => {
|
|
640
640
|
r !== "bullet" && (t.dispatchCommand(He, void 0), e("bullet"));
|
|
641
|
-
}, children: /* @__PURE__ */ n(
|
|
641
|
+
}, children: /* @__PURE__ */ n(E, { blockType: "bullet" }) }),
|
|
642
642
|
/* @__PURE__ */ n(T, { onClick: () => {
|
|
643
643
|
r !== "number" && (t.dispatchCommand(Ue, void 0), e("number"));
|
|
644
|
-
}, children: /* @__PURE__ */ n(
|
|
644
|
+
}, children: /* @__PURE__ */ n(E, { blockType: "number" }) }),
|
|
645
645
|
/* @__PURE__ */ n(T, { onClick: () => {
|
|
646
646
|
r !== "check" && (t.dispatchCommand(Gt, void 0), e("check"));
|
|
647
|
-
}, children: /* @__PURE__ */ n(
|
|
647
|
+
}, children: /* @__PURE__ */ n(E, { blockType: "check" }) }),
|
|
648
648
|
/* @__PURE__ */ n(T, { onClick: () => {
|
|
649
649
|
r !== "quote" && t.update(() => {
|
|
650
|
-
const c =
|
|
651
|
-
|
|
650
|
+
const c = y();
|
|
651
|
+
R(c) && (ut(c, () => Ge()), e("quote"));
|
|
652
652
|
});
|
|
653
|
-
}, children: /* @__PURE__ */ n(
|
|
653
|
+
}, children: /* @__PURE__ */ n(E, { blockType: "quote" }) })
|
|
654
654
|
]
|
|
655
655
|
}
|
|
656
656
|
) });
|
|
657
657
|
}, cn = () => {
|
|
658
|
-
const [t] =
|
|
659
|
-
const
|
|
660
|
-
|
|
658
|
+
const [t] = _(), [r, e] = p(!1), [o, i] = p(!1), [a, l] = p(!1), [s, d] = p(!1), [c, u] = p(!1), [g, v] = p(!1), [x, w] = p(!1), [k, m] = p(""), [C, N] = p(!1), I = M(() => {
|
|
659
|
+
const b = y();
|
|
660
|
+
R(b) && (e(b.hasFormat("bold")), i(b.hasFormat("italic")), l(b.hasFormat("underline")), d(b.hasFormat("strikethrough")), u(b.hasFormat("code")), v(b.hasFormat("superscript")), w(b.hasFormat("subscript")), m(ze(b, "color", "")));
|
|
661
661
|
}, []);
|
|
662
|
-
|
|
662
|
+
L(() => ot(
|
|
663
663
|
t.registerCommand(
|
|
664
|
-
|
|
664
|
+
V,
|
|
665
665
|
() => (I(), !1),
|
|
666
666
|
q
|
|
667
667
|
),
|
|
668
|
-
t.registerUpdateListener(({ editorState:
|
|
669
|
-
|
|
668
|
+
t.registerUpdateListener(({ editorState: b }) => {
|
|
669
|
+
b.read(() => {
|
|
670
670
|
I();
|
|
671
671
|
});
|
|
672
672
|
})
|
|
673
673
|
), [t, I]);
|
|
674
|
-
const
|
|
674
|
+
const Y = M(
|
|
675
675
|
() => t.dispatchCommand(A, "bold"),
|
|
676
676
|
[t]
|
|
677
677
|
), Q = M(
|
|
@@ -693,17 +693,17 @@ const on = Tr("div", {
|
|
|
693
693
|
() => t.dispatchCommand(A, "subscript"),
|
|
694
694
|
[t]
|
|
695
695
|
), wt = Qt(() => {
|
|
696
|
-
const
|
|
697
|
-
return r &&
|
|
696
|
+
const b = [];
|
|
697
|
+
return r && b.push("bold"), o && b.push("italic"), a && b.push("underline"), s && b.push("strikethrough"), c && b.push("code"), g && b.push("superscript"), x && b.push("subscript"), k && b.push("color"), b;
|
|
698
698
|
}, [
|
|
699
699
|
r,
|
|
700
700
|
o,
|
|
701
701
|
a,
|
|
702
702
|
c,
|
|
703
703
|
g,
|
|
704
|
-
|
|
704
|
+
x,
|
|
705
705
|
s,
|
|
706
|
-
|
|
706
|
+
k
|
|
707
707
|
]);
|
|
708
708
|
return /* @__PURE__ */ h(F, { children: [
|
|
709
709
|
/* @__PURE__ */ h(
|
|
@@ -713,7 +713,7 @@ const on = Tr("div", {
|
|
|
713
713
|
"aria-label": "Tekstformattering",
|
|
714
714
|
value: wt,
|
|
715
715
|
children: [
|
|
716
|
-
/* @__PURE__ */ n(O, { onClick:
|
|
716
|
+
/* @__PURE__ */ n(O, { onClick: Y, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ n(Dr, { size: "1.25rem" }) }),
|
|
717
717
|
/* @__PURE__ */ n(
|
|
718
718
|
O,
|
|
719
719
|
{
|
|
@@ -735,7 +735,7 @@ const on = Tr("div", {
|
|
|
735
735
|
]
|
|
736
736
|
}
|
|
737
737
|
),
|
|
738
|
-
/* @__PURE__ */ h(Zt, { open: C, onOpenChange:
|
|
738
|
+
/* @__PURE__ */ h(Zt, { open: C, onOpenChange: N, children: [
|
|
739
739
|
/* @__PURE__ */ n(te, { children: /* @__PURE__ */ n(lt, { children: /* @__PURE__ */ n(dr, { size: "1.25rem" }) }) }),
|
|
740
740
|
/* @__PURE__ */ n(ee, { children: /* @__PURE__ */ h(
|
|
741
741
|
tt,
|
|
@@ -773,7 +773,7 @@ const on = Tr("div", {
|
|
|
773
773
|
}
|
|
774
774
|
),
|
|
775
775
|
/* @__PURE__ */ n(O, { onClick: ke, title: "Kode", value: "code", children: /* @__PURE__ */ n(Br, { size: "1.25rem" }) }),
|
|
776
|
-
/* @__PURE__ */ n(hn, { activeColor:
|
|
776
|
+
/* @__PURE__ */ n(hn, { activeColor: k })
|
|
777
777
|
]
|
|
778
778
|
}
|
|
779
779
|
) })
|
|
@@ -786,9 +786,9 @@ const on = Tr("div", {
|
|
|
786
786
|
{ name: "Blå", value: "#2044b8" },
|
|
787
787
|
{ name: "Lilla", value: "#9c31de" }
|
|
788
788
|
], hn = ({ activeColor: t }) => {
|
|
789
|
-
const [r] =
|
|
789
|
+
const [r] = _(), [e, o] = p(!1), i = (a) => {
|
|
790
790
|
r.update(() => {
|
|
791
|
-
const l =
|
|
791
|
+
const l = y();
|
|
792
792
|
l && $e(l, { color: a });
|
|
793
793
|
});
|
|
794
794
|
};
|
|
@@ -833,7 +833,7 @@ const on = Tr("div", {
|
|
|
833
833
|
) })
|
|
834
834
|
] });
|
|
835
835
|
}, un = ({ children: t }) => {
|
|
836
|
-
const { hasFocus: r, editorRef: e } = H(), o = r, [i, a] =
|
|
836
|
+
const { hasFocus: r, editorRef: e } = H(), o = r, [i, a] = p(o);
|
|
837
837
|
tr(() => {
|
|
838
838
|
a(o);
|
|
839
839
|
}, [o]);
|
|
@@ -890,8 +890,8 @@ const on = Tr("div", {
|
|
|
890
890
|
t
|
|
891
891
|
] });
|
|
892
892
|
function pn() {
|
|
893
|
-
const [t] =
|
|
894
|
-
return
|
|
893
|
+
const [t] = _();
|
|
894
|
+
return L(() => ot(
|
|
895
895
|
t.registerCommand(
|
|
896
896
|
Gt,
|
|
897
897
|
() => (We(t, "check"), !0),
|
|
@@ -910,7 +910,7 @@ function pn() {
|
|
|
910
910
|
t.registerCommand(
|
|
911
911
|
Ht,
|
|
912
912
|
(r) => {
|
|
913
|
-
if (
|
|
913
|
+
if (pt() != null) {
|
|
914
914
|
const o = t.getRootElement();
|
|
915
915
|
return o != null && o.focus(), !0;
|
|
916
916
|
}
|
|
@@ -921,9 +921,9 @@ function pn() {
|
|
|
921
921
|
t.registerCommand(
|
|
922
922
|
ye,
|
|
923
923
|
(r) => {
|
|
924
|
-
const e =
|
|
924
|
+
const e = pt();
|
|
925
925
|
return e != null && t.isEditable() ? (t.update(() => {
|
|
926
|
-
const o =
|
|
926
|
+
const o = mt(e);
|
|
927
927
|
K(o) && (r.preventDefault(), o.toggleChecked());
|
|
928
928
|
}), !0) : !1;
|
|
929
929
|
},
|
|
@@ -932,8 +932,8 @@ function pn() {
|
|
|
932
932
|
t.registerCommand(
|
|
933
933
|
Se,
|
|
934
934
|
(r) => t.getEditorState().read(() => {
|
|
935
|
-
const e =
|
|
936
|
-
if (
|
|
935
|
+
const e = y();
|
|
936
|
+
if (R(e) && e.isCollapsed()) {
|
|
937
937
|
const { anchor: o } = e, i = o.type === "element";
|
|
938
938
|
if (i || o.offset === 0) {
|
|
939
939
|
const a = o.getNode(), l = Wt(
|
|
@@ -942,7 +942,7 @@ function pn() {
|
|
|
942
942
|
);
|
|
943
943
|
if (K(l)) {
|
|
944
944
|
const s = l.getParent();
|
|
945
|
-
if (
|
|
945
|
+
if (kt(s) && s.getListType() === "check" && (i || l.getFirstDescendant() === a)) {
|
|
946
946
|
const d = t.getElementByKey(l.__key);
|
|
947
947
|
if (d != null && document.activeElement !== d)
|
|
948
948
|
return d.focus(), r.preventDefault(), !0;
|
|
@@ -977,7 +977,7 @@ function zt(t) {
|
|
|
977
977
|
const r = t.target, e = mn(r);
|
|
978
978
|
e != null && e.isEditable() && e.update(() => {
|
|
979
979
|
if (t.target) {
|
|
980
|
-
const o =
|
|
980
|
+
const o = mt(r);
|
|
981
981
|
K(o) && (r.focus(), o.toggleChecked());
|
|
982
982
|
}
|
|
983
983
|
});
|
|
@@ -997,7 +997,7 @@ function mn(t) {
|
|
|
997
997
|
}
|
|
998
998
|
return null;
|
|
999
999
|
}
|
|
1000
|
-
function
|
|
1000
|
+
function pt() {
|
|
1001
1001
|
const t = document.activeElement;
|
|
1002
1002
|
return t != null && t.tagName === "LI" && t.parentNode != null && // @ts-ignore internal field
|
|
1003
1003
|
t.parentNode.__lexicalListType === "check" ? t : null;
|
|
@@ -1008,16 +1008,16 @@ function fn(t, r) {
|
|
|
1008
1008
|
o = o.getParentOrThrow().getParent(), o != null && (e = r ? o.getPreviousSibling() : o.getNextSibling());
|
|
1009
1009
|
for (; K(e); ) {
|
|
1010
1010
|
const i = r ? e.getLastChild() : e.getFirstChild();
|
|
1011
|
-
if (!
|
|
1011
|
+
if (!kt(i))
|
|
1012
1012
|
return e;
|
|
1013
1013
|
e = r ? i.getLastChild() : i.getFirstChild();
|
|
1014
1014
|
}
|
|
1015
1015
|
return null;
|
|
1016
1016
|
}
|
|
1017
1017
|
function At(t, r, e) {
|
|
1018
|
-
const o =
|
|
1018
|
+
const o = pt();
|
|
1019
1019
|
return o != null && r.update(() => {
|
|
1020
|
-
const i =
|
|
1020
|
+
const i = mt(o);
|
|
1021
1021
|
if (!K(i))
|
|
1022
1022
|
return;
|
|
1023
1023
|
const a = fn(i, e);
|
|
@@ -1033,7 +1033,7 @@ function At(t, r, e) {
|
|
|
1033
1033
|
const Lt = Ee("INSERT_IMAGE_COMMAND");
|
|
1034
1034
|
function kn() {
|
|
1035
1035
|
const [t] = Ct();
|
|
1036
|
-
return
|
|
1036
|
+
return L(() => {
|
|
1037
1037
|
if (!t.hasNodes([U]))
|
|
1038
1038
|
throw new Error("ImagePlugin: ImageNode not registered on editor");
|
|
1039
1039
|
return ot(
|
|
@@ -1058,8 +1058,8 @@ const bn = () => /* @__PURE__ */ h(F, { children: [
|
|
|
1058
1058
|
] }), vn = ({
|
|
1059
1059
|
state: t
|
|
1060
1060
|
}) => {
|
|
1061
|
-
const [r] =
|
|
1062
|
-
return
|
|
1061
|
+
const [r] = _(), e = J(!1);
|
|
1062
|
+
return L(() => {
|
|
1063
1063
|
!t || e.current || (e.current = !0, window.queueMicrotask(() => {
|
|
1064
1064
|
try {
|
|
1065
1065
|
if (Nr(t)) {
|
|
@@ -1126,7 +1126,7 @@ const bn = () => /* @__PURE__ */ h(F, { children: [
|
|
|
1126
1126
|
right: "1rem",
|
|
1127
1127
|
display: "flex"
|
|
1128
1128
|
},
|
|
1129
|
-
children: /* @__PURE__ */ n(
|
|
1129
|
+
children: /* @__PURE__ */ n(st, {})
|
|
1130
1130
|
}
|
|
1131
1131
|
), so = ({
|
|
1132
1132
|
isLoading: t,
|
|
@@ -1141,15 +1141,15 @@ const bn = () => /* @__PURE__ */ h(F, { children: [
|
|
|
1141
1141
|
onBlur: c,
|
|
1142
1142
|
defaultState: u,
|
|
1143
1143
|
css: g,
|
|
1144
|
-
signUrl:
|
|
1145
|
-
fileUpload:
|
|
1146
|
-
editable:
|
|
1144
|
+
signUrl: v,
|
|
1145
|
+
fileUpload: x,
|
|
1146
|
+
editable: w = !0
|
|
1147
1147
|
}) => {
|
|
1148
|
-
const { hasFocus:
|
|
1149
|
-
() => ({ hasFocus:
|
|
1150
|
-
[
|
|
1148
|
+
const { hasFocus: k, attributes: m } = Ir({ onBlur: c }), C = J(null), N = Qt(
|
|
1149
|
+
() => ({ hasFocus: k, editorRef: C, signUrl: v, fileUpload: x }),
|
|
1150
|
+
[k, v, x]
|
|
1151
1151
|
);
|
|
1152
|
-
return /* @__PURE__ */ n(de.Provider, { value:
|
|
1152
|
+
return /* @__PURE__ */ n(de.Provider, { value: N, children: /* @__PURE__ */ h(
|
|
1153
1153
|
pr,
|
|
1154
1154
|
{
|
|
1155
1155
|
initialConfig: {
|
|
@@ -1159,17 +1159,17 @@ const bn = () => /* @__PURE__ */ h(F, { children: [
|
|
|
1159
1159
|
},
|
|
1160
1160
|
theme: Mt,
|
|
1161
1161
|
nodes: o,
|
|
1162
|
-
editable:
|
|
1162
|
+
editable: w
|
|
1163
1163
|
},
|
|
1164
1164
|
children: [
|
|
1165
1165
|
/* @__PURE__ */ h(
|
|
1166
1166
|
Cn,
|
|
1167
1167
|
{
|
|
1168
1168
|
ref: C,
|
|
1169
|
-
hasFocus:
|
|
1169
|
+
hasFocus: k,
|
|
1170
1170
|
hideBorder: d,
|
|
1171
1171
|
css: g,
|
|
1172
|
-
...
|
|
1172
|
+
...m,
|
|
1173
1173
|
children: [
|
|
1174
1174
|
a,
|
|
1175
1175
|
/* @__PURE__ */ n(
|
|
@@ -1196,7 +1196,7 @@ const bn = () => /* @__PURE__ */ h(F, { children: [
|
|
|
1196
1196
|
/* @__PURE__ */ n(bn, {}),
|
|
1197
1197
|
i,
|
|
1198
1198
|
/* @__PURE__ */ n(Mn, { isLoading: t }),
|
|
1199
|
-
|
|
1199
|
+
w && !a && /* @__PURE__ */ n(un, { children: l })
|
|
1200
1200
|
]
|
|
1201
1201
|
}
|
|
1202
1202
|
),
|
|
@@ -1406,14 +1406,14 @@ const bn = () => /* @__PURE__ */ h(F, { children: [
|
|
|
1406
1406
|
fileUpload: t,
|
|
1407
1407
|
...r
|
|
1408
1408
|
}) => {
|
|
1409
|
-
const [e] =
|
|
1409
|
+
const [e] = _(), [o, i] = p(null), a = (s) => {
|
|
1410
1410
|
var c;
|
|
1411
1411
|
const d = (c = s.target.files) == null ? void 0 : c[0];
|
|
1412
1412
|
if (d) {
|
|
1413
1413
|
const u = new Image(), g = window.URL.createObjectURL(d);
|
|
1414
1414
|
u.onload = async () => {
|
|
1415
|
-
const
|
|
1416
|
-
i({ url:
|
|
1415
|
+
const v = await t.uploadFile({ file: d });
|
|
1416
|
+
i({ url: v, width: u.naturalWidth, height: u.naturalHeight }), window.URL.revokeObjectURL(g);
|
|
1417
1417
|
}, u.src = g;
|
|
1418
1418
|
}
|
|
1419
1419
|
}, l = () => {
|
|
@@ -1425,7 +1425,7 @@ const bn = () => /* @__PURE__ */ h(F, { children: [
|
|
|
1425
1425
|
};
|
|
1426
1426
|
return /* @__PURE__ */ h(ne, { ...r, children: [
|
|
1427
1427
|
/* @__PURE__ */ n(or, { children: "Sett inn bilde" }),
|
|
1428
|
-
t.isLoading && /* @__PURE__ */ n(
|
|
1428
|
+
t.isLoading && /* @__PURE__ */ n(st, {}),
|
|
1429
1429
|
/* @__PURE__ */ n(
|
|
1430
1430
|
bt,
|
|
1431
1431
|
{
|
|
@@ -1435,10 +1435,10 @@ const bn = () => /* @__PURE__ */ h(F, { children: [
|
|
|
1435
1435
|
disabled: t.isLoading
|
|
1436
1436
|
}
|
|
1437
1437
|
),
|
|
1438
|
-
/* @__PURE__ */ h(
|
|
1439
|
-
/* @__PURE__ */ n(
|
|
1438
|
+
/* @__PURE__ */ h(ct, { children: [
|
|
1439
|
+
/* @__PURE__ */ n(S, { onClick: () => r.onOpenChange(!1), children: "Avbryt" }),
|
|
1440
1440
|
/* @__PURE__ */ n(
|
|
1441
|
-
|
|
1441
|
+
S,
|
|
1442
1442
|
{
|
|
1443
1443
|
variant: "primary",
|
|
1444
1444
|
disabled: !o || t.isLoading,
|
|
@@ -1449,7 +1449,7 @@ const bn = () => /* @__PURE__ */ h(F, { children: [
|
|
|
1449
1449
|
] })
|
|
1450
1450
|
] });
|
|
1451
1451
|
}, ho = () => {
|
|
1452
|
-
const [t] =
|
|
1452
|
+
const [t] = _(), { fileUpload: r } = H(), [e, o] = p(!1), i = M(() => {
|
|
1453
1453
|
t.dispatchCommand(Je, {
|
|
1454
1454
|
rows: "3",
|
|
1455
1455
|
columns: "3",
|
|
@@ -1489,8 +1489,8 @@ function Ln(t) {
|
|
|
1489
1489
|
return f({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "circle", attr: { cx: "256", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "416", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "96", cy: "256", r: "48" } }] })(t);
|
|
1490
1490
|
}
|
|
1491
1491
|
const uo = () => {
|
|
1492
|
-
const [t] =
|
|
1493
|
-
|
|
1492
|
+
const [t] = _(), [r, e] = p(null), { hasFocus: o } = H();
|
|
1493
|
+
L(() => {
|
|
1494
1494
|
!o && r && e(null);
|
|
1495
1495
|
}, [o, r]);
|
|
1496
1496
|
const { refs: i, floatingStyles: a } = vt({
|
|
@@ -1501,11 +1501,11 @@ const uo = () => {
|
|
|
1501
1501
|
},
|
|
1502
1502
|
middleware: [ie({ mainAxis: -20, crossAxis: -2 })]
|
|
1503
1503
|
});
|
|
1504
|
-
|
|
1505
|
-
|
|
1504
|
+
L(() => t.registerCommand(
|
|
1505
|
+
V,
|
|
1506
1506
|
() => {
|
|
1507
|
-
const s =
|
|
1508
|
-
if (
|
|
1507
|
+
const s = y();
|
|
1508
|
+
if (R(s)) {
|
|
1509
1509
|
const d = s.anchor.getNode(), c = Ye(d);
|
|
1510
1510
|
e(c ? t.getElementByKey(c.getKey()) : null);
|
|
1511
1511
|
}
|
|
@@ -1541,7 +1541,7 @@ const uo = () => {
|
|
|
1541
1541
|
at,
|
|
1542
1542
|
{
|
|
1543
1543
|
trigger: /* @__PURE__ */ n(
|
|
1544
|
-
|
|
1544
|
+
S,
|
|
1545
1545
|
{
|
|
1546
1546
|
icon: !0,
|
|
1547
1547
|
variant: "primary",
|
|
@@ -1613,11 +1613,11 @@ function _n(t) {
|
|
|
1613
1613
|
return t instanceof B;
|
|
1614
1614
|
}
|
|
1615
1615
|
const wn = ({ onClose: t }) => {
|
|
1616
|
-
const [r] =
|
|
1616
|
+
const [r] = _(), e = M(
|
|
1617
1617
|
(i) => {
|
|
1618
1618
|
r.update(() => {
|
|
1619
|
-
const a =
|
|
1620
|
-
if (
|
|
1619
|
+
const a = y();
|
|
1620
|
+
if (R(a) && a.isCollapsed()) {
|
|
1621
1621
|
const l = z(i);
|
|
1622
1622
|
a.insertNodes([l]);
|
|
1623
1623
|
const s = Ut();
|
|
@@ -1632,48 +1632,60 @@ const wn = ({ onClose: t }) => {
|
|
|
1632
1632
|
e(i.currentTarget.url.value), t();
|
|
1633
1633
|
}, children: [
|
|
1634
1634
|
/* @__PURE__ */ n(bt, { name: "url", label: "URL", type: "url", required: !0 }),
|
|
1635
|
-
/* @__PURE__ */ h(
|
|
1636
|
-
/* @__PURE__ */ n(
|
|
1637
|
-
/* @__PURE__ */ n(
|
|
1635
|
+
/* @__PURE__ */ h(ct, { children: [
|
|
1636
|
+
/* @__PURE__ */ n(S, { onClick: t, children: "Avbryt" }),
|
|
1637
|
+
/* @__PURE__ */ n(S, { type: "submit", variant: "primary", children: "Sett inn" })
|
|
1638
1638
|
] })
|
|
1639
1639
|
] });
|
|
1640
1640
|
}, yn = ({
|
|
1641
1641
|
onClose: t,
|
|
1642
1642
|
getDocs: r
|
|
1643
1643
|
}) => {
|
|
1644
|
-
const [e] =
|
|
1645
|
-
|
|
1644
|
+
const [e] = _(), o = J(!1), [i, a] = p(null), [l, s] = p([]);
|
|
1645
|
+
L(() => {
|
|
1646
|
+
o.current || (async () => {
|
|
1647
|
+
o.current = !0;
|
|
1648
|
+
try {
|
|
1649
|
+
const c = await r();
|
|
1650
|
+
a(c);
|
|
1651
|
+
} catch {
|
|
1652
|
+
}
|
|
1653
|
+
})();
|
|
1654
|
+
}, [r]);
|
|
1655
|
+
const d = M(
|
|
1656
|
+
(c) => {
|
|
1646
1657
|
e.update(() => {
|
|
1647
|
-
const
|
|
1648
|
-
if (
|
|
1649
|
-
const
|
|
1650
|
-
for (const [
|
|
1651
|
-
const
|
|
1652
|
-
|
|
1658
|
+
const u = y();
|
|
1659
|
+
if (R(u)) {
|
|
1660
|
+
const g = [];
|
|
1661
|
+
for (const [v, x] of c.entries()) {
|
|
1662
|
+
const w = pe(x.value);
|
|
1663
|
+
w.append(z(x.label)), g.push(w), v !== c.length - 1 && g.push(z(" "));
|
|
1653
1664
|
}
|
|
1654
|
-
|
|
1665
|
+
u.insertNodes(g);
|
|
1655
1666
|
}
|
|
1656
1667
|
});
|
|
1657
1668
|
},
|
|
1658
1669
|
[e]
|
|
1659
1670
|
);
|
|
1660
1671
|
return /* @__PURE__ */ h(F, { children: [
|
|
1661
|
-
/* @__PURE__ */ n(
|
|
1672
|
+
!i && /* @__PURE__ */ n(st, {}),
|
|
1673
|
+
i && /* @__PURE__ */ n(
|
|
1662
1674
|
ar,
|
|
1663
1675
|
{
|
|
1664
1676
|
isMulti: !0,
|
|
1665
|
-
options:
|
|
1666
|
-
onChange: (
|
|
1677
|
+
options: i,
|
|
1678
|
+
onChange: (c) => s(c)
|
|
1667
1679
|
}
|
|
1668
1680
|
),
|
|
1669
|
-
/* @__PURE__ */ h(
|
|
1670
|
-
/* @__PURE__ */ n(
|
|
1681
|
+
/* @__PURE__ */ h(ct, { children: [
|
|
1682
|
+
/* @__PURE__ */ n(S, { onClick: t, children: "Avbryt" }),
|
|
1671
1683
|
/* @__PURE__ */ n(
|
|
1672
|
-
|
|
1684
|
+
S,
|
|
1673
1685
|
{
|
|
1674
1686
|
variant: "primary",
|
|
1675
1687
|
onClick: () => {
|
|
1676
|
-
l
|
|
1688
|
+
d(l), t();
|
|
1677
1689
|
},
|
|
1678
1690
|
children: "Sett inn"
|
|
1679
1691
|
}
|
|
@@ -1685,7 +1697,7 @@ const wn = ({ onClose: t }) => {
|
|
|
1685
1697
|
fileUpload: r,
|
|
1686
1698
|
filePrefix: e
|
|
1687
1699
|
}) => {
|
|
1688
|
-
const [o] =
|
|
1700
|
+
const [o] = _(), [i, a] = p(null), l = async (d) => {
|
|
1689
1701
|
var u;
|
|
1690
1702
|
const c = (u = d.target.files) == null ? void 0 : u[0];
|
|
1691
1703
|
if (c) {
|
|
@@ -1699,8 +1711,8 @@ const wn = ({ onClose: t }) => {
|
|
|
1699
1711
|
o.update(() => {
|
|
1700
1712
|
if (!i)
|
|
1701
1713
|
return;
|
|
1702
|
-
const d =
|
|
1703
|
-
if (
|
|
1714
|
+
const d = y();
|
|
1715
|
+
if (R(d) && d.isCollapsed()) {
|
|
1704
1716
|
const c = z(i.name);
|
|
1705
1717
|
d.insertNodes([c]);
|
|
1706
1718
|
const u = Ut();
|
|
@@ -1710,7 +1722,7 @@ const wn = ({ onClose: t }) => {
|
|
|
1710
1722
|
});
|
|
1711
1723
|
}, [o, i]);
|
|
1712
1724
|
return /* @__PURE__ */ h(F, { children: [
|
|
1713
|
-
r.isLoading && /* @__PURE__ */ n(
|
|
1725
|
+
r.isLoading && /* @__PURE__ */ n(st, {}),
|
|
1714
1726
|
/* @__PURE__ */ n(
|
|
1715
1727
|
bt,
|
|
1716
1728
|
{
|
|
@@ -1719,10 +1731,10 @@ const wn = ({ onClose: t }) => {
|
|
|
1719
1731
|
disabled: r.isLoading
|
|
1720
1732
|
}
|
|
1721
1733
|
),
|
|
1722
|
-
/* @__PURE__ */ h(
|
|
1723
|
-
/* @__PURE__ */ n(
|
|
1734
|
+
/* @__PURE__ */ h(ct, { children: [
|
|
1735
|
+
/* @__PURE__ */ n(S, { onClick: t, children: "Avbryt" }),
|
|
1724
1736
|
/* @__PURE__ */ n(
|
|
1725
|
-
|
|
1737
|
+
S,
|
|
1726
1738
|
{
|
|
1727
1739
|
variant: "primary",
|
|
1728
1740
|
onClick: () => {
|
|
@@ -1740,21 +1752,21 @@ const wn = ({ onClose: t }) => {
|
|
|
1740
1752
|
getDocs: e,
|
|
1741
1753
|
filePrefix: o
|
|
1742
1754
|
}) => {
|
|
1743
|
-
const { fileUpload: i } = H(), [a, l] =
|
|
1755
|
+
const { fileUpload: i } = H(), [a, l] = p("url"), s = () => {
|
|
1744
1756
|
r(!1);
|
|
1745
1757
|
};
|
|
1746
1758
|
return /* @__PURE__ */ h(ne, { open: t, onOpenChange: r, css: { width: "600px" }, children: [
|
|
1747
1759
|
/* @__PURE__ */ h(ir, { css: { marginBottom: "$8" }, children: [
|
|
1748
|
-
/* @__PURE__ */ n(
|
|
1760
|
+
/* @__PURE__ */ n(gt, { active: a === "url", onClick: () => l("url"), children: "URL" }),
|
|
1749
1761
|
e && /* @__PURE__ */ n(
|
|
1750
|
-
|
|
1762
|
+
gt,
|
|
1751
1763
|
{
|
|
1752
1764
|
active: a === "rutine",
|
|
1753
1765
|
onClick: () => l("rutine"),
|
|
1754
1766
|
children: "Rutine"
|
|
1755
1767
|
}
|
|
1756
1768
|
),
|
|
1757
|
-
i && /* @__PURE__ */ n(
|
|
1769
|
+
i && /* @__PURE__ */ n(gt, { active: a === "file", onClick: () => l("file"), children: "Fil" })
|
|
1758
1770
|
] }),
|
|
1759
1771
|
a === "url" && /* @__PURE__ */ n(wn, { onClose: s }),
|
|
1760
1772
|
a === "rutine" && e && /* @__PURE__ */ n(yn, { onClose: s, getDocs: e }),
|
|
@@ -1771,15 +1783,15 @@ const wn = ({ onClose: t }) => {
|
|
|
1771
1783
|
getDocs: t,
|
|
1772
1784
|
filePrefix: r
|
|
1773
1785
|
}) => {
|
|
1774
|
-
const [e] =
|
|
1775
|
-
const d =
|
|
1776
|
-
if (
|
|
1786
|
+
const [e] = _(), [o, i] = p(!1), [a, l] = p(!1), s = M(() => {
|
|
1787
|
+
const d = y();
|
|
1788
|
+
if (R(d)) {
|
|
1777
1789
|
const c = ge(d), u = c.getParent();
|
|
1778
1790
|
i(Z(u) || Z(c));
|
|
1779
1791
|
}
|
|
1780
1792
|
}, []);
|
|
1781
|
-
return
|
|
1782
|
-
|
|
1793
|
+
return L(() => e.registerCommand(
|
|
1794
|
+
V,
|
|
1783
1795
|
() => (s(), !1),
|
|
1784
1796
|
q
|
|
1785
1797
|
), [e, s]), /* @__PURE__ */ h(tt, { type: "single", value: o ? "link" : "", children: [
|
|
@@ -1805,8 +1817,8 @@ const wn = ({ onClose: t }) => {
|
|
|
1805
1817
|
)
|
|
1806
1818
|
] });
|
|
1807
1819
|
}, mo = () => {
|
|
1808
|
-
const [t] =
|
|
1809
|
-
|
|
1820
|
+
const [t] = _(), r = J(null), [e, o] = p(null), [i, a] = p(""), { hasFocus: l } = H();
|
|
1821
|
+
L(() => {
|
|
1810
1822
|
e ? t.update(() => {
|
|
1811
1823
|
a(e.getURL());
|
|
1812
1824
|
}) : a("");
|
|
@@ -1823,36 +1835,36 @@ const wn = ({ onClose: t }) => {
|
|
|
1823
1835
|
}), { getFloatingProps: g } = ae([
|
|
1824
1836
|
le(u),
|
|
1825
1837
|
Mr(u)
|
|
1826
|
-
]),
|
|
1827
|
-
var
|
|
1828
|
-
const
|
|
1829
|
-
if (
|
|
1830
|
-
const C = ge(
|
|
1838
|
+
]), v = M(() => {
|
|
1839
|
+
var m;
|
|
1840
|
+
const k = y();
|
|
1841
|
+
if (R(k)) {
|
|
1842
|
+
const C = ge(k), N = C.getParent();
|
|
1831
1843
|
let I = null;
|
|
1832
|
-
if (Z(
|
|
1833
|
-
const
|
|
1834
|
-
|
|
1844
|
+
if (Z(N) ? I = N : Z(C) && (I = C), I) {
|
|
1845
|
+
const Y = window.getSelection(), Q = t.getRootElement();
|
|
1846
|
+
k !== null && Y !== null && Q !== null && Q.contains(Y.anchorNode) && t.isEditable() && (r.current = ((m = Y.focusNode) == null ? void 0 : m.parentElement) ?? null);
|
|
1835
1847
|
}
|
|
1836
1848
|
o(I);
|
|
1837
1849
|
}
|
|
1838
|
-
}, [t]),
|
|
1850
|
+
}, [t]), x = M(() => {
|
|
1839
1851
|
e && _n(e) && t.update(() => {
|
|
1840
1852
|
e.remove();
|
|
1841
1853
|
}), t.dispatchCommand(it, null);
|
|
1842
1854
|
}, [t, e]);
|
|
1843
|
-
if (
|
|
1855
|
+
if (L(() => {
|
|
1844
1856
|
t.getEditorState().read(() => {
|
|
1845
|
-
|
|
1857
|
+
v();
|
|
1846
1858
|
});
|
|
1847
|
-
}, [t,
|
|
1848
|
-
t.registerUpdateListener(({ editorState:
|
|
1849
|
-
|
|
1850
|
-
|
|
1859
|
+
}, [t, v]), L(() => ot(
|
|
1860
|
+
t.registerUpdateListener(({ editorState: k }) => {
|
|
1861
|
+
k.read(() => {
|
|
1862
|
+
v();
|
|
1851
1863
|
});
|
|
1852
1864
|
}),
|
|
1853
1865
|
t.registerCommand(
|
|
1854
|
-
|
|
1855
|
-
() => (
|
|
1866
|
+
V,
|
|
1867
|
+
() => (v(), !1),
|
|
1856
1868
|
q
|
|
1857
1869
|
),
|
|
1858
1870
|
t.registerCommand(
|
|
@@ -1860,9 +1872,9 @@ const wn = ({ onClose: t }) => {
|
|
|
1860
1872
|
() => e ? (o(null), !0) : !1,
|
|
1861
1873
|
Ie
|
|
1862
1874
|
)
|
|
1863
|
-
), [t,
|
|
1875
|
+
), [t, v, e]), !s)
|
|
1864
1876
|
return null;
|
|
1865
|
-
const
|
|
1877
|
+
const w = _t(i);
|
|
1866
1878
|
return /* @__PURE__ */ n(se, { children: /* @__PURE__ */ h(
|
|
1867
1879
|
re,
|
|
1868
1880
|
{
|
|
@@ -1888,14 +1900,14 @@ const wn = ({ onClose: t }) => {
|
|
|
1888
1900
|
textOverflow: "ellipsis",
|
|
1889
1901
|
marginRight: "$4"
|
|
1890
1902
|
},
|
|
1891
|
-
href:
|
|
1892
|
-
title:
|
|
1903
|
+
href: w,
|
|
1904
|
+
title: w,
|
|
1893
1905
|
target: "_blank",
|
|
1894
1906
|
rel: "noreferrer",
|
|
1895
1907
|
children: i
|
|
1896
1908
|
}
|
|
1897
1909
|
),
|
|
1898
|
-
/* @__PURE__ */ n(
|
|
1910
|
+
/* @__PURE__ */ n(S, { color: "danger", icon: !0, size: "sm", onClick: x, children: /* @__PURE__ */ n(gr, { size: 24 }) })
|
|
1899
1911
|
]
|
|
1900
1912
|
}
|
|
1901
1913
|
) });
|
|
@@ -1910,7 +1922,7 @@ const wn = ({ onClose: t }) => {
|
|
|
1910
1922
|
/* @__PURE__ */ h(
|
|
1911
1923
|
T,
|
|
1912
1924
|
{
|
|
1913
|
-
onClick: () => t.dispatchCommand(
|
|
1925
|
+
onClick: () => t.dispatchCommand(ht, "left"),
|
|
1914
1926
|
children: [
|
|
1915
1927
|
/* @__PURE__ */ n(Ot, { size: "1.25rem" }),
|
|
1916
1928
|
"Venstre"
|
|
@@ -1920,7 +1932,7 @@ const wn = ({ onClose: t }) => {
|
|
|
1920
1932
|
/* @__PURE__ */ h(
|
|
1921
1933
|
T,
|
|
1922
1934
|
{
|
|
1923
|
-
onClick: () => t.dispatchCommand(
|
|
1935
|
+
onClick: () => t.dispatchCommand(ht, "center"),
|
|
1924
1936
|
children: [
|
|
1925
1937
|
/* @__PURE__ */ n($r, { size: "1.25rem" }),
|
|
1926
1938
|
"Midt"
|
|
@@ -1930,7 +1942,7 @@ const wn = ({ onClose: t }) => {
|
|
|
1930
1942
|
/* @__PURE__ */ h(
|
|
1931
1943
|
T,
|
|
1932
1944
|
{
|
|
1933
|
-
onClick: () => t.dispatchCommand(
|
|
1945
|
+
onClick: () => t.dispatchCommand(ht, "right"),
|
|
1934
1946
|
children: [
|
|
1935
1947
|
/* @__PURE__ */ n(Ar, { size: "1.25rem" }),
|
|
1936
1948
|
"Høyre"
|
|
@@ -1942,7 +1954,7 @@ const wn = ({ onClose: t }) => {
|
|
|
1942
1954
|
);
|
|
1943
1955
|
}, Dt = ["image/"], ko = () => {
|
|
1944
1956
|
const [t] = Ct(), { fileUpload: r } = H();
|
|
1945
|
-
return
|
|
1957
|
+
return L(() => t.registerCommand(
|
|
1946
1958
|
qe,
|
|
1947
1959
|
(e) => ((async () => {
|
|
1948
1960
|
const o = await Pe(
|