@arkitektbedriftene/fe-lib 4.2.0 → 4.2.1

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.
@@ -4,7 +4,7 @@ import { type InitialConfigType } from "@lexical/react/LexicalComposer.js";
4
4
  import { type UploadFn } from "./editorContext";
5
5
  import type { EditorState, SerializedEditorState } from "lexical";
6
6
  export type RichTextEditorState = EditorState | string | SerializedEditorState;
7
- export declare const RichTextEditor: ({ isLoading, children, placeholderText, nodes, plugins, toolbar, toolbarContent, content, hideBorder, onBlur, defaultState, css, signUrl, fileUpload, }: {
7
+ export declare const RichTextEditor: ({ isLoading, children, placeholderText, nodes, plugins, toolbar, toolbarContent, content, hideBorder, onBlur, defaultState, css, signUrl, fileUpload, editable, }: {
8
8
  isLoading: boolean;
9
9
  children: ReactNode;
10
10
  placeholderText?: string | undefined;
@@ -24,4 +24,5 @@ export declare const RichTextEditor: ({ isLoading, children, placeholderText, no
24
24
  }> | undefined;
25
25
  signUrl?: ((url: string) => Promise<string>) | undefined;
26
26
  fileUpload?: UploadFn | undefined;
27
+ editable?: boolean | undefined;
27
28
  }) => import("react/jsx-runtime").JSX.Element;
@@ -3,21 +3,21 @@ var de = (t, r, e) => r in t ? ce(t, r, { enumerable: !0, configurable: !0, writ
3
3
  var O = (t, r, e) => (de(t, typeof r != "symbol" ? r + "" : r, e), e);
4
4
  import { createHeadlessEditor as At } from "@lexical/headless";
5
5
  import { $generateHtmlFromNodes as zt } from "@lexical/html";
6
- import { $getRoot as K, ParagraphNode as he, $createParagraphNode as U, $createTextNode as I, $setSelection as V, $getNodeByKey as ot, DecoratorNode as ue, $applyNodeReplacement as ge, SELECTION_CHANGE_COMMAND as G, $getSelection as y, COMMAND_PRIORITY_CRITICAL as ct, $isRangeSelection as N, $isRootOrShadowRoot as $t, FORMAT_TEXT_COMMAND as j, COMMAND_PRIORITY_LOW as R, KEY_ARROW_DOWN_COMMAND as pe, KEY_ARROW_UP_COMMAND as me, KEY_ESCAPE_COMMAND as Dt, KEY_SPACE_COMMAND as fe, $getNearestNodeFromDOMNode as dt, KEY_ARROW_LEFT_COMMAND as ke, $isElementNode as be, createCommand as Me, $insertNodes as Ce, COMMAND_PRIORITY_EDITOR as ve, COMMAND_PRIORITY_NORMAL as Te, $createRangeSelection as Bt, COMMAND_PRIORITY_HIGH as _e, FORMAT_ELEMENT_COMMAND as it } from "lexical";
6
+ import { $getRoot as G, ParagraphNode as he, $createParagraphNode as W, $createTextNode as I, $setSelection as V, $getNodeByKey as ot, DecoratorNode as ue, $applyNodeReplacement as ge, SELECTION_CHANGE_COMMAND as Y, $getSelection as y, COMMAND_PRIORITY_CRITICAL as ct, $isRangeSelection as N, $isRootOrShadowRoot as $t, FORMAT_TEXT_COMMAND as K, COMMAND_PRIORITY_LOW as R, KEY_ARROW_DOWN_COMMAND as pe, KEY_ARROW_UP_COMMAND as me, KEY_ESCAPE_COMMAND as Dt, KEY_SPACE_COMMAND as fe, $getNearestNodeFromDOMNode as dt, KEY_ARROW_LEFT_COMMAND as ke, $isElementNode as be, createCommand as Me, $insertNodes as Ce, COMMAND_PRIORITY_EDITOR as ve, COMMAND_PRIORITY_NORMAL as Te, $createRangeSelection as Bt, COMMAND_PRIORITY_HIGH as _e, FORMAT_ELEMENT_COMMAND as it } from "lexical";
7
7
  import { trimTextContentFromAnchor as Le, $setBlocksType as at, $isAtNodeEnd as Lt } from "@lexical/selection";
8
8
  import { $dfs as xe, $getNearestNodeOfType as we, $findMatchingParent as Pt, mergeRegister as Z, isHTMLElement as xt, $wrapNodeInElement as ye, mediaFileReader as Ne, isMimeType as Se } from "@lexical/utils";
9
- import { LinkNode as P, AutoLinkNode as Ft, $isLinkNode as J, TOGGLE_LINK_COMMAND as tt } from "@lexical/link";
10
- import { ListNode as ht, ListItemNode as Ht, $isListNode as ut, INSERT_UNORDERED_LIST_COMMAND as Ee, INSERT_ORDERED_LIST_COMMAND as Re, INSERT_CHECK_LIST_COMMAND as Ut, insertList as Ie, $isListItemNode as F } from "@lexical/list";
9
+ import { LinkNode as F, AutoLinkNode as Ft, $isLinkNode as J, TOGGLE_LINK_COMMAND as tt } from "@lexical/link";
10
+ import { ListNode as ht, ListItemNode as Ht, $isListNode as ut, INSERT_UNORDERED_LIST_COMMAND as Ee, INSERT_ORDERED_LIST_COMMAND as Re, INSERT_CHECK_LIST_COMMAND as Ut, insertList as Ie, $isListItemNode as H } from "@lexical/list";
11
11
  import { HeadingNode as Wt, QuoteNode as jt, $isHeadingNode as Oe, $createHeadingNode as Ae, $createQuoteNode as ze, DRAG_DROP_PASTE as $e } from "@lexical/rich-text";
12
12
  import { TableNode as Kt, TableRowNode as Gt, TableCellNode as Yt, INSERT_TABLE_COMMAND as De, $getTableCellNodeFromLexicalNode as Be, $deleteTableColumn__EXPERIMENTAL as Pe, $deleteTableRow__EXPERIMENTAL as Fe, $insertTableColumn__EXPERIMENTAL as wt, $insertTableRow__EXPERIMENTAL as yt } from "@lexical/table";
13
- import { jsx as o, jsxs as u, Fragment as W } from "react/jsx-runtime";
14
- import { createContext as He, useState as b, useRef as Y, useCallback as T, useContext as Ue, useEffect as _, useMemo as qt, useLayoutEffect as We } from "react";
15
- import { Box as H, Stack as je, Button as L, DropdownMenu as et, ToolbarButton as gt, DropdownMenuIconItem as v, ToolbarToggleGroup as Jt, ToolbarToggleItem as B, OverlayCard as Xt, Toolbar as Ke, ToolbarSeparator as Ge, styled as Ye, Spinner as pt, Dialog as Qt, DialogHeader as qe, TextInput as mt, DialogActions as rt, DropdownMenuItem as D, DropdownMenuSeparator as Nt, NavBar as Je, NavBarItem as lt, Combobox as Xe } from "./ui.es.js";
13
+ import { jsx as o, jsxs as u, Fragment as j } from "react/jsx-runtime";
14
+ import { createContext as He, useState as b, useRef as q, useCallback as T, useContext as Ue, useEffect as _, useMemo as qt, useLayoutEffect as We } from "react";
15
+ import { Box as U, Stack as je, Button as L, DropdownMenu as et, ToolbarButton as gt, DropdownMenuIconItem as v, ToolbarToggleGroup as Jt, ToolbarToggleItem as P, OverlayCard as Xt, Toolbar as Ke, ToolbarSeparator as Ge, styled as Ye, Spinner as pt, Dialog as Qt, DialogHeader as qe, TextInput as mt, DialogActions as rt, DropdownMenuItem as B, DropdownMenuSeparator as Nt, NavBar as Je, NavBarItem as lt, Combobox as Xe } from "./ui.es.js";
16
16
  import { f as Qe, g as Ve, h as Ze, G as f, i as tr, j as er } from "./index.esm-787a7997.js";
17
17
  import { useLexicalComposerContext as x } from "@lexical/react/LexicalComposerContext.js";
18
18
  import { LexicalComposer as rr } from "@lexical/react/LexicalComposer.js";
19
19
  import { RichTextPlugin as nr } from "@lexical/react/LexicalRichTextPlugin.js";
20
- import or from "@lexical/react/LexicalErrorBoundary.js";
20
+ import { LexicalErrorBoundary as or } from "@lexical/react/LexicalErrorBoundary.js";
21
21
  import { useFloating as ft, autoUpdate as Vt, size as ir, flip as ar, offset as Zt, shift as lr, useInteractions as te, useRole as ee, FloatingPortal as re, inline as sr, useDismiss as cr } from "@floating-ui/react";
22
22
  import { s as dr, c as hr } from "./stitches.config-00c23cdb.js";
23
23
  import { ListPlugin as ur } from "@lexical/react/LexicalListPlugin.js";
@@ -46,7 +46,7 @@ const fr = ({
46
46
  maxChars: r,
47
47
  maxLines: e
48
48
  }) => {
49
- const n = K(), i = n.getTextContent(), a = fr({ text: i, maxChars: r, maxLines: e }), l = i.length - a, d = n.select().anchor;
49
+ const n = G(), i = n.getTextContent(), a = fr({ text: i, maxChars: r, maxLines: e }), l = i.length - a, d = n.select().anchor;
50
50
  Le(t, d, l);
51
51
  const c = n.getLastChild();
52
52
  return c instanceof he && c.getChildrenSize() === 0 && c.remove(), l;
@@ -65,9 +65,9 @@ const fr = ({
65
65
  }, Mt = (t) => t[0] === "{", kr = (t) => t !== null && typeof t == "object" && "isEmpty" in t, br = (t, r) => {
66
66
  t.update(
67
67
  () => {
68
- const e = K();
68
+ const e = G();
69
69
  e.clear();
70
- const n = U();
70
+ const n = W();
71
71
  n.append(I("")), e.append(n), V(null);
72
72
  },
73
73
  {
@@ -77,9 +77,9 @@ const fr = ({
77
77
  }, Mr = (t, r, e) => {
78
78
  r.update(
79
79
  () => {
80
- const n = K();
80
+ const n = G();
81
81
  n.clear();
82
- const i = U();
82
+ const i = W();
83
83
  i.append(I(t.trim())), n.append(i), V(null);
84
84
  },
85
85
  {
@@ -98,7 +98,7 @@ const fr = ({
98
98
  try {
99
99
  if (typeof t == "string" && !Mt(t))
100
100
  i.update(() => {
101
- const s = K(), d = U();
101
+ const s = G(), d = W();
102
102
  d.append(I(t.trim())), s.append(d);
103
103
  });
104
104
  else {
@@ -129,7 +129,7 @@ const fr = ({
129
129
  try {
130
130
  if (typeof t == "string" && !Mt(t))
131
131
  i.update(() => {
132
- const l = K(), s = U();
132
+ const l = G(), s = W();
133
133
  s.append(I(t.trim())), l.append(s);
134
134
  });
135
135
  else {
@@ -153,7 +153,7 @@ const fr = ({
153
153
  }
154
154
  return { html: a, trimCount: n };
155
155
  }, Hn = (t) => xe().map(({ node: r }) => r).filter((r) => t.some((e) => r instanceof e));
156
- class X extends P {
156
+ class X extends F {
157
157
  static getType() {
158
158
  return "target-link";
159
159
  }
@@ -178,7 +178,7 @@ class X extends P {
178
178
  return super.exportJSON();
179
179
  }
180
180
  static importJSON(r) {
181
- return P.importJSON(r);
181
+ return F.importJSON(r);
182
182
  }
183
183
  }
184
184
  const oe = He({
@@ -187,7 +187,7 @@ const oe = He({
187
187
  signUrl: void 0,
188
188
  fileUpload: void 0
189
189
  }), Cr = ({ onBlur: t }) => {
190
- const [r, e] = b(!1), n = Y(null), i = T(() => {
190
+ const [r, e] = b(!1), n = q(null), i = T(() => {
191
191
  e(!0), n.current && window.clearTimeout(n.current);
192
192
  }, []), a = T(() => {
193
193
  n.current = window.setTimeout(() => {
@@ -209,40 +209,40 @@ function vr({
209
209
  height: n,
210
210
  nodeKey: i
211
211
  }) {
212
- const { signUrl: a } = z(), [l, s] = b(a ? "" : t), [d, c] = b(!1), h = Y(!1), [g] = x();
212
+ const { signUrl: a } = z(), [l, s] = b(a ? "" : t), [d, c] = b(!1), h = q(!1), [g] = x();
213
213
  _(() => {
214
- const p = async () => {
214
+ const m = async () => {
215
215
  s(await (a == null ? void 0 : a(t)) ?? t);
216
216
  };
217
- !l && !h.current && (h.current = !0, p());
217
+ !l && !h.current && (h.current = !0, m());
218
218
  }, []);
219
- const k = (p) => (C) => {
220
- C.relatedTarget instanceof HTMLElement && C.relatedTarget.dataset.controls === "true" || c(p);
221
- }, E = () => {
219
+ const k = (m) => (C) => {
220
+ C.relatedTarget instanceof HTMLElement && C.relatedTarget.dataset.controls === "true" || c(m);
221
+ }, S = () => {
222
222
  g.update(() => {
223
- const p = ot(i);
224
- p && p.remove();
223
+ const m = ot(i);
224
+ m && m.remove();
225
225
  });
226
- }, S = () => {
226
+ }, E = () => {
227
227
  g.update(() => {
228
- var m;
229
- const p = ot(i);
230
- if (!p)
228
+ var p;
229
+ const m = ot(i);
230
+ if (!m)
231
231
  return;
232
- const C = p.getPreviousSibling() || ((m = p.getParent()) == null ? void 0 : m.getPreviousSibling());
233
- C && C.insertBefore(p);
232
+ const C = m.getPreviousSibling() || ((p = m.getParent()) == null ? void 0 : p.getPreviousSibling());
233
+ C && C.insertBefore(m);
234
234
  });
235
235
  }, M = () => {
236
236
  g.update(() => {
237
- var m;
238
- const p = ot(i);
239
- if (!p)
237
+ var p;
238
+ const m = ot(i);
239
+ if (!m)
240
240
  return;
241
- const C = p.getNextSibling() || ((m = p.getParent()) == null ? void 0 : m.getNextSibling());
242
- C && C.insertAfter(p);
241
+ const C = m.getNextSibling() || ((p = m.getParent()) == null ? void 0 : p.getNextSibling());
242
+ C && C.insertAfter(m);
243
243
  });
244
244
  };
245
- return l ? /* @__PURE__ */ u(H, { css: { position: "relative", display: "inline-block" }, children: [
245
+ return l ? /* @__PURE__ */ u(U, { css: { position: "relative", display: "inline-block" }, children: [
246
246
  /* @__PURE__ */ u(
247
247
  je,
248
248
  {
@@ -264,7 +264,7 @@ function vr({
264
264
  icon: !0,
265
265
  size: "sm",
266
266
  css: { width: "20px", height: "20px" },
267
- onClick: E,
267
+ onClick: S,
268
268
  color: "danger",
269
269
  children: /* @__PURE__ */ o(Qe, {})
270
270
  }
@@ -275,7 +275,7 @@ function vr({
275
275
  icon: !0,
276
276
  size: "sm",
277
277
  css: { width: "20px", height: "20px" },
278
- onClick: S,
278
+ onClick: E,
279
279
  children: /* @__PURE__ */ o(Ve, {})
280
280
  }
281
281
  ),
@@ -427,7 +427,7 @@ const Wn = [
427
427
  ht,
428
428
  Ht,
429
429
  Ft,
430
- P,
430
+ F,
431
431
  Kt,
432
432
  Gt,
433
433
  Yt,
@@ -438,14 +438,14 @@ const Wn = [
438
438
  ht,
439
439
  Ht,
440
440
  Ft,
441
- P,
441
+ F,
442
442
  Kt,
443
443
  Gt,
444
444
  Yt,
445
445
  $,
446
446
  X,
447
447
  {
448
- replace: P,
448
+ replace: F,
449
449
  with: (t) => new X(
450
450
  t.getURL(),
451
451
  { rel: t.__rel, target: t.__target, title: t.__title }
@@ -544,10 +544,10 @@ const Wr = dr("div", {
544
544
  quote: /* @__PURE__ */ o(Pr, { size: "1.25rem" })
545
545
  }, w = ({
546
546
  blockType: t
547
- }) => /* @__PURE__ */ u(W, { children: [
548
- /* @__PURE__ */ o(H, { css: { display: "flex", flex: "0 0 auto" }, children: jr[t] }),
547
+ }) => /* @__PURE__ */ u(j, { children: [
548
+ /* @__PURE__ */ o(U, { css: { display: "flex", flex: "0 0 auto" }, children: jr[t] }),
549
549
  /* @__PURE__ */ o(
550
- H,
550
+ U,
551
551
  {
552
552
  css: {
553
553
  flex: "1 1 auto",
@@ -573,19 +573,19 @@ const Wr = dr("div", {
573
573
  }, Gr = () => {
574
574
  const [t] = x(), [r, e] = b("paragraph");
575
575
  _(() => t.registerCommand(
576
- G,
576
+ Y,
577
577
  () => {
578
578
  const c = y(), h = Kr(c);
579
579
  if (!h)
580
580
  return !1;
581
- const { element: g, anchorNode: k } = h, E = g.getKey();
582
- if (t.getElementByKey(E) !== null)
581
+ const { element: g, anchorNode: k } = h, S = g.getKey();
582
+ if (t.getElementByKey(S) !== null)
583
583
  if (ut(g)) {
584
584
  const M = we(
585
585
  k,
586
586
  ht
587
- ), p = M ? M.getListType() : g.getListType();
588
- e(p);
587
+ ), m = M ? M.getListType() : g.getListType();
588
+ e(m);
589
589
  } else {
590
590
  const M = Oe(g) ? g.getTag() : g.getType();
591
591
  M in ie && e(M);
@@ -617,7 +617,7 @@ const Wr = dr("div", {
617
617
  /* @__PURE__ */ o(v, { onClick: () => {
618
618
  r !== "paragraph" && t.update(() => {
619
619
  const c = y();
620
- N(c) && (at(c, () => U()), e("paragraph"));
620
+ N(c) && (at(c, () => W()), e("paragraph"));
621
621
  });
622
622
  }, children: /* @__PURE__ */ o(w, { blockType: "paragraph" }) }),
623
623
  /* @__PURE__ */ o(v, { onClick: () => n("h1"), children: /* @__PURE__ */ o(w, { blockType: "h1" }) }),
@@ -646,39 +646,39 @@ const Wr = dr("div", {
646
646
  ) });
647
647
  }, Yr = () => {
648
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
- const m = y();
650
- N(m) && (e(m.hasFormat("bold")), i(m.hasFormat("italic")), l(m.hasFormat("underline")), d(m.hasFormat("code")), h(m.hasFormat("superscript")));
649
+ const p = y();
650
+ N(p) && (e(p.hasFormat("bold")), i(p.hasFormat("italic")), l(p.hasFormat("underline")), d(p.hasFormat("code")), h(p.hasFormat("superscript")));
651
651
  }, []);
652
652
  _(() => Z(
653
653
  t.registerCommand(
654
- G,
654
+ Y,
655
655
  () => (g(), !1),
656
656
  ct
657
657
  ),
658
- t.registerUpdateListener(({ editorState: m }) => {
659
- m.read(() => {
658
+ t.registerUpdateListener(({ editorState: p }) => {
659
+ p.read(() => {
660
660
  g();
661
661
  });
662
662
  })
663
663
  ), [t, g]);
664
664
  const k = T(
665
- () => t.dispatchCommand(j, "bold"),
666
- [t]
667
- ), E = T(
668
- () => t.dispatchCommand(j, "italic"),
665
+ () => t.dispatchCommand(K, "bold"),
669
666
  [t]
670
667
  ), S = T(
671
- () => t.dispatchCommand(j, "underline"),
668
+ () => t.dispatchCommand(K, "italic"),
669
+ [t]
670
+ ), E = T(
671
+ () => t.dispatchCommand(K, "underline"),
672
672
  [t]
673
673
  ), M = T(
674
- () => t.dispatchCommand(j, "code"),
674
+ () => t.dispatchCommand(K, "code"),
675
675
  [t]
676
- ), p = T(
677
- () => t.dispatchCommand(j, "superscript"),
676
+ ), m = T(
677
+ () => t.dispatchCommand(K, "superscript"),
678
678
  [t]
679
679
  ), C = qt(() => {
680
- const m = [];
681
- return r && m.push("bold"), n && m.push("italic"), a && m.push("underline"), s && m.push("code"), c && m.push("superscript"), m;
680
+ const p = [];
681
+ return r && p.push("bold"), n && p.push("italic"), a && p.push("underline"), s && p.push("code"), c && p.push("superscript"), p;
682
682
  }, [r, n, a, s, c]);
683
683
  return /* @__PURE__ */ u(
684
684
  Jt,
@@ -687,30 +687,30 @@ const Wr = dr("div", {
687
687
  "aria-label": "Tekstformattering",
688
688
  value: C,
689
689
  children: [
690
- /* @__PURE__ */ o(B, { onClick: k, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ o(xr, { size: "1.25rem" }) }),
690
+ /* @__PURE__ */ o(P, { onClick: k, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ o(xr, { size: "1.25rem" }) }),
691
691
  /* @__PURE__ */ o(
692
- B,
692
+ P,
693
693
  {
694
- onClick: E,
694
+ onClick: S,
695
695
  title: "Kursiv tekst",
696
696
  value: "italic",
697
697
  children: /* @__PURE__ */ o(Or, { size: "1.25rem" })
698
698
  }
699
699
  ),
700
700
  /* @__PURE__ */ o(
701
- B,
701
+ P,
702
702
  {
703
- onClick: S,
703
+ onClick: E,
704
704
  title: "Understreket tekst",
705
705
  value: "underline",
706
706
  children: /* @__PURE__ */ o(Ur, { size: "1.25rem" })
707
707
  }
708
708
  ),
709
- /* @__PURE__ */ o(B, { onClick: M, title: "Kode", value: "code", children: /* @__PURE__ */ o(wr, { size: "1.25rem" }) }),
709
+ /* @__PURE__ */ o(P, { onClick: M, title: "Kode", value: "code", children: /* @__PURE__ */ o(wr, { size: "1.25rem" }) }),
710
710
  /* @__PURE__ */ o(
711
- B,
711
+ P,
712
712
  {
713
- onClick: p,
713
+ onClick: m,
714
714
  title: "Superscript",
715
715
  value: "superscript",
716
716
  children: /* @__PURE__ */ o(Fr, { size: "1.25rem" })
@@ -810,7 +810,7 @@ function Xr() {
810
810
  const e = st();
811
811
  return e != null && t.isEditable() ? (t.update(() => {
812
812
  const n = dt(e);
813
- F(n) && (r.preventDefault(), n.toggleChecked());
813
+ H(n) && (r.preventDefault(), n.toggleChecked());
814
814
  }), !0) : !1;
815
815
  },
816
816
  R
@@ -826,7 +826,7 @@ function Xr() {
826
826
  a,
827
827
  (s) => be(s) && !s.isInline()
828
828
  );
829
- if (F(l)) {
829
+ if (H(l)) {
830
830
  const s = l.getParent();
831
831
  if (ut(s) && s.getListType() === "check" && (i || l.getFirstDescendant() === a)) {
832
832
  const d = t.getElementByKey(l.__key);
@@ -864,7 +864,7 @@ function Et(t) {
864
864
  e != null && e.isEditable() && e.update(() => {
865
865
  if (t.target) {
866
866
  const n = dt(r);
867
- F(n) && (r.focus(), n.toggleChecked());
867
+ H(n) && (r.focus(), n.toggleChecked());
868
868
  }
869
869
  });
870
870
  });
@@ -890,9 +890,9 @@ function st() {
890
890
  }
891
891
  function Vr(t, r) {
892
892
  let e = r ? t.getPreviousSibling() : t.getNextSibling(), n = t;
893
- for (; e == null && F(n); )
893
+ for (; e == null && H(n); )
894
894
  n = n.getParentOrThrow().getParent(), n != null && (e = r ? n.getPreviousSibling() : n.getNextSibling());
895
- for (; F(e); ) {
895
+ for (; H(e); ) {
896
896
  const i = r ? e.getLastChild() : e.getFirstChild();
897
897
  if (!ut(i))
898
898
  return e;
@@ -904,7 +904,7 @@ function It(t, r, e) {
904
904
  const n = st();
905
905
  return n != null && r.update(() => {
906
906
  const i = dt(n);
907
- if (!F(i))
907
+ if (!H(i))
908
908
  return;
909
909
  const a = Vr(i, e);
910
910
  if (a != null) {
@@ -927,14 +927,14 @@ function Zr() {
927
927
  vt,
928
928
  (r) => {
929
929
  const e = Ct(r);
930
- return Ce([e]), $t(e.getParentOrThrow()) && ye(e, U).selectEnd(), !0;
930
+ return Ce([e]), $t(e.getParentOrThrow()) && ye(e, W).selectEnd(), !0;
931
931
  },
932
932
  ve
933
933
  )
934
934
  );
935
935
  }, [t]), null;
936
936
  }
937
- const tn = () => /* @__PURE__ */ u(W, { children: [
937
+ const tn = () => /* @__PURE__ */ u(j, { children: [
938
938
  /* @__PURE__ */ o(ur, {}),
939
939
  /* @__PURE__ */ o(pr, {}),
940
940
  /* @__PURE__ */ o(gr, {}),
@@ -944,7 +944,7 @@ const tn = () => /* @__PURE__ */ u(W, { children: [
944
944
  ] }), en = ({
945
945
  state: t
946
946
  }) => {
947
- const [r] = x(), e = Y(!1);
947
+ const [r] = x(), e = q(!1);
948
948
  return _(() => {
949
949
  !t || e.current || (e.current = !0, window.queueMicrotask(() => {
950
950
  try {
@@ -1003,7 +1003,7 @@ const tn = () => /* @__PURE__ */ u(W, { children: [
1003
1003
  }), nn = ({
1004
1004
  isLoading: t
1005
1005
  }) => /* @__PURE__ */ o(
1006
- H,
1006
+ U,
1007
1007
  {
1008
1008
  css: {
1009
1009
  visibility: t ? "visible" : "hidden",
@@ -1028,33 +1028,34 @@ const tn = () => /* @__PURE__ */ u(W, { children: [
1028
1028
  defaultState: h,
1029
1029
  css: g,
1030
1030
  signUrl: k,
1031
- fileUpload: E
1031
+ fileUpload: S,
1032
+ editable: E = !0
1032
1033
  }) => {
1033
- const { hasFocus: S, attributes: M } = Cr({ onBlur: c }), p = Y(null), C = qt(
1034
- () => ({ hasFocus: S, editorRef: p, signUrl: k, fileUpload: E }),
1035
- [S, k, E]
1034
+ const { hasFocus: M, attributes: m } = Cr({ onBlur: c }), C = q(null), p = qt(
1035
+ () => ({ hasFocus: M, editorRef: C, signUrl: k, fileUpload: S }),
1036
+ [M, k, S]
1036
1037
  );
1037
- return /* @__PURE__ */ o(oe.Provider, { value: C, children: /* @__PURE__ */ u(
1038
+ return /* @__PURE__ */ o(oe.Provider, { value: p, children: /* @__PURE__ */ u(
1038
1039
  rr,
1039
1040
  {
1040
1041
  initialConfig: {
1041
1042
  namespace: "ain-rich-text",
1042
- onError: (m) => {
1043
- console.error(m);
1043
+ onError: (D) => {
1044
+ console.error(D);
1044
1045
  },
1045
1046
  theme: bt,
1046
1047
  nodes: n,
1047
- editable: !0
1048
+ editable: E
1048
1049
  },
1049
1050
  children: [
1050
1051
  /* @__PURE__ */ u(
1051
1052
  rn,
1052
1053
  {
1053
- ref: p,
1054
- hasFocus: S,
1054
+ ref: C,
1055
+ hasFocus: M,
1055
1056
  hideBorder: d,
1056
1057
  css: g,
1057
- ...M,
1058
+ ...m,
1058
1059
  children: [
1059
1060
  a,
1060
1061
  /* @__PURE__ */ o(
@@ -1062,7 +1063,7 @@ const tn = () => /* @__PURE__ */ u(W, { children: [
1062
1063
  {
1063
1064
  contentEditable: s,
1064
1065
  placeholder: e ? /* @__PURE__ */ o(
1065
- H,
1066
+ U,
1066
1067
  {
1067
1068
  css: {
1068
1069
  position: "absolute",
@@ -1081,12 +1082,12 @@ const tn = () => /* @__PURE__ */ u(W, { children: [
1081
1082
  /* @__PURE__ */ o(tn, {}),
1082
1083
  i,
1083
1084
  /* @__PURE__ */ o(nn, { isLoading: t }),
1084
- !a && /* @__PURE__ */ o(qr, { children: l })
1085
+ E && !a && /* @__PURE__ */ o(qr, { children: l })
1085
1086
  ]
1086
1087
  }
1087
1088
  ),
1088
1089
  /* @__PURE__ */ o(en, { state: h }),
1089
- /* @__PURE__ */ o(W, { children: r })
1090
+ /* @__PURE__ */ o(j, { children: r })
1090
1091
  ]
1091
1092
  }
1092
1093
  ) });
@@ -1338,7 +1339,7 @@ const tn = () => /* @__PURE__ */ u(W, { children: [
1338
1339
  includeHeaders: !1
1339
1340
  });
1340
1341
  }, [t]);
1341
- return /* @__PURE__ */ u(W, { children: [
1342
+ return /* @__PURE__ */ u(j, { children: [
1342
1343
  /* @__PURE__ */ u(
1343
1344
  et,
1344
1345
  {
@@ -1384,7 +1385,7 @@ const qn = () => {
1384
1385
  middleware: [Zt({ mainAxis: -20, crossAxis: -2 })]
1385
1386
  });
1386
1387
  _(() => t.registerCommand(
1387
- G,
1388
+ Y,
1388
1389
  () => {
1389
1390
  const s = y();
1390
1391
  if (N(s)) {
@@ -1435,14 +1436,14 @@ const qn = () => {
1435
1436
  }
1436
1437
  ),
1437
1438
  children: [
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" }),
1439
+ /* @__PURE__ */ o(B, { onClick: l("add-row-over"), children: "Legg til rad over" }),
1440
+ /* @__PURE__ */ o(B, { onClick: l("add-row-under"), children: "Legg til rad under" }),
1440
1441
  /* @__PURE__ */ o(Nt, {}),
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" }),
1442
+ /* @__PURE__ */ o(B, { onClick: l("add-column-left"), children: "Legg til kolonne venstre" }),
1443
+ /* @__PURE__ */ o(B, { onClick: l("add-column-right"), children: "Legg til kolonne høyre" }),
1443
1444
  /* @__PURE__ */ o(Nt, {}),
1444
- /* @__PURE__ */ o(D, { onClick: l("delete-row"), children: "Fjern rad" }),
1445
- /* @__PURE__ */ o(D, { onClick: l("delete-column"), children: "Fjern kolonne" })
1445
+ /* @__PURE__ */ o(B, { onClick: l("delete-row"), children: "Fjern rad" }),
1446
+ /* @__PURE__ */ o(B, { onClick: l("delete-column"), children: "Fjern kolonne" })
1446
1447
  ]
1447
1448
  }
1448
1449
  ) : null;
@@ -1456,7 +1457,7 @@ function le(t) {
1456
1457
  const r = t.anchor, e = t.focus, n = t.anchor.getNode(), i = t.focus.getNode();
1457
1458
  return n === i ? n : t.isBackward() ? Lt(e) ? n : i : Lt(r) ? n : i;
1458
1459
  }
1459
- const Jn = (t) => (A.baseURL = t, A), Q = class extends P {
1460
+ const Jn = (t) => (A.baseURL = t, A), Q = class extends F {
1460
1461
  static getType() {
1461
1462
  return "rutine_link";
1462
1463
  }
@@ -1539,7 +1540,7 @@ const cn = ({ onClose: t }) => {
1539
1540
  },
1540
1541
  [e]
1541
1542
  );
1542
- return /* @__PURE__ */ u(W, { children: [
1543
+ return /* @__PURE__ */ u(j, { children: [
1543
1544
  /* @__PURE__ */ o(
1544
1545
  Xe,
1545
1546
  {
@@ -1591,7 +1592,7 @@ const cn = ({ onClose: t }) => {
1591
1592
  n.dispatchCommand(tt, Tt(i.url));
1592
1593
  });
1593
1594
  }, [n, i]);
1594
- return /* @__PURE__ */ u(W, { children: [
1595
+ return /* @__PURE__ */ u(j, { children: [
1595
1596
  r.isLoading && /* @__PURE__ */ o(pt, {}),
1596
1597
  /* @__PURE__ */ o(
1597
1598
  mt,
@@ -1661,12 +1662,12 @@ const cn = ({ onClose: t }) => {
1661
1662
  }
1662
1663
  }, []);
1663
1664
  return _(() => e.registerCommand(
1664
- G,
1665
+ Y,
1665
1666
  () => (s(), !1),
1666
1667
  ct
1667
1668
  ), [e, s]), /* @__PURE__ */ u(Jt, { type: "single", value: n ? "link" : "", children: [
1668
1669
  /* @__PURE__ */ o(
1669
- B,
1670
+ P,
1670
1671
  {
1671
1672
  onClick: () => {
1672
1673
  n ? e.dispatchCommand(tt, null) : l(!0);
@@ -1687,7 +1688,7 @@ const cn = ({ onClose: t }) => {
1687
1688
  )
1688
1689
  ] });
1689
1690
  }, Qn = () => {
1690
- const [t] = x(), r = Y(null), [e, n] = b(null), [i, a] = b(""), { hasFocus: l } = z();
1691
+ const [t] = x(), r = q(null), [e, n] = b(null), [i, a] = b(""), { hasFocus: l } = z();
1691
1692
  _(() => {
1692
1693
  e ? t.update(() => {
1693
1694
  a(e.getURL());
@@ -1706,18 +1707,18 @@ const cn = ({ onClose: t }) => {
1706
1707
  ee(h),
1707
1708
  cr(h)
1708
1709
  ]), k = T(() => {
1709
- var p;
1710
+ var m;
1710
1711
  const M = y();
1711
1712
  if (N(M)) {
1712
- const C = le(M), m = C.getParent();
1713
- let q = null;
1714
- if (J(m) ? q = m : J(C) && (q = C), q) {
1713
+ const C = le(M), p = C.getParent();
1714
+ let D = null;
1715
+ if (J(p) ? D = p : J(C) && (D = C), D) {
1715
1716
  const nt = window.getSelection(), _t = t.getRootElement();
1716
- M !== null && nt !== null && _t !== null && _t.contains(nt.anchorNode) && t.isEditable() && (r.current = ((p = nt.focusNode) == null ? void 0 : p.parentElement) ?? null);
1717
+ M !== null && nt !== null && _t !== null && _t.contains(nt.anchorNode) && t.isEditable() && (r.current = ((m = nt.focusNode) == null ? void 0 : m.parentElement) ?? null);
1717
1718
  }
1718
- n(q);
1719
+ n(D);
1719
1720
  }
1720
- }, [t]), E = T(() => {
1721
+ }, [t]), S = T(() => {
1721
1722
  e && sn(e) && t.update(() => {
1722
1723
  e.remove();
1723
1724
  }), t.dispatchCommand(tt, null);
@@ -1733,7 +1734,7 @@ const cn = ({ onClose: t }) => {
1733
1734
  });
1734
1735
  }),
1735
1736
  t.registerCommand(
1736
- G,
1737
+ Y,
1737
1738
  () => (k(), !0),
1738
1739
  R
1739
1740
  ),
@@ -1744,7 +1745,7 @@ const cn = ({ onClose: t }) => {
1744
1745
  )
1745
1746
  ), [t, k, e]), !s)
1746
1747
  return null;
1747
- const S = Tt(i);
1748
+ const E = Tt(i);
1748
1749
  return /* @__PURE__ */ o(re, { children: /* @__PURE__ */ u(
1749
1750
  Xt,
1750
1751
  {
@@ -1760,7 +1761,7 @@ const cn = ({ onClose: t }) => {
1760
1761
  ...g(),
1761
1762
  children: [
1762
1763
  /* @__PURE__ */ o(
1763
- H,
1764
+ U,
1764
1765
  {
1765
1766
  as: "a",
1766
1767
  css: {
@@ -1770,14 +1771,14 @@ const cn = ({ onClose: t }) => {
1770
1771
  textOverflow: "ellipsis",
1771
1772
  marginRight: "$4"
1772
1773
  },
1773
- href: S,
1774
- title: S,
1774
+ href: E,
1775
+ title: E,
1775
1776
  target: "_blank",
1776
1777
  rel: "noreferrer",
1777
1778
  children: i
1778
1779
  }
1779
1780
  ),
1780
- /* @__PURE__ */ o(L, { color: "danger", icon: !0, size: "sm", onClick: E, children: /* @__PURE__ */ o(er, { size: 24 }) })
1781
+ /* @__PURE__ */ o(L, { color: "danger", icon: !0, size: "sm", onClick: S, children: /* @__PURE__ */ o(er, { size: 24 }) })
1781
1782
  ]
1782
1783
  }
1783
1784
  ) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkitektbedriftene/fe-lib",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {