@arkitektbedriftene/fe-lib 1.4.0 → 1.4.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.
- package/dist/rich-text/Plugins/LinkInsertPlugin.d.ts +13 -3
- package/dist/rich-text.es.js +203 -178
- package/package.json +1 -1
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
type UploadFile = {
|
|
3
|
+
uploadFile: ({ file }: {
|
|
4
|
+
file: File;
|
|
5
|
+
}) => Promise<string>;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const LinkToolbarButton: ({ getDocs, uploadFile, }: {
|
|
9
|
+
getDocs?: (() => {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[]) | undefined;
|
|
13
|
+
uploadFile?: UploadFile | undefined;
|
|
5
14
|
}) => JSX.Element;
|
|
15
|
+
export {};
|
package/dist/rich-text.es.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
var Jt = Object.defineProperty;
|
|
2
2
|
var Xt = (t, e, r) => e in t ? Jt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
-
var
|
|
3
|
+
var ht = (t, e, r) => (Xt(t, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
4
|
import { createHeadlessEditor as Qt } from "@lexical/headless";
|
|
5
5
|
import { $generateHtmlFromNodes as Vt } from "@lexical/html";
|
|
6
|
-
import { $getRoot as q, ParagraphNode as Zt, $createParagraphNode as Y, $createTextNode as
|
|
7
|
-
import { trimTextContentFromAnchor as se, $setBlocksType as
|
|
8
|
-
import { LinkNode as
|
|
9
|
-
import { ListNode as
|
|
6
|
+
import { $getRoot as q, ParagraphNode as Zt, $createParagraphNode as Y, $createTextNode as I, $setSelection as G, SELECTION_CHANGE_COMMAND as F, $getSelection as T, COMMAND_PRIORITY_CRITICAL as tt, $isRangeSelection as L, $isRootOrShadowRoot as te, FORMAT_TEXT_COMMAND as D, COMMAND_PRIORITY_LOW as _, KEY_ARROW_DOWN_COMMAND as ee, KEY_ARROW_UP_COMMAND as re, KEY_ESCAPE_COMMAND as Mt, KEY_SPACE_COMMAND as ne, $getNearestNodeFromDOMNode as et, KEY_ARROW_LEFT_COMMAND as oe, $isElementNode as ie, COMMAND_PRIORITY_NORMAL as ae, $createRangeSelection as Tt, COMMAND_PRIORITY_HIGH as le } from "lexical";
|
|
7
|
+
import { trimTextContentFromAnchor as se, $setBlocksType as Q, $isAtNodeEnd as pt } from "@lexical/selection";
|
|
8
|
+
import { LinkNode as $, AutoLinkNode as Lt, $isLinkNode as W, TOGGLE_LINK_COMMAND as J } from "@lexical/link";
|
|
9
|
+
import { ListNode as rt, ListItemNode as yt, $isListNode as nt, INSERT_UNORDERED_LIST_COMMAND as ce, INSERT_ORDERED_LIST_COMMAND as de, INSERT_CHECK_LIST_COMMAND as xt, insertList as ue, $isListItemNode as A } from "@lexical/list";
|
|
10
10
|
import { HeadingNode as Nt, QuoteNode as St, $isHeadingNode as he, $createHeadingNode as pe, $createQuoteNode as ge } from "@lexical/rich-text";
|
|
11
|
-
import { TableNode as wt, TableRowNode as Et, TableCellNode as _t, INSERT_TABLE_COMMAND as fe, $getTableCellNodeFromLexicalNode as me, $deleteTableColumn__EXPERIMENTAL as ke, $deleteTableRow__EXPERIMENTAL as be, $insertTableColumn__EXPERIMENTAL as
|
|
11
|
+
import { TableNode as wt, TableRowNode as Et, TableCellNode as _t, INSERT_TABLE_COMMAND as fe, $getTableCellNodeFromLexicalNode as me, $deleteTableColumn__EXPERIMENTAL as ke, $deleteTableRow__EXPERIMENTAL as be, $insertTableColumn__EXPERIMENTAL as gt, $insertTableRow__EXPERIMENTAL as ft } from "@lexical/table";
|
|
12
12
|
import { jsx as n, jsxs as p, Fragment as H } from "react/jsx-runtime";
|
|
13
|
-
import { createContext as ve, useState as k, useRef as
|
|
14
|
-
import { DropdownMenu as
|
|
13
|
+
import { createContext as ve, useState as k, useRef as ot, useCallback as v, useContext as Ce, useEffect as x, useMemo as Rt, useLayoutEffect as Me } from "react";
|
|
14
|
+
import { DropdownMenu as it, ToolbarButton as It, DropdownMenuIconItem as M, Box as P, ToolbarToggleGroup as zt, ToolbarToggleItem as O, OverlayCard as Ot, Toolbar as Te, ToolbarSeparator as Le, styled as ye, Spinner as $t, Button as w, DropdownMenuItem as z, DropdownMenuSeparator as mt, Dialog as xe, NavBar as Ne, NavBarItem as V, TextInput as Se, DialogActions as at, Combobox as we } from "./ui.es.js";
|
|
15
15
|
import { LexicalComposer as Ee } from "@lexical/react/LexicalComposer.js";
|
|
16
16
|
import { RichTextPlugin as _e } from "@lexical/react/LexicalRichTextPlugin.js";
|
|
17
17
|
import Re from "@lexical/react/LexicalErrorBoundary.js";
|
|
18
|
-
import { useFloating as
|
|
18
|
+
import { useFloating as lt, autoUpdate as At, size as Ie, flip as ze, offset as Bt, shift as Oe, useInteractions as Dt, useRole as Pt, FloatingPortal as Ft, inline as $e, useDismiss as Ae } from "@floating-ui/react";
|
|
19
19
|
import { useLexicalComposerContext as y } from "@lexical/react/LexicalComposerContext.js";
|
|
20
|
-
import { $getNearestNodeOfType as Be, $findMatchingParent as Ht, mergeRegister as
|
|
20
|
+
import { $getNearestNodeOfType as Be, $findMatchingParent as Ht, mergeRegister as st, isHTMLElement as kt } from "@lexical/utils";
|
|
21
21
|
import { G as g, e as De } from "./index.esm-67eba761.js";
|
|
22
|
-
import { s as
|
|
22
|
+
import { s as Pe, c as Fe } from "./stitches.config-00c23cdb.js";
|
|
23
23
|
import { ListPlugin as He } from "@lexical/react/LexicalListPlugin.js";
|
|
24
24
|
import { HistoryPlugin as Ue } from "@lexical/react/LexicalHistoryPlugin.js";
|
|
25
25
|
import { TablePlugin as We } from "@lexical/react/LexicalTablePlugin.js";
|
|
@@ -67,7 +67,7 @@ const Ke = ({
|
|
|
67
67
|
const r = q();
|
|
68
68
|
r.clear();
|
|
69
69
|
const o = Y();
|
|
70
|
-
o.append(
|
|
70
|
+
o.append(I("")), r.append(o), G(null);
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
tag: e
|
|
@@ -79,7 +79,7 @@ const Ke = ({
|
|
|
79
79
|
const o = q();
|
|
80
80
|
o.clear();
|
|
81
81
|
const i = Y();
|
|
82
|
-
i.append(
|
|
82
|
+
i.append(I(t.trim())), o.append(i), G(null);
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
tag: r
|
|
@@ -97,7 +97,7 @@ const Ke = ({
|
|
|
97
97
|
if (typeof t == "string" && !Wt(t))
|
|
98
98
|
i.update(() => {
|
|
99
99
|
const a = q(), s = Y();
|
|
100
|
-
s.append(
|
|
100
|
+
s.append(I(t.trim())), a.append(s);
|
|
101
101
|
});
|
|
102
102
|
else {
|
|
103
103
|
const a = i.parseEditorState(t, () => {
|
|
@@ -117,7 +117,7 @@ const Ke = ({
|
|
|
117
117
|
r != null && r.updateFn && ((a = r.updateFn) == null || a.call(r)), l = Vt(i);
|
|
118
118
|
}), { html: l, trimCount: o };
|
|
119
119
|
};
|
|
120
|
-
class j extends
|
|
120
|
+
class j extends $ {
|
|
121
121
|
static getType() {
|
|
122
122
|
return "target-link";
|
|
123
123
|
}
|
|
@@ -142,39 +142,39 @@ class j extends O {
|
|
|
142
142
|
return super.exportJSON();
|
|
143
143
|
}
|
|
144
144
|
static importJSON(e) {
|
|
145
|
-
return
|
|
145
|
+
return $.importJSON(e);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
const cn = [
|
|
149
149
|
Nt,
|
|
150
150
|
St,
|
|
151
|
-
|
|
151
|
+
rt,
|
|
152
152
|
yt,
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
Lt,
|
|
154
|
+
$,
|
|
155
155
|
wt,
|
|
156
156
|
Et,
|
|
157
157
|
_t
|
|
158
158
|
], dn = [
|
|
159
159
|
Nt,
|
|
160
160
|
St,
|
|
161
|
-
|
|
161
|
+
rt,
|
|
162
162
|
yt,
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
Lt,
|
|
164
|
+
$,
|
|
165
165
|
wt,
|
|
166
166
|
Et,
|
|
167
167
|
_t,
|
|
168
168
|
j,
|
|
169
169
|
{
|
|
170
|
-
replace:
|
|
170
|
+
replace: $,
|
|
171
171
|
with: (t) => new j(
|
|
172
172
|
t.getURL(),
|
|
173
173
|
{ rel: t.__rel, target: t.__target, title: t.__title }
|
|
174
174
|
)
|
|
175
175
|
}
|
|
176
176
|
], jt = ve({ hasFocus: !1, editorRef: { current: null } }), Xe = ({ onBlur: t }) => {
|
|
177
|
-
const [e, r] = k(!1), o =
|
|
177
|
+
const [e, r] = k(!1), o = ot(null), i = v(() => {
|
|
178
178
|
r(!0), o.current && window.clearTimeout(o.current);
|
|
179
179
|
}, []), l = v(() => {
|
|
180
180
|
o.current = window.setTimeout(() => {
|
|
@@ -188,7 +188,7 @@ const cn = [
|
|
|
188
188
|
onBlur: l
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
|
-
},
|
|
191
|
+
}, ct = () => Ce(jt);
|
|
192
192
|
function Qe(t) {
|
|
193
193
|
return g({ 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);
|
|
194
194
|
}
|
|
@@ -243,7 +243,7 @@ function pr(t) {
|
|
|
243
243
|
function gr(t) {
|
|
244
244
|
return g({ 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);
|
|
245
245
|
}
|
|
246
|
-
const fr =
|
|
246
|
+
const fr = Pe("div", {
|
|
247
247
|
width: "10rem",
|
|
248
248
|
display: "flex"
|
|
249
249
|
}), Kt = {
|
|
@@ -273,9 +273,9 @@ const fr = Fe("div", {
|
|
|
273
273
|
}, C = ({
|
|
274
274
|
blockType: t
|
|
275
275
|
}) => /* @__PURE__ */ p(H, { children: [
|
|
276
|
-
/* @__PURE__ */ n(
|
|
276
|
+
/* @__PURE__ */ n(P, { css: { display: "flex", flex: "0 0 auto" }, children: mr[t] }),
|
|
277
277
|
/* @__PURE__ */ n(
|
|
278
|
-
|
|
278
|
+
P,
|
|
279
279
|
{
|
|
280
280
|
css: {
|
|
281
281
|
flex: "1 1 auto",
|
|
@@ -287,7 +287,7 @@ const fr = Fe("div", {
|
|
|
287
287
|
}
|
|
288
288
|
)
|
|
289
289
|
] }), kr = (t) => {
|
|
290
|
-
if (!
|
|
290
|
+
if (!L(t))
|
|
291
291
|
return null;
|
|
292
292
|
const e = t.anchor.getNode();
|
|
293
293
|
let r = e.getKey() === "root" ? e : Ht(e, (o) => {
|
|
@@ -301,17 +301,17 @@ const fr = Fe("div", {
|
|
|
301
301
|
}, br = () => {
|
|
302
302
|
const [t] = y(), [e, r] = k("paragraph");
|
|
303
303
|
x(() => t.registerCommand(
|
|
304
|
-
|
|
304
|
+
F,
|
|
305
305
|
() => {
|
|
306
|
-
const c =
|
|
306
|
+
const c = T(), u = kr(c);
|
|
307
307
|
if (!u)
|
|
308
308
|
return !1;
|
|
309
309
|
const { element: h, anchorNode: m } = u, E = h.getKey();
|
|
310
310
|
if (t.getElementByKey(E) !== null)
|
|
311
|
-
if (
|
|
311
|
+
if (nt(h)) {
|
|
312
312
|
const b = Be(
|
|
313
313
|
m,
|
|
314
|
-
|
|
314
|
+
rt
|
|
315
315
|
), S = b ? b.getListType() : h.getListType();
|
|
316
316
|
r(S);
|
|
317
317
|
} else {
|
|
@@ -320,16 +320,16 @@ const fr = Fe("div", {
|
|
|
320
320
|
}
|
|
321
321
|
return !1;
|
|
322
322
|
},
|
|
323
|
-
|
|
323
|
+
tt
|
|
324
324
|
), [t]);
|
|
325
325
|
const o = (c) => {
|
|
326
326
|
e !== c && t.update(() => {
|
|
327
|
-
const u =
|
|
328
|
-
|
|
327
|
+
const u = T();
|
|
328
|
+
L(u) && (Q(u, () => pe(c)), r(c));
|
|
329
329
|
});
|
|
330
330
|
};
|
|
331
331
|
return /* @__PURE__ */ n(fr, { children: /* @__PURE__ */ p(
|
|
332
|
-
|
|
332
|
+
it,
|
|
333
333
|
{
|
|
334
334
|
trigger: /* @__PURE__ */ n(
|
|
335
335
|
It,
|
|
@@ -344,8 +344,8 @@ const fr = Fe("div", {
|
|
|
344
344
|
children: [
|
|
345
345
|
/* @__PURE__ */ n(M, { onClick: () => {
|
|
346
346
|
e !== "paragraph" && t.update(() => {
|
|
347
|
-
const c =
|
|
348
|
-
|
|
347
|
+
const c = T();
|
|
348
|
+
L(c) && (Q(c, () => Y()), r("paragraph"));
|
|
349
349
|
});
|
|
350
350
|
}, children: /* @__PURE__ */ n(C, { blockType: "paragraph" }) }),
|
|
351
351
|
/* @__PURE__ */ n(M, { onClick: () => o("h1"), children: /* @__PURE__ */ n(C, { blockType: "h1" }) }),
|
|
@@ -365,8 +365,8 @@ const fr = Fe("div", {
|
|
|
365
365
|
}, children: /* @__PURE__ */ n(C, { blockType: "check" }) }),
|
|
366
366
|
/* @__PURE__ */ n(M, { onClick: () => {
|
|
367
367
|
e !== "quote" && t.update(() => {
|
|
368
|
-
const c =
|
|
369
|
-
|
|
368
|
+
const c = T();
|
|
369
|
+
L(c) && (Q(c, () => ge()), r("quote"));
|
|
370
370
|
});
|
|
371
371
|
}, children: /* @__PURE__ */ n(C, { blockType: "quote" }) })
|
|
372
372
|
]
|
|
@@ -374,14 +374,14 @@ const fr = Fe("div", {
|
|
|
374
374
|
) });
|
|
375
375
|
}, vr = () => {
|
|
376
376
|
const [t] = y(), [e, r] = k(!1), [o, i] = k(!1), [l, a] = k(!1), [s, d] = k(!1), [c, u] = k(!1), h = v(() => {
|
|
377
|
-
const f =
|
|
378
|
-
|
|
377
|
+
const f = T();
|
|
378
|
+
L(f) && (r(f.hasFormat("bold")), i(f.hasFormat("italic")), a(f.hasFormat("underline")), d(f.hasFormat("code")), u(f.hasFormat("superscript")));
|
|
379
379
|
}, []);
|
|
380
|
-
x(() =>
|
|
380
|
+
x(() => st(
|
|
381
381
|
t.registerCommand(
|
|
382
|
-
|
|
382
|
+
F,
|
|
383
383
|
() => (h(), !1),
|
|
384
|
-
|
|
384
|
+
tt
|
|
385
385
|
),
|
|
386
386
|
t.registerUpdateListener(({ editorState: f }) => {
|
|
387
387
|
f.read(() => {
|
|
@@ -390,21 +390,21 @@ const fr = Fe("div", {
|
|
|
390
390
|
})
|
|
391
391
|
), [t, h]);
|
|
392
392
|
const m = v(
|
|
393
|
-
() => t.dispatchCommand(
|
|
393
|
+
() => t.dispatchCommand(D, "bold"),
|
|
394
394
|
[t]
|
|
395
395
|
), E = v(
|
|
396
|
-
() => t.dispatchCommand(
|
|
396
|
+
() => t.dispatchCommand(D, "italic"),
|
|
397
397
|
[t]
|
|
398
398
|
), N = v(
|
|
399
|
-
() => t.dispatchCommand(
|
|
399
|
+
() => t.dispatchCommand(D, "underline"),
|
|
400
400
|
[t]
|
|
401
401
|
), b = v(
|
|
402
|
-
() => t.dispatchCommand(
|
|
402
|
+
() => t.dispatchCommand(D, "code"),
|
|
403
403
|
[t]
|
|
404
404
|
), S = v(
|
|
405
|
-
() => t.dispatchCommand(
|
|
405
|
+
() => t.dispatchCommand(D, "superscript"),
|
|
406
406
|
[t]
|
|
407
|
-
),
|
|
407
|
+
), B = Rt(() => {
|
|
408
408
|
const f = [];
|
|
409
409
|
return e && f.push("bold"), o && f.push("italic"), l && f.push("underline"), s && f.push("code"), c && f.push("superscript"), f;
|
|
410
410
|
}, [e, o, l, s, c]);
|
|
@@ -413,11 +413,11 @@ const fr = Fe("div", {
|
|
|
413
413
|
{
|
|
414
414
|
type: "multiple",
|
|
415
415
|
"aria-label": "Tekstformattering",
|
|
416
|
-
value:
|
|
416
|
+
value: B,
|
|
417
417
|
children: [
|
|
418
|
-
/* @__PURE__ */ n(
|
|
418
|
+
/* @__PURE__ */ n(O, { onClick: m, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ n(Qe, { size: "1.25rem" }) }),
|
|
419
419
|
/* @__PURE__ */ n(
|
|
420
|
-
|
|
420
|
+
O,
|
|
421
421
|
{
|
|
422
422
|
onClick: E,
|
|
423
423
|
title: "Kursiv tekst",
|
|
@@ -426,7 +426,7 @@ const fr = Fe("div", {
|
|
|
426
426
|
}
|
|
427
427
|
),
|
|
428
428
|
/* @__PURE__ */ n(
|
|
429
|
-
|
|
429
|
+
O,
|
|
430
430
|
{
|
|
431
431
|
onClick: N,
|
|
432
432
|
title: "Understreket tekst",
|
|
@@ -434,9 +434,9 @@ const fr = Fe("div", {
|
|
|
434
434
|
children: /* @__PURE__ */ n(gr, { size: "1.25rem" })
|
|
435
435
|
}
|
|
436
436
|
),
|
|
437
|
-
/* @__PURE__ */ n(
|
|
437
|
+
/* @__PURE__ */ n(O, { onClick: b, title: "Kode", value: "code", children: /* @__PURE__ */ n(Ve, { size: "1.25rem" }) }),
|
|
438
438
|
/* @__PURE__ */ n(
|
|
439
|
-
|
|
439
|
+
O,
|
|
440
440
|
{
|
|
441
441
|
onClick: S,
|
|
442
442
|
title: "Superscript",
|
|
@@ -448,11 +448,11 @@ const fr = Fe("div", {
|
|
|
448
448
|
}
|
|
449
449
|
);
|
|
450
450
|
}, Cr = ({ children: t }) => {
|
|
451
|
-
const { hasFocus: e, editorRef: r } =
|
|
451
|
+
const { hasFocus: e, editorRef: r } = ct(), o = e, [i, l] = k(o);
|
|
452
452
|
Me(() => {
|
|
453
453
|
l(o);
|
|
454
454
|
}, [o]);
|
|
455
|
-
const { context: a, refs: s, floatingStyles: d } =
|
|
455
|
+
const { context: a, refs: s, floatingStyles: d } = lt({
|
|
456
456
|
placement: "top",
|
|
457
457
|
whileElementsMounted: At,
|
|
458
458
|
middleware: [
|
|
@@ -475,11 +475,11 @@ const fr = Fe("div", {
|
|
|
475
475
|
reference: r.current
|
|
476
476
|
}
|
|
477
477
|
}), { getFloatingProps: c } = Dt([
|
|
478
|
-
|
|
478
|
+
Pt(a, {
|
|
479
479
|
role: "dialog"
|
|
480
480
|
})
|
|
481
481
|
]);
|
|
482
|
-
return i ? /* @__PURE__ */ n(
|
|
482
|
+
return i ? /* @__PURE__ */ n(Ft, { children: /* @__PURE__ */ n(
|
|
483
483
|
Ot,
|
|
484
484
|
{
|
|
485
485
|
ref: s.setFloating,
|
|
@@ -497,15 +497,15 @@ const fr = Fe("div", {
|
|
|
497
497
|
}, Mr = ({
|
|
498
498
|
children: t,
|
|
499
499
|
...e
|
|
500
|
-
}) => /* @__PURE__ */ p(
|
|
500
|
+
}) => /* @__PURE__ */ p(Te, { "aria-label": "Formattering", ...e, children: [
|
|
501
501
|
/* @__PURE__ */ n(br, {}),
|
|
502
|
-
/* @__PURE__ */ n(
|
|
502
|
+
/* @__PURE__ */ n(Le, {}),
|
|
503
503
|
/* @__PURE__ */ n(vr, {}),
|
|
504
504
|
t
|
|
505
505
|
] });
|
|
506
|
-
function
|
|
506
|
+
function Tr() {
|
|
507
507
|
const [t] = y();
|
|
508
|
-
return x(() =>
|
|
508
|
+
return x(() => st(
|
|
509
509
|
t.registerCommand(
|
|
510
510
|
xt,
|
|
511
511
|
() => (ue(t, "check"), !0),
|
|
@@ -513,18 +513,18 @@ function Lr() {
|
|
|
513
513
|
),
|
|
514
514
|
t.registerCommand(
|
|
515
515
|
ee,
|
|
516
|
-
(e) =>
|
|
516
|
+
(e) => Ct(e, t, !1),
|
|
517
517
|
_
|
|
518
518
|
),
|
|
519
519
|
t.registerCommand(
|
|
520
520
|
re,
|
|
521
|
-
(e) =>
|
|
521
|
+
(e) => Ct(e, t, !0),
|
|
522
522
|
_
|
|
523
523
|
),
|
|
524
524
|
t.registerCommand(
|
|
525
525
|
Mt,
|
|
526
526
|
(e) => {
|
|
527
|
-
if (
|
|
527
|
+
if (Z() != null) {
|
|
528
528
|
const o = t.getRootElement();
|
|
529
529
|
return o != null && o.focus(), !0;
|
|
530
530
|
}
|
|
@@ -535,10 +535,10 @@ function Lr() {
|
|
|
535
535
|
t.registerCommand(
|
|
536
536
|
ne,
|
|
537
537
|
(e) => {
|
|
538
|
-
const r =
|
|
538
|
+
const r = Z();
|
|
539
539
|
return r != null && t.isEditable() ? (t.update(() => {
|
|
540
|
-
const o =
|
|
541
|
-
|
|
540
|
+
const o = et(r);
|
|
541
|
+
A(o) && (e.preventDefault(), o.toggleChecked());
|
|
542
542
|
}), !0) : !1;
|
|
543
543
|
},
|
|
544
544
|
_
|
|
@@ -546,17 +546,17 @@ function Lr() {
|
|
|
546
546
|
t.registerCommand(
|
|
547
547
|
oe,
|
|
548
548
|
(e) => t.getEditorState().read(() => {
|
|
549
|
-
const r =
|
|
550
|
-
if (
|
|
549
|
+
const r = T();
|
|
550
|
+
if (L(r) && r.isCollapsed()) {
|
|
551
551
|
const { anchor: o } = r, i = o.type === "element";
|
|
552
552
|
if (i || o.offset === 0) {
|
|
553
553
|
const l = o.getNode(), a = Ht(
|
|
554
554
|
l,
|
|
555
555
|
(s) => ie(s) && !s.isInline()
|
|
556
556
|
);
|
|
557
|
-
if (
|
|
557
|
+
if (A(a)) {
|
|
558
558
|
const s = a.getParent();
|
|
559
|
-
if (
|
|
559
|
+
if (nt(s) && s.getListType() === "check" && (i || a.getFirstDescendant() === l)) {
|
|
560
560
|
const d = t.getElementByKey(a.__key);
|
|
561
561
|
if (d != null && document.activeElement !== d)
|
|
562
562
|
return d.focus(), e.preventDefault(), !0;
|
|
@@ -569,16 +569,16 @@ function Lr() {
|
|
|
569
569
|
_
|
|
570
570
|
),
|
|
571
571
|
t.registerRootListener((e, r) => {
|
|
572
|
-
e !== null && (e.addEventListener("click",
|
|
572
|
+
e !== null && (e.addEventListener("click", bt), e.addEventListener("pointerdown", vt)), r !== null && (r.removeEventListener("click", bt), r.removeEventListener("pointerdown", vt));
|
|
573
573
|
})
|
|
574
574
|
), [t]), null;
|
|
575
575
|
}
|
|
576
576
|
function qt(t, e) {
|
|
577
577
|
const r = t.target;
|
|
578
|
-
if (r === null || !
|
|
578
|
+
if (r === null || !kt(r))
|
|
579
579
|
return;
|
|
580
580
|
const o = r.firstChild;
|
|
581
|
-
if (o != null &&
|
|
581
|
+
if (o != null && kt(o) && (o.tagName === "UL" || o.tagName === "OL"))
|
|
582
582
|
return;
|
|
583
583
|
const i = r.parentNode;
|
|
584
584
|
if (!i || i.__lexicalListType !== "check")
|
|
@@ -586,23 +586,23 @@ function qt(t, e) {
|
|
|
586
586
|
const l = t.pageX, a = r.getBoundingClientRect();
|
|
587
587
|
(r.dir === "rtl" ? l < a.right && l > a.right - 20 : l > a.left && l < a.left + 20) && e();
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function bt(t) {
|
|
590
590
|
qt(t, () => {
|
|
591
|
-
const e = t.target, r =
|
|
591
|
+
const e = t.target, r = Lr(e);
|
|
592
592
|
r != null && r.isEditable() && r.update(() => {
|
|
593
593
|
if (t.target) {
|
|
594
|
-
const o =
|
|
595
|
-
|
|
594
|
+
const o = et(e);
|
|
595
|
+
A(o) && (e.focus(), o.toggleChecked());
|
|
596
596
|
}
|
|
597
597
|
});
|
|
598
598
|
});
|
|
599
599
|
}
|
|
600
|
-
function
|
|
600
|
+
function vt(t) {
|
|
601
601
|
qt(t, () => {
|
|
602
602
|
t.preventDefault();
|
|
603
603
|
});
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function Lr(t) {
|
|
606
606
|
let e = t;
|
|
607
607
|
for (; e; ) {
|
|
608
608
|
if (e.__lexicalEditor)
|
|
@@ -611,28 +611,28 @@ function Tr(t) {
|
|
|
611
611
|
}
|
|
612
612
|
return null;
|
|
613
613
|
}
|
|
614
|
-
function
|
|
614
|
+
function Z() {
|
|
615
615
|
const t = document.activeElement;
|
|
616
616
|
return t != null && t.tagName === "LI" && t.parentNode != null && // @ts-ignore internal field
|
|
617
617
|
t.parentNode.__lexicalListType === "check" ? t : null;
|
|
618
618
|
}
|
|
619
619
|
function yr(t, e) {
|
|
620
620
|
let r = e ? t.getPreviousSibling() : t.getNextSibling(), o = t;
|
|
621
|
-
for (; r == null &&
|
|
621
|
+
for (; r == null && A(o); )
|
|
622
622
|
o = o.getParentOrThrow().getParent(), o != null && (r = e ? o.getPreviousSibling() : o.getNextSibling());
|
|
623
|
-
for (;
|
|
623
|
+
for (; A(r); ) {
|
|
624
624
|
const i = e ? r.getLastChild() : r.getFirstChild();
|
|
625
|
-
if (!
|
|
625
|
+
if (!nt(i))
|
|
626
626
|
return r;
|
|
627
627
|
r = e ? i.getLastChild() : i.getFirstChild();
|
|
628
628
|
}
|
|
629
629
|
return null;
|
|
630
630
|
}
|
|
631
|
-
function
|
|
632
|
-
const o =
|
|
631
|
+
function Ct(t, e, r) {
|
|
632
|
+
const o = Z();
|
|
633
633
|
return o != null && e.update(() => {
|
|
634
|
-
const i =
|
|
635
|
-
if (
|
|
634
|
+
const i = et(o);
|
|
635
|
+
if (!A(i))
|
|
636
636
|
return;
|
|
637
637
|
const l = yr(i, r);
|
|
638
638
|
if (l != null) {
|
|
@@ -648,7 +648,7 @@ const xr = () => /* @__PURE__ */ p(H, { children: [
|
|
|
648
648
|
/* @__PURE__ */ n(He, {}),
|
|
649
649
|
/* @__PURE__ */ n(We, {}),
|
|
650
650
|
/* @__PURE__ */ n(Ue, {}),
|
|
651
|
-
/* @__PURE__ */ n(
|
|
651
|
+
/* @__PURE__ */ n(Tr, {}),
|
|
652
652
|
/* @__PURE__ */ n(je, {})
|
|
653
653
|
] }), Nr = ({
|
|
654
654
|
state: t
|
|
@@ -711,7 +711,7 @@ const xr = () => /* @__PURE__ */ p(H, { children: [
|
|
|
711
711
|
}), wr = ({
|
|
712
712
|
isLoading: t
|
|
713
713
|
}) => /* @__PURE__ */ n(
|
|
714
|
-
|
|
714
|
+
P,
|
|
715
715
|
{
|
|
716
716
|
css: {
|
|
717
717
|
visibility: t ? "visible" : "hidden",
|
|
@@ -736,7 +736,7 @@ const xr = () => /* @__PURE__ */ p(H, { children: [
|
|
|
736
736
|
defaultState: u,
|
|
737
737
|
css: h
|
|
738
738
|
}) => {
|
|
739
|
-
const { hasFocus: m, attributes: E } = Xe({ onBlur: c }), N =
|
|
739
|
+
const { hasFocus: m, attributes: E } = Xe({ onBlur: c }), N = ot(null), b = Rt(() => ({ hasFocus: m, editorRef: N }), [m]);
|
|
740
740
|
return /* @__PURE__ */ n(jt.Provider, { value: b, children: /* @__PURE__ */ p(
|
|
741
741
|
Ee,
|
|
742
742
|
{
|
|
@@ -765,7 +765,7 @@ const xr = () => /* @__PURE__ */ p(H, { children: [
|
|
|
765
765
|
{
|
|
766
766
|
contentEditable: s,
|
|
767
767
|
placeholder: r ? /* @__PURE__ */ n(
|
|
768
|
-
|
|
768
|
+
P,
|
|
769
769
|
{
|
|
770
770
|
css: {
|
|
771
771
|
position: "absolute",
|
|
@@ -983,7 +983,7 @@ const xr = () => /* @__PURE__ */ p(H, { children: [
|
|
|
983
983
|
defaultVariants: {
|
|
984
984
|
size: "md"
|
|
985
985
|
}
|
|
986
|
-
}, hn =
|
|
986
|
+
}, hn = Fe(Er), pn = () => {
|
|
987
987
|
const [t] = y(), e = v(() => {
|
|
988
988
|
t.dispatchCommand(fe, {
|
|
989
989
|
rows: "3",
|
|
@@ -992,7 +992,7 @@ const xr = () => /* @__PURE__ */ p(H, { children: [
|
|
|
992
992
|
});
|
|
993
993
|
}, [t]);
|
|
994
994
|
return /* @__PURE__ */ n(
|
|
995
|
-
|
|
995
|
+
it,
|
|
996
996
|
{
|
|
997
997
|
trigger: /* @__PURE__ */ n(It, { dropdown: !0, children: "Sett inn" }),
|
|
998
998
|
side: "bottom",
|
|
@@ -1008,11 +1008,11 @@ function _r(t) {
|
|
|
1008
1008
|
return g({ 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);
|
|
1009
1009
|
}
|
|
1010
1010
|
const gn = () => {
|
|
1011
|
-
const [t] = y(), [e, r] = k(null), { hasFocus: o } =
|
|
1011
|
+
const [t] = y(), [e, r] = k(null), { hasFocus: o } = ct();
|
|
1012
1012
|
x(() => {
|
|
1013
1013
|
!o && e && r(null);
|
|
1014
1014
|
}, [o, e]);
|
|
1015
|
-
const { refs: i, floatingStyles: l } =
|
|
1015
|
+
const { refs: i, floatingStyles: l } = lt({
|
|
1016
1016
|
placement: "top-end",
|
|
1017
1017
|
open: !!e,
|
|
1018
1018
|
elements: {
|
|
@@ -1021,10 +1021,10 @@ const gn = () => {
|
|
|
1021
1021
|
middleware: [Bt({ mainAxis: -20, crossAxis: -2 })]
|
|
1022
1022
|
});
|
|
1023
1023
|
x(() => t.registerCommand(
|
|
1024
|
-
|
|
1024
|
+
F,
|
|
1025
1025
|
() => {
|
|
1026
|
-
const s =
|
|
1027
|
-
if (
|
|
1026
|
+
const s = T();
|
|
1027
|
+
if (L(s)) {
|
|
1028
1028
|
const d = s.anchor.getNode(), c = me(d);
|
|
1029
1029
|
r(c ? t.getElementByKey(c.getKey()) : null);
|
|
1030
1030
|
}
|
|
@@ -1036,16 +1036,16 @@ const gn = () => {
|
|
|
1036
1036
|
t.update(() => {
|
|
1037
1037
|
switch (s) {
|
|
1038
1038
|
case "add-row-over":
|
|
1039
|
-
|
|
1039
|
+
ft(!1);
|
|
1040
1040
|
break;
|
|
1041
1041
|
case "add-row-under":
|
|
1042
|
-
|
|
1042
|
+
ft(!0);
|
|
1043
1043
|
break;
|
|
1044
1044
|
case "add-column-left":
|
|
1045
|
-
|
|
1045
|
+
gt(!1);
|
|
1046
1046
|
break;
|
|
1047
1047
|
case "add-column-right":
|
|
1048
|
-
|
|
1048
|
+
gt(!0);
|
|
1049
1049
|
break;
|
|
1050
1050
|
case "delete-row":
|
|
1051
1051
|
be();
|
|
@@ -1057,7 +1057,7 @@ const gn = () => {
|
|
|
1057
1057
|
});
|
|
1058
1058
|
};
|
|
1059
1059
|
return e ? /* @__PURE__ */ p(
|
|
1060
|
-
|
|
1060
|
+
it,
|
|
1061
1061
|
{
|
|
1062
1062
|
trigger: /* @__PURE__ */ n(
|
|
1063
1063
|
w,
|
|
@@ -1072,28 +1072,28 @@ const gn = () => {
|
|
|
1072
1072
|
}
|
|
1073
1073
|
),
|
|
1074
1074
|
children: [
|
|
1075
|
-
/* @__PURE__ */ n(
|
|
1076
|
-
/* @__PURE__ */ n(
|
|
1077
|
-
/* @__PURE__ */ n(
|
|
1078
|
-
/* @__PURE__ */ n(
|
|
1079
|
-
/* @__PURE__ */ n(
|
|
1080
|
-
/* @__PURE__ */ n(
|
|
1081
|
-
/* @__PURE__ */ n(
|
|
1082
|
-
/* @__PURE__ */ n(
|
|
1075
|
+
/* @__PURE__ */ n(z, { onClick: a("add-row-over"), children: "Legg til rad over" }),
|
|
1076
|
+
/* @__PURE__ */ n(z, { onClick: a("add-row-under"), children: "Legg til rad under" }),
|
|
1077
|
+
/* @__PURE__ */ n(mt, {}),
|
|
1078
|
+
/* @__PURE__ */ n(z, { onClick: a("add-column-left"), children: "Legg til kolonne venstre" }),
|
|
1079
|
+
/* @__PURE__ */ n(z, { onClick: a("add-column-right"), children: "Legg til kolonne høyre" }),
|
|
1080
|
+
/* @__PURE__ */ n(mt, {}),
|
|
1081
|
+
/* @__PURE__ */ n(z, { onClick: a("delete-row"), children: "Fjern rad" }),
|
|
1082
|
+
/* @__PURE__ */ n(z, { onClick: a("delete-column"), children: "Fjern kolonne" })
|
|
1083
1083
|
]
|
|
1084
1084
|
}
|
|
1085
1085
|
) : null;
|
|
1086
1086
|
};
|
|
1087
|
-
function
|
|
1087
|
+
function dt(t) {
|
|
1088
1088
|
let e = t;
|
|
1089
1089
|
const r = /^(?:(?: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;
|
|
1090
1090
|
return e = String(e).trim(), e.match(r) || e.match(o) ? e : "https://";
|
|
1091
1091
|
}
|
|
1092
1092
|
function Yt(t) {
|
|
1093
1093
|
const e = t.anchor, r = t.focus, o = t.anchor.getNode(), i = t.focus.getNode();
|
|
1094
|
-
return o === i ? o : t.isBackward() ?
|
|
1094
|
+
return o === i ? o : t.isBackward() ? pt(r) ? o : i : pt(e) ? o : i;
|
|
1095
1095
|
}
|
|
1096
|
-
const fn = (t) => (R.baseURL = t, R), K = class extends
|
|
1096
|
+
const fn = (t) => (R.baseURL = t, R), K = class extends $ {
|
|
1097
1097
|
static getType() {
|
|
1098
1098
|
return "rutine_link";
|
|
1099
1099
|
}
|
|
@@ -1124,7 +1124,7 @@ const fn = (t) => (R.baseURL = t, R), K = class extends O {
|
|
|
1124
1124
|
}
|
|
1125
1125
|
};
|
|
1126
1126
|
let R = K;
|
|
1127
|
-
|
|
1127
|
+
ht(R, "baseURL", "");
|
|
1128
1128
|
function Gt(t) {
|
|
1129
1129
|
return new R(t);
|
|
1130
1130
|
}
|
|
@@ -1135,37 +1135,40 @@ const Ir = ({ onClose: t }) => {
|
|
|
1135
1135
|
const [e] = y(), r = v(
|
|
1136
1136
|
(i) => {
|
|
1137
1137
|
e.update(() => {
|
|
1138
|
-
const l =
|
|
1139
|
-
if (
|
|
1140
|
-
const a =
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
}
|
|
1138
|
+
const l = T();
|
|
1139
|
+
if (L(l) && l.isCollapsed()) {
|
|
1140
|
+
const a = I(i);
|
|
1141
|
+
l.insertNodes([a]);
|
|
1142
|
+
const s = Tt();
|
|
1143
|
+
s.setTextNodeRange(a, 0, a, i.length), G(s);
|
|
1145
1144
|
}
|
|
1146
|
-
|
|
1145
|
+
e.dispatchCommand(J, dt(i));
|
|
1146
|
+
});
|
|
1147
1147
|
},
|
|
1148
1148
|
[e]
|
|
1149
1149
|
);
|
|
1150
1150
|
return /* @__PURE__ */ p("form", { onSubmit: (i) => {
|
|
1151
|
-
r(i.
|
|
1151
|
+
r(i.currentTarget.url.value), t();
|
|
1152
1152
|
}, children: [
|
|
1153
1153
|
/* @__PURE__ */ n(Se, { name: "url", label: "URL", type: "url", required: !0 }),
|
|
1154
|
-
/* @__PURE__ */ p(
|
|
1154
|
+
/* @__PURE__ */ p(at, { children: [
|
|
1155
1155
|
/* @__PURE__ */ n(w, { onClick: t, children: "Avbryt" }),
|
|
1156
|
-
/* @__PURE__ */ n(w, { type: "submit", variant: "primary", children: "
|
|
1156
|
+
/* @__PURE__ */ n(w, { type: "submit", variant: "primary", children: "Sett inn" })
|
|
1157
1157
|
] })
|
|
1158
1158
|
] });
|
|
1159
|
-
}, zr = ({
|
|
1159
|
+
}, zr = ({
|
|
1160
|
+
onClose: t,
|
|
1161
|
+
getDocs: e
|
|
1162
|
+
}) => {
|
|
1160
1163
|
const [r] = y(), [o, i] = k([]), l = e(), a = v(
|
|
1161
1164
|
(s) => {
|
|
1162
1165
|
r.update(() => {
|
|
1163
|
-
const d =
|
|
1164
|
-
if (
|
|
1166
|
+
const d = T();
|
|
1167
|
+
if (L(d)) {
|
|
1165
1168
|
const c = [];
|
|
1166
1169
|
for (const [u, h] of s.entries()) {
|
|
1167
1170
|
const m = Gt(h.value);
|
|
1168
|
-
m.append(
|
|
1171
|
+
m.append(I(h.label)), c.push(m), u !== s.length - 1 && c.push(I(" "));
|
|
1169
1172
|
}
|
|
1170
1173
|
d.insertNodes(c);
|
|
1171
1174
|
}
|
|
@@ -1174,8 +1177,15 @@ const Ir = ({ onClose: t }) => {
|
|
|
1174
1177
|
[r]
|
|
1175
1178
|
);
|
|
1176
1179
|
return /* @__PURE__ */ p(H, { children: [
|
|
1177
|
-
/* @__PURE__ */ n(
|
|
1178
|
-
|
|
1180
|
+
/* @__PURE__ */ n(
|
|
1181
|
+
we,
|
|
1182
|
+
{
|
|
1183
|
+
isMulti: !0,
|
|
1184
|
+
options: l,
|
|
1185
|
+
onChange: (s) => i(s)
|
|
1186
|
+
}
|
|
1187
|
+
),
|
|
1188
|
+
/* @__PURE__ */ p(at, { children: [
|
|
1179
1189
|
/* @__PURE__ */ n(w, { onClick: t, children: "Avbryt" }),
|
|
1180
1190
|
/* @__PURE__ */ n(
|
|
1181
1191
|
w,
|
|
@@ -1184,12 +1194,15 @@ const Ir = ({ onClose: t }) => {
|
|
|
1184
1194
|
onClick: () => {
|
|
1185
1195
|
a(o), t();
|
|
1186
1196
|
},
|
|
1187
|
-
children: "
|
|
1197
|
+
children: "Sett inn"
|
|
1188
1198
|
}
|
|
1189
1199
|
)
|
|
1190
1200
|
] })
|
|
1191
1201
|
] });
|
|
1192
|
-
}, Or = ({
|
|
1202
|
+
}, Or = ({
|
|
1203
|
+
onClose: t,
|
|
1204
|
+
uploadFile: e
|
|
1205
|
+
}) => {
|
|
1193
1206
|
const [r] = y(), [o, i] = k(null), l = async (s) => {
|
|
1194
1207
|
var c;
|
|
1195
1208
|
const d = (c = s.target.files) == null ? void 0 : c[0];
|
|
@@ -1202,15 +1215,17 @@ const Ir = ({ onClose: t }) => {
|
|
|
1202
1215
|
}
|
|
1203
1216
|
}, a = v(() => {
|
|
1204
1217
|
r.update(() => {
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1218
|
+
if (!o)
|
|
1219
|
+
return;
|
|
1220
|
+
const s = T();
|
|
1221
|
+
if (L(s) && s.isCollapsed()) {
|
|
1222
|
+
const d = I(o.name);
|
|
1223
|
+
s.insertNodes([d]);
|
|
1224
|
+
const c = Tt();
|
|
1225
|
+
c.setTextNodeRange(d, 0, d, o.name.length), G(c);
|
|
1212
1226
|
}
|
|
1213
|
-
|
|
1227
|
+
r.dispatchCommand(J, dt(o.url));
|
|
1228
|
+
});
|
|
1214
1229
|
}, [r, o]);
|
|
1215
1230
|
return /* @__PURE__ */ p(H, { children: [
|
|
1216
1231
|
e.isLoading && /* @__PURE__ */ n($t, {}),
|
|
@@ -1222,7 +1237,7 @@ const Ir = ({ onClose: t }) => {
|
|
|
1222
1237
|
disabled: e.isLoading
|
|
1223
1238
|
}
|
|
1224
1239
|
),
|
|
1225
|
-
/* @__PURE__ */ p(
|
|
1240
|
+
/* @__PURE__ */ p(at, { children: [
|
|
1226
1241
|
/* @__PURE__ */ n(w, { onClick: t, children: "Avbryt" }),
|
|
1227
1242
|
/* @__PURE__ */ n(
|
|
1228
1243
|
w,
|
|
@@ -1232,7 +1247,7 @@ const Ir = ({ onClose: t }) => {
|
|
|
1232
1247
|
a(), t();
|
|
1233
1248
|
},
|
|
1234
1249
|
disabled: !o,
|
|
1235
|
-
children: "
|
|
1250
|
+
children: "Sett inn"
|
|
1236
1251
|
}
|
|
1237
1252
|
)
|
|
1238
1253
|
] })
|
|
@@ -1248,32 +1263,42 @@ const Ir = ({ onClose: t }) => {
|
|
|
1248
1263
|
};
|
|
1249
1264
|
return /* @__PURE__ */ p(xe, { open: t, onOpenChange: e, css: { width: "600px" }, children: [
|
|
1250
1265
|
/* @__PURE__ */ p(Ne, { css: { marginBottom: "$8" }, children: [
|
|
1251
|
-
/* @__PURE__ */ n(
|
|
1252
|
-
/* @__PURE__ */ n(
|
|
1253
|
-
|
|
1266
|
+
/* @__PURE__ */ n(V, { active: i === "url", onClick: () => l("url"), children: "URL" }),
|
|
1267
|
+
r && /* @__PURE__ */ n(
|
|
1268
|
+
V,
|
|
1269
|
+
{
|
|
1270
|
+
active: i === "rutine",
|
|
1271
|
+
onClick: () => l("rutine"),
|
|
1272
|
+
children: "Rutine"
|
|
1273
|
+
}
|
|
1274
|
+
),
|
|
1275
|
+
o && /* @__PURE__ */ n(V, { active: i === "file", onClick: () => l("file"), children: "Fil" })
|
|
1254
1276
|
] }),
|
|
1255
1277
|
i === "url" && /* @__PURE__ */ n(Ir, { onClose: a }),
|
|
1256
|
-
i === "rutine" && /* @__PURE__ */ n(zr, { onClose: a, getDocs: r }),
|
|
1257
|
-
i === "file" && /* @__PURE__ */ n(Or, { onClose: a, uploadFile: o })
|
|
1278
|
+
i === "rutine" && r && /* @__PURE__ */ n(zr, { onClose: a, getDocs: r }),
|
|
1279
|
+
i === "file" && o && /* @__PURE__ */ n(Or, { onClose: a, uploadFile: o })
|
|
1258
1280
|
] });
|
|
1259
|
-
}, mn = ({
|
|
1281
|
+
}, mn = ({
|
|
1282
|
+
getDocs: t,
|
|
1283
|
+
uploadFile: e
|
|
1284
|
+
}) => {
|
|
1260
1285
|
const [r] = y(), [o, i] = k(!1), [l, a] = k(!1), s = v(() => {
|
|
1261
|
-
const d =
|
|
1262
|
-
if (
|
|
1286
|
+
const d = T();
|
|
1287
|
+
if (L(d)) {
|
|
1263
1288
|
const c = Yt(d), u = c.getParent();
|
|
1264
1289
|
i(W(u) || W(c));
|
|
1265
1290
|
}
|
|
1266
1291
|
}, []);
|
|
1267
1292
|
return x(() => r.registerCommand(
|
|
1268
|
-
|
|
1293
|
+
F,
|
|
1269
1294
|
() => (s(), !1),
|
|
1270
|
-
|
|
1295
|
+
tt
|
|
1271
1296
|
), [r, s]), /* @__PURE__ */ p(zt, { type: "single", value: o ? "link" : "", children: [
|
|
1272
1297
|
/* @__PURE__ */ n(
|
|
1273
|
-
|
|
1298
|
+
O,
|
|
1274
1299
|
{
|
|
1275
1300
|
onClick: () => {
|
|
1276
|
-
o ? r.dispatchCommand(
|
|
1301
|
+
o ? r.dispatchCommand(J, null) : a(!0);
|
|
1277
1302
|
},
|
|
1278
1303
|
title: "Lenke",
|
|
1279
1304
|
value: "link",
|
|
@@ -1291,13 +1316,13 @@ const Ir = ({ onClose: t }) => {
|
|
|
1291
1316
|
)
|
|
1292
1317
|
] });
|
|
1293
1318
|
}, kn = () => {
|
|
1294
|
-
const [t] = y(), e =
|
|
1319
|
+
const [t] = y(), e = ot(null), [r, o] = k(null), [i, l] = k(""), { hasFocus: a } = ct();
|
|
1295
1320
|
x(() => {
|
|
1296
1321
|
r ? t.update(() => {
|
|
1297
1322
|
l(r.getURL());
|
|
1298
1323
|
}) : l("");
|
|
1299
1324
|
}, [t, r]);
|
|
1300
|
-
const s = !!(r && i && a), { refs: d, floatingStyles: c, context: u } =
|
|
1325
|
+
const s = !!(r && i && a), { refs: d, floatingStyles: c, context: u } = lt({
|
|
1301
1326
|
placement: "top",
|
|
1302
1327
|
strategy: "fixed",
|
|
1303
1328
|
open: s,
|
|
@@ -1307,37 +1332,37 @@ const Ir = ({ onClose: t }) => {
|
|
|
1307
1332
|
},
|
|
1308
1333
|
middleware: [$e()]
|
|
1309
1334
|
}), { getFloatingProps: h } = Dt([
|
|
1310
|
-
|
|
1335
|
+
Pt(u),
|
|
1311
1336
|
Ae(u)
|
|
1312
1337
|
]), m = v(() => {
|
|
1313
1338
|
var S;
|
|
1314
|
-
const b =
|
|
1315
|
-
if (
|
|
1316
|
-
const
|
|
1339
|
+
const b = T();
|
|
1340
|
+
if (L(b)) {
|
|
1341
|
+
const B = Yt(b), f = B.getParent();
|
|
1317
1342
|
let U = null;
|
|
1318
|
-
if (W(f) ? U = f : W(
|
|
1319
|
-
const
|
|
1320
|
-
b !== null &&
|
|
1343
|
+
if (W(f) ? U = f : W(B) && (U = B), U) {
|
|
1344
|
+
const X = window.getSelection(), ut = t.getRootElement();
|
|
1345
|
+
b !== null && X !== null && ut !== null && ut.contains(X.anchorNode) && t.isEditable() && (e.current = ((S = X.focusNode) == null ? void 0 : S.parentElement) ?? null);
|
|
1321
1346
|
}
|
|
1322
1347
|
o(U);
|
|
1323
1348
|
}
|
|
1324
1349
|
}, [t]), E = v(() => {
|
|
1325
1350
|
r && Rr(r) && t.update(() => {
|
|
1326
1351
|
r.remove();
|
|
1327
|
-
}), t.dispatchCommand(
|
|
1352
|
+
}), t.dispatchCommand(J, null);
|
|
1328
1353
|
}, [t, r]);
|
|
1329
1354
|
if (x(() => {
|
|
1330
1355
|
t.getEditorState().read(() => {
|
|
1331
1356
|
m();
|
|
1332
1357
|
});
|
|
1333
|
-
}, [t, m]), x(() =>
|
|
1358
|
+
}, [t, m]), x(() => st(
|
|
1334
1359
|
t.registerUpdateListener(({ editorState: b }) => {
|
|
1335
1360
|
b.read(() => {
|
|
1336
1361
|
m();
|
|
1337
1362
|
});
|
|
1338
1363
|
}),
|
|
1339
1364
|
t.registerCommand(
|
|
1340
|
-
|
|
1365
|
+
F,
|
|
1341
1366
|
() => (m(), !0),
|
|
1342
1367
|
_
|
|
1343
1368
|
),
|
|
@@ -1348,8 +1373,8 @@ const Ir = ({ onClose: t }) => {
|
|
|
1348
1373
|
)
|
|
1349
1374
|
), [t, m, r]), !s)
|
|
1350
1375
|
return null;
|
|
1351
|
-
const N =
|
|
1352
|
-
return /* @__PURE__ */ n(
|
|
1376
|
+
const N = dt(i);
|
|
1377
|
+
return /* @__PURE__ */ n(Ft, { children: /* @__PURE__ */ p(
|
|
1353
1378
|
Ot,
|
|
1354
1379
|
{
|
|
1355
1380
|
ref: d.setFloating,
|
|
@@ -1364,7 +1389,7 @@ const Ir = ({ onClose: t }) => {
|
|
|
1364
1389
|
...h(),
|
|
1365
1390
|
children: [
|
|
1366
1391
|
/* @__PURE__ */ n(
|
|
1367
|
-
|
|
1392
|
+
P,
|
|
1368
1393
|
{
|
|
1369
1394
|
as: "a",
|
|
1370
1395
|
css: {
|
|
@@ -1410,5 +1435,5 @@ export {
|
|
|
1410
1435
|
Je as setStateFromPlainText,
|
|
1411
1436
|
sn as stateToHTML,
|
|
1412
1437
|
Xe as useHasFocusWithin,
|
|
1413
|
-
|
|
1438
|
+
ct as useRichTextContext
|
|
1414
1439
|
};
|