@arkitektbedriftene/fe-lib 2.5.4 → 4.0.0

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.
@@ -12,3 +12,4 @@ export * from './Plugins/RutineLinkNode';
12
12
  export * from './Plugins/LinkTargetNode';
13
13
  export * from './Plugins/Image/ImageNode';
14
14
  export * from './Plugins/AlignPlugin';
15
+ export * from './Plugins/DragDropPastePlugin';
@@ -9,7 +9,7 @@ import { LinkNode as P, AutoLinkNode as Pt, $isLinkNode as J, TOGGLE_LINK_COMMAN
9
9
  import { ListNode as ht, ListItemNode as Ft, $isListNode as ut, INSERT_UNORDERED_LIST_COMMAND as xe, INSERT_ORDERED_LIST_COMMAND as we, INSERT_CHECK_LIST_COMMAND as Ht, insertList as ye, $isListItemNode as F } from "@lexical/list";
10
10
  import { HeadingNode as Ut, QuoteNode as Wt, $isHeadingNode as Ne, $createHeadingNode as Se, $createQuoteNode as Ee, DRAG_DROP_PASTE as Re } from "@lexical/rich-text";
11
11
  import { TableNode as jt, TableRowNode as Kt, TableCellNode as Gt, INSERT_TABLE_COMMAND as Ie, $getTableCellNodeFromLexicalNode as Oe, $deleteTableColumn__EXPERIMENTAL as Ae, $deleteTableRow__EXPERIMENTAL as ze, $insertTableColumn__EXPERIMENTAL as xt, $insertTableRow__EXPERIMENTAL as wt } from "@lexical/table";
12
- import { jsx as n, jsxs as u, Fragment as W } from "react/jsx-runtime";
12
+ import { jsx as o, jsxs as u, Fragment as W } from "react/jsx-runtime";
13
13
  import { createContext as $e, useState as b, useRef as Y, useCallback as T, useContext as De, useEffect as _, useMemo as Yt, useLayoutEffect as Be } from "react";
14
14
  import { Box as H, Stack as Pe, Button as L, DropdownMenu as tt, ToolbarButton as gt, DropdownMenuIconItem as v, ToolbarToggleGroup as qt, ToolbarToggleItem as B, OverlayCard as Jt, Toolbar as Fe, ToolbarSeparator as He, styled as Ue, Spinner as pt, Dialog as Xt, DialogHeader as We, TextInput as mt, DialogActions as et, DropdownMenuItem as D, DropdownMenuSeparator as yt, NavBar as je, NavBarItem as lt, Combobox as Ke } from "./ui.es.js";
15
15
  import { f as Ge, g as Ye, h as qe, G as f, i as Je, j as Xe } from "./index.esm-787a7997.js";
@@ -33,11 +33,11 @@ const mr = ({
33
33
  }) => {
34
34
  if (t.length === 0)
35
35
  return 0;
36
- const o = typeof e == "number", i = typeof r == "number";
37
- if (!o && !i)
36
+ const n = typeof e == "number", i = typeof r == "number";
37
+ if (!n && !i)
38
38
  return t.length;
39
39
  let a = 0, l = 0;
40
- for (; l < t.length && (!o || a < e) && (!i || l < r); )
40
+ for (; l < t.length && (!n || a < e) && (!i || l < r); )
41
41
  t[l] === `
42
42
  ` && a++, l++;
43
43
  return t.slice(0, l).length;
@@ -46,9 +46,9 @@ const mr = ({
46
46
  maxChars: r,
47
47
  maxLines: e
48
48
  }) => {
49
- const o = K(), i = o.getTextContent(), a = mr({ text: i, maxChars: r, maxLines: e }), l = i.length - a, d = o.select().anchor;
49
+ const n = K(), i = n.getTextContent(), a = mr({ text: i, maxChars: r, maxLines: e }), l = i.length - a, d = n.select().anchor;
50
50
  Le(t, d, l);
51
- const c = o.getLastChild();
51
+ const c = n.getLastChild();
52
52
  return c instanceof he && c.getChildrenSize() === 0 && c.remove(), l;
53
53
  }, bt = {
54
54
  quote: "ain-rich-text-quote",
@@ -67,8 +67,8 @@ const mr = ({
67
67
  () => {
68
68
  const e = K();
69
69
  e.clear();
70
- const o = U();
71
- o.append(I("")), e.append(o), V(null);
70
+ const n = U();
71
+ n.append(I("")), e.append(n), V(null);
72
72
  },
73
73
  {
74
74
  tag: r
@@ -77,18 +77,18 @@ const mr = ({
77
77
  }, br = (t, r, e) => {
78
78
  r.update(
79
79
  () => {
80
- const o = K();
81
- o.clear();
80
+ const n = K();
81
+ n.clear();
82
82
  const i = U();
83
- i.append(I(t.trim())), o.append(i), V(null);
83
+ i.append(I(t.trim())), n.append(i), V(null);
84
84
  },
85
85
  {
86
86
  tag: e
87
87
  }
88
88
  ), r.blur();
89
- }, Pn = async (t, r, e) => {
89
+ }, Bn = async (t, r, e) => {
90
90
  var l;
91
- let o = 0;
91
+ let n = 0;
92
92
  const i = At({
93
93
  nodes: r,
94
94
  editable: !1,
@@ -103,7 +103,7 @@ const mr = ({
103
103
  });
104
104
  else {
105
105
  const s = i.parseEditorState(t, () => {
106
- (e == null ? void 0 : e.maxLines) !== void 0 && (o = ne({
106
+ (e == null ? void 0 : e.maxLines) !== void 0 && (n = ne({
107
107
  editor: i,
108
108
  maxLines: e.maxLines
109
109
  }));
@@ -117,9 +117,9 @@ const mr = ({
117
117
  let a = "";
118
118
  return i.read(() => {
119
119
  a = zt(i);
120
- }), { html: a, trimCount: o };
121
- }, Fn = (t, r, e) => {
122
- let o = 0;
120
+ }), { html: a, trimCount: n };
121
+ }, Pn = (t, r, e) => {
122
+ let n = 0;
123
123
  const i = At({
124
124
  nodes: r,
125
125
  editable: !1,
@@ -134,7 +134,7 @@ const mr = ({
134
134
  });
135
135
  else {
136
136
  const l = i.parseEditorState(t, () => {
137
- (e == null ? void 0 : e.maxLines) !== void 0 && (o = ne({
137
+ (e == null ? void 0 : e.maxLines) !== void 0 && (n = ne({
138
138
  editor: i,
139
139
  maxLines: e.maxLines
140
140
  }));
@@ -151,13 +151,13 @@ const mr = ({
151
151
  });
152
152
  } catch {
153
153
  }
154
- return { html: a, trimCount: o };
154
+ return { html: a, trimCount: n };
155
155
  };
156
156
  class X extends P {
157
157
  static getType() {
158
158
  return "target-link";
159
159
  }
160
- constructor(r, e, o) {
160
+ constructor(r, e, n) {
161
161
  let i = !1;
162
162
  const a = { ...e };
163
163
  try {
@@ -165,7 +165,7 @@ class X extends P {
165
165
  window.location.hostname !== l.hostname && (i = !0);
166
166
  } catch {
167
167
  }
168
- i && (a.target = "_blank", a.rel = "noopener noreferrer"), super(r, a, o);
168
+ i && (a.target = "_blank", a.rel = "noopener noreferrer"), super(r, a, n);
169
169
  }
170
170
  static clone(r) {
171
171
  return new X(
@@ -187,10 +187,10 @@ const oe = $e({
187
187
  signUrl: void 0,
188
188
  fileUpload: void 0
189
189
  }), Mr = ({ onBlur: t }) => {
190
- const [r, e] = b(!1), o = Y(null), i = T(() => {
191
- e(!0), o.current && window.clearTimeout(o.current);
190
+ const [r, e] = b(!1), n = Y(null), i = T(() => {
191
+ e(!0), n.current && window.clearTimeout(n.current);
192
192
  }, []), a = T(() => {
193
- o.current = window.setTimeout(() => {
193
+ n.current = window.setTimeout(() => {
194
194
  e(!1), t == null || t();
195
195
  }, 0);
196
196
  }, [t]);
@@ -206,7 +206,7 @@ function Cr({
206
206
  src: t,
207
207
  altText: r,
208
208
  width: e,
209
- height: o,
209
+ height: n,
210
210
  nodeKey: i
211
211
  }) {
212
212
  const { signUrl: a } = z(), [l, s] = b(a ? "" : t), [d, c] = b(!1), h = Y(!1), [g] = x();
@@ -258,7 +258,7 @@ function Cr({
258
258
  "data-controls": "true",
259
259
  onMouseLeave: k(!1),
260
260
  children: [
261
- /* @__PURE__ */ n(
261
+ /* @__PURE__ */ o(
262
262
  L,
263
263
  {
264
264
  icon: !0,
@@ -266,39 +266,39 @@ function Cr({
266
266
  css: { width: "20px", height: "20px" },
267
267
  onClick: E,
268
268
  color: "danger",
269
- children: /* @__PURE__ */ n(Ge, {})
269
+ children: /* @__PURE__ */ o(Ge, {})
270
270
  }
271
271
  ),
272
- /* @__PURE__ */ n(
272
+ /* @__PURE__ */ o(
273
273
  L,
274
274
  {
275
275
  icon: !0,
276
276
  size: "sm",
277
277
  css: { width: "20px", height: "20px" },
278
278
  onClick: S,
279
- children: /* @__PURE__ */ n(Ye, {})
279
+ children: /* @__PURE__ */ o(Ye, {})
280
280
  }
281
281
  ),
282
- /* @__PURE__ */ n(
282
+ /* @__PURE__ */ o(
283
283
  L,
284
284
  {
285
285
  icon: !0,
286
286
  size: "sm",
287
287
  css: { width: "20px", height: "20px" },
288
288
  onClick: M,
289
- children: /* @__PURE__ */ n(qe, {})
289
+ children: /* @__PURE__ */ o(qe, {})
290
290
  }
291
291
  )
292
292
  ]
293
293
  }
294
294
  ),
295
- /* @__PURE__ */ n(
295
+ /* @__PURE__ */ o(
296
296
  "img",
297
297
  {
298
298
  src: l,
299
299
  alt: r,
300
300
  style: {
301
- height: o,
301
+ height: n,
302
302
  width: e
303
303
  },
304
304
  className: "ain-rich-text-image",
@@ -307,21 +307,21 @@ function Cr({
307
307
  "data-controls": "true"
308
308
  }
309
309
  )
310
- ] }) : /* @__PURE__ */ n("span", {});
310
+ ] }) : /* @__PURE__ */ o("span", {});
311
311
  }
312
312
  function vr(t) {
313
- const r = t, { alt: e, src: o, width: i, height: a } = r;
314
- return { node: Ct({ altText: e, height: a, src: o, width: i }) };
313
+ const r = t, { alt: e, src: n, width: i, height: a } = r;
314
+ return { node: Ct({ altText: e, height: a, src: n, width: i }) };
315
315
  }
316
316
  class $ extends ue {
317
- constructor(e, o, i, a, l, s) {
317
+ constructor(e, n, i, a, l, s) {
318
318
  super(s);
319
319
  O(this, "__src");
320
320
  O(this, "__altText");
321
321
  O(this, "__width");
322
322
  O(this, "__height");
323
323
  O(this, "__meta");
324
- this.__src = e, this.__altText = o, this.__width = i || "inherit", this.__height = a || "inherit", this.__meta = l;
324
+ this.__src = e, this.__altText = n, this.__width = i || "inherit", this.__height = a || "inherit", this.__meta = l;
325
325
  }
326
326
  static getType() {
327
327
  return "image";
@@ -337,9 +337,9 @@ class $ extends ue {
337
337
  );
338
338
  }
339
339
  static importJSON(e) {
340
- const { altText: o, height: i, width: a, src: l, meta: s } = e;
340
+ const { altText: n, height: i, width: a, src: l, meta: s } = e;
341
341
  return Ct({
342
- altText: o,
342
+ altText: n,
343
343
  height: i,
344
344
  src: l,
345
345
  width: a,
@@ -373,12 +373,12 @@ class $ extends ue {
373
373
  return this.__meta ?? { width: 0, height: 0 };
374
374
  }
375
375
  setSrc(e) {
376
- const o = this.getWritable();
377
- o.__src = e;
376
+ const n = this.getWritable();
377
+ n.__src = e;
378
378
  }
379
- setWidthAndHeight(e, o) {
379
+ setWidthAndHeight(e, n) {
380
380
  const i = this.getWritable();
381
- i.__width = e, i.__height = o;
381
+ i.__width = e, i.__height = n;
382
382
  }
383
383
  // View
384
384
  createDOM(e) {
@@ -394,7 +394,7 @@ class $ extends ue {
394
394
  return this.__altText;
395
395
  }
396
396
  decorate() {
397
- return /* @__PURE__ */ n(
397
+ return /* @__PURE__ */ o(
398
398
  Cr,
399
399
  {
400
400
  src: this.__src,
@@ -410,18 +410,18 @@ function Ct({
410
410
  altText: t,
411
411
  height: r,
412
412
  src: e,
413
- width: o,
413
+ width: n,
414
414
  meta: i,
415
415
  key: a
416
416
  }) {
417
417
  return ge(
418
- new $(e, t, o, r, i, a)
418
+ new $(e, t, n, r, i, a)
419
419
  );
420
420
  }
421
- function Hn(t) {
421
+ function Fn(t) {
422
422
  return t instanceof $;
423
423
  }
424
- const Un = [
424
+ const Hn = [
425
425
  Ut,
426
426
  Wt,
427
427
  ht,
@@ -432,7 +432,7 @@ const Un = [
432
432
  Kt,
433
433
  Gt,
434
434
  $
435
- ], Wn = [
435
+ ], Un = [
436
436
  Ut,
437
437
  Wt,
438
438
  ht,
@@ -531,22 +531,22 @@ const Ur = cr("div", {
531
531
  quote: "Sitat",
532
532
  check: "Avkrysningsliste"
533
533
  }, Wr = {
534
- bullet: /* @__PURE__ */ n(Dr, { size: "1.25rem" }),
535
- h1: /* @__PURE__ */ n(wr, { size: "1.25rem" }),
536
- h2: /* @__PURE__ */ n(yr, { size: "1.25rem" }),
537
- h3: /* @__PURE__ */ n(Nr, { size: "1.25rem" }),
538
- h4: /* @__PURE__ */ n(Sr, { size: "1.25rem" }),
539
- h5: /* @__PURE__ */ n(Er, { size: "1.25rem" }),
540
- h6: /* @__PURE__ */ n(Rr, { size: "1.25rem" }),
541
- number: /* @__PURE__ */ n($r, { size: "1.25rem" }),
542
- check: /* @__PURE__ */ n(zr, { size: "1.25rem" }),
543
- paragraph: /* @__PURE__ */ n(Or, { size: "1.25rem" }),
544
- quote: /* @__PURE__ */ n(Br, { size: "1.25rem" })
534
+ bullet: /* @__PURE__ */ o(Dr, { size: "1.25rem" }),
535
+ h1: /* @__PURE__ */ o(wr, { size: "1.25rem" }),
536
+ h2: /* @__PURE__ */ o(yr, { size: "1.25rem" }),
537
+ h3: /* @__PURE__ */ o(Nr, { size: "1.25rem" }),
538
+ h4: /* @__PURE__ */ o(Sr, { size: "1.25rem" }),
539
+ h5: /* @__PURE__ */ o(Er, { size: "1.25rem" }),
540
+ h6: /* @__PURE__ */ o(Rr, { size: "1.25rem" }),
541
+ number: /* @__PURE__ */ o($r, { size: "1.25rem" }),
542
+ check: /* @__PURE__ */ o(zr, { size: "1.25rem" }),
543
+ paragraph: /* @__PURE__ */ o(Or, { size: "1.25rem" }),
544
+ quote: /* @__PURE__ */ o(Br, { size: "1.25rem" })
545
545
  }, w = ({
546
546
  blockType: t
547
547
  }) => /* @__PURE__ */ u(W, { children: [
548
- /* @__PURE__ */ n(H, { css: { display: "flex", flex: "0 0 auto" }, children: Wr[t] }),
549
- /* @__PURE__ */ n(
548
+ /* @__PURE__ */ o(H, { css: { display: "flex", flex: "0 0 auto" }, children: Wr[t] }),
549
+ /* @__PURE__ */ o(
550
550
  H,
551
551
  {
552
552
  css: {
@@ -562,8 +562,8 @@ const Ur = cr("div", {
562
562
  if (!N(t))
563
563
  return null;
564
564
  const r = t.anchor.getNode();
565
- let e = r.getKey() === "root" ? r : re(r, (o) => {
566
- const i = o.getParent();
565
+ let e = r.getKey() === "root" ? r : re(r, (n) => {
566
+ const i = n.getParent();
567
567
  return i !== null && $t(i);
568
568
  });
569
569
  return e === null && (e = r.getTopLevelElementOrThrow()), {
@@ -594,58 +594,58 @@ const Ur = cr("div", {
594
594
  },
595
595
  ct
596
596
  ), [t]);
597
- const o = (c) => {
597
+ const n = (c) => {
598
598
  r !== c && t.update(() => {
599
599
  const h = y();
600
600
  N(h) && (at(h, () => Se(c)), e(c));
601
601
  });
602
602
  };
603
- return /* @__PURE__ */ n(Ur, { children: /* @__PURE__ */ u(
603
+ return /* @__PURE__ */ o(Ur, { children: /* @__PURE__ */ u(
604
604
  tt,
605
605
  {
606
- trigger: /* @__PURE__ */ n(
606
+ trigger: /* @__PURE__ */ o(
607
607
  gt,
608
608
  {
609
609
  dropdown: !0,
610
610
  css: { display: "flex", width: "100%", overflow: "hidden" },
611
- children: /* @__PURE__ */ n(w, { blockType: r })
611
+ children: /* @__PURE__ */ o(w, { blockType: r })
612
612
  }
613
613
  ),
614
614
  side: "bottom",
615
615
  align: "start",
616
616
  children: [
617
- /* @__PURE__ */ n(v, { onClick: () => {
617
+ /* @__PURE__ */ o(v, { onClick: () => {
618
618
  r !== "paragraph" && t.update(() => {
619
619
  const c = y();
620
620
  N(c) && (at(c, () => U()), e("paragraph"));
621
621
  });
622
- }, children: /* @__PURE__ */ n(w, { blockType: "paragraph" }) }),
623
- /* @__PURE__ */ n(v, { onClick: () => o("h1"), children: /* @__PURE__ */ n(w, { blockType: "h1" }) }),
624
- /* @__PURE__ */ n(v, { onClick: () => o("h2"), children: /* @__PURE__ */ n(w, { blockType: "h2" }) }),
625
- /* @__PURE__ */ n(v, { onClick: () => o("h3"), children: /* @__PURE__ */ n(w, { blockType: "h3" }) }),
626
- /* @__PURE__ */ n(v, { onClick: () => o("h4"), children: /* @__PURE__ */ n(w, { blockType: "h4" }) }),
627
- /* @__PURE__ */ n(v, { onClick: () => o("h5"), children: /* @__PURE__ */ n(w, { blockType: "h5" }) }),
628
- /* @__PURE__ */ n(v, { onClick: () => o("h6"), children: /* @__PURE__ */ n(w, { blockType: "h6" }) }),
629
- /* @__PURE__ */ n(v, { onClick: () => {
622
+ }, children: /* @__PURE__ */ o(w, { blockType: "paragraph" }) }),
623
+ /* @__PURE__ */ o(v, { onClick: () => n("h1"), children: /* @__PURE__ */ o(w, { blockType: "h1" }) }),
624
+ /* @__PURE__ */ o(v, { onClick: () => n("h2"), children: /* @__PURE__ */ o(w, { blockType: "h2" }) }),
625
+ /* @__PURE__ */ o(v, { onClick: () => n("h3"), children: /* @__PURE__ */ o(w, { blockType: "h3" }) }),
626
+ /* @__PURE__ */ o(v, { onClick: () => n("h4"), children: /* @__PURE__ */ o(w, { blockType: "h4" }) }),
627
+ /* @__PURE__ */ o(v, { onClick: () => n("h5"), children: /* @__PURE__ */ o(w, { blockType: "h5" }) }),
628
+ /* @__PURE__ */ o(v, { onClick: () => n("h6"), children: /* @__PURE__ */ o(w, { blockType: "h6" }) }),
629
+ /* @__PURE__ */ o(v, { onClick: () => {
630
630
  r !== "bullet" && (t.dispatchCommand(xe, void 0), e("bullet"));
631
- }, children: /* @__PURE__ */ n(w, { blockType: "bullet" }) }),
632
- /* @__PURE__ */ n(v, { onClick: () => {
631
+ }, children: /* @__PURE__ */ o(w, { blockType: "bullet" }) }),
632
+ /* @__PURE__ */ o(v, { onClick: () => {
633
633
  r !== "number" && (t.dispatchCommand(we, void 0), e("number"));
634
- }, children: /* @__PURE__ */ n(w, { blockType: "number" }) }),
635
- /* @__PURE__ */ n(v, { onClick: () => {
634
+ }, children: /* @__PURE__ */ o(w, { blockType: "number" }) }),
635
+ /* @__PURE__ */ o(v, { onClick: () => {
636
636
  r !== "check" && (t.dispatchCommand(Ht, void 0), e("check"));
637
- }, children: /* @__PURE__ */ n(w, { blockType: "check" }) }),
638
- /* @__PURE__ */ n(v, { onClick: () => {
637
+ }, children: /* @__PURE__ */ o(w, { blockType: "check" }) }),
638
+ /* @__PURE__ */ o(v, { onClick: () => {
639
639
  r !== "quote" && t.update(() => {
640
640
  const c = y();
641
641
  N(c) && (at(c, () => Ee()), e("quote"));
642
642
  });
643
- }, children: /* @__PURE__ */ n(w, { blockType: "quote" }) })
643
+ }, children: /* @__PURE__ */ o(w, { blockType: "quote" }) })
644
644
  ]
645
645
  }
646
646
  ) });
647
647
  }, Gr = () => {
648
- const [t] = x(), [r, e] = b(!1), [o, i] = b(!1), [a, l] = b(!1), [s, d] = b(!1), [c, h] = b(!1), g = T(() => {
648
+ const [t] = x(), [r, e] = b(!1), [n, i] = b(!1), [a, l] = b(!1), [s, d] = b(!1), [c, h] = b(!1), g = T(() => {
649
649
  const m = y();
650
650
  N(m) && (e(m.hasFormat("bold")), i(m.hasFormat("italic")), l(m.hasFormat("underline")), d(m.hasFormat("code")), h(m.hasFormat("superscript")));
651
651
  }, []);
@@ -678,8 +678,8 @@ const Ur = cr("div", {
678
678
  [t]
679
679
  ), C = Yt(() => {
680
680
  const m = [];
681
- return r && m.push("bold"), o && m.push("italic"), a && m.push("underline"), s && m.push("code"), c && m.push("superscript"), m;
682
- }, [r, o, a, s, c]);
681
+ return r && m.push("bold"), n && m.push("italic"), a && m.push("underline"), s && m.push("code"), c && m.push("superscript"), m;
682
+ }, [r, n, a, s, c]);
683
683
  return /* @__PURE__ */ u(
684
684
  qt,
685
685
  {
@@ -687,43 +687,43 @@ const Ur = cr("div", {
687
687
  "aria-label": "Tekstformattering",
688
688
  value: C,
689
689
  children: [
690
- /* @__PURE__ */ n(B, { onClick: k, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ n(Lr, { size: "1.25rem" }) }),
691
- /* @__PURE__ */ n(
690
+ /* @__PURE__ */ o(B, { onClick: k, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ o(Lr, { size: "1.25rem" }) }),
691
+ /* @__PURE__ */ o(
692
692
  B,
693
693
  {
694
694
  onClick: E,
695
695
  title: "Kursiv tekst",
696
696
  value: "italic",
697
- children: /* @__PURE__ */ n(Ir, { size: "1.25rem" })
697
+ children: /* @__PURE__ */ o(Ir, { size: "1.25rem" })
698
698
  }
699
699
  ),
700
- /* @__PURE__ */ n(
700
+ /* @__PURE__ */ o(
701
701
  B,
702
702
  {
703
703
  onClick: S,
704
704
  title: "Understreket tekst",
705
705
  value: "underline",
706
- children: /* @__PURE__ */ n(Hr, { size: "1.25rem" })
706
+ children: /* @__PURE__ */ o(Hr, { size: "1.25rem" })
707
707
  }
708
708
  ),
709
- /* @__PURE__ */ n(B, { onClick: M, title: "Kode", value: "code", children: /* @__PURE__ */ n(xr, { size: "1.25rem" }) }),
710
- /* @__PURE__ */ n(
709
+ /* @__PURE__ */ o(B, { onClick: M, title: "Kode", value: "code", children: /* @__PURE__ */ o(xr, { size: "1.25rem" }) }),
710
+ /* @__PURE__ */ o(
711
711
  B,
712
712
  {
713
713
  onClick: p,
714
714
  title: "Superscript",
715
715
  value: "superscript",
716
- children: /* @__PURE__ */ n(Pr, { size: "1.25rem" })
716
+ children: /* @__PURE__ */ o(Pr, { size: "1.25rem" })
717
717
  }
718
718
  )
719
719
  ]
720
720
  }
721
721
  );
722
722
  }, Yr = ({ children: t }) => {
723
- const { hasFocus: r, editorRef: e } = z(), o = r, [i, a] = b(o);
723
+ const { hasFocus: r, editorRef: e } = z(), n = r, [i, a] = b(n);
724
724
  Be(() => {
725
- a(o);
726
- }, [o]);
725
+ a(n);
726
+ }, [n]);
727
727
  const { context: l, refs: s, floatingStyles: d } = ft({
728
728
  placement: "top",
729
729
  whileElementsMounted: Qt,
@@ -751,7 +751,7 @@ const Ur = cr("div", {
751
751
  role: "dialog"
752
752
  })
753
753
  ]);
754
- return i ? /* @__PURE__ */ n(ee, { children: /* @__PURE__ */ n(
754
+ return i ? /* @__PURE__ */ o(ee, { children: /* @__PURE__ */ o(
755
755
  Jt,
756
756
  {
757
757
  ref: s.setFloating,
@@ -763,16 +763,16 @@ const Ur = cr("div", {
763
763
  overflow: "hidden",
764
764
  boxShadow: "$md"
765
765
  },
766
- children: /* @__PURE__ */ n(qr, { children: t })
766
+ children: /* @__PURE__ */ o(qr, { children: t })
767
767
  }
768
768
  ) }) : null;
769
769
  }, qr = ({
770
770
  children: t,
771
771
  ...r
772
772
  }) => /* @__PURE__ */ u(Fe, { "aria-label": "Formattering", ...r, children: [
773
- /* @__PURE__ */ n(Kr, {}),
774
- /* @__PURE__ */ n(He, {}),
775
- /* @__PURE__ */ n(Gr, {}),
773
+ /* @__PURE__ */ o(Kr, {}),
774
+ /* @__PURE__ */ o(He, {}),
775
+ /* @__PURE__ */ o(Gr, {}),
776
776
  t
777
777
  ] });
778
778
  function Jr() {
@@ -797,8 +797,8 @@ function Jr() {
797
797
  Dt,
798
798
  (r) => {
799
799
  if (st() != null) {
800
- const o = t.getRootElement();
801
- return o != null && o.focus(), !0;
800
+ const n = t.getRootElement();
801
+ return n != null && n.focus(), !0;
802
802
  }
803
803
  return !1;
804
804
  },
@@ -809,8 +809,8 @@ function Jr() {
809
809
  (r) => {
810
810
  const e = st();
811
811
  return e != null && t.isEditable() ? (t.update(() => {
812
- const o = dt(e);
813
- F(o) && (r.preventDefault(), o.toggleChecked());
812
+ const n = dt(e);
813
+ F(n) && (r.preventDefault(), n.toggleChecked());
814
814
  }), !0) : !1;
815
815
  },
816
816
  R
@@ -820,9 +820,9 @@ function Jr() {
820
820
  (r) => t.getEditorState().read(() => {
821
821
  const e = y();
822
822
  if (N(e) && e.isCollapsed()) {
823
- const { anchor: o } = e, i = o.type === "element";
824
- if (i || o.offset === 0) {
825
- const a = o.getNode(), l = re(
823
+ const { anchor: n } = e, i = n.type === "element";
824
+ if (i || n.offset === 0) {
825
+ const a = n.getNode(), l = re(
826
826
  a,
827
827
  (s) => be(s) && !s.isInline()
828
828
  );
@@ -849,8 +849,8 @@ function ae(t, r) {
849
849
  const e = t.target;
850
850
  if (e === null || !Nt(e))
851
851
  return;
852
- const o = e.firstChild;
853
- if (o != null && Nt(o) && (o.tagName === "UL" || o.tagName === "OL"))
852
+ const n = e.firstChild;
853
+ if (n != null && Nt(n) && (n.tagName === "UL" || n.tagName === "OL"))
854
854
  return;
855
855
  const i = e.parentNode;
856
856
  if (!i || i.__lexicalListType !== "check")
@@ -863,8 +863,8 @@ function Et(t) {
863
863
  const r = t.target, e = Xr(r);
864
864
  e != null && e.isEditable() && e.update(() => {
865
865
  if (t.target) {
866
- const o = dt(r);
867
- F(o) && (r.focus(), o.toggleChecked());
866
+ const n = dt(r);
867
+ F(n) && (r.focus(), n.toggleChecked());
868
868
  }
869
869
  });
870
870
  });
@@ -889,9 +889,9 @@ function st() {
889
889
  t.parentNode.__lexicalListType === "check" ? t : null;
890
890
  }
891
891
  function Qr(t, r) {
892
- let e = r ? t.getPreviousSibling() : t.getNextSibling(), o = t;
893
- for (; e == null && F(o); )
894
- o = o.getParentOrThrow().getParent(), o != null && (e = r ? o.getPreviousSibling() : o.getNextSibling());
892
+ let e = r ? t.getPreviousSibling() : t.getNextSibling(), n = t;
893
+ for (; e == null && F(n); )
894
+ n = n.getParentOrThrow().getParent(), n != null && (e = r ? n.getPreviousSibling() : n.getNextSibling());
895
895
  for (; F(e); ) {
896
896
  const i = r ? e.getLastChild() : e.getFirstChild();
897
897
  if (!ut(i))
@@ -901,9 +901,9 @@ function Qr(t, r) {
901
901
  return null;
902
902
  }
903
903
  function It(t, r, e) {
904
- const o = st();
905
- return o != null && r.update(() => {
906
- const i = dt(o);
904
+ const n = st();
905
+ return n != null && r.update(() => {
906
+ const i = dt(n);
907
907
  if (!F(i))
908
908
  return;
909
909
  const a = Qr(i, e);
@@ -934,39 +934,14 @@ function Vr() {
934
934
  );
935
935
  }, [t]), null;
936
936
  }
937
- const Ot = ["image/"], Zr = () => {
938
- const [t] = kt(), { fileUpload: r } = z();
939
- return _(() => t.registerCommand(
940
- Re,
941
- (e) => ((async () => {
942
- const o = await lr(
943
- e,
944
- [Ot].flatMap((i) => i)
945
- );
946
- for (const { file: i, result: a } of o)
947
- if (sr(i, Ot)) {
948
- let l = a;
949
- const s = new Image(), d = window.URL.createObjectURL(i);
950
- s.onload = async () => {
951
- r && (l = await r.uploadFile({ file: i })), t.dispatchCommand(vt, {
952
- src: l,
953
- altText: i.name,
954
- meta: { width: s.naturalWidth, height: s.naturalHeight }
955
- }), window.URL.revokeObjectURL(d);
956
- }, s.src = d;
957
- }
958
- })(), !0),
959
- R
960
- ), [t, r]), null;
961
- }, tn = () => /* @__PURE__ */ u(W, { children: [
962
- /* @__PURE__ */ n(hr, {}),
963
- /* @__PURE__ */ n(gr, {}),
964
- /* @__PURE__ */ n(ur, {}),
965
- /* @__PURE__ */ n(Jr, {}),
966
- /* @__PURE__ */ n(pr, {}),
967
- /* @__PURE__ */ n(Vr, {}),
968
- /* @__PURE__ */ n(Zr, {})
969
- ] }), en = ({
937
+ const Zr = () => /* @__PURE__ */ u(W, { children: [
938
+ /* @__PURE__ */ o(hr, {}),
939
+ /* @__PURE__ */ o(gr, {}),
940
+ /* @__PURE__ */ o(ur, {}),
941
+ /* @__PURE__ */ o(Jr, {}),
942
+ /* @__PURE__ */ o(pr, {}),
943
+ /* @__PURE__ */ o(Vr, {})
944
+ ] }), tn = ({
970
945
  state: t
971
946
  }) => {
972
947
  const [r] = x(), e = Y(!1);
@@ -981,14 +956,14 @@ const Ot = ["image/"], Zr = () => {
981
956
  br(t, r);
982
957
  return;
983
958
  }
984
- const o = r.parseEditorState(t);
985
- o.isEmpty() || r.setEditorState(o);
986
- } catch (o) {
987
- console.error("Could not parse"), console.error(o);
959
+ const n = r.parseEditorState(t);
960
+ n.isEmpty() || r.setEditorState(n);
961
+ } catch (n) {
962
+ console.error("Could not parse"), console.error(n);
988
963
  }
989
964
  }));
990
965
  }, []), null;
991
- }, rn = Ue("div", {
966
+ }, en = Ue("div", {
992
967
  border: "1px solid $borderDarker",
993
968
  borderRadius: "$md",
994
969
  position: "relative",
@@ -1025,9 +1000,9 @@ const Ot = ["image/"], Zr = () => {
1025
1000
  }
1026
1001
  }
1027
1002
  ]
1028
- }), nn = ({
1003
+ }), rn = ({
1029
1004
  isLoading: t
1030
- }) => /* @__PURE__ */ n(
1005
+ }) => /* @__PURE__ */ o(
1031
1006
  H,
1032
1007
  {
1033
1008
  css: {
@@ -1037,13 +1012,13 @@ const Ot = ["image/"], Zr = () => {
1037
1012
  right: "1rem",
1038
1013
  display: "flex"
1039
1014
  },
1040
- children: /* @__PURE__ */ n(pt, {})
1015
+ children: /* @__PURE__ */ o(pt, {})
1041
1016
  }
1042
- ), jn = ({
1017
+ ), Wn = ({
1043
1018
  isLoading: t,
1044
1019
  children: r,
1045
1020
  placeholderText: e,
1046
- nodes: o,
1021
+ nodes: n,
1047
1022
  plugins: i,
1048
1023
  toolbar: a,
1049
1024
  toolbarContent: l,
@@ -1059,7 +1034,7 @@ const Ot = ["image/"], Zr = () => {
1059
1034
  () => ({ hasFocus: S, editorRef: p, signUrl: k, fileUpload: E }),
1060
1035
  [S, k, E]
1061
1036
  );
1062
- return /* @__PURE__ */ n(oe.Provider, { value: C, children: /* @__PURE__ */ u(
1037
+ return /* @__PURE__ */ o(oe.Provider, { value: C, children: /* @__PURE__ */ u(
1063
1038
  Qe,
1064
1039
  {
1065
1040
  initialConfig: {
@@ -1068,12 +1043,12 @@ const Ot = ["image/"], Zr = () => {
1068
1043
  console.error(m);
1069
1044
  },
1070
1045
  theme: bt,
1071
- nodes: o,
1046
+ nodes: n,
1072
1047
  editable: !0
1073
1048
  },
1074
1049
  children: [
1075
1050
  /* @__PURE__ */ u(
1076
- rn,
1051
+ en,
1077
1052
  {
1078
1053
  ref: p,
1079
1054
  hasFocus: S,
@@ -1082,11 +1057,11 @@ const Ot = ["image/"], Zr = () => {
1082
1057
  ...M,
1083
1058
  children: [
1084
1059
  a,
1085
- /* @__PURE__ */ n(
1060
+ /* @__PURE__ */ o(
1086
1061
  Ve,
1087
1062
  {
1088
1063
  contentEditable: s,
1089
- placeholder: e ? /* @__PURE__ */ n(
1064
+ placeholder: e ? /* @__PURE__ */ o(
1090
1065
  H,
1091
1066
  {
1092
1067
  css: {
@@ -1103,19 +1078,19 @@ const Ot = ["image/"], Zr = () => {
1103
1078
  ErrorBoundary: Ze
1104
1079
  }
1105
1080
  ),
1106
- /* @__PURE__ */ n(tn, {}),
1081
+ /* @__PURE__ */ o(Zr, {}),
1107
1082
  i,
1108
- /* @__PURE__ */ n(nn, { isLoading: t }),
1109
- !a && /* @__PURE__ */ n(Yr, { children: l })
1083
+ /* @__PURE__ */ o(rn, { isLoading: t }),
1084
+ !a && /* @__PURE__ */ o(Yr, { children: l })
1110
1085
  ]
1111
1086
  }
1112
1087
  ),
1113
- /* @__PURE__ */ n(en, { state: h }),
1114
- /* @__PURE__ */ n(W, { children: r })
1088
+ /* @__PURE__ */ o(tn, { state: h }),
1089
+ /* @__PURE__ */ o(W, { children: r })
1115
1090
  ]
1116
1091
  }
1117
1092
  ) });
1118
- }, on = {
1093
+ }, nn = {
1119
1094
  fontSize: "1rem",
1120
1095
  lineHeight: "1.5",
1121
1096
  "h1, h2, h3, h4, h5, h6": {
@@ -1309,11 +1284,11 @@ const Ot = ["image/"], Zr = () => {
1309
1284
  defaultVariants: {
1310
1285
  size: "md"
1311
1286
  }
1312
- }, Kn = dr(on), an = ({
1287
+ }, jn = dr(nn), on = ({
1313
1288
  fileUpload: t,
1314
1289
  ...r
1315
1290
  }) => {
1316
- const [e] = x(), [o, i] = b(null), a = (s) => {
1291
+ const [e] = x(), [n, i] = b(null), a = (s) => {
1317
1292
  var c;
1318
1293
  const d = (c = s.target.files) == null ? void 0 : c[0];
1319
1294
  if (d) {
@@ -1324,16 +1299,16 @@ const Ot = ["image/"], Zr = () => {
1324
1299
  }, h.src = g;
1325
1300
  }
1326
1301
  }, l = () => {
1327
- o && !t.isLoading && (e.dispatchCommand(vt, {
1328
- src: o.url,
1329
- altText: `Image: ${o.url}`,
1330
- meta: { width: o.width, height: o.height }
1302
+ n && !t.isLoading && (e.dispatchCommand(vt, {
1303
+ src: n.url,
1304
+ altText: `Image: ${n.url}`,
1305
+ meta: { width: n.width, height: n.height }
1331
1306
  }), r.onOpenChange(!1));
1332
1307
  };
1333
1308
  return /* @__PURE__ */ u(Xt, { ...r, children: [
1334
- /* @__PURE__ */ n(We, { children: "Sett inn bilde" }),
1335
- t.isLoading && /* @__PURE__ */ n(pt, {}),
1336
- /* @__PURE__ */ n(
1309
+ /* @__PURE__ */ o(We, { children: "Sett inn bilde" }),
1310
+ t.isLoading && /* @__PURE__ */ o(pt, {}),
1311
+ /* @__PURE__ */ o(
1337
1312
  mt,
1338
1313
  {
1339
1314
  type: "file",
@@ -1343,20 +1318,20 @@ const Ot = ["image/"], Zr = () => {
1343
1318
  }
1344
1319
  ),
1345
1320
  /* @__PURE__ */ u(et, { children: [
1346
- /* @__PURE__ */ n(L, { onClick: () => r.onOpenChange(!1), children: "Avbryt" }),
1347
- /* @__PURE__ */ n(
1321
+ /* @__PURE__ */ o(L, { onClick: () => r.onOpenChange(!1), children: "Avbryt" }),
1322
+ /* @__PURE__ */ o(
1348
1323
  L,
1349
1324
  {
1350
1325
  variant: "primary",
1351
- disabled: !o || t.isLoading,
1326
+ disabled: !n || t.isLoading,
1352
1327
  onClick: l,
1353
1328
  children: "Sett inn"
1354
1329
  }
1355
1330
  )
1356
1331
  ] })
1357
1332
  ] });
1358
- }, Gn = () => {
1359
- const [t] = x(), { fileUpload: r } = z(), [e, o] = b(!1), i = T(() => {
1333
+ }, Kn = () => {
1334
+ const [t] = x(), { fileUpload: r } = z(), [e, n] = b(!1), i = T(() => {
1360
1335
  t.dispatchCommand(Ie, {
1361
1336
  rows: "3",
1362
1337
  columns: "3",
@@ -1367,39 +1342,39 @@ const Ot = ["image/"], Zr = () => {
1367
1342
  /* @__PURE__ */ u(
1368
1343
  tt,
1369
1344
  {
1370
- trigger: /* @__PURE__ */ n(gt, { dropdown: !0, children: "Sett inn" }),
1345
+ trigger: /* @__PURE__ */ o(gt, { dropdown: !0, children: "Sett inn" }),
1371
1346
  side: "bottom",
1372
1347
  align: "end",
1373
1348
  children: [
1374
1349
  /* @__PURE__ */ u(v, { onClick: i, children: [
1375
- /* @__PURE__ */ n(Fr, { size: "1.25rem" }),
1350
+ /* @__PURE__ */ o(Fr, { size: "1.25rem" }),
1376
1351
  " Tabell"
1377
1352
  ] }),
1378
- r && /* @__PURE__ */ u(v, { onClick: () => o(!0), children: [
1379
- /* @__PURE__ */ n(Je, { size: "1.25rem" }),
1353
+ r && /* @__PURE__ */ u(v, { onClick: () => n(!0), children: [
1354
+ /* @__PURE__ */ o(Je, { size: "1.25rem" }),
1380
1355
  " Bilde"
1381
1356
  ] })
1382
1357
  ]
1383
1358
  }
1384
1359
  ),
1385
- r && /* @__PURE__ */ n(
1386
- an,
1360
+ r && /* @__PURE__ */ o(
1361
+ on,
1387
1362
  {
1388
1363
  open: e,
1389
- onOpenChange: o,
1364
+ onOpenChange: n,
1390
1365
  fileUpload: r
1391
1366
  }
1392
1367
  )
1393
1368
  ] });
1394
1369
  };
1395
- function ln(t) {
1370
+ function an(t) {
1396
1371
  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);
1397
1372
  }
1398
- const Yn = () => {
1399
- const [t] = x(), [r, e] = b(null), { hasFocus: o } = z();
1373
+ const Gn = () => {
1374
+ const [t] = x(), [r, e] = b(null), { hasFocus: n } = z();
1400
1375
  _(() => {
1401
- !o && r && e(null);
1402
- }, [o, r]);
1376
+ !n && r && e(null);
1377
+ }, [n, r]);
1403
1378
  const { refs: i, floatingStyles: a } = ft({
1404
1379
  placement: "top-end",
1405
1380
  open: !!r,
@@ -1447,7 +1422,7 @@ const Yn = () => {
1447
1422
  return r ? /* @__PURE__ */ u(
1448
1423
  tt,
1449
1424
  {
1450
- trigger: /* @__PURE__ */ n(
1425
+ trigger: /* @__PURE__ */ o(
1451
1426
  L,
1452
1427
  {
1453
1428
  icon: !0,
@@ -1456,32 +1431,32 @@ const Yn = () => {
1456
1431
  ref: i.setFloating,
1457
1432
  style: a,
1458
1433
  css: { padding: "2px", width: "18px", height: "18px" },
1459
- children: /* @__PURE__ */ n(ln, {})
1434
+ children: /* @__PURE__ */ o(an, {})
1460
1435
  }
1461
1436
  ),
1462
1437
  children: [
1463
- /* @__PURE__ */ n(D, { onClick: l("add-row-over"), children: "Legg til rad over" }),
1464
- /* @__PURE__ */ n(D, { onClick: l("add-row-under"), children: "Legg til rad under" }),
1465
- /* @__PURE__ */ n(yt, {}),
1466
- /* @__PURE__ */ n(D, { onClick: l("add-column-left"), children: "Legg til kolonne venstre" }),
1467
- /* @__PURE__ */ n(D, { onClick: l("add-column-right"), children: "Legg til kolonne høyre" }),
1468
- /* @__PURE__ */ n(yt, {}),
1469
- /* @__PURE__ */ n(D, { onClick: l("delete-row"), children: "Fjern rad" }),
1470
- /* @__PURE__ */ n(D, { onClick: l("delete-column"), children: "Fjern kolonne" })
1438
+ /* @__PURE__ */ o(D, { onClick: l("add-row-over"), children: "Legg til rad over" }),
1439
+ /* @__PURE__ */ o(D, { onClick: l("add-row-under"), children: "Legg til rad under" }),
1440
+ /* @__PURE__ */ o(yt, {}),
1441
+ /* @__PURE__ */ o(D, { onClick: l("add-column-left"), children: "Legg til kolonne venstre" }),
1442
+ /* @__PURE__ */ o(D, { onClick: l("add-column-right"), children: "Legg til kolonne høyre" }),
1443
+ /* @__PURE__ */ o(yt, {}),
1444
+ /* @__PURE__ */ o(D, { onClick: l("delete-row"), children: "Fjern rad" }),
1445
+ /* @__PURE__ */ o(D, { onClick: l("delete-column"), children: "Fjern kolonne" })
1471
1446
  ]
1472
1447
  }
1473
1448
  ) : null;
1474
1449
  };
1475
1450
  function Tt(t) {
1476
1451
  let r = t;
1477
- const e = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi, o = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
1478
- return r = String(r).trim(), r.match(e) || r.match(o) ? r : "https://";
1452
+ const e = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi, n = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
1453
+ return r = String(r).trim(), r.match(e) || r.match(n) ? r : "https://";
1479
1454
  }
1480
1455
  function le(t) {
1481
- const r = t.anchor, e = t.focus, o = t.anchor.getNode(), i = t.focus.getNode();
1482
- return o === i ? o : t.isBackward() ? Lt(e) ? o : i : Lt(r) ? o : i;
1456
+ const r = t.anchor, e = t.focus, n = t.anchor.getNode(), i = t.focus.getNode();
1457
+ return n === i ? n : t.isBackward() ? Lt(e) ? n : i : Lt(r) ? n : i;
1483
1458
  }
1484
- const qn = (t) => (A.baseURL = t, A), Q = class extends P {
1459
+ const Yn = (t) => (A.baseURL = t, A), Q = class extends P {
1485
1460
  static getType() {
1486
1461
  return "rutine_link";
1487
1462
  }
@@ -1516,10 +1491,10 @@ O(A, "baseURL", "");
1516
1491
  function se(t) {
1517
1492
  return new A(t);
1518
1493
  }
1519
- function sn(t) {
1494
+ function ln(t) {
1520
1495
  return t instanceof A;
1521
1496
  }
1522
- const cn = ({ onClose: t }) => {
1497
+ const sn = ({ onClose: t }) => {
1523
1498
  const [r] = x(), e = T(
1524
1499
  (i) => {
1525
1500
  r.update(() => {
@@ -1538,17 +1513,17 @@ const cn = ({ onClose: t }) => {
1538
1513
  return /* @__PURE__ */ u("form", { onSubmit: (i) => {
1539
1514
  e(i.currentTarget.url.value), t();
1540
1515
  }, children: [
1541
- /* @__PURE__ */ n(mt, { name: "url", label: "URL", type: "url", required: !0 }),
1516
+ /* @__PURE__ */ o(mt, { name: "url", label: "URL", type: "url", required: !0 }),
1542
1517
  /* @__PURE__ */ u(et, { children: [
1543
- /* @__PURE__ */ n(L, { onClick: t, children: "Avbryt" }),
1544
- /* @__PURE__ */ n(L, { type: "submit", variant: "primary", children: "Sett inn" })
1518
+ /* @__PURE__ */ o(L, { onClick: t, children: "Avbryt" }),
1519
+ /* @__PURE__ */ o(L, { type: "submit", variant: "primary", children: "Sett inn" })
1545
1520
  ] })
1546
1521
  ] });
1547
- }, dn = ({
1522
+ }, cn = ({
1548
1523
  onClose: t,
1549
1524
  getDocs: r
1550
1525
  }) => {
1551
- const [e] = x(), [o, i] = b([]), a = r(), l = T(
1526
+ const [e] = x(), [n, i] = b([]), a = r(), l = T(
1552
1527
  (s) => {
1553
1528
  e.update(() => {
1554
1529
  const d = y();
@@ -1565,7 +1540,7 @@ const cn = ({ onClose: t }) => {
1565
1540
  [e]
1566
1541
  );
1567
1542
  return /* @__PURE__ */ u(W, { children: [
1568
- /* @__PURE__ */ n(
1543
+ /* @__PURE__ */ o(
1569
1544
  Ke,
1570
1545
  {
1571
1546
  isMulti: !0,
@@ -1574,25 +1549,25 @@ const cn = ({ onClose: t }) => {
1574
1549
  }
1575
1550
  ),
1576
1551
  /* @__PURE__ */ u(et, { children: [
1577
- /* @__PURE__ */ n(L, { onClick: t, children: "Avbryt" }),
1578
- /* @__PURE__ */ n(
1552
+ /* @__PURE__ */ o(L, { onClick: t, children: "Avbryt" }),
1553
+ /* @__PURE__ */ o(
1579
1554
  L,
1580
1555
  {
1581
1556
  variant: "primary",
1582
1557
  onClick: () => {
1583
- l(o), t();
1558
+ l(n), t();
1584
1559
  },
1585
1560
  children: "Sett inn"
1586
1561
  }
1587
1562
  )
1588
1563
  ] })
1589
1564
  ] });
1590
- }, hn = ({
1565
+ }, dn = ({
1591
1566
  onClose: t,
1592
1567
  fileUpload: r,
1593
1568
  filePrefix: e
1594
1569
  }) => {
1595
- const [o] = x(), [i, a] = b(null), l = async (d) => {
1570
+ const [n] = x(), [i, a] = b(null), l = async (d) => {
1596
1571
  var h;
1597
1572
  const c = (h = d.target.files) == null ? void 0 : h[0];
1598
1573
  if (c) {
@@ -1603,7 +1578,7 @@ const cn = ({ onClose: t }) => {
1603
1578
  });
1604
1579
  }
1605
1580
  }, s = T(() => {
1606
- o.update(() => {
1581
+ n.update(() => {
1607
1582
  if (!i)
1608
1583
  return;
1609
1584
  const d = y();
@@ -1613,12 +1588,12 @@ const cn = ({ onClose: t }) => {
1613
1588
  const h = Bt();
1614
1589
  h.setTextNodeRange(c, 0, c, i.name.length), V(h);
1615
1590
  }
1616
- o.dispatchCommand(Z, Tt(i.url));
1591
+ n.dispatchCommand(Z, Tt(i.url));
1617
1592
  });
1618
- }, [o, i]);
1593
+ }, [n, i]);
1619
1594
  return /* @__PURE__ */ u(W, { children: [
1620
- r.isLoading && /* @__PURE__ */ n(pt, {}),
1621
- /* @__PURE__ */ n(
1595
+ r.isLoading && /* @__PURE__ */ o(pt, {}),
1596
+ /* @__PURE__ */ o(
1622
1597
  mt,
1623
1598
  {
1624
1599
  type: "file",
@@ -1627,8 +1602,8 @@ const cn = ({ onClose: t }) => {
1627
1602
  }
1628
1603
  ),
1629
1604
  /* @__PURE__ */ u(et, { children: [
1630
- /* @__PURE__ */ n(L, { onClick: t, children: "Avbryt" }),
1631
- /* @__PURE__ */ n(
1605
+ /* @__PURE__ */ o(L, { onClick: t, children: "Avbryt" }),
1606
+ /* @__PURE__ */ o(
1632
1607
  L,
1633
1608
  {
1634
1609
  variant: "primary",
@@ -1641,19 +1616,19 @@ const cn = ({ onClose: t }) => {
1641
1616
  )
1642
1617
  ] })
1643
1618
  ] });
1644
- }, un = ({
1619
+ }, hn = ({
1645
1620
  open: t,
1646
1621
  onOpenChange: r,
1647
1622
  getDocs: e,
1648
- filePrefix: o
1623
+ filePrefix: n
1649
1624
  }) => {
1650
1625
  const { fileUpload: i } = z(), [a, l] = b("url"), s = () => {
1651
1626
  r(!1);
1652
1627
  };
1653
1628
  return /* @__PURE__ */ u(Xt, { open: t, onOpenChange: r, css: { width: "600px" }, children: [
1654
1629
  /* @__PURE__ */ u(je, { css: { marginBottom: "$8" }, children: [
1655
- /* @__PURE__ */ n(lt, { active: a === "url", onClick: () => l("url"), children: "URL" }),
1656
- e && /* @__PURE__ */ n(
1630
+ /* @__PURE__ */ o(lt, { active: a === "url", onClick: () => l("url"), children: "URL" }),
1631
+ e && /* @__PURE__ */ o(
1657
1632
  lt,
1658
1633
  {
1659
1634
  active: a === "rutine",
@@ -1661,24 +1636,24 @@ const cn = ({ onClose: t }) => {
1661
1636
  children: "Rutine"
1662
1637
  }
1663
1638
  ),
1664
- i && /* @__PURE__ */ n(lt, { active: a === "file", onClick: () => l("file"), children: "Fil" })
1639
+ i && /* @__PURE__ */ o(lt, { active: a === "file", onClick: () => l("file"), children: "Fil" })
1665
1640
  ] }),
1666
- a === "url" && /* @__PURE__ */ n(cn, { onClose: s }),
1667
- a === "rutine" && e && /* @__PURE__ */ n(dn, { onClose: s, getDocs: e }),
1668
- a === "file" && i && /* @__PURE__ */ n(
1669
- hn,
1641
+ a === "url" && /* @__PURE__ */ o(sn, { onClose: s }),
1642
+ a === "rutine" && e && /* @__PURE__ */ o(cn, { onClose: s, getDocs: e }),
1643
+ a === "file" && i && /* @__PURE__ */ o(
1644
+ dn,
1670
1645
  {
1671
1646
  onClose: s,
1672
1647
  fileUpload: i,
1673
- filePrefix: o
1648
+ filePrefix: n
1674
1649
  }
1675
1650
  )
1676
1651
  ] });
1677
- }, Jn = ({
1652
+ }, qn = ({
1678
1653
  getDocs: t,
1679
1654
  filePrefix: r
1680
1655
  }) => {
1681
- const [e] = x(), [o, i] = b(!1), [a, l] = b(!1), s = T(() => {
1656
+ const [e] = x(), [n, i] = b(!1), [a, l] = b(!1), s = T(() => {
1682
1657
  const d = y();
1683
1658
  if (N(d)) {
1684
1659
  const c = le(d), h = c.getParent();
@@ -1689,20 +1664,20 @@ const cn = ({ onClose: t }) => {
1689
1664
  G,
1690
1665
  () => (s(), !1),
1691
1666
  ct
1692
- ), [e, s]), /* @__PURE__ */ u(qt, { type: "single", value: o ? "link" : "", children: [
1693
- /* @__PURE__ */ n(
1667
+ ), [e, s]), /* @__PURE__ */ u(qt, { type: "single", value: n ? "link" : "", children: [
1668
+ /* @__PURE__ */ o(
1694
1669
  B,
1695
1670
  {
1696
1671
  onClick: () => {
1697
- o ? e.dispatchCommand(Z, null) : l(!0);
1672
+ n ? e.dispatchCommand(Z, null) : l(!0);
1698
1673
  },
1699
1674
  title: "Lenke",
1700
1675
  value: "link",
1701
- children: /* @__PURE__ */ n(Ar, { size: "1.25rem" })
1676
+ children: /* @__PURE__ */ o(Ar, { size: "1.25rem" })
1702
1677
  }
1703
1678
  ),
1704
- /* @__PURE__ */ n(
1705
- un,
1679
+ /* @__PURE__ */ o(
1680
+ hn,
1706
1681
  {
1707
1682
  open: a,
1708
1683
  onOpenChange: l,
@@ -1711,8 +1686,8 @@ const cn = ({ onClose: t }) => {
1711
1686
  }
1712
1687
  )
1713
1688
  ] });
1714
- }, Xn = () => {
1715
- const [t] = x(), r = Y(null), [e, o] = b(null), [i, a] = b(""), { hasFocus: l } = z();
1689
+ }, Jn = () => {
1690
+ const [t] = x(), r = Y(null), [e, n] = b(null), [i, a] = b(""), { hasFocus: l } = z();
1716
1691
  _(() => {
1717
1692
  e ? t.update(() => {
1718
1693
  a(e.getURL());
@@ -1740,10 +1715,10 @@ const cn = ({ onClose: t }) => {
1740
1715
  const nt = window.getSelection(), _t = t.getRootElement();
1741
1716
  M !== null && nt !== null && _t !== null && _t.contains(nt.anchorNode) && t.isEditable() && (r.current = ((p = nt.focusNode) == null ? void 0 : p.parentElement) ?? null);
1742
1717
  }
1743
- o(q);
1718
+ n(q);
1744
1719
  }
1745
1720
  }, [t]), E = T(() => {
1746
- e && sn(e) && t.update(() => {
1721
+ e && ln(e) && t.update(() => {
1747
1722
  e.remove();
1748
1723
  }), t.dispatchCommand(Z, null);
1749
1724
  }, [t, e]);
@@ -1764,13 +1739,13 @@ const cn = ({ onClose: t }) => {
1764
1739
  ),
1765
1740
  t.registerCommand(
1766
1741
  Dt,
1767
- () => e ? (o(null), !0) : !1,
1742
+ () => e ? (n(null), !0) : !1,
1768
1743
  _e
1769
1744
  )
1770
1745
  ), [t, k, e]), !s)
1771
1746
  return null;
1772
1747
  const S = Tt(i);
1773
- return /* @__PURE__ */ n(ee, { children: /* @__PURE__ */ u(
1748
+ return /* @__PURE__ */ o(ee, { children: /* @__PURE__ */ u(
1774
1749
  Jt,
1775
1750
  {
1776
1751
  ref: d.setFloating,
@@ -1784,7 +1759,7 @@ const cn = ({ onClose: t }) => {
1784
1759
  style: c,
1785
1760
  ...g(),
1786
1761
  children: [
1787
- /* @__PURE__ */ n(
1762
+ /* @__PURE__ */ o(
1788
1763
  H,
1789
1764
  {
1790
1765
  as: "a",
@@ -1802,24 +1777,24 @@ const cn = ({ onClose: t }) => {
1802
1777
  children: i
1803
1778
  }
1804
1779
  ),
1805
- /* @__PURE__ */ n(L, { color: "danger", icon: !0, size: "sm", onClick: E, children: /* @__PURE__ */ n(Xe, { size: 24 }) })
1780
+ /* @__PURE__ */ o(L, { color: "danger", icon: !0, size: "sm", onClick: E, children: /* @__PURE__ */ o(Xe, { size: 24 }) })
1806
1781
  ]
1807
1782
  }
1808
1783
  ) });
1809
- }, Qn = () => {
1784
+ }, Xn = () => {
1810
1785
  const [t] = kt();
1811
1786
  return /* @__PURE__ */ u(
1812
1787
  tt,
1813
1788
  {
1814
1789
  align: "end",
1815
- trigger: /* @__PURE__ */ n(gt, { dropdown: !0, children: /* @__PURE__ */ n(St, { size: "1.25rem" }) }),
1790
+ trigger: /* @__PURE__ */ o(gt, { dropdown: !0, children: /* @__PURE__ */ o(St, { size: "1.25rem" }) }),
1816
1791
  children: [
1817
1792
  /* @__PURE__ */ u(
1818
1793
  v,
1819
1794
  {
1820
1795
  onClick: () => t.dispatchCommand(it, "left"),
1821
1796
  children: [
1822
- /* @__PURE__ */ n(St, { size: "1.25rem" }),
1797
+ /* @__PURE__ */ o(St, { size: "1.25rem" }),
1823
1798
  "Venstre"
1824
1799
  ]
1825
1800
  }
@@ -1829,7 +1804,7 @@ const cn = ({ onClose: t }) => {
1829
1804
  {
1830
1805
  onClick: () => t.dispatchCommand(it, "center"),
1831
1806
  children: [
1832
- /* @__PURE__ */ n(Tr, { size: "1.25rem" }),
1807
+ /* @__PURE__ */ o(Tr, { size: "1.25rem" }),
1833
1808
  "Midt"
1834
1809
  ]
1835
1810
  }
@@ -1839,7 +1814,7 @@ const cn = ({ onClose: t }) => {
1839
1814
  {
1840
1815
  onClick: () => t.dispatchCommand(it, "right"),
1841
1816
  children: [
1842
- /* @__PURE__ */ n(_r, { size: "1.25rem" }),
1817
+ /* @__PURE__ */ o(_r, { size: "1.25rem" }),
1843
1818
  "Høyre"
1844
1819
  ]
1845
1820
  }
@@ -1847,35 +1822,60 @@ const cn = ({ onClose: t }) => {
1847
1822
  ]
1848
1823
  }
1849
1824
  );
1825
+ }, Ot = ["image/"], Qn = () => {
1826
+ const [t] = kt(), { fileUpload: r } = z();
1827
+ return _(() => t.registerCommand(
1828
+ Re,
1829
+ (e) => ((async () => {
1830
+ const n = await lr(
1831
+ e,
1832
+ [Ot].flatMap((i) => i)
1833
+ );
1834
+ for (const { file: i, result: a } of n)
1835
+ if (sr(i, Ot)) {
1836
+ let l = a;
1837
+ const s = new Image(), d = window.URL.createObjectURL(i);
1838
+ s.onload = async () => {
1839
+ r && (l = await r.uploadFile({ file: i })), t.dispatchCommand(vt, {
1840
+ src: l,
1841
+ altText: i.name,
1842
+ meta: { width: s.naturalWidth, height: s.naturalHeight }
1843
+ }), window.URL.revokeObjectURL(d);
1844
+ }, s.src = d;
1845
+ }
1846
+ })(), !0),
1847
+ R
1848
+ ), [t, r]), null;
1850
1849
  };
1851
1850
  export {
1852
1851
  Ct as $createImageNode,
1853
1852
  se as $createRutineLinkNode,
1854
- Hn as $isImageNode,
1855
- sn as $isRutineLinkNode,
1856
- Qn as AlignToolbarDropdown,
1853
+ Fn as $isImageNode,
1854
+ ln as $isRutineLinkNode,
1855
+ Xn as AlignToolbarDropdown,
1856
+ Qn as DragDropPastePlugin,
1857
1857
  Yr as FloatingToolbar,
1858
1858
  $ as ImageNode,
1859
- Gn as InsertSelector,
1860
- Xn as LinkEditPlugin,
1859
+ Kn as InsertSelector,
1860
+ Jn as LinkEditPlugin,
1861
1861
  X as LinkTargetNode,
1862
- Jn as LinkToolbarButton,
1863
- jn as RichTextEditor,
1862
+ qn as LinkToolbarButton,
1863
+ Wn as RichTextEditor,
1864
1864
  qr as RichTextToolbar,
1865
1865
  A as RutineLinkNode,
1866
- qn as RutineLinkNodeInit,
1867
- Yn as TableEditPlugin,
1866
+ Yn as RutineLinkNodeInit,
1867
+ Gn as TableEditPlugin,
1868
1868
  kr as clearEditorState,
1869
- Un as defaultNodes,
1870
- Wn as defaultViewNodes,
1869
+ Hn as defaultNodes,
1870
+ Un as defaultViewNodes,
1871
1871
  fr as isEditorState,
1872
1872
  Mt as isJSON,
1873
1873
  oe as richTextContext,
1874
- Kn as richTextCss,
1875
- on as richTextStyleObj,
1874
+ jn as richTextCss,
1875
+ nn as richTextStyleObj,
1876
1876
  br as setStateFromPlainText,
1877
- Pn as stateToHTML,
1878
- Fn as syncStateToHTML,
1877
+ Bn as stateToHTML,
1878
+ Pn as syncStateToHTML,
1879
1879
  Mr as useHasFocusWithin,
1880
1880
  z as useRichTextContext
1881
1881
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkitektbedriftene/fe-lib",
3
- "version": "2.5.4",
3
+ "version": "4.0.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -76,15 +76,15 @@
76
76
  },
77
77
  "dependencies": {
78
78
  "@floating-ui/react": "^0.26.0",
79
- "@lexical/headless": "~0.17.0",
80
- "@lexical/html": "~0.17.0",
81
- "@lexical/link": "~0.17.0",
82
- "@lexical/list": "~0.17.0",
83
- "@lexical/react": "~0.17.0",
84
- "@lexical/rich-text": "~0.17.0",
85
- "@lexical/selection": "~0.17.0",
86
- "@lexical/table": "~0.17.0",
87
- "@lexical/utils": "~0.17.0",
79
+ "@lexical/headless": "~0.22.0",
80
+ "@lexical/html": "~0.22.0",
81
+ "@lexical/link": "~0.22.0",
82
+ "@lexical/list": "~0.22.0",
83
+ "@lexical/react": "~0.22.0",
84
+ "@lexical/rich-text": "~0.22.0",
85
+ "@lexical/selection": "~0.22.0",
86
+ "@lexical/table": "~0.22.0",
87
+ "@lexical/utils": "~0.22.0",
88
88
  "@radix-ui/react-checkbox": "^1.1.3",
89
89
  "@radix-ui/react-dialog": "^1.1.4",
90
90
  "@radix-ui/react-dropdown-menu": "^2.1.4",
@@ -92,10 +92,10 @@
92
92
  "@radix-ui/react-toolbar": "^1.1.1",
93
93
  "@stitches/react": "^1.2.8",
94
94
  "jwt-decode": "^4.0.0",
95
- "lexical": "~0.17.0",
95
+ "lexical": "~0.22.0",
96
96
  "oidc-client-ts": "^2.2.2",
97
97
  "react-icons": "^4.8.0",
98
98
  "react-select": "^5.8.0",
99
99
  "use-local-storage-state": "^18.2.1"
100
100
  }
101
- }
101
+ }