@arkitektbedriftene/fe-lib 5.1.3 → 5.1.4
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/rich-text.es.js +278 -290
- package/package.json +1 -1
package/dist/rich-text.es.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Me = (t, r, e) => r in t ?
|
|
1
|
+
var ve = Object.defineProperty;
|
|
2
|
+
var Me = (t, r, e) => r in t ? ve(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
3
|
var $ = (t, r, e) => Me(t, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
-
import { createHeadlessEditor as
|
|
5
|
-
import { $generateHtmlFromNodes as
|
|
6
|
-
import { $getRoot as V, ParagraphNode as
|
|
7
|
-
import { trimTextContentFromAnchor as Oe, $setBlocksType as ut, $getSelectionStyleValueForProperty as ze, $patchStyleText as $e, $isAtNodeEnd as
|
|
8
|
-
import { $dfs as Ae, $getNearestNodeOfType as De, $findMatchingParent as Wt, mergeRegister as ot, isHTMLElement as St, $wrapNodeInElement as
|
|
4
|
+
import { createHeadlessEditor as Pt } from "@lexical/headless";
|
|
5
|
+
import { $generateHtmlFromNodes as Bt } from "@lexical/html";
|
|
6
|
+
import { $getRoot as V, ParagraphNode as xe, $createParagraphNode as G, $createTextNode as z, $setSelection as nt, $getNodeByKey as dt, DecoratorNode as Te, $applyNodeReplacement as Le, SELECTION_CHANGE_COMMAND as Q, $getSelection as y, COMMAND_PRIORITY_EDITOR as q, $isRangeSelection as E, $isRootOrShadowRoot as Ft, FORMAT_TEXT_COMMAND as A, COMMAND_PRIORITY_LOW as D, KEY_ARROW_DOWN_COMMAND as we, KEY_ARROW_UP_COMMAND as _e, 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
|
+
import { $dfs as Ae, $getNearestNodeOfType as De, $findMatchingParent as Wt, mergeRegister as ot, isHTMLElement as St, $wrapNodeInElement as Pe, mediaFileReader as Be, isMimeType as Fe } from "@lexical/utils";
|
|
9
9
|
import { LinkNode as W, AutoLinkNode as jt, $isLinkNode as tt, TOGGLE_LINK_COMMAND as it } from "@lexical/link";
|
|
10
|
-
import { ListNode as ft, ListItemNode as Kt, $isListNode as kt, INSERT_UNORDERED_LIST_COMMAND 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 j } 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
|
-
import { jsx as n, jsxs as h, Fragment as
|
|
13
|
+
import { jsx as n, jsxs as h, Fragment as B } from "react/jsx-runtime";
|
|
14
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
|
|
15
|
+
import { Box as P, Stack as er, Button as S, DropdownMenu as at, ToolbarButton as lt, DropdownMenuIconItem as T, ToolbarToggleGroup as et, 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 U, 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-Dzt91gSZ.js";
|
|
17
17
|
import { useLexicalComposerContext as w } from "@lexical/react/LexicalComposerContext.js";
|
|
18
18
|
import { HorizontalRuleNode as pr } from "@lexical/react/LexicalHorizontalRuleNode.js";
|
|
19
19
|
import { LexicalComposer as mr } from "@lexical/react/LexicalComposer.js";
|
|
20
20
|
import { RichTextPlugin as fr } from "@lexical/react/LexicalRichTextPlugin.js";
|
|
21
21
|
import { LexicalErrorBoundary as kr } from "@lexical/react/LexicalErrorBoundary.js";
|
|
22
|
-
import { useFloating as
|
|
23
|
-
import { s as
|
|
22
|
+
import { useFloating as Ct, autoUpdate as oe, size as br, flip as Cr, offset as ie, shift as vr, useInteractions as ae, useRole as le, FloatingPortal as se, inline as Mr, useDismiss as xr } from "@floating-ui/react";
|
|
23
|
+
import { s as Tr, c as Lr } from "./stitches.config-CEYOm13b.js";
|
|
24
24
|
import { ListPlugin as wr } from "@lexical/react/LexicalListPlugin.js";
|
|
25
|
-
import { HistoryPlugin as
|
|
26
|
-
import { TablePlugin as
|
|
25
|
+
import { HistoryPlugin as _r } from "@lexical/react/LexicalHistoryPlugin.js";
|
|
26
|
+
import { TablePlugin as yr } from "@lexical/react/LexicalTablePlugin.js";
|
|
27
27
|
import { HorizontalRulePlugin as Sr } from "@lexical/react/LexicalHorizontalRulePlugin.js";
|
|
28
28
|
import { TabIndentationPlugin as Nr } from "@lexical/react/LexicalTabIndentationPlugin.js";
|
|
29
|
-
import { useLexicalComposerContext as
|
|
29
|
+
import { useLexicalComposerContext as vt } from "@lexical/react/LexicalComposerContext";
|
|
30
30
|
const Er = ({
|
|
31
31
|
text: t,
|
|
32
32
|
maxChars: r,
|
|
@@ -50,7 +50,7 @@ const Er = ({
|
|
|
50
50
|
const o = V(), i = o.getTextContent(), a = Er({ text: i, maxChars: r, maxLines: e }), l = i.length - a, d = o.select().anchor;
|
|
51
51
|
Oe(t, d, l);
|
|
52
52
|
const c = o.getLastChild();
|
|
53
|
-
return c instanceof
|
|
53
|
+
return c instanceof xe && c.getChildrenSize() === 0 && c.remove(), l;
|
|
54
54
|
}, Mt = {
|
|
55
55
|
quote: "ain-rich-text-quote",
|
|
56
56
|
text: {
|
|
@@ -64,7 +64,7 @@ const Er = ({
|
|
|
64
64
|
listitem: "ain-rich-text-nested-list-item"
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
},
|
|
67
|
+
}, xt = (t) => t[0] === "{", Rr = (t) => t !== null && typeof t == "object" && "isEmpty" in t, Ir = (t, r) => {
|
|
68
68
|
t.update(
|
|
69
69
|
() => {
|
|
70
70
|
const e = V();
|
|
@@ -88,17 +88,17 @@ const Er = ({
|
|
|
88
88
|
tag: e
|
|
89
89
|
}
|
|
90
90
|
), r.blur();
|
|
91
|
-
},
|
|
91
|
+
}, no = async (t, r, e) => {
|
|
92
92
|
var l;
|
|
93
93
|
let o = 0;
|
|
94
|
-
const i =
|
|
94
|
+
const i = Pt({
|
|
95
95
|
nodes: r,
|
|
96
96
|
editable: !1,
|
|
97
97
|
theme: Mt
|
|
98
98
|
});
|
|
99
99
|
if (t)
|
|
100
100
|
try {
|
|
101
|
-
if (typeof t == "string" && !
|
|
101
|
+
if (typeof t == "string" && !xt(t))
|
|
102
102
|
i.update(() => {
|
|
103
103
|
const s = V(), d = G();
|
|
104
104
|
d.append(z(t.trim())), s.append(d);
|
|
@@ -118,18 +118,18 @@ const Er = ({
|
|
|
118
118
|
await ((l = e == null ? void 0 : e.updateFn) == null ? void 0 : l.call(e, i));
|
|
119
119
|
let a = "";
|
|
120
120
|
return i.read(() => {
|
|
121
|
-
a =
|
|
121
|
+
a = Bt(i);
|
|
122
122
|
}), { html: a, trimCount: o };
|
|
123
|
-
},
|
|
123
|
+
}, oo = (t, r, e) => {
|
|
124
124
|
let o = 0;
|
|
125
|
-
const i =
|
|
125
|
+
const i = Pt({
|
|
126
126
|
nodes: r,
|
|
127
127
|
editable: !1,
|
|
128
128
|
theme: Mt
|
|
129
129
|
});
|
|
130
130
|
if (t)
|
|
131
131
|
try {
|
|
132
|
-
if (typeof t == "string" && !
|
|
132
|
+
if (typeof t == "string" && !xt(t))
|
|
133
133
|
i.update(() => {
|
|
134
134
|
const l = V(), s = G();
|
|
135
135
|
s.append(z(t.trim())), l.append(s);
|
|
@@ -149,12 +149,12 @@ const Er = ({
|
|
|
149
149
|
let a = "";
|
|
150
150
|
try {
|
|
151
151
|
i.read(() => {
|
|
152
|
-
a =
|
|
152
|
+
a = Bt(i);
|
|
153
153
|
});
|
|
154
154
|
} catch {
|
|
155
155
|
}
|
|
156
156
|
return { html: a, trimCount: o };
|
|
157
|
-
},
|
|
157
|
+
}, io = (t) => Ae().map(({ node: r }) => r).filter((r) => t.some((e) => r instanceof e));
|
|
158
158
|
class rt extends W {
|
|
159
159
|
static getType() {
|
|
160
160
|
return "target-link";
|
|
@@ -203,7 +203,7 @@ const de = Qe({
|
|
|
203
203
|
onBlur: a
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
},
|
|
206
|
+
}, F = () => Ze(de);
|
|
207
207
|
function $r({
|
|
208
208
|
src: t,
|
|
209
209
|
altText: r,
|
|
@@ -211,28 +211,28 @@ function $r({
|
|
|
211
211
|
height: o,
|
|
212
212
|
nodeKey: i
|
|
213
213
|
}) {
|
|
214
|
-
const { signUrl: a } =
|
|
214
|
+
const { signUrl: a } = F(), [l, s] = p(a ? "" : t), [d, c] = p(!1), u = J(!1), [g] = w();
|
|
215
215
|
L(() => {
|
|
216
216
|
const m = async () => {
|
|
217
217
|
s(await (a == null ? void 0 : a(t)) || t);
|
|
218
218
|
};
|
|
219
219
|
!l && !u.current && (u.current = !0, m());
|
|
220
220
|
}, []);
|
|
221
|
-
const
|
|
222
|
-
|
|
221
|
+
const C = (m) => (v) => {
|
|
222
|
+
v.relatedTarget instanceof HTMLElement && v.relatedTarget.dataset.controls === "true" || c(m);
|
|
223
223
|
}, x = () => {
|
|
224
224
|
g.update(() => {
|
|
225
225
|
const m = dt(i);
|
|
226
226
|
m && m.remove();
|
|
227
227
|
});
|
|
228
|
-
},
|
|
228
|
+
}, _ = () => {
|
|
229
229
|
g.update(() => {
|
|
230
230
|
var N;
|
|
231
231
|
const m = dt(i);
|
|
232
232
|
if (!m)
|
|
233
233
|
return;
|
|
234
|
-
const
|
|
235
|
-
|
|
234
|
+
const v = m.getPreviousSibling() || ((N = m.getParent()) == null ? void 0 : N.getPreviousSibling());
|
|
235
|
+
v && v.insertBefore(m);
|
|
236
236
|
});
|
|
237
237
|
}, k = () => {
|
|
238
238
|
g.update(() => {
|
|
@@ -240,11 +240,11 @@ function $r({
|
|
|
240
240
|
const m = dt(i);
|
|
241
241
|
if (!m)
|
|
242
242
|
return;
|
|
243
|
-
const
|
|
244
|
-
|
|
243
|
+
const v = m.getNextSibling() || ((N = m.getParent()) == null ? void 0 : N.getNextSibling());
|
|
244
|
+
v && v.insertAfter(m);
|
|
245
245
|
});
|
|
246
246
|
};
|
|
247
|
-
return l ? /* @__PURE__ */ h(
|
|
247
|
+
return l ? /* @__PURE__ */ h(P, { css: { position: "relative", display: "inline-block" }, children: [
|
|
248
248
|
/* @__PURE__ */ h(
|
|
249
249
|
er,
|
|
250
250
|
{
|
|
@@ -258,7 +258,7 @@ function $r({
|
|
|
258
258
|
},
|
|
259
259
|
gap: 1,
|
|
260
260
|
"data-controls": "true",
|
|
261
|
-
onMouseLeave:
|
|
261
|
+
onMouseLeave: C(!1),
|
|
262
262
|
children: [
|
|
263
263
|
/* @__PURE__ */ n(
|
|
264
264
|
S,
|
|
@@ -277,7 +277,7 @@ function $r({
|
|
|
277
277
|
icon: !0,
|
|
278
278
|
size: "sm",
|
|
279
279
|
css: { width: "20px", height: "20px" },
|
|
280
|
-
onClick:
|
|
280
|
+
onClick: _,
|
|
281
281
|
children: /* @__PURE__ */ n(sr, {})
|
|
282
282
|
}
|
|
283
283
|
),
|
|
@@ -304,8 +304,8 @@ function $r({
|
|
|
304
304
|
width: e
|
|
305
305
|
},
|
|
306
306
|
className: "ain-rich-text-image",
|
|
307
|
-
onMouseEnter:
|
|
308
|
-
onMouseLeave:
|
|
307
|
+
onMouseEnter: C(!0),
|
|
308
|
+
onMouseLeave: C(!1),
|
|
309
309
|
"data-controls": "true"
|
|
310
310
|
}
|
|
311
311
|
)
|
|
@@ -313,9 +313,9 @@ function $r({
|
|
|
313
313
|
}
|
|
314
314
|
function Ar(t) {
|
|
315
315
|
const r = t, { alt: e, src: o, width: i, height: a } = r;
|
|
316
|
-
return { node:
|
|
316
|
+
return { node: Tt({ altText: e, height: a, src: o, width: i }) };
|
|
317
317
|
}
|
|
318
|
-
class
|
|
318
|
+
class H extends Te {
|
|
319
319
|
constructor(e, o, i, a, l, s) {
|
|
320
320
|
super(s);
|
|
321
321
|
$(this, "__src");
|
|
@@ -329,7 +329,7 @@ class F extends xe {
|
|
|
329
329
|
return "image";
|
|
330
330
|
}
|
|
331
331
|
static clone(e) {
|
|
332
|
-
return new
|
|
332
|
+
return new H(
|
|
333
333
|
e.__src,
|
|
334
334
|
e.__altText,
|
|
335
335
|
e.__width,
|
|
@@ -340,7 +340,7 @@ class F extends xe {
|
|
|
340
340
|
}
|
|
341
341
|
static importJSON(e) {
|
|
342
342
|
const { altText: o, height: i, width: a, src: l, meta: s } = e;
|
|
343
|
-
return
|
|
343
|
+
return Tt({
|
|
344
344
|
altText: o,
|
|
345
345
|
height: i,
|
|
346
346
|
src: l,
|
|
@@ -408,7 +408,7 @@ class F extends xe {
|
|
|
408
408
|
);
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
|
-
function
|
|
411
|
+
function Tt({
|
|
412
412
|
altText: t,
|
|
413
413
|
height: r,
|
|
414
414
|
src: e,
|
|
@@ -417,13 +417,13 @@ function xt({
|
|
|
417
417
|
key: a
|
|
418
418
|
}) {
|
|
419
419
|
return Le(
|
|
420
|
-
new
|
|
420
|
+
new H(e, t, o, r, i, a)
|
|
421
421
|
);
|
|
422
422
|
}
|
|
423
|
-
function
|
|
424
|
-
return t instanceof
|
|
423
|
+
function ao(t) {
|
|
424
|
+
return t instanceof H;
|
|
425
425
|
}
|
|
426
|
-
const
|
|
426
|
+
const lo = [
|
|
427
427
|
qt,
|
|
428
428
|
Jt,
|
|
429
429
|
ft,
|
|
@@ -433,9 +433,9 @@ const co = [
|
|
|
433
433
|
Yt,
|
|
434
434
|
Xt,
|
|
435
435
|
Vt,
|
|
436
|
-
|
|
436
|
+
H,
|
|
437
437
|
pr
|
|
438
|
-
],
|
|
438
|
+
], so = [
|
|
439
439
|
qt,
|
|
440
440
|
Jt,
|
|
441
441
|
ft,
|
|
@@ -445,7 +445,7 @@ const co = [
|
|
|
445
445
|
Yt,
|
|
446
446
|
Xt,
|
|
447
447
|
Vt,
|
|
448
|
-
|
|
448
|
+
H,
|
|
449
449
|
rt,
|
|
450
450
|
{
|
|
451
451
|
replace: W,
|
|
@@ -461,16 +461,16 @@ function Dr(t) {
|
|
|
461
461
|
function Ot(t) {
|
|
462
462
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M4 6l16 0" } }, { tag: "path", attr: { d: "M4 12l10 0" } }, { tag: "path", attr: { d: "M4 18l14 0" } }] })(t);
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function Pr(t) {
|
|
465
465
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M4 6l16 0" } }, { tag: "path", attr: { d: "M10 12l10 0" } }, { tag: "path", attr: { d: "M6 18l14 0" } }] })(t);
|
|
466
466
|
}
|
|
467
|
-
function
|
|
467
|
+
function Br(t) {
|
|
468
468
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 5h6a3.5 3.5 0 0 1 0 7h-6z" } }, { tag: "path", attr: { d: "M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7" } }] })(t);
|
|
469
469
|
}
|
|
470
|
-
function
|
|
470
|
+
function Fr(t) {
|
|
471
471
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 8l-4 4l4 4" } }, { tag: "path", attr: { d: "M17 8l4 4l-4 4" } }, { tag: "path", attr: { d: "M14 4l-4 16" } }] })(t);
|
|
472
472
|
}
|
|
473
|
-
function
|
|
473
|
+
function Hr(t) {
|
|
474
474
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 18v-8l-2 2" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
|
|
475
475
|
}
|
|
476
476
|
function Ur(t) {
|
|
@@ -483,51 +483,45 @@ function jr(t) {
|
|
|
483
483
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M20 18v-8l-4 6h5" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
|
|
484
484
|
}
|
|
485
485
|
function Kr(t) {
|
|
486
|
-
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17 18h2a2 2 0 1 0 0 -4h-2v-4h4" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
|
|
487
|
-
}
|
|
488
|
-
function Gr(t) {
|
|
489
|
-
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 14a2 2 0 1 0 0 4a2 2 0 0 0 0 -4z" } }, { tag: "path", attr: { d: "M21 12a2 2 0 1 0 -4 0v4" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
|
|
490
|
-
}
|
|
491
|
-
function qr(t) {
|
|
492
486
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M11 5l6 0" } }, { tag: "path", attr: { d: "M7 19l6 0" } }, { tag: "path", attr: { d: "M14 5l-4 14" } }] })(t);
|
|
493
487
|
}
|
|
494
|
-
function
|
|
488
|
+
function Gr(t) {
|
|
495
489
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17.5 15.5m-3.5 0a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0" } }, { tag: "path", attr: { d: "M3 19v-10.5a3.5 3.5 0 0 1 7 0v10.5" } }, { tag: "path", attr: { d: "M3 13h7" } }, { tag: "path", attr: { d: "M21 12v7" } }] })(t);
|
|
496
490
|
}
|
|
497
|
-
function
|
|
491
|
+
function qr(t) {
|
|
498
492
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" } }, { tag: "path", attr: { d: "M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" } }] })(t);
|
|
499
493
|
}
|
|
500
|
-
function
|
|
494
|
+
function Jr(t) {
|
|
501
495
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M3.5 5.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 11.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 17.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M11 6l9 0" } }, { tag: "path", attr: { d: "M11 12l9 0" } }, { tag: "path", attr: { d: "M11 18l9 0" } }] })(t);
|
|
502
496
|
}
|
|
503
|
-
function
|
|
497
|
+
function Yr(t) {
|
|
504
498
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M11 6h9" } }, { tag: "path", attr: { d: "M11 12h9" } }, { tag: "path", attr: { d: "M12 18h8" } }, { tag: "path", attr: { d: "M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4" } }, { tag: "path", attr: { d: "M6 10v-6l-2 2" } }] })(t);
|
|
505
499
|
}
|
|
506
|
-
function
|
|
500
|
+
function Xr(t) {
|
|
507
501
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M9 6l11 0" } }, { tag: "path", attr: { d: "M9 12l11 0" } }, { tag: "path", attr: { d: "M9 18l11 0" } }, { tag: "path", attr: { d: "M5 6l0 .01" } }, { tag: "path", attr: { d: "M5 12l0 .01" } }, { tag: "path", attr: { d: "M5 18l0 .01" } }] })(t);
|
|
508
502
|
}
|
|
509
|
-
function
|
|
503
|
+
function Vr(t) {
|
|
510
504
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M10 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5" } }, { tag: "path", attr: { d: "M19 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5" } }] })(t);
|
|
511
505
|
}
|
|
512
|
-
function
|
|
506
|
+
function Qr(t) {
|
|
513
507
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M5 12l14 0" } }, { tag: "path", attr: { d: "M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5" } }] })(t);
|
|
514
508
|
}
|
|
515
|
-
function
|
|
509
|
+
function Zr(t) {
|
|
516
510
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M5 7l8 10m-8 0l8 -10" } }, { tag: "path", attr: { d: "M21 20h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2" } }] })(t);
|
|
517
511
|
}
|
|
518
|
-
function
|
|
512
|
+
function tn(t) {
|
|
519
513
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M5 7l8 10m-8 0l8 -10" } }, { tag: "path", attr: { d: "M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2" } }] })(t);
|
|
520
514
|
}
|
|
521
|
-
function
|
|
515
|
+
function en(t) {
|
|
522
516
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z" } }, { tag: "path", attr: { d: "M4 10l16 0" } }, { tag: "path", attr: { d: "M10 4l0 16" } }] })(t);
|
|
523
517
|
}
|
|
524
|
-
function
|
|
518
|
+
function rn(t) {
|
|
525
519
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M9 15v-7a3 3 0 0 1 6 0v7" } }, { tag: "path", attr: { d: "M9 11h6" } }, { tag: "path", attr: { d: "M5 19h14" } }] })(t);
|
|
526
520
|
}
|
|
527
|
-
function
|
|
521
|
+
function nn(t) {
|
|
528
522
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 5v5a5 5 0 0 0 10 0v-5" } }, { tag: "path", attr: { d: "M5 19h14" } }] })(t);
|
|
529
523
|
}
|
|
530
|
-
const
|
|
524
|
+
const on = Tr("div", {
|
|
531
525
|
width: "10rem",
|
|
532
526
|
display: "flex"
|
|
533
527
|
}), he = {
|
|
@@ -536,30 +530,26 @@ const ln = xr("div", {
|
|
|
536
530
|
h2: "Overskrift 2",
|
|
537
531
|
h3: "Overskrift 3",
|
|
538
532
|
h4: "Overskrift 4",
|
|
539
|
-
h5: "Overskrift 5",
|
|
540
|
-
h6: "Overskrift 6",
|
|
541
533
|
number: "Nummerert liste",
|
|
542
534
|
paragraph: "Normal",
|
|
543
535
|
quote: "Sitat",
|
|
544
536
|
check: "Avkrysningsliste"
|
|
545
|
-
},
|
|
546
|
-
bullet: /* @__PURE__ */ n(
|
|
547
|
-
h1: /* @__PURE__ */ n(
|
|
537
|
+
}, an = {
|
|
538
|
+
bullet: /* @__PURE__ */ n(Xr, { size: "1.25rem" }),
|
|
539
|
+
h1: /* @__PURE__ */ n(Hr, { size: "1.25rem" }),
|
|
548
540
|
h2: /* @__PURE__ */ n(Ur, { size: "1.25rem" }),
|
|
549
541
|
h3: /* @__PURE__ */ n(Wr, { size: "1.25rem" }),
|
|
550
542
|
h4: /* @__PURE__ */ n(jr, { size: "1.25rem" }),
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
quote: /* @__PURE__ */ n(Zr, { size: "1.25rem" })
|
|
557
|
-
}, E = ({
|
|
543
|
+
number: /* @__PURE__ */ n(Yr, { size: "1.25rem" }),
|
|
544
|
+
check: /* @__PURE__ */ n(Jr, { size: "1.25rem" }),
|
|
545
|
+
paragraph: /* @__PURE__ */ n(Gr, { size: "1.25rem" }),
|
|
546
|
+
quote: /* @__PURE__ */ n(Vr, { size: "1.25rem" })
|
|
547
|
+
}, I = ({
|
|
558
548
|
blockType: t
|
|
559
|
-
}) => /* @__PURE__ */ h(
|
|
560
|
-
/* @__PURE__ */ n(
|
|
549
|
+
}) => /* @__PURE__ */ h(B, { children: [
|
|
550
|
+
/* @__PURE__ */ n(P, { css: { display: "flex", flex: "0 0 auto" }, children: an[t] }),
|
|
561
551
|
/* @__PURE__ */ n(
|
|
562
|
-
|
|
552
|
+
P,
|
|
563
553
|
{
|
|
564
554
|
css: {
|
|
565
555
|
flex: "1 1 auto",
|
|
@@ -570,31 +560,31 @@ const ln = xr("div", {
|
|
|
570
560
|
children: he[t]
|
|
571
561
|
}
|
|
572
562
|
)
|
|
573
|
-
] }),
|
|
574
|
-
if (!
|
|
563
|
+
] }), ln = (t) => {
|
|
564
|
+
if (!E(t))
|
|
575
565
|
return null;
|
|
576
566
|
const r = t.anchor.getNode();
|
|
577
567
|
let e = r.getKey() === "root" ? r : Wt(r, (o) => {
|
|
578
568
|
const i = o.getParent();
|
|
579
|
-
return i !== null &&
|
|
569
|
+
return i !== null && Ft(i);
|
|
580
570
|
});
|
|
581
571
|
return e === null && (e = r.getTopLevelElementOrThrow()), {
|
|
582
572
|
anchorNode: r,
|
|
583
573
|
element: e
|
|
584
574
|
};
|
|
585
|
-
},
|
|
575
|
+
}, sn = () => {
|
|
586
576
|
const [t] = w(), [r, e] = p("paragraph");
|
|
587
577
|
L(() => t.registerCommand(
|
|
588
578
|
Q,
|
|
589
579
|
() => {
|
|
590
|
-
const c =
|
|
580
|
+
const c = y(), u = ln(c);
|
|
591
581
|
if (!u)
|
|
592
582
|
return !1;
|
|
593
|
-
const { element: g, anchorNode:
|
|
583
|
+
const { element: g, anchorNode: C } = u, x = g.getKey();
|
|
594
584
|
if (t.getElementByKey(x) !== null)
|
|
595
585
|
if (kt(g)) {
|
|
596
586
|
const k = De(
|
|
597
|
-
|
|
587
|
+
C,
|
|
598
588
|
ft
|
|
599
589
|
), m = k ? k.getListType() : g.getListType();
|
|
600
590
|
e(m);
|
|
@@ -608,11 +598,11 @@ const ln = xr("div", {
|
|
|
608
598
|
), [t]);
|
|
609
599
|
const o = (c) => {
|
|
610
600
|
r !== c && t.update(() => {
|
|
611
|
-
const u =
|
|
612
|
-
|
|
601
|
+
const u = y();
|
|
602
|
+
E(u) && (ut(u, () => Ke(c)), e(c));
|
|
613
603
|
});
|
|
614
604
|
};
|
|
615
|
-
return /* @__PURE__ */ n(
|
|
605
|
+
return /* @__PURE__ */ n(on, { children: /* @__PURE__ */ h(
|
|
616
606
|
at,
|
|
617
607
|
{
|
|
618
608
|
trigger: /* @__PURE__ */ n(
|
|
@@ -620,7 +610,7 @@ const ln = xr("div", {
|
|
|
620
610
|
{
|
|
621
611
|
dropdown: !0,
|
|
622
612
|
css: { display: "flex", width: "100%", overflow: "hidden" },
|
|
623
|
-
children: /* @__PURE__ */ n(
|
|
613
|
+
children: /* @__PURE__ */ n(I, { blockType: r })
|
|
624
614
|
}
|
|
625
615
|
),
|
|
626
616
|
side: "bottom",
|
|
@@ -628,51 +618,49 @@ const ln = xr("div", {
|
|
|
628
618
|
children: [
|
|
629
619
|
/* @__PURE__ */ n(T, { onClick: () => {
|
|
630
620
|
r !== "paragraph" && t.update(() => {
|
|
631
|
-
const c =
|
|
632
|
-
|
|
621
|
+
const c = y();
|
|
622
|
+
E(c) && (ut(c, () => G()), e("paragraph"));
|
|
633
623
|
});
|
|
634
|
-
}, children: /* @__PURE__ */ n(
|
|
635
|
-
/* @__PURE__ */ n(T, { onClick: () => o("h1"), children: /* @__PURE__ */ n(
|
|
636
|
-
/* @__PURE__ */ n(T, { onClick: () => o("h2"), children: /* @__PURE__ */ n(
|
|
637
|
-
/* @__PURE__ */ n(T, { onClick: () => o("h3"), children: /* @__PURE__ */ n(
|
|
638
|
-
/* @__PURE__ */ n(T, { onClick: () => o("h4"), children: /* @__PURE__ */ n(
|
|
639
|
-
/* @__PURE__ */ n(T, { onClick: () => o("h5"), children: /* @__PURE__ */ n(E, { blockType: "h5" }) }),
|
|
640
|
-
/* @__PURE__ */ n(T, { onClick: () => o("h6"), children: /* @__PURE__ */ n(E, { blockType: "h6" }) }),
|
|
624
|
+
}, children: /* @__PURE__ */ n(I, { blockType: "paragraph" }) }),
|
|
625
|
+
/* @__PURE__ */ n(T, { onClick: () => o("h1"), children: /* @__PURE__ */ n(I, { blockType: "h1" }) }),
|
|
626
|
+
/* @__PURE__ */ n(T, { onClick: () => o("h2"), children: /* @__PURE__ */ n(I, { blockType: "h2" }) }),
|
|
627
|
+
/* @__PURE__ */ n(T, { onClick: () => o("h3"), children: /* @__PURE__ */ n(I, { blockType: "h3" }) }),
|
|
628
|
+
/* @__PURE__ */ n(T, { onClick: () => o("h4"), children: /* @__PURE__ */ n(I, { blockType: "h4" }) }),
|
|
641
629
|
/* @__PURE__ */ n(T, { onClick: () => {
|
|
642
|
-
r !== "bullet" && (t.dispatchCommand(
|
|
643
|
-
}, children: /* @__PURE__ */ n(
|
|
630
|
+
r !== "bullet" && (t.dispatchCommand(He, void 0), e("bullet"));
|
|
631
|
+
}, children: /* @__PURE__ */ n(I, { blockType: "bullet" }) }),
|
|
644
632
|
/* @__PURE__ */ n(T, { onClick: () => {
|
|
645
633
|
r !== "number" && (t.dispatchCommand(Ue, void 0), e("number"));
|
|
646
|
-
}, children: /* @__PURE__ */ n(
|
|
634
|
+
}, children: /* @__PURE__ */ n(I, { blockType: "number" }) }),
|
|
647
635
|
/* @__PURE__ */ n(T, { onClick: () => {
|
|
648
636
|
r !== "check" && (t.dispatchCommand(Gt, void 0), e("check"));
|
|
649
|
-
}, children: /* @__PURE__ */ n(
|
|
637
|
+
}, children: /* @__PURE__ */ n(I, { blockType: "check" }) }),
|
|
650
638
|
/* @__PURE__ */ n(T, { onClick: () => {
|
|
651
639
|
r !== "quote" && t.update(() => {
|
|
652
|
-
const c =
|
|
653
|
-
|
|
640
|
+
const c = y();
|
|
641
|
+
E(c) && (ut(c, () => Ge()), e("quote"));
|
|
654
642
|
});
|
|
655
|
-
}, children: /* @__PURE__ */ n(
|
|
643
|
+
}, children: /* @__PURE__ */ n(I, { blockType: "quote" }) })
|
|
656
644
|
]
|
|
657
645
|
}
|
|
658
646
|
) });
|
|
659
|
-
},
|
|
660
|
-
const [t] = w(), [r, e] = p(!1), [o, i] = p(!1), [a, l] = p(!1), [s, d] = p(!1), [c, u] = p(!1), [g,
|
|
661
|
-
const b =
|
|
662
|
-
|
|
647
|
+
}, cn = () => {
|
|
648
|
+
const [t] = w(), [r, e] = p(!1), [o, i] = p(!1), [a, l] = p(!1), [s, d] = p(!1), [c, u] = p(!1), [g, C] = p(!1), [x, _] = p(!1), [k, m] = p(""), [v, N] = p(!1), R = M(() => {
|
|
649
|
+
const b = y();
|
|
650
|
+
E(b) && (e(b.hasFormat("bold")), i(b.hasFormat("italic")), l(b.hasFormat("underline")), d(b.hasFormat("strikethrough")), u(b.hasFormat("code")), C(b.hasFormat("superscript")), _(b.hasFormat("subscript")), m(ze(b, "color", "")));
|
|
663
651
|
}, []);
|
|
664
652
|
L(() => ot(
|
|
665
653
|
t.registerCommand(
|
|
666
654
|
Q,
|
|
667
|
-
() => (
|
|
655
|
+
() => (R(), !1),
|
|
668
656
|
q
|
|
669
657
|
),
|
|
670
658
|
t.registerUpdateListener(({ editorState: b }) => {
|
|
671
659
|
b.read(() => {
|
|
672
|
-
|
|
660
|
+
R();
|
|
673
661
|
});
|
|
674
662
|
})
|
|
675
|
-
), [t,
|
|
663
|
+
), [t, R]);
|
|
676
664
|
const Y = M(
|
|
677
665
|
() => t.dispatchCommand(A, "bold"),
|
|
678
666
|
[t]
|
|
@@ -691,10 +679,10 @@ const ln = xr("div", {
|
|
|
691
679
|
), be = M(
|
|
692
680
|
() => t.dispatchCommand(A, "superscript"),
|
|
693
681
|
[t]
|
|
694
|
-
),
|
|
682
|
+
), Ce = M(
|
|
695
683
|
() => t.dispatchCommand(A, "subscript"),
|
|
696
684
|
[t]
|
|
697
|
-
),
|
|
685
|
+
), _t = Qt(() => {
|
|
698
686
|
const b = [];
|
|
699
687
|
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;
|
|
700
688
|
}, [
|
|
@@ -707,22 +695,22 @@ const ln = xr("div", {
|
|
|
707
695
|
s,
|
|
708
696
|
k
|
|
709
697
|
]);
|
|
710
|
-
return /* @__PURE__ */ h(
|
|
698
|
+
return /* @__PURE__ */ h(B, { children: [
|
|
711
699
|
/* @__PURE__ */ h(
|
|
712
700
|
et,
|
|
713
701
|
{
|
|
714
702
|
type: "multiple",
|
|
715
703
|
"aria-label": "Tekstformattering",
|
|
716
|
-
value:
|
|
704
|
+
value: _t,
|
|
717
705
|
children: [
|
|
718
|
-
/* @__PURE__ */ n(O, { onClick: Y, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ n(
|
|
706
|
+
/* @__PURE__ */ n(O, { onClick: Y, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ n(Br, { size: "1.25rem" }) }),
|
|
719
707
|
/* @__PURE__ */ n(
|
|
720
708
|
O,
|
|
721
709
|
{
|
|
722
710
|
onClick: Z,
|
|
723
711
|
title: "Kursiv tekst",
|
|
724
712
|
value: "italic",
|
|
725
|
-
children: /* @__PURE__ */ n(
|
|
713
|
+
children: /* @__PURE__ */ n(Kr, { size: "1.25rem" })
|
|
726
714
|
}
|
|
727
715
|
),
|
|
728
716
|
/* @__PURE__ */ n(
|
|
@@ -731,20 +719,20 @@ const ln = xr("div", {
|
|
|
731
719
|
onClick: me,
|
|
732
720
|
title: "Understreket tekst",
|
|
733
721
|
value: "underline",
|
|
734
|
-
children: /* @__PURE__ */ n(
|
|
722
|
+
children: /* @__PURE__ */ n(nn, { size: "1.25rem" })
|
|
735
723
|
}
|
|
736
724
|
)
|
|
737
725
|
]
|
|
738
726
|
}
|
|
739
727
|
),
|
|
740
|
-
/* @__PURE__ */ h(Zt, { open:
|
|
728
|
+
/* @__PURE__ */ h(Zt, { open: v, onOpenChange: N, children: [
|
|
741
729
|
/* @__PURE__ */ n(te, { children: /* @__PURE__ */ n(lt, { children: /* @__PURE__ */ n(dr, { size: "1.25rem" }) }) }),
|
|
742
730
|
/* @__PURE__ */ n(ee, { children: /* @__PURE__ */ h(
|
|
743
731
|
et,
|
|
744
732
|
{
|
|
745
733
|
type: "multiple",
|
|
746
734
|
"aria-label": "Tekstformattering",
|
|
747
|
-
value:
|
|
735
|
+
value: _t,
|
|
748
736
|
css: { margin: "$1" },
|
|
749
737
|
children: [
|
|
750
738
|
/* @__PURE__ */ n(
|
|
@@ -753,7 +741,7 @@ const ln = xr("div", {
|
|
|
753
741
|
onClick: fe,
|
|
754
742
|
title: "Gjennomstreking",
|
|
755
743
|
value: "strikethrough",
|
|
756
|
-
children: /* @__PURE__ */ n(
|
|
744
|
+
children: /* @__PURE__ */ n(Qr, { size: "1.25rem" })
|
|
757
745
|
}
|
|
758
746
|
),
|
|
759
747
|
/* @__PURE__ */ n(
|
|
@@ -762,40 +750,40 @@ const ln = xr("div", {
|
|
|
762
750
|
onClick: be,
|
|
763
751
|
title: "Superscript",
|
|
764
752
|
value: "superscript",
|
|
765
|
-
children: /* @__PURE__ */ n(
|
|
753
|
+
children: /* @__PURE__ */ n(tn, { size: "1.25rem" })
|
|
766
754
|
}
|
|
767
755
|
),
|
|
768
756
|
/* @__PURE__ */ n(
|
|
769
757
|
O,
|
|
770
758
|
{
|
|
771
|
-
onClick:
|
|
759
|
+
onClick: Ce,
|
|
772
760
|
title: "Subscript",
|
|
773
761
|
value: "subscript",
|
|
774
|
-
children: /* @__PURE__ */ n(
|
|
762
|
+
children: /* @__PURE__ */ n(Zr, { size: "1.25rem" })
|
|
775
763
|
}
|
|
776
764
|
),
|
|
777
|
-
/* @__PURE__ */ n(O, { onClick: ke, title: "Kode", value: "code", children: /* @__PURE__ */ n(
|
|
778
|
-
/* @__PURE__ */ n(
|
|
765
|
+
/* @__PURE__ */ n(O, { onClick: ke, title: "Kode", value: "code", children: /* @__PURE__ */ n(Fr, { size: "1.25rem" }) }),
|
|
766
|
+
/* @__PURE__ */ n(hn, { activeColor: k })
|
|
779
767
|
]
|
|
780
768
|
}
|
|
781
769
|
) })
|
|
782
770
|
] })
|
|
783
771
|
] });
|
|
784
|
-
},
|
|
772
|
+
}, dn = [
|
|
785
773
|
{ name: "Reset", value: "" },
|
|
786
774
|
{ name: "Rød", value: "#df2222" },
|
|
787
775
|
{ name: "Grønn", value: "#1ca021" },
|
|
788
776
|
{ name: "Blå", value: "#2044b8" },
|
|
789
777
|
{ name: "Lilla", value: "#9c31de" }
|
|
790
|
-
],
|
|
778
|
+
], hn = ({ activeColor: t }) => {
|
|
791
779
|
const [r] = w(), [e, o] = p(!1), i = (a) => {
|
|
792
780
|
r.update(() => {
|
|
793
|
-
const l =
|
|
781
|
+
const l = y();
|
|
794
782
|
l && $e(l, { color: a });
|
|
795
783
|
});
|
|
796
784
|
};
|
|
797
785
|
return /* @__PURE__ */ h(Zt, { open: e, onOpenChange: o, children: [
|
|
798
|
-
/* @__PURE__ */ n(te, { children: /* @__PURE__ */ n(O, { value: "color", title: "Tekstfarge", children: /* @__PURE__ */ n(
|
|
786
|
+
/* @__PURE__ */ n(te, { children: /* @__PURE__ */ n(O, { value: "color", title: "Tekstfarge", children: /* @__PURE__ */ n(rn, { size: "1.25rem" }) }) }),
|
|
799
787
|
/* @__PURE__ */ n(ee, { children: /* @__PURE__ */ n(
|
|
800
788
|
et,
|
|
801
789
|
{
|
|
@@ -803,7 +791,7 @@ const ln = xr("div", {
|
|
|
803
791
|
"aria-label": "Tekstfarge",
|
|
804
792
|
value: t,
|
|
805
793
|
css: { margin: "$1" },
|
|
806
|
-
children:
|
|
794
|
+
children: dn.map((a) => /* @__PURE__ */ n(
|
|
807
795
|
O,
|
|
808
796
|
{
|
|
809
797
|
value: a.value,
|
|
@@ -811,7 +799,7 @@ const ln = xr("div", {
|
|
|
811
799
|
!a.value || a.value === t ? null : a.value
|
|
812
800
|
),
|
|
813
801
|
children: a.value ? /* @__PURE__ */ n(
|
|
814
|
-
|
|
802
|
+
P,
|
|
815
803
|
{
|
|
816
804
|
css: {
|
|
817
805
|
width: "1rem",
|
|
@@ -834,12 +822,12 @@ const ln = xr("div", {
|
|
|
834
822
|
}
|
|
835
823
|
) })
|
|
836
824
|
] });
|
|
837
|
-
},
|
|
838
|
-
const { hasFocus: r, editorRef: e } =
|
|
825
|
+
}, un = ({ children: t }) => {
|
|
826
|
+
const { hasFocus: r, editorRef: e } = F(), o = r, [i, a] = p(o);
|
|
839
827
|
tr(() => {
|
|
840
828
|
a(o);
|
|
841
829
|
}, [o]);
|
|
842
|
-
const { context: l, refs: s, floatingStyles: d } =
|
|
830
|
+
const { context: l, refs: s, floatingStyles: d } = Ct({
|
|
843
831
|
placement: "top",
|
|
844
832
|
whileElementsMounted: oe,
|
|
845
833
|
middleware: [
|
|
@@ -848,11 +836,11 @@ const ln = xr("div", {
|
|
|
848
836
|
g.floating.style.minWidth = `${u.reference.width}px`;
|
|
849
837
|
}
|
|
850
838
|
}),
|
|
851
|
-
|
|
839
|
+
Cr(),
|
|
852
840
|
ie({
|
|
853
841
|
mainAxis: 8
|
|
854
842
|
}),
|
|
855
|
-
|
|
843
|
+
vr({
|
|
856
844
|
padding: 8
|
|
857
845
|
})
|
|
858
846
|
],
|
|
@@ -878,20 +866,20 @@ const ln = xr("div", {
|
|
|
878
866
|
overflow: "hidden",
|
|
879
867
|
boxShadow: "$md"
|
|
880
868
|
},
|
|
881
|
-
children: /* @__PURE__ */ n(
|
|
869
|
+
children: /* @__PURE__ */ n(gn, { children: t })
|
|
882
870
|
}
|
|
883
871
|
) }) : null;
|
|
884
|
-
},
|
|
872
|
+
}, gn = ({
|
|
885
873
|
children: t,
|
|
886
874
|
...r
|
|
887
875
|
}) => /* @__PURE__ */ h(rr, { "aria-label": "Formattering", ...r, children: [
|
|
888
|
-
/* @__PURE__ */ n(
|
|
876
|
+
/* @__PURE__ */ n(sn, {}),
|
|
889
877
|
/* @__PURE__ */ n(Rt, {}),
|
|
890
|
-
/* @__PURE__ */ n(
|
|
878
|
+
/* @__PURE__ */ n(cn, {}),
|
|
891
879
|
/* @__PURE__ */ n(Rt, {}),
|
|
892
880
|
t
|
|
893
881
|
] });
|
|
894
|
-
function
|
|
882
|
+
function pn() {
|
|
895
883
|
const [t] = w();
|
|
896
884
|
return L(() => ot(
|
|
897
885
|
t.registerCommand(
|
|
@@ -905,12 +893,12 @@ function fn() {
|
|
|
905
893
|
D
|
|
906
894
|
),
|
|
907
895
|
t.registerCommand(
|
|
908
|
-
|
|
896
|
+
_e,
|
|
909
897
|
(r) => At(r, t, !0),
|
|
910
898
|
D
|
|
911
899
|
),
|
|
912
900
|
t.registerCommand(
|
|
913
|
-
|
|
901
|
+
Ht,
|
|
914
902
|
(r) => {
|
|
915
903
|
if (pt() != null) {
|
|
916
904
|
const o = t.getRootElement();
|
|
@@ -921,7 +909,7 @@ function fn() {
|
|
|
921
909
|
D
|
|
922
910
|
),
|
|
923
911
|
t.registerCommand(
|
|
924
|
-
|
|
912
|
+
ye,
|
|
925
913
|
(r) => {
|
|
926
914
|
const e = pt();
|
|
927
915
|
return e != null && t.isEditable() ? (t.update(() => {
|
|
@@ -934,8 +922,8 @@ function fn() {
|
|
|
934
922
|
t.registerCommand(
|
|
935
923
|
Se,
|
|
936
924
|
(r) => t.getEditorState().read(() => {
|
|
937
|
-
const e =
|
|
938
|
-
if (
|
|
925
|
+
const e = y();
|
|
926
|
+
if (E(e) && e.isCollapsed()) {
|
|
939
927
|
const { anchor: o } = e, i = o.type === "element";
|
|
940
928
|
if (i || o.offset === 0) {
|
|
941
929
|
const a = o.getNode(), l = Wt(
|
|
@@ -976,7 +964,7 @@ function ue(t, r) {
|
|
|
976
964
|
}
|
|
977
965
|
function zt(t) {
|
|
978
966
|
ue(t, () => {
|
|
979
|
-
const r = t.target, e =
|
|
967
|
+
const r = t.target, e = mn(r);
|
|
980
968
|
e != null && e.isEditable() && e.update(() => {
|
|
981
969
|
if (t.target) {
|
|
982
970
|
const o = mt(r);
|
|
@@ -990,7 +978,7 @@ function $t(t) {
|
|
|
990
978
|
t.preventDefault();
|
|
991
979
|
});
|
|
992
980
|
}
|
|
993
|
-
function
|
|
981
|
+
function mn(t) {
|
|
994
982
|
let r = t;
|
|
995
983
|
for (; r; ) {
|
|
996
984
|
if (r.__lexicalEditor)
|
|
@@ -1004,7 +992,7 @@ function pt() {
|
|
|
1004
992
|
return t != null && t.tagName === "LI" && t.parentNode != null && // @ts-ignore internal field
|
|
1005
993
|
t.parentNode.__lexicalListType === "check" ? t : null;
|
|
1006
994
|
}
|
|
1007
|
-
function
|
|
995
|
+
function fn(t, r) {
|
|
1008
996
|
let e = r ? t.getPreviousSibling() : t.getNextSibling(), o = t;
|
|
1009
997
|
for (; e == null && j(o); )
|
|
1010
998
|
o = o.getParentOrThrow().getParent(), o != null && (e = r ? o.getPreviousSibling() : o.getNextSibling());
|
|
@@ -1022,7 +1010,7 @@ function At(t, r, e) {
|
|
|
1022
1010
|
const i = mt(o);
|
|
1023
1011
|
if (!j(i))
|
|
1024
1012
|
return;
|
|
1025
|
-
const a =
|
|
1013
|
+
const a = fn(i, e);
|
|
1026
1014
|
if (a != null) {
|
|
1027
1015
|
a.selectStart();
|
|
1028
1016
|
const l = r.getElementByKey(a.__key);
|
|
@@ -1033,32 +1021,32 @@ function At(t, r, e) {
|
|
|
1033
1021
|
}), !1;
|
|
1034
1022
|
}
|
|
1035
1023
|
const Lt = Ee("INSERT_IMAGE_COMMAND");
|
|
1036
|
-
function
|
|
1037
|
-
const [t] =
|
|
1024
|
+
function kn() {
|
|
1025
|
+
const [t] = vt();
|
|
1038
1026
|
return L(() => {
|
|
1039
|
-
if (!t.hasNodes([
|
|
1027
|
+
if (!t.hasNodes([H]))
|
|
1040
1028
|
throw new Error("ImagePlugin: ImageNode not registered on editor");
|
|
1041
1029
|
return ot(
|
|
1042
1030
|
t.registerCommand(
|
|
1043
1031
|
Lt,
|
|
1044
1032
|
(r) => {
|
|
1045
|
-
const e =
|
|
1046
|
-
return Re([e]),
|
|
1033
|
+
const e = Tt(r);
|
|
1034
|
+
return Re([e]), Ft(e.getParentOrThrow()) && Pe(e, G).selectEnd(), !0;
|
|
1047
1035
|
},
|
|
1048
1036
|
q
|
|
1049
1037
|
)
|
|
1050
1038
|
);
|
|
1051
1039
|
}, [t]), null;
|
|
1052
1040
|
}
|
|
1053
|
-
const
|
|
1041
|
+
const bn = () => /* @__PURE__ */ h(B, { children: [
|
|
1054
1042
|
/* @__PURE__ */ n(wr, {}),
|
|
1055
|
-
/* @__PURE__ */ n(_r, {}),
|
|
1056
1043
|
/* @__PURE__ */ n(yr, {}),
|
|
1057
|
-
/* @__PURE__ */ n(
|
|
1044
|
+
/* @__PURE__ */ n(_r, {}),
|
|
1045
|
+
/* @__PURE__ */ n(pn, {}),
|
|
1058
1046
|
/* @__PURE__ */ n(Nr, {}),
|
|
1059
|
-
/* @__PURE__ */ n(
|
|
1047
|
+
/* @__PURE__ */ n(kn, {}),
|
|
1060
1048
|
/* @__PURE__ */ n(Sr, {})
|
|
1061
|
-
] }),
|
|
1049
|
+
] }), Cn = ({
|
|
1062
1050
|
state: t
|
|
1063
1051
|
}) => {
|
|
1064
1052
|
const [r] = w(), e = J(!1);
|
|
@@ -1069,7 +1057,7 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1069
1057
|
t.isEmpty() ? Ir(r) : r.setEditorState(t);
|
|
1070
1058
|
return;
|
|
1071
1059
|
}
|
|
1072
|
-
if (typeof t == "string" && !
|
|
1060
|
+
if (typeof t == "string" && !xt(t)) {
|
|
1073
1061
|
Or(t, r);
|
|
1074
1062
|
return;
|
|
1075
1063
|
}
|
|
@@ -1080,7 +1068,7 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1080
1068
|
}
|
|
1081
1069
|
}));
|
|
1082
1070
|
}, []), null;
|
|
1083
|
-
},
|
|
1071
|
+
}, vn = nr("div", {
|
|
1084
1072
|
border: "1px solid $borderDarker",
|
|
1085
1073
|
borderRadius: "$md",
|
|
1086
1074
|
position: "relative",
|
|
@@ -1117,10 +1105,10 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1117
1105
|
}
|
|
1118
1106
|
}
|
|
1119
1107
|
]
|
|
1120
|
-
}),
|
|
1108
|
+
}), Mn = ({
|
|
1121
1109
|
isLoading: t
|
|
1122
1110
|
}) => /* @__PURE__ */ n(
|
|
1123
|
-
|
|
1111
|
+
P,
|
|
1124
1112
|
{
|
|
1125
1113
|
css: {
|
|
1126
1114
|
visibility: t ? "visible" : "hidden",
|
|
@@ -1131,7 +1119,7 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1131
1119
|
},
|
|
1132
1120
|
children: /* @__PURE__ */ n(st, {})
|
|
1133
1121
|
}
|
|
1134
|
-
),
|
|
1122
|
+
), co = ({
|
|
1135
1123
|
isLoading: t,
|
|
1136
1124
|
children: r,
|
|
1137
1125
|
placeholderText: e,
|
|
@@ -1144,31 +1132,31 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1144
1132
|
onBlur: c,
|
|
1145
1133
|
defaultState: u,
|
|
1146
1134
|
css: g,
|
|
1147
|
-
signUrl:
|
|
1135
|
+
signUrl: C,
|
|
1148
1136
|
fileUpload: x,
|
|
1149
|
-
editable:
|
|
1137
|
+
editable: _ = !0
|
|
1150
1138
|
}) => {
|
|
1151
|
-
const { hasFocus: k, attributes: m } = zr({ onBlur: c }),
|
|
1152
|
-
() => ({ hasFocus: k, editorRef:
|
|
1153
|
-
[k,
|
|
1139
|
+
const { hasFocus: k, attributes: m } = zr({ onBlur: c }), v = J(null), N = Qt(
|
|
1140
|
+
() => ({ hasFocus: k, editorRef: v, signUrl: C, fileUpload: x }),
|
|
1141
|
+
[k, C, x]
|
|
1154
1142
|
);
|
|
1155
1143
|
return /* @__PURE__ */ n(de.Provider, { value: N, children: /* @__PURE__ */ h(
|
|
1156
1144
|
mr,
|
|
1157
1145
|
{
|
|
1158
1146
|
initialConfig: {
|
|
1159
1147
|
namespace: "ain-rich-text",
|
|
1160
|
-
onError: (
|
|
1161
|
-
console.error(
|
|
1148
|
+
onError: (R) => {
|
|
1149
|
+
console.error(R);
|
|
1162
1150
|
},
|
|
1163
1151
|
theme: Mt,
|
|
1164
1152
|
nodes: o,
|
|
1165
|
-
editable:
|
|
1153
|
+
editable: _
|
|
1166
1154
|
},
|
|
1167
1155
|
children: [
|
|
1168
1156
|
/* @__PURE__ */ h(
|
|
1169
|
-
|
|
1157
|
+
vn,
|
|
1170
1158
|
{
|
|
1171
|
-
ref:
|
|
1159
|
+
ref: v,
|
|
1172
1160
|
hasFocus: k,
|
|
1173
1161
|
hideBorder: d,
|
|
1174
1162
|
css: g,
|
|
@@ -1180,7 +1168,7 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1180
1168
|
{
|
|
1181
1169
|
contentEditable: s,
|
|
1182
1170
|
placeholder: e ? /* @__PURE__ */ n(
|
|
1183
|
-
|
|
1171
|
+
P,
|
|
1184
1172
|
{
|
|
1185
1173
|
css: {
|
|
1186
1174
|
position: "absolute",
|
|
@@ -1196,19 +1184,19 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1196
1184
|
ErrorBoundary: kr
|
|
1197
1185
|
}
|
|
1198
1186
|
),
|
|
1199
|
-
/* @__PURE__ */ n(
|
|
1187
|
+
/* @__PURE__ */ n(bn, {}),
|
|
1200
1188
|
i,
|
|
1201
|
-
/* @__PURE__ */ n(
|
|
1202
|
-
|
|
1189
|
+
/* @__PURE__ */ n(Mn, { isLoading: t }),
|
|
1190
|
+
_ && !a && /* @__PURE__ */ n(un, { children: l })
|
|
1203
1191
|
]
|
|
1204
1192
|
}
|
|
1205
1193
|
),
|
|
1206
|
-
/* @__PURE__ */ n(
|
|
1207
|
-
/* @__PURE__ */ n(
|
|
1194
|
+
/* @__PURE__ */ n(Cn, { state: u }),
|
|
1195
|
+
/* @__PURE__ */ n(B, { children: r })
|
|
1208
1196
|
]
|
|
1209
1197
|
}
|
|
1210
1198
|
) });
|
|
1211
|
-
},
|
|
1199
|
+
}, xn = {
|
|
1212
1200
|
lineHeight: "1.5",
|
|
1213
1201
|
whiteSpace: "pre-wrap",
|
|
1214
1202
|
wordBreak: "break-word",
|
|
@@ -1418,7 +1406,7 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1418
1406
|
defaultVariants: {
|
|
1419
1407
|
size: "md"
|
|
1420
1408
|
}
|
|
1421
|
-
},
|
|
1409
|
+
}, ho = Lr(xn), Tn = ({
|
|
1422
1410
|
fileUpload: t,
|
|
1423
1411
|
...r
|
|
1424
1412
|
}) => {
|
|
@@ -1428,8 +1416,8 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1428
1416
|
if (d) {
|
|
1429
1417
|
const u = new Image(), g = window.URL.createObjectURL(d);
|
|
1430
1418
|
u.onload = async () => {
|
|
1431
|
-
const
|
|
1432
|
-
i({ url:
|
|
1419
|
+
const C = await t.uploadFile({ file: d });
|
|
1420
|
+
i({ url: C, width: u.naturalWidth, height: u.naturalHeight }), window.URL.revokeObjectURL(g);
|
|
1433
1421
|
}, u.src = g;
|
|
1434
1422
|
}
|
|
1435
1423
|
}, l = () => {
|
|
@@ -1464,15 +1452,15 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1464
1452
|
)
|
|
1465
1453
|
] })
|
|
1466
1454
|
] });
|
|
1467
|
-
},
|
|
1468
|
-
const [t] = w(), { fileUpload: r } =
|
|
1455
|
+
}, uo = () => {
|
|
1456
|
+
const [t] = w(), { fileUpload: r } = F(), [e, o] = p(!1), i = M(() => {
|
|
1469
1457
|
t.dispatchCommand(Je, {
|
|
1470
1458
|
rows: "3",
|
|
1471
1459
|
columns: "3",
|
|
1472
1460
|
includeHeaders: !1
|
|
1473
1461
|
});
|
|
1474
1462
|
}, [t]);
|
|
1475
|
-
return /* @__PURE__ */ h(
|
|
1463
|
+
return /* @__PURE__ */ h(B, { children: [
|
|
1476
1464
|
/* @__PURE__ */ h(
|
|
1477
1465
|
at,
|
|
1478
1466
|
{
|
|
@@ -1481,7 +1469,7 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1481
1469
|
align: "end",
|
|
1482
1470
|
children: [
|
|
1483
1471
|
/* @__PURE__ */ h(T, { onClick: i, children: [
|
|
1484
|
-
/* @__PURE__ */ n(
|
|
1472
|
+
/* @__PURE__ */ n(en, { size: "1.25rem" }),
|
|
1485
1473
|
" Tabell"
|
|
1486
1474
|
] }),
|
|
1487
1475
|
r && /* @__PURE__ */ h(T, { onClick: () => o(!0), children: [
|
|
@@ -1492,7 +1480,7 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1492
1480
|
}
|
|
1493
1481
|
),
|
|
1494
1482
|
r && /* @__PURE__ */ n(
|
|
1495
|
-
|
|
1483
|
+
Tn,
|
|
1496
1484
|
{
|
|
1497
1485
|
open: e,
|
|
1498
1486
|
onOpenChange: o,
|
|
@@ -1501,15 +1489,15 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1501
1489
|
)
|
|
1502
1490
|
] });
|
|
1503
1491
|
};
|
|
1504
|
-
function
|
|
1492
|
+
function Ln(t) {
|
|
1505
1493
|
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);
|
|
1506
1494
|
}
|
|
1507
|
-
const
|
|
1508
|
-
const [t] = w(), [r, e] = p(null), { hasFocus: o } =
|
|
1495
|
+
const go = () => {
|
|
1496
|
+
const [t] = w(), [r, e] = p(null), { hasFocus: o } = F();
|
|
1509
1497
|
L(() => {
|
|
1510
1498
|
!o && r && e(null);
|
|
1511
1499
|
}, [o, r]);
|
|
1512
|
-
const { refs: i, floatingStyles: a } =
|
|
1500
|
+
const { refs: i, floatingStyles: a } = Ct({
|
|
1513
1501
|
placement: "top-end",
|
|
1514
1502
|
open: !!r,
|
|
1515
1503
|
elements: {
|
|
@@ -1520,8 +1508,8 @@ const mo = () => {
|
|
|
1520
1508
|
L(() => t.registerCommand(
|
|
1521
1509
|
Q,
|
|
1522
1510
|
() => {
|
|
1523
|
-
const s =
|
|
1524
|
-
if (
|
|
1511
|
+
const s = y();
|
|
1512
|
+
if (E(s)) {
|
|
1525
1513
|
const d = s.anchor.getNode(), c = Ye(d);
|
|
1526
1514
|
e(c ? t.getElementByKey(c.getKey()) : null);
|
|
1527
1515
|
}
|
|
@@ -1565,7 +1553,7 @@ const mo = () => {
|
|
|
1565
1553
|
ref: i.setFloating,
|
|
1566
1554
|
style: a,
|
|
1567
1555
|
css: { padding: "2px", width: "18px", height: "18px" },
|
|
1568
|
-
children: /* @__PURE__ */ n(
|
|
1556
|
+
children: /* @__PURE__ */ n(Ln, {})
|
|
1569
1557
|
}
|
|
1570
1558
|
),
|
|
1571
1559
|
children: [
|
|
@@ -1588,9 +1576,9 @@ function wt(t) {
|
|
|
1588
1576
|
}
|
|
1589
1577
|
function ge(t) {
|
|
1590
1578
|
const r = t.anchor, e = t.focus, o = t.anchor.getNode(), i = t.focus.getNode();
|
|
1591
|
-
return o === i ? o : t.isBackward() ?
|
|
1579
|
+
return o === i ? o : t.isBackward() ? yt(e) ? o : i : yt(r) ? o : i;
|
|
1592
1580
|
}
|
|
1593
|
-
const
|
|
1581
|
+
const po = (t) => (K.baseURL = t, K), X = class X extends W {
|
|
1594
1582
|
static getType() {
|
|
1595
1583
|
return "rutine_link";
|
|
1596
1584
|
}
|
|
@@ -1625,15 +1613,15 @@ let K = X;
|
|
|
1625
1613
|
function pe(t) {
|
|
1626
1614
|
return new K(t);
|
|
1627
1615
|
}
|
|
1628
|
-
function
|
|
1616
|
+
function wn(t) {
|
|
1629
1617
|
return t instanceof K;
|
|
1630
1618
|
}
|
|
1631
|
-
const
|
|
1619
|
+
const _n = ({ onClose: t }) => {
|
|
1632
1620
|
const [r] = w(), e = M(
|
|
1633
1621
|
(i) => {
|
|
1634
1622
|
r.update(() => {
|
|
1635
|
-
const a =
|
|
1636
|
-
if (
|
|
1623
|
+
const a = y();
|
|
1624
|
+
if (E(a) && a.isCollapsed()) {
|
|
1637
1625
|
const l = z(i);
|
|
1638
1626
|
a.insertNodes([l]);
|
|
1639
1627
|
const s = Ut();
|
|
@@ -1653,7 +1641,7 @@ const Sn = ({ onClose: t }) => {
|
|
|
1653
1641
|
/* @__PURE__ */ n(S, { type: "submit", variant: "primary", children: "Sett inn" })
|
|
1654
1642
|
] })
|
|
1655
1643
|
] });
|
|
1656
|
-
},
|
|
1644
|
+
}, yn = ({
|
|
1657
1645
|
onClose: t,
|
|
1658
1646
|
getDocs: r
|
|
1659
1647
|
}) => {
|
|
@@ -1671,12 +1659,12 @@ const Sn = ({ onClose: t }) => {
|
|
|
1671
1659
|
const d = M(
|
|
1672
1660
|
(c) => {
|
|
1673
1661
|
e.update(() => {
|
|
1674
|
-
const u =
|
|
1675
|
-
if (
|
|
1662
|
+
const u = y();
|
|
1663
|
+
if (E(u)) {
|
|
1676
1664
|
const g = [];
|
|
1677
|
-
for (const [
|
|
1678
|
-
const
|
|
1679
|
-
|
|
1665
|
+
for (const [C, x] of c.entries()) {
|
|
1666
|
+
const _ = pe(x.value);
|
|
1667
|
+
_.append(z(x.label)), g.push(_), C !== c.length - 1 && g.push(z(" "));
|
|
1680
1668
|
}
|
|
1681
1669
|
u.insertNodes(g);
|
|
1682
1670
|
}
|
|
@@ -1684,7 +1672,7 @@ const Sn = ({ onClose: t }) => {
|
|
|
1684
1672
|
},
|
|
1685
1673
|
[e]
|
|
1686
1674
|
);
|
|
1687
|
-
return /* @__PURE__ */ h(
|
|
1675
|
+
return /* @__PURE__ */ h(B, { children: [
|
|
1688
1676
|
!i && /* @__PURE__ */ n(st, {}),
|
|
1689
1677
|
i && /* @__PURE__ */ n(
|
|
1690
1678
|
ar,
|
|
@@ -1708,7 +1696,7 @@ const Sn = ({ onClose: t }) => {
|
|
|
1708
1696
|
)
|
|
1709
1697
|
] })
|
|
1710
1698
|
] });
|
|
1711
|
-
},
|
|
1699
|
+
}, Sn = ({
|
|
1712
1700
|
onClose: t,
|
|
1713
1701
|
fileUpload: r,
|
|
1714
1702
|
filePrefix: e
|
|
@@ -1727,8 +1715,8 @@ const Sn = ({ onClose: t }) => {
|
|
|
1727
1715
|
o.update(() => {
|
|
1728
1716
|
if (!i)
|
|
1729
1717
|
return;
|
|
1730
|
-
const d =
|
|
1731
|
-
if (
|
|
1718
|
+
const d = y();
|
|
1719
|
+
if (E(d) && d.isCollapsed()) {
|
|
1732
1720
|
const c = z(i.name);
|
|
1733
1721
|
d.insertNodes([c]);
|
|
1734
1722
|
const u = Ut();
|
|
@@ -1737,7 +1725,7 @@ const Sn = ({ onClose: t }) => {
|
|
|
1737
1725
|
o.dispatchCommand(it, wt(i.url));
|
|
1738
1726
|
});
|
|
1739
1727
|
}, [o, i]);
|
|
1740
|
-
return /* @__PURE__ */ h(
|
|
1728
|
+
return /* @__PURE__ */ h(B, { children: [
|
|
1741
1729
|
r.isLoading && /* @__PURE__ */ n(st, {}),
|
|
1742
1730
|
/* @__PURE__ */ n(
|
|
1743
1731
|
bt,
|
|
@@ -1762,13 +1750,13 @@ const Sn = ({ onClose: t }) => {
|
|
|
1762
1750
|
)
|
|
1763
1751
|
] })
|
|
1764
1752
|
] });
|
|
1765
|
-
},
|
|
1753
|
+
}, Nn = ({
|
|
1766
1754
|
open: t,
|
|
1767
1755
|
onOpenChange: r,
|
|
1768
1756
|
getDocs: e,
|
|
1769
1757
|
filePrefix: o
|
|
1770
1758
|
}) => {
|
|
1771
|
-
const { fileUpload: i } =
|
|
1759
|
+
const { fileUpload: i } = F(), [a, l] = p("url"), s = () => {
|
|
1772
1760
|
r(!1);
|
|
1773
1761
|
};
|
|
1774
1762
|
return /* @__PURE__ */ h(ne, { open: t, onOpenChange: r, css: { width: "600px" }, children: [
|
|
@@ -1784,10 +1772,10 @@ const Sn = ({ onClose: t }) => {
|
|
|
1784
1772
|
),
|
|
1785
1773
|
i && /* @__PURE__ */ n(gt, { active: a === "file", onClick: () => l("file"), children: "Fil" })
|
|
1786
1774
|
] }),
|
|
1787
|
-
a === "url" && /* @__PURE__ */ n(
|
|
1788
|
-
a === "rutine" && e && /* @__PURE__ */ n(
|
|
1775
|
+
a === "url" && /* @__PURE__ */ n(_n, { onClose: s }),
|
|
1776
|
+
a === "rutine" && e && /* @__PURE__ */ n(yn, { onClose: s, getDocs: e }),
|
|
1789
1777
|
a === "file" && i && /* @__PURE__ */ n(
|
|
1790
|
-
|
|
1778
|
+
Sn,
|
|
1791
1779
|
{
|
|
1792
1780
|
onClose: s,
|
|
1793
1781
|
fileUpload: i,
|
|
@@ -1795,13 +1783,13 @@ const Sn = ({ onClose: t }) => {
|
|
|
1795
1783
|
}
|
|
1796
1784
|
)
|
|
1797
1785
|
] });
|
|
1798
|
-
},
|
|
1786
|
+
}, mo = ({
|
|
1799
1787
|
getDocs: t,
|
|
1800
1788
|
filePrefix: r
|
|
1801
1789
|
}) => {
|
|
1802
1790
|
const [e] = w(), [o, i] = p(!1), [a, l] = p(!1), s = M(() => {
|
|
1803
|
-
const d =
|
|
1804
|
-
if (
|
|
1791
|
+
const d = y();
|
|
1792
|
+
if (E(d)) {
|
|
1805
1793
|
const c = ge(d), u = c.getParent();
|
|
1806
1794
|
i(tt(u) || tt(c));
|
|
1807
1795
|
}
|
|
@@ -1819,11 +1807,11 @@ const Sn = ({ onClose: t }) => {
|
|
|
1819
1807
|
},
|
|
1820
1808
|
title: "Lenke",
|
|
1821
1809
|
value: "link",
|
|
1822
|
-
children: /* @__PURE__ */ n(
|
|
1810
|
+
children: /* @__PURE__ */ n(qr, { size: "1.25rem" })
|
|
1823
1811
|
}
|
|
1824
1812
|
),
|
|
1825
1813
|
/* @__PURE__ */ n(
|
|
1826
|
-
|
|
1814
|
+
Nn,
|
|
1827
1815
|
{
|
|
1828
1816
|
open: a,
|
|
1829
1817
|
onOpenChange: l,
|
|
@@ -1832,14 +1820,14 @@ const Sn = ({ onClose: t }) => {
|
|
|
1832
1820
|
}
|
|
1833
1821
|
)
|
|
1834
1822
|
] });
|
|
1835
|
-
},
|
|
1836
|
-
const [t] = w(), r = J(null), [e, o] = p(null), [i, a] = p(""), { hasFocus: l } =
|
|
1823
|
+
}, fo = () => {
|
|
1824
|
+
const [t] = w(), r = J(null), [e, o] = p(null), [i, a] = p(""), { hasFocus: l } = F();
|
|
1837
1825
|
L(() => {
|
|
1838
1826
|
e ? t.update(() => {
|
|
1839
1827
|
a(e.getURL());
|
|
1840
1828
|
}) : a("");
|
|
1841
1829
|
}, [t, e]);
|
|
1842
|
-
const s = !!(e && i && l), { refs: d, floatingStyles: c, context: u } =
|
|
1830
|
+
const s = !!(e && i && l), { refs: d, floatingStyles: c, context: u } = Ct({
|
|
1843
1831
|
placement: "top",
|
|
1844
1832
|
strategy: "fixed",
|
|
1845
1833
|
open: s,
|
|
@@ -1850,46 +1838,46 @@ const Sn = ({ onClose: t }) => {
|
|
|
1850
1838
|
middleware: [Mr()]
|
|
1851
1839
|
}), { getFloatingProps: g } = ae([
|
|
1852
1840
|
le(u),
|
|
1853
|
-
|
|
1854
|
-
]),
|
|
1841
|
+
xr(u)
|
|
1842
|
+
]), C = M(() => {
|
|
1855
1843
|
var m;
|
|
1856
|
-
const k =
|
|
1857
|
-
if (
|
|
1858
|
-
const
|
|
1859
|
-
let
|
|
1860
|
-
if (tt(N) ?
|
|
1844
|
+
const k = y();
|
|
1845
|
+
if (E(k)) {
|
|
1846
|
+
const v = ge(k), N = v.getParent();
|
|
1847
|
+
let R = null;
|
|
1848
|
+
if (tt(N) ? R = N : tt(v) && (R = v), R) {
|
|
1861
1849
|
const Y = window.getSelection(), Z = t.getRootElement();
|
|
1862
1850
|
k !== null && Y !== null && Z !== null && Z.contains(Y.anchorNode) && t.isEditable() && (r.current = ((m = Y.focusNode) == null ? void 0 : m.parentElement) ?? null);
|
|
1863
1851
|
}
|
|
1864
|
-
o(
|
|
1852
|
+
o(R);
|
|
1865
1853
|
}
|
|
1866
1854
|
}, [t]), x = M(() => {
|
|
1867
|
-
e &&
|
|
1855
|
+
e && wn(e) && t.update(() => {
|
|
1868
1856
|
e.remove();
|
|
1869
1857
|
}), t.dispatchCommand(it, null);
|
|
1870
1858
|
}, [t, e]);
|
|
1871
1859
|
if (L(() => {
|
|
1872
1860
|
t.getEditorState().read(() => {
|
|
1873
|
-
|
|
1861
|
+
C();
|
|
1874
1862
|
});
|
|
1875
|
-
}, [t,
|
|
1863
|
+
}, [t, C]), L(() => ot(
|
|
1876
1864
|
t.registerUpdateListener(({ editorState: k }) => {
|
|
1877
1865
|
k.read(() => {
|
|
1878
|
-
|
|
1866
|
+
C();
|
|
1879
1867
|
});
|
|
1880
1868
|
}),
|
|
1881
1869
|
t.registerCommand(
|
|
1882
1870
|
Q,
|
|
1883
|
-
() => (
|
|
1871
|
+
() => (C(), !1),
|
|
1884
1872
|
q
|
|
1885
1873
|
),
|
|
1886
1874
|
t.registerCommand(
|
|
1887
|
-
|
|
1875
|
+
Ht,
|
|
1888
1876
|
() => e ? (o(null), !0) : !1,
|
|
1889
1877
|
Ie
|
|
1890
1878
|
)
|
|
1891
|
-
), [t,
|
|
1892
|
-
const
|
|
1879
|
+
), [t, C, e]), !s) return null;
|
|
1880
|
+
const _ = wt(i);
|
|
1893
1881
|
return /* @__PURE__ */ n(se, { children: /* @__PURE__ */ h(
|
|
1894
1882
|
re,
|
|
1895
1883
|
{
|
|
@@ -1905,7 +1893,7 @@ const Sn = ({ onClose: t }) => {
|
|
|
1905
1893
|
...g(),
|
|
1906
1894
|
children: [
|
|
1907
1895
|
/* @__PURE__ */ n(
|
|
1908
|
-
|
|
1896
|
+
P,
|
|
1909
1897
|
{
|
|
1910
1898
|
as: "a",
|
|
1911
1899
|
css: {
|
|
@@ -1915,8 +1903,8 @@ const Sn = ({ onClose: t }) => {
|
|
|
1915
1903
|
textOverflow: "ellipsis",
|
|
1916
1904
|
marginRight: "$4"
|
|
1917
1905
|
},
|
|
1918
|
-
href:
|
|
1919
|
-
title:
|
|
1906
|
+
href: _,
|
|
1907
|
+
title: _,
|
|
1920
1908
|
target: "_blank",
|
|
1921
1909
|
rel: "noreferrer",
|
|
1922
1910
|
children: i
|
|
@@ -1926,8 +1914,8 @@ const Sn = ({ onClose: t }) => {
|
|
|
1926
1914
|
]
|
|
1927
1915
|
}
|
|
1928
1916
|
) });
|
|
1929
|
-
},
|
|
1930
|
-
const [t] =
|
|
1917
|
+
}, ko = () => {
|
|
1918
|
+
const [t] = vt();
|
|
1931
1919
|
return /* @__PURE__ */ h(
|
|
1932
1920
|
at,
|
|
1933
1921
|
{
|
|
@@ -1959,7 +1947,7 @@ const Sn = ({ onClose: t }) => {
|
|
|
1959
1947
|
{
|
|
1960
1948
|
onClick: () => t.dispatchCommand(ht, "right"),
|
|
1961
1949
|
children: [
|
|
1962
|
-
/* @__PURE__ */ n(
|
|
1950
|
+
/* @__PURE__ */ n(Pr, { size: "1.25rem" }),
|
|
1963
1951
|
"Høyre"
|
|
1964
1952
|
]
|
|
1965
1953
|
}
|
|
@@ -1967,17 +1955,17 @@ const Sn = ({ onClose: t }) => {
|
|
|
1967
1955
|
]
|
|
1968
1956
|
}
|
|
1969
1957
|
);
|
|
1970
|
-
}, Dt = ["image/"],
|
|
1971
|
-
const [t] =
|
|
1958
|
+
}, Dt = ["image/"], bo = () => {
|
|
1959
|
+
const [t] = vt(), { fileUpload: r } = F();
|
|
1972
1960
|
return L(() => t.registerCommand(
|
|
1973
1961
|
qe,
|
|
1974
1962
|
(e) => ((async () => {
|
|
1975
|
-
const o = await
|
|
1963
|
+
const o = await Be(
|
|
1976
1964
|
e,
|
|
1977
1965
|
[Dt].flatMap((i) => i)
|
|
1978
1966
|
);
|
|
1979
1967
|
for (const { file: i, result: a } of o)
|
|
1980
|
-
if (
|
|
1968
|
+
if (Fe(i, Dt)) {
|
|
1981
1969
|
let l = a;
|
|
1982
1970
|
const s = new Image(), d = window.URL.createObjectURL(i);
|
|
1983
1971
|
s.onload = async () => {
|
|
@@ -1993,35 +1981,35 @@ const Sn = ({ onClose: t }) => {
|
|
|
1993
1981
|
), [t, r]), null;
|
|
1994
1982
|
};
|
|
1995
1983
|
export {
|
|
1996
|
-
|
|
1984
|
+
Tt as $createImageNode,
|
|
1997
1985
|
pe as $createRutineLinkNode,
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
1986
|
+
io as $getNodesOfTypes,
|
|
1987
|
+
ao as $isImageNode,
|
|
1988
|
+
wn as $isRutineLinkNode,
|
|
1989
|
+
ko as AlignToolbarDropdown,
|
|
1990
|
+
bo as DragDropPastePlugin,
|
|
1991
|
+
un as FloatingToolbar,
|
|
1992
|
+
H as ImageNode,
|
|
1993
|
+
uo as InsertSelector,
|
|
1994
|
+
fo as LinkEditPlugin,
|
|
2007
1995
|
rt as LinkTargetNode,
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
1996
|
+
mo as LinkToolbarButton,
|
|
1997
|
+
co as RichTextEditor,
|
|
1998
|
+
gn as RichTextToolbar,
|
|
2011
1999
|
K as RutineLinkNode,
|
|
2012
|
-
|
|
2013
|
-
|
|
2000
|
+
po as RutineLinkNodeInit,
|
|
2001
|
+
go as TableEditPlugin,
|
|
2014
2002
|
Ir as clearEditorState,
|
|
2015
|
-
|
|
2016
|
-
|
|
2003
|
+
lo as defaultNodes,
|
|
2004
|
+
so as defaultViewNodes,
|
|
2017
2005
|
Rr as isEditorState,
|
|
2018
|
-
|
|
2006
|
+
xt as isJSON,
|
|
2019
2007
|
de as richTextContext,
|
|
2020
|
-
|
|
2021
|
-
|
|
2008
|
+
ho as richTextCss,
|
|
2009
|
+
xn as richTextStyleObj,
|
|
2022
2010
|
Or as setStateFromPlainText,
|
|
2023
|
-
|
|
2024
|
-
|
|
2011
|
+
no as stateToHTML,
|
|
2012
|
+
oo as syncStateToHTML,
|
|
2025
2013
|
zr as useHasFocusWithin,
|
|
2026
|
-
|
|
2014
|
+
F as useRichTextContext
|
|
2027
2015
|
};
|