@arkitektbedriftene/fe-lib 2.4.0 → 2.5.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.
package/dist/rich-text.es.js
CHANGED
|
@@ -3,15 +3,15 @@ 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
|
|
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";
|
|
7
7
|
import { trimTextContentFromAnchor as Le, $setBlocksType as at, $isAtNodeEnd as Lt } from "@lexical/selection";
|
|
8
|
-
import { LinkNode as P, AutoLinkNode as
|
|
9
|
-
import { ListNode as ht, ListItemNode as
|
|
8
|
+
import { LinkNode as P, AutoLinkNode as Pt, $isLinkNode as J, TOGGLE_LINK_COMMAND as Z } from "@lexical/link";
|
|
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
|
|
13
|
-
import { createContext as
|
|
14
|
-
import { Box as H, Stack as
|
|
12
|
+
import { jsx as n, jsxs as u, Fragment as W } from "react/jsx-runtime";
|
|
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
|
+
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";
|
|
16
16
|
import { useLexicalComposerContext as x } from "@lexical/react/LexicalComposerContext.js";
|
|
17
17
|
import { LexicalComposer as Qe } from "@lexical/react/LexicalComposer.js";
|
|
@@ -33,23 +33,23 @@ const mr = ({
|
|
|
33
33
|
}) => {
|
|
34
34
|
if (t.length === 0)
|
|
35
35
|
return 0;
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
36
|
+
const o = typeof e == "number", i = typeof r == "number";
|
|
37
|
+
if (!o && !i)
|
|
38
38
|
return t.length;
|
|
39
|
-
let
|
|
40
|
-
for (;
|
|
41
|
-
t[
|
|
42
|
-
` &&
|
|
43
|
-
return t.slice(0,
|
|
39
|
+
let a = 0, l = 0;
|
|
40
|
+
for (; l < t.length && (!o || a < e) && (!i || l < r); )
|
|
41
|
+
t[l] === `
|
|
42
|
+
` && a++, l++;
|
|
43
|
+
return t.slice(0, l).length;
|
|
44
44
|
}, ne = ({
|
|
45
45
|
editor: t,
|
|
46
46
|
maxChars: r,
|
|
47
47
|
maxLines: e
|
|
48
48
|
}) => {
|
|
49
|
-
const
|
|
50
|
-
Le(t, d,
|
|
51
|
-
const c =
|
|
52
|
-
return c instanceof he && c.getChildrenSize() === 0 && c.remove(),
|
|
49
|
+
const o = K(), i = o.getTextContent(), a = mr({ text: i, maxChars: r, maxLines: e }), l = i.length - a, d = o.select().anchor;
|
|
50
|
+
Le(t, d, l);
|
|
51
|
+
const c = o.getLastChild();
|
|
52
|
+
return c instanceof he && c.getChildrenSize() === 0 && c.remove(), l;
|
|
53
53
|
}, bt = {
|
|
54
54
|
quote: "ain-rich-text-quote",
|
|
55
55
|
text: {
|
|
@@ -67,8 +67,8 @@ const mr = ({
|
|
|
67
67
|
() => {
|
|
68
68
|
const e = K();
|
|
69
69
|
e.clear();
|
|
70
|
-
const
|
|
71
|
-
|
|
70
|
+
const o = U();
|
|
71
|
+
o.append(I("")), e.append(o), 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
|
|
81
|
-
|
|
82
|
-
const i =
|
|
83
|
-
i.append(I(t.trim())),
|
|
80
|
+
const o = K();
|
|
81
|
+
o.clear();
|
|
82
|
+
const i = U();
|
|
83
|
+
i.append(I(t.trim())), o.append(i), V(null);
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
tag: e
|
|
87
87
|
}
|
|
88
88
|
), r.blur();
|
|
89
|
-
},
|
|
90
|
-
var
|
|
91
|
-
let
|
|
89
|
+
}, Pn = async (t, r, e) => {
|
|
90
|
+
var l;
|
|
91
|
+
let o = 0;
|
|
92
92
|
const i = At({
|
|
93
93
|
nodes: r,
|
|
94
94
|
editable: !1,
|
|
@@ -98,12 +98,12 @@ const mr = ({
|
|
|
98
98
|
try {
|
|
99
99
|
if (typeof t == "string" && !Mt(t))
|
|
100
100
|
i.update(() => {
|
|
101
|
-
const s = K(), d =
|
|
101
|
+
const s = K(), d = U();
|
|
102
102
|
d.append(I(t.trim())), s.append(d);
|
|
103
103
|
});
|
|
104
104
|
else {
|
|
105
105
|
const s = i.parseEditorState(t, () => {
|
|
106
|
-
(e == null ? void 0 : e.maxLines) !== void 0 && (
|
|
106
|
+
(e == null ? void 0 : e.maxLines) !== void 0 && (o = ne({
|
|
107
107
|
editor: i,
|
|
108
108
|
maxLines: e.maxLines
|
|
109
109
|
}));
|
|
@@ -113,13 +113,13 @@ const mr = ({
|
|
|
113
113
|
} catch (s) {
|
|
114
114
|
console.error(s);
|
|
115
115
|
}
|
|
116
|
-
await ((
|
|
117
|
-
let
|
|
116
|
+
await ((l = e == null ? void 0 : e.updateFn) == null ? void 0 : l.call(e, i));
|
|
117
|
+
let a = "";
|
|
118
118
|
return i.read(() => {
|
|
119
|
-
|
|
120
|
-
}), { html:
|
|
121
|
-
},
|
|
122
|
-
let
|
|
119
|
+
a = zt(i);
|
|
120
|
+
}), { html: a, trimCount: o };
|
|
121
|
+
}, Fn = (t, r, e) => {
|
|
122
|
+
let o = 0;
|
|
123
123
|
const i = At({
|
|
124
124
|
nodes: r,
|
|
125
125
|
editable: !1,
|
|
@@ -129,43 +129,43 @@ const mr = ({
|
|
|
129
129
|
try {
|
|
130
130
|
if (typeof t == "string" && !Mt(t))
|
|
131
131
|
i.update(() => {
|
|
132
|
-
const
|
|
133
|
-
s.append(I(t.trim())),
|
|
132
|
+
const l = K(), s = U();
|
|
133
|
+
s.append(I(t.trim())), l.append(s);
|
|
134
134
|
});
|
|
135
135
|
else {
|
|
136
|
-
const
|
|
137
|
-
(e == null ? void 0 : e.maxLines) !== void 0 && (
|
|
136
|
+
const l = i.parseEditorState(t, () => {
|
|
137
|
+
(e == null ? void 0 : e.maxLines) !== void 0 && (o = ne({
|
|
138
138
|
editor: i,
|
|
139
139
|
maxLines: e.maxLines
|
|
140
140
|
}));
|
|
141
141
|
});
|
|
142
|
-
|
|
142
|
+
l.isEmpty() || i.setEditorState(l);
|
|
143
143
|
}
|
|
144
|
-
} catch (
|
|
145
|
-
console.error(
|
|
144
|
+
} catch (l) {
|
|
145
|
+
console.error(l);
|
|
146
146
|
}
|
|
147
|
-
let
|
|
147
|
+
let a = "";
|
|
148
148
|
try {
|
|
149
149
|
i.read(() => {
|
|
150
|
-
|
|
150
|
+
a = zt(i);
|
|
151
151
|
});
|
|
152
152
|
} catch {
|
|
153
153
|
}
|
|
154
|
-
return { html:
|
|
154
|
+
return { html: a, trimCount: o };
|
|
155
155
|
};
|
|
156
156
|
class X extends P {
|
|
157
157
|
static getType() {
|
|
158
158
|
return "target-link";
|
|
159
159
|
}
|
|
160
|
-
constructor(r, e,
|
|
160
|
+
constructor(r, e, o) {
|
|
161
161
|
let i = !1;
|
|
162
|
-
const
|
|
162
|
+
const a = { ...e };
|
|
163
163
|
try {
|
|
164
|
-
const
|
|
165
|
-
window.location.hostname !==
|
|
164
|
+
const l = new URL(r);
|
|
165
|
+
window.location.hostname !== l.hostname && (i = !0);
|
|
166
166
|
} catch {
|
|
167
167
|
}
|
|
168
|
-
i && (
|
|
168
|
+
i && (a.target = "_blank", a.rel = "noopener noreferrer"), super(r, a, o);
|
|
169
169
|
}
|
|
170
170
|
static clone(r) {
|
|
171
171
|
return new X(
|
|
@@ -181,16 +181,16 @@ class X extends P {
|
|
|
181
181
|
return P.importJSON(r);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
const oe =
|
|
184
|
+
const oe = $e({
|
|
185
185
|
hasFocus: !1,
|
|
186
186
|
editorRef: { current: null },
|
|
187
187
|
signUrl: void 0,
|
|
188
188
|
fileUpload: void 0
|
|
189
189
|
}), Mr = ({ onBlur: t }) => {
|
|
190
|
-
const [r, e] = b(!1),
|
|
191
|
-
e(!0),
|
|
192
|
-
}, []),
|
|
193
|
-
|
|
190
|
+
const [r, e] = b(!1), o = Y(null), i = T(() => {
|
|
191
|
+
e(!0), o.current && window.clearTimeout(o.current);
|
|
192
|
+
}, []), a = T(() => {
|
|
193
|
+
o.current = window.setTimeout(() => {
|
|
194
194
|
e(!1), t == null || t();
|
|
195
195
|
}, 0);
|
|
196
196
|
}, [t]);
|
|
@@ -198,23 +198,23 @@ const oe = De({
|
|
|
198
198
|
hasFocus: r,
|
|
199
199
|
attributes: {
|
|
200
200
|
onFocus: i,
|
|
201
|
-
onBlur:
|
|
201
|
+
onBlur: a
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
|
-
},
|
|
204
|
+
}, z = () => De(oe);
|
|
205
205
|
function Cr({
|
|
206
206
|
src: t,
|
|
207
207
|
altText: r,
|
|
208
208
|
width: e,
|
|
209
|
-
height:
|
|
209
|
+
height: o,
|
|
210
210
|
nodeKey: i
|
|
211
211
|
}) {
|
|
212
|
-
const { signUrl:
|
|
212
|
+
const { signUrl: a } = z(), [l, s] = b(a ? "" : t), [d, c] = b(!1), h = Y(!1), [g] = x();
|
|
213
213
|
_(() => {
|
|
214
214
|
const p = async () => {
|
|
215
|
-
s(await (
|
|
215
|
+
s(await (a == null ? void 0 : a(t)) ?? t);
|
|
216
216
|
};
|
|
217
|
-
!
|
|
217
|
+
!l && !h.current && (h.current = !0, p());
|
|
218
218
|
}, []);
|
|
219
219
|
const k = (p) => (C) => {
|
|
220
220
|
C.relatedTarget instanceof HTMLElement && C.relatedTarget.dataset.controls === "true" || c(p);
|
|
@@ -242,9 +242,9 @@ function Cr({
|
|
|
242
242
|
C && C.insertAfter(p);
|
|
243
243
|
});
|
|
244
244
|
};
|
|
245
|
-
return
|
|
246
|
-
/* @__PURE__ */
|
|
247
|
-
|
|
245
|
+
return l ? /* @__PURE__ */ u(H, { css: { position: "relative", display: "inline-block" }, children: [
|
|
246
|
+
/* @__PURE__ */ u(
|
|
247
|
+
Pe,
|
|
248
248
|
{
|
|
249
249
|
css: {
|
|
250
250
|
position: "absolute",
|
|
@@ -258,7 +258,7 @@ function Cr({
|
|
|
258
258
|
"data-controls": "true",
|
|
259
259
|
onMouseLeave: k(!1),
|
|
260
260
|
children: [
|
|
261
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ n(
|
|
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__ */
|
|
269
|
+
children: /* @__PURE__ */ n(Ge, {})
|
|
270
270
|
}
|
|
271
271
|
),
|
|
272
|
-
/* @__PURE__ */
|
|
272
|
+
/* @__PURE__ */ n(
|
|
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__ */
|
|
279
|
+
children: /* @__PURE__ */ n(Ye, {})
|
|
280
280
|
}
|
|
281
281
|
),
|
|
282
|
-
/* @__PURE__ */
|
|
282
|
+
/* @__PURE__ */ n(
|
|
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__ */
|
|
289
|
+
children: /* @__PURE__ */ n(qe, {})
|
|
290
290
|
}
|
|
291
291
|
)
|
|
292
292
|
]
|
|
293
293
|
}
|
|
294
294
|
),
|
|
295
|
-
/* @__PURE__ */
|
|
295
|
+
/* @__PURE__ */ n(
|
|
296
296
|
"img",
|
|
297
297
|
{
|
|
298
|
-
src:
|
|
298
|
+
src: l,
|
|
299
299
|
alt: r,
|
|
300
300
|
style: {
|
|
301
|
-
height:
|
|
301
|
+
height: o,
|
|
302
302
|
width: e
|
|
303
303
|
},
|
|
304
304
|
className: "ain-rich-text-image",
|
|
@@ -307,27 +307,27 @@ function Cr({
|
|
|
307
307
|
"data-controls": "true"
|
|
308
308
|
}
|
|
309
309
|
)
|
|
310
|
-
] }) : /* @__PURE__ */
|
|
310
|
+
] }) : /* @__PURE__ */ n("span", {});
|
|
311
311
|
}
|
|
312
312
|
function vr(t) {
|
|
313
|
-
const r = t, { alt: e, src:
|
|
314
|
-
return { node: Ct({ altText: e, height:
|
|
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 }) };
|
|
315
315
|
}
|
|
316
|
-
class
|
|
317
|
-
constructor(e,
|
|
316
|
+
class $ extends ue {
|
|
317
|
+
constructor(e, o, 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 =
|
|
324
|
+
this.__src = e, this.__altText = o, this.__width = i || "inherit", this.__height = a || "inherit", this.__meta = l;
|
|
325
325
|
}
|
|
326
326
|
static getType() {
|
|
327
327
|
return "image";
|
|
328
328
|
}
|
|
329
329
|
static clone(e) {
|
|
330
|
-
return new
|
|
330
|
+
return new $(
|
|
331
331
|
e.__src,
|
|
332
332
|
e.__altText,
|
|
333
333
|
e.__width,
|
|
@@ -337,12 +337,12 @@ class z extends ue {
|
|
|
337
337
|
);
|
|
338
338
|
}
|
|
339
339
|
static importJSON(e) {
|
|
340
|
-
const { altText:
|
|
340
|
+
const { altText: o, height: i, width: a, src: l, meta: s } = e;
|
|
341
341
|
return Ct({
|
|
342
|
-
altText:
|
|
342
|
+
altText: o,
|
|
343
343
|
height: i,
|
|
344
|
-
src:
|
|
345
|
-
width:
|
|
344
|
+
src: l,
|
|
345
|
+
width: a,
|
|
346
346
|
meta: s
|
|
347
347
|
});
|
|
348
348
|
}
|
|
@@ -373,12 +373,12 @@ class z extends ue {
|
|
|
373
373
|
return this.__meta ?? { width: 0, height: 0 };
|
|
374
374
|
}
|
|
375
375
|
setSrc(e) {
|
|
376
|
-
const
|
|
377
|
-
|
|
376
|
+
const o = this.getWritable();
|
|
377
|
+
o.__src = e;
|
|
378
378
|
}
|
|
379
|
-
setWidthAndHeight(e,
|
|
379
|
+
setWidthAndHeight(e, o) {
|
|
380
380
|
const i = this.getWritable();
|
|
381
|
-
i.__width = e, i.__height =
|
|
381
|
+
i.__width = e, i.__height = o;
|
|
382
382
|
}
|
|
383
383
|
// View
|
|
384
384
|
createDOM(e) {
|
|
@@ -394,7 +394,7 @@ class z extends ue {
|
|
|
394
394
|
return this.__altText;
|
|
395
395
|
}
|
|
396
396
|
decorate() {
|
|
397
|
-
return /* @__PURE__ */
|
|
397
|
+
return /* @__PURE__ */ n(
|
|
398
398
|
Cr,
|
|
399
399
|
{
|
|
400
400
|
src: this.__src,
|
|
@@ -410,39 +410,39 @@ function Ct({
|
|
|
410
410
|
altText: t,
|
|
411
411
|
height: r,
|
|
412
412
|
src: e,
|
|
413
|
-
width:
|
|
413
|
+
width: o,
|
|
414
414
|
meta: i,
|
|
415
|
-
key:
|
|
415
|
+
key: a
|
|
416
416
|
}) {
|
|
417
417
|
return ge(
|
|
418
|
-
new
|
|
418
|
+
new $(e, t, o, r, i, a)
|
|
419
419
|
);
|
|
420
420
|
}
|
|
421
|
-
function
|
|
422
|
-
return t instanceof
|
|
421
|
+
function Hn(t) {
|
|
422
|
+
return t instanceof $;
|
|
423
423
|
}
|
|
424
424
|
const Un = [
|
|
425
425
|
Ut,
|
|
426
426
|
Wt,
|
|
427
427
|
ht,
|
|
428
|
-
|
|
429
|
-
|
|
428
|
+
Ft,
|
|
429
|
+
Pt,
|
|
430
430
|
P,
|
|
431
431
|
jt,
|
|
432
432
|
Kt,
|
|
433
433
|
Gt,
|
|
434
|
-
|
|
434
|
+
$
|
|
435
435
|
], Wn = [
|
|
436
436
|
Ut,
|
|
437
437
|
Wt,
|
|
438
438
|
ht,
|
|
439
|
-
|
|
440
|
-
|
|
439
|
+
Ft,
|
|
440
|
+
Pt,
|
|
441
441
|
P,
|
|
442
442
|
jt,
|
|
443
443
|
Kt,
|
|
444
444
|
Gt,
|
|
445
|
-
|
|
445
|
+
$,
|
|
446
446
|
X,
|
|
447
447
|
{
|
|
448
448
|
replace: P,
|
|
@@ -497,22 +497,22 @@ function Ar(t) {
|
|
|
497
497
|
function zr(t) {
|
|
498
498
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M3.5 5.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 11.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 17.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M11 6l9 0" } }, { tag: "path", attr: { d: "M11 12l9 0" } }, { tag: "path", attr: { d: "M11 18l9 0" } }] })(t);
|
|
499
499
|
}
|
|
500
|
-
function
|
|
500
|
+
function $r(t) {
|
|
501
501
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M11 6h9" } }, { tag: "path", attr: { d: "M11 12h9" } }, { tag: "path", attr: { d: "M12 18h8" } }, { tag: "path", attr: { d: "M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4" } }, { tag: "path", attr: { d: "M6 10v-6l-2 2" } }] })(t);
|
|
502
502
|
}
|
|
503
|
-
function
|
|
503
|
+
function Dr(t) {
|
|
504
504
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M9 6l11 0" } }, { tag: "path", attr: { d: "M9 12l11 0" } }, { tag: "path", attr: { d: "M9 18l11 0" } }, { tag: "path", attr: { d: "M5 6l0 .01" } }, { tag: "path", attr: { d: "M5 12l0 .01" } }, { tag: "path", attr: { d: "M5 18l0 .01" } }] })(t);
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function Br(t) {
|
|
507
507
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M10 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5" } }, { tag: "path", attr: { d: "M19 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5" } }] })(t);
|
|
508
508
|
}
|
|
509
|
-
function
|
|
509
|
+
function Pr(t) {
|
|
510
510
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M5 7l8 10m-8 0l8 -10" } }, { tag: "path", attr: { d: "M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2" } }] })(t);
|
|
511
511
|
}
|
|
512
|
-
function
|
|
512
|
+
function Fr(t) {
|
|
513
513
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z" } }, { tag: "path", attr: { d: "M4 10l16 0" } }, { tag: "path", attr: { d: "M10 4l0 16" } }] })(t);
|
|
514
514
|
}
|
|
515
|
-
function
|
|
515
|
+
function Hr(t) {
|
|
516
516
|
return f({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 5v5a5 5 0 0 0 10 0v-5" } }, { tag: "path", attr: { d: "M5 19h14" } }] })(t);
|
|
517
517
|
}
|
|
518
518
|
const Ur = cr("div", {
|
|
@@ -531,22 +531,22 @@ const Ur = cr("div", {
|
|
|
531
531
|
quote: "Sitat",
|
|
532
532
|
check: "Avkrysningsliste"
|
|
533
533
|
}, Wr = {
|
|
534
|
-
bullet: /* @__PURE__ */
|
|
535
|
-
h1: /* @__PURE__ */
|
|
536
|
-
h2: /* @__PURE__ */
|
|
537
|
-
h3: /* @__PURE__ */
|
|
538
|
-
h4: /* @__PURE__ */
|
|
539
|
-
h5: /* @__PURE__ */
|
|
540
|
-
h6: /* @__PURE__ */
|
|
541
|
-
number: /* @__PURE__ */
|
|
542
|
-
check: /* @__PURE__ */
|
|
543
|
-
paragraph: /* @__PURE__ */
|
|
544
|
-
quote: /* @__PURE__ */
|
|
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" })
|
|
545
545
|
}, w = ({
|
|
546
546
|
blockType: t
|
|
547
|
-
}) => /* @__PURE__ */
|
|
548
|
-
/* @__PURE__ */
|
|
549
|
-
/* @__PURE__ */
|
|
547
|
+
}) => /* @__PURE__ */ u(W, { children: [
|
|
548
|
+
/* @__PURE__ */ n(H, { css: { display: "flex", flex: "0 0 auto" }, children: Wr[t] }),
|
|
549
|
+
/* @__PURE__ */ n(
|
|
550
550
|
H,
|
|
551
551
|
{
|
|
552
552
|
css: {
|
|
@@ -562,9 +562,9 @@ 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, (
|
|
566
|
-
const i =
|
|
567
|
-
return i !== null &&
|
|
565
|
+
let e = r.getKey() === "root" ? r : re(r, (o) => {
|
|
566
|
+
const i = o.getParent();
|
|
567
|
+
return i !== null && $t(i);
|
|
568
568
|
});
|
|
569
569
|
return e === null && (e = r.getTopLevelElementOrThrow()), {
|
|
570
570
|
anchorNode: r,
|
|
@@ -575,10 +575,10 @@ const Ur = cr("div", {
|
|
|
575
575
|
_(() => t.registerCommand(
|
|
576
576
|
G,
|
|
577
577
|
() => {
|
|
578
|
-
const c = y(),
|
|
579
|
-
if (!
|
|
578
|
+
const c = y(), h = jr(c);
|
|
579
|
+
if (!h)
|
|
580
580
|
return !1;
|
|
581
|
-
const { element: g, anchorNode: k } =
|
|
581
|
+
const { element: g, anchorNode: k } = h, E = g.getKey();
|
|
582
582
|
if (t.getElementByKey(E) !== null)
|
|
583
583
|
if (ut(g)) {
|
|
584
584
|
const M = ir(
|
|
@@ -594,60 +594,60 @@ const Ur = cr("div", {
|
|
|
594
594
|
},
|
|
595
595
|
ct
|
|
596
596
|
), [t]);
|
|
597
|
-
const
|
|
597
|
+
const o = (c) => {
|
|
598
598
|
r !== c && t.update(() => {
|
|
599
|
-
const
|
|
600
|
-
N(
|
|
599
|
+
const h = y();
|
|
600
|
+
N(h) && (at(h, () => Se(c)), e(c));
|
|
601
601
|
});
|
|
602
602
|
};
|
|
603
|
-
return /* @__PURE__ */
|
|
603
|
+
return /* @__PURE__ */ n(Ur, { children: /* @__PURE__ */ u(
|
|
604
604
|
tt,
|
|
605
605
|
{
|
|
606
|
-
trigger: /* @__PURE__ */
|
|
606
|
+
trigger: /* @__PURE__ */ n(
|
|
607
607
|
gt,
|
|
608
608
|
{
|
|
609
609
|
dropdown: !0,
|
|
610
610
|
css: { display: "flex", width: "100%", overflow: "hidden" },
|
|
611
|
-
children: /* @__PURE__ */
|
|
611
|
+
children: /* @__PURE__ */ n(w, { blockType: r })
|
|
612
612
|
}
|
|
613
613
|
),
|
|
614
614
|
side: "bottom",
|
|
615
615
|
align: "start",
|
|
616
616
|
children: [
|
|
617
|
-
/* @__PURE__ */
|
|
617
|
+
/* @__PURE__ */ n(v, { onClick: () => {
|
|
618
618
|
r !== "paragraph" && t.update(() => {
|
|
619
619
|
const c = y();
|
|
620
|
-
N(c) && (at(c, () =>
|
|
620
|
+
N(c) && (at(c, () => U()), e("paragraph"));
|
|
621
621
|
});
|
|
622
|
-
}, children: /* @__PURE__ */
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
/* @__PURE__ */
|
|
627
|
-
/* @__PURE__ */
|
|
628
|
-
/* @__PURE__ */
|
|
629
|
-
/* @__PURE__ */
|
|
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: () => {
|
|
630
630
|
r !== "bullet" && (t.dispatchCommand(xe, void 0), e("bullet"));
|
|
631
|
-
}, children: /* @__PURE__ */
|
|
632
|
-
/* @__PURE__ */
|
|
631
|
+
}, children: /* @__PURE__ */ n(w, { blockType: "bullet" }) }),
|
|
632
|
+
/* @__PURE__ */ n(v, { onClick: () => {
|
|
633
633
|
r !== "number" && (t.dispatchCommand(we, void 0), e("number"));
|
|
634
|
-
}, children: /* @__PURE__ */
|
|
635
|
-
/* @__PURE__ */
|
|
636
|
-
r !== "check" && (t.dispatchCommand(
|
|
637
|
-
}, children: /* @__PURE__ */
|
|
638
|
-
/* @__PURE__ */
|
|
634
|
+
}, children: /* @__PURE__ */ n(w, { blockType: "number" }) }),
|
|
635
|
+
/* @__PURE__ */ n(v, { onClick: () => {
|
|
636
|
+
r !== "check" && (t.dispatchCommand(Ht, void 0), e("check"));
|
|
637
|
+
}, children: /* @__PURE__ */ n(w, { blockType: "check" }) }),
|
|
638
|
+
/* @__PURE__ */ n(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__ */
|
|
643
|
+
}, children: /* @__PURE__ */ n(w, { blockType: "quote" }) })
|
|
644
644
|
]
|
|
645
645
|
}
|
|
646
646
|
) });
|
|
647
647
|
}, Gr = () => {
|
|
648
|
-
const [t] = x(), [r, e] = b(!1), [
|
|
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(() => {
|
|
649
649
|
const m = y();
|
|
650
|
-
N(m) && (e(m.hasFormat("bold")), i(m.hasFormat("italic")),
|
|
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
|
}, []);
|
|
652
652
|
_(() => rt(
|
|
653
653
|
t.registerCommand(
|
|
@@ -678,59 +678,59 @@ const Ur = cr("div", {
|
|
|
678
678
|
[t]
|
|
679
679
|
), C = Yt(() => {
|
|
680
680
|
const m = [];
|
|
681
|
-
return r && m.push("bold"),
|
|
682
|
-
}, [r,
|
|
683
|
-
return /* @__PURE__ */
|
|
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]);
|
|
683
|
+
return /* @__PURE__ */ u(
|
|
684
684
|
qt,
|
|
685
685
|
{
|
|
686
686
|
type: "multiple",
|
|
687
687
|
"aria-label": "Tekstformattering",
|
|
688
688
|
value: C,
|
|
689
689
|
children: [
|
|
690
|
-
/* @__PURE__ */
|
|
691
|
-
/* @__PURE__ */
|
|
692
|
-
|
|
690
|
+
/* @__PURE__ */ n(B, { onClick: k, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ n(Lr, { size: "1.25rem" }) }),
|
|
691
|
+
/* @__PURE__ */ n(
|
|
692
|
+
B,
|
|
693
693
|
{
|
|
694
694
|
onClick: E,
|
|
695
695
|
title: "Kursiv tekst",
|
|
696
696
|
value: "italic",
|
|
697
|
-
children: /* @__PURE__ */
|
|
697
|
+
children: /* @__PURE__ */ n(Ir, { size: "1.25rem" })
|
|
698
698
|
}
|
|
699
699
|
),
|
|
700
|
-
/* @__PURE__ */
|
|
701
|
-
|
|
700
|
+
/* @__PURE__ */ n(
|
|
701
|
+
B,
|
|
702
702
|
{
|
|
703
703
|
onClick: S,
|
|
704
704
|
title: "Understreket tekst",
|
|
705
705
|
value: "underline",
|
|
706
|
-
children: /* @__PURE__ */
|
|
706
|
+
children: /* @__PURE__ */ n(Hr, { size: "1.25rem" })
|
|
707
707
|
}
|
|
708
708
|
),
|
|
709
|
-
/* @__PURE__ */
|
|
710
|
-
/* @__PURE__ */
|
|
711
|
-
|
|
709
|
+
/* @__PURE__ */ n(B, { onClick: M, title: "Kode", value: "code", children: /* @__PURE__ */ n(xr, { size: "1.25rem" }) }),
|
|
710
|
+
/* @__PURE__ */ n(
|
|
711
|
+
B,
|
|
712
712
|
{
|
|
713
713
|
onClick: p,
|
|
714
714
|
title: "Superscript",
|
|
715
715
|
value: "superscript",
|
|
716
|
-
children: /* @__PURE__ */
|
|
716
|
+
children: /* @__PURE__ */ n(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 } =
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
}, [
|
|
727
|
-
const { context:
|
|
723
|
+
const { hasFocus: r, editorRef: e } = z(), o = r, [i, a] = b(o);
|
|
724
|
+
Be(() => {
|
|
725
|
+
a(o);
|
|
726
|
+
}, [o]);
|
|
727
|
+
const { context: l, refs: s, floatingStyles: d } = ft({
|
|
728
728
|
placement: "top",
|
|
729
729
|
whileElementsMounted: Qt,
|
|
730
730
|
middleware: [
|
|
731
731
|
tr({
|
|
732
|
-
apply: ({ rects:
|
|
733
|
-
g.floating.style.minWidth = `${
|
|
732
|
+
apply: ({ rects: h, elements: g }) => {
|
|
733
|
+
g.floating.style.minWidth = `${h.reference.width}px`;
|
|
734
734
|
}
|
|
735
735
|
}),
|
|
736
736
|
er(),
|
|
@@ -742,16 +742,16 @@ const Ur = cr("div", {
|
|
|
742
742
|
})
|
|
743
743
|
],
|
|
744
744
|
open: i,
|
|
745
|
-
onOpenChange:
|
|
745
|
+
onOpenChange: a,
|
|
746
746
|
elements: {
|
|
747
747
|
reference: e.current
|
|
748
748
|
}
|
|
749
749
|
}), { getFloatingProps: c } = Zt([
|
|
750
|
-
te(
|
|
750
|
+
te(l, {
|
|
751
751
|
role: "dialog"
|
|
752
752
|
})
|
|
753
753
|
]);
|
|
754
|
-
return i ? /* @__PURE__ */
|
|
754
|
+
return i ? /* @__PURE__ */ n(ee, { children: /* @__PURE__ */ n(
|
|
755
755
|
Jt,
|
|
756
756
|
{
|
|
757
757
|
ref: s.setFloating,
|
|
@@ -763,23 +763,23 @@ const Ur = cr("div", {
|
|
|
763
763
|
overflow: "hidden",
|
|
764
764
|
boxShadow: "$md"
|
|
765
765
|
},
|
|
766
|
-
children: /* @__PURE__ */
|
|
766
|
+
children: /* @__PURE__ */ n(qr, { children: t })
|
|
767
767
|
}
|
|
768
768
|
) }) : null;
|
|
769
769
|
}, qr = ({
|
|
770
770
|
children: t,
|
|
771
771
|
...r
|
|
772
|
-
}) => /* @__PURE__ */
|
|
773
|
-
/* @__PURE__ */
|
|
774
|
-
/* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */
|
|
772
|
+
}) => /* @__PURE__ */ u(Fe, { "aria-label": "Formattering", ...r, children: [
|
|
773
|
+
/* @__PURE__ */ n(Kr, {}),
|
|
774
|
+
/* @__PURE__ */ n(He, {}),
|
|
775
|
+
/* @__PURE__ */ n(Gr, {}),
|
|
776
776
|
t
|
|
777
777
|
] });
|
|
778
778
|
function Jr() {
|
|
779
779
|
const [t] = x();
|
|
780
780
|
return _(() => rt(
|
|
781
781
|
t.registerCommand(
|
|
782
|
-
|
|
782
|
+
Ht,
|
|
783
783
|
() => (ye(t, "check"), !0),
|
|
784
784
|
R
|
|
785
785
|
),
|
|
@@ -794,11 +794,11 @@ function Jr() {
|
|
|
794
794
|
R
|
|
795
795
|
),
|
|
796
796
|
t.registerCommand(
|
|
797
|
-
|
|
797
|
+
Dt,
|
|
798
798
|
(r) => {
|
|
799
799
|
if (st() != null) {
|
|
800
|
-
const
|
|
801
|
-
return
|
|
800
|
+
const o = t.getRootElement();
|
|
801
|
+
return o != null && o.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
|
|
813
|
-
|
|
812
|
+
const o = dt(e);
|
|
813
|
+
F(o) && (r.preventDefault(), o.toggleChecked());
|
|
814
814
|
}), !0) : !1;
|
|
815
815
|
},
|
|
816
816
|
R
|
|
@@ -820,16 +820,16 @@ function Jr() {
|
|
|
820
820
|
(r) => t.getEditorState().read(() => {
|
|
821
821
|
const e = y();
|
|
822
822
|
if (N(e) && e.isCollapsed()) {
|
|
823
|
-
const { anchor:
|
|
824
|
-
if (i ||
|
|
825
|
-
const
|
|
826
|
-
|
|
823
|
+
const { anchor: o } = e, i = o.type === "element";
|
|
824
|
+
if (i || o.offset === 0) {
|
|
825
|
+
const a = o.getNode(), l = re(
|
|
826
|
+
a,
|
|
827
827
|
(s) => be(s) && !s.isInline()
|
|
828
828
|
);
|
|
829
|
-
if (
|
|
830
|
-
const s =
|
|
831
|
-
if (ut(s) && s.getListType() === "check" && (i ||
|
|
832
|
-
const d = t.getElementByKey(
|
|
829
|
+
if (F(l)) {
|
|
830
|
+
const s = l.getParent();
|
|
831
|
+
if (ut(s) && s.getListType() === "check" && (i || l.getFirstDescendant() === a)) {
|
|
832
|
+
const d = t.getElementByKey(l.__key);
|
|
833
833
|
if (d != null && document.activeElement !== d)
|
|
834
834
|
return d.focus(), r.preventDefault(), !0;
|
|
835
835
|
}
|
|
@@ -849,22 +849,22 @@ function ae(t, r) {
|
|
|
849
849
|
const e = t.target;
|
|
850
850
|
if (e === null || !Nt(e))
|
|
851
851
|
return;
|
|
852
|
-
const
|
|
853
|
-
if (
|
|
852
|
+
const o = e.firstChild;
|
|
853
|
+
if (o != null && Nt(o) && (o.tagName === "UL" || o.tagName === "OL"))
|
|
854
854
|
return;
|
|
855
855
|
const i = e.parentNode;
|
|
856
856
|
if (!i || i.__lexicalListType !== "check")
|
|
857
857
|
return;
|
|
858
|
-
const
|
|
859
|
-
(e.dir === "rtl" ?
|
|
858
|
+
const a = t.pageX, l = e.getBoundingClientRect();
|
|
859
|
+
(e.dir === "rtl" ? a < l.right && a > l.right - 20 : a > l.left && a < l.left + 20) && r();
|
|
860
860
|
}
|
|
861
861
|
function Et(t) {
|
|
862
862
|
ae(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
|
|
867
|
-
|
|
866
|
+
const o = dt(r);
|
|
867
|
+
F(o) && (r.focus(), o.toggleChecked());
|
|
868
868
|
}
|
|
869
869
|
});
|
|
870
870
|
});
|
|
@@ -889,10 +889,10 @@ 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(),
|
|
893
|
-
for (; e == null &&
|
|
894
|
-
|
|
895
|
-
for (;
|
|
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());
|
|
895
|
+
for (; F(e); ) {
|
|
896
896
|
const i = r ? e.getLastChild() : e.getFirstChild();
|
|
897
897
|
if (!ut(i))
|
|
898
898
|
return e;
|
|
@@ -901,17 +901,17 @@ function Qr(t, r) {
|
|
|
901
901
|
return null;
|
|
902
902
|
}
|
|
903
903
|
function It(t, r, e) {
|
|
904
|
-
const
|
|
905
|
-
return
|
|
906
|
-
const i = dt(
|
|
907
|
-
if (!
|
|
904
|
+
const o = st();
|
|
905
|
+
return o != null && r.update(() => {
|
|
906
|
+
const i = dt(o);
|
|
907
|
+
if (!F(i))
|
|
908
908
|
return;
|
|
909
|
-
const
|
|
910
|
-
if (
|
|
911
|
-
|
|
912
|
-
const
|
|
913
|
-
|
|
914
|
-
|
|
909
|
+
const a = Qr(i, e);
|
|
910
|
+
if (a != null) {
|
|
911
|
+
a.selectStart();
|
|
912
|
+
const l = r.getElementByKey(a.__key);
|
|
913
|
+
l != null && (t.preventDefault(), setTimeout(() => {
|
|
914
|
+
l.focus();
|
|
915
915
|
}, 0));
|
|
916
916
|
}
|
|
917
917
|
}), !1;
|
|
@@ -920,14 +920,14 @@ const vt = Me("INSERT_IMAGE_COMMAND");
|
|
|
920
920
|
function Vr() {
|
|
921
921
|
const [t] = kt();
|
|
922
922
|
return _(() => {
|
|
923
|
-
if (!t.hasNodes([
|
|
923
|
+
if (!t.hasNodes([$]))
|
|
924
924
|
throw new Error("ImagePlugin: ImageNode not registered on editor");
|
|
925
925
|
return rt(
|
|
926
926
|
t.registerCommand(
|
|
927
927
|
vt,
|
|
928
928
|
(r) => {
|
|
929
929
|
const e = Ct(r);
|
|
930
|
-
return Ce([e]),
|
|
930
|
+
return Ce([e]), $t(e.getParentOrThrow()) && ar(e, U).selectEnd(), !0;
|
|
931
931
|
},
|
|
932
932
|
ve
|
|
933
933
|
)
|
|
@@ -935,21 +935,21 @@ function Vr() {
|
|
|
935
935
|
}, [t]), null;
|
|
936
936
|
}
|
|
937
937
|
const Ot = ["image/"], Zr = () => {
|
|
938
|
-
const [t] = kt(), { fileUpload: r } =
|
|
938
|
+
const [t] = kt(), { fileUpload: r } = z();
|
|
939
939
|
return _(() => t.registerCommand(
|
|
940
940
|
Re,
|
|
941
941
|
(e) => ((async () => {
|
|
942
|
-
const
|
|
942
|
+
const o = await lr(
|
|
943
943
|
e,
|
|
944
944
|
[Ot].flatMap((i) => i)
|
|
945
945
|
);
|
|
946
|
-
for (const { file: i, result:
|
|
946
|
+
for (const { file: i, result: a } of o)
|
|
947
947
|
if (sr(i, Ot)) {
|
|
948
|
-
let
|
|
948
|
+
let l = a;
|
|
949
949
|
const s = new Image(), d = window.URL.createObjectURL(i);
|
|
950
950
|
s.onload = async () => {
|
|
951
|
-
r && (
|
|
952
|
-
src:
|
|
951
|
+
r && (l = await r.uploadFile({ file: i })), t.dispatchCommand(vt, {
|
|
952
|
+
src: l,
|
|
953
953
|
altText: i.name,
|
|
954
954
|
meta: { width: s.naturalWidth, height: s.naturalHeight }
|
|
955
955
|
}), window.URL.revokeObjectURL(d);
|
|
@@ -958,14 +958,14 @@ const Ot = ["image/"], Zr = () => {
|
|
|
958
958
|
})(), !0),
|
|
959
959
|
R
|
|
960
960
|
), [t, r]), null;
|
|
961
|
-
}, tn = () => /* @__PURE__ */
|
|
962
|
-
/* @__PURE__ */
|
|
963
|
-
/* @__PURE__ */
|
|
964
|
-
/* @__PURE__ */
|
|
965
|
-
/* @__PURE__ */
|
|
966
|
-
/* @__PURE__ */
|
|
967
|
-
/* @__PURE__ */
|
|
968
|
-
/* @__PURE__ */
|
|
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
969
|
] }), en = ({
|
|
970
970
|
state: t
|
|
971
971
|
}) => {
|
|
@@ -981,10 +981,10 @@ const Ot = ["image/"], Zr = () => {
|
|
|
981
981
|
br(t, r);
|
|
982
982
|
return;
|
|
983
983
|
}
|
|
984
|
-
const
|
|
985
|
-
|
|
986
|
-
} catch (
|
|
987
|
-
console.error("Could not parse"), console.error(
|
|
984
|
+
const o = r.parseEditorState(t);
|
|
985
|
+
o.isEmpty() || r.setEditorState(o);
|
|
986
|
+
} catch (o) {
|
|
987
|
+
console.error("Could not parse"), console.error(o);
|
|
988
988
|
}
|
|
989
989
|
}));
|
|
990
990
|
}, []), null;
|
|
@@ -1027,7 +1027,7 @@ const Ot = ["image/"], Zr = () => {
|
|
|
1027
1027
|
]
|
|
1028
1028
|
}), nn = ({
|
|
1029
1029
|
isLoading: t
|
|
1030
|
-
}) => /* @__PURE__ */
|
|
1030
|
+
}) => /* @__PURE__ */ n(
|
|
1031
1031
|
H,
|
|
1032
1032
|
{
|
|
1033
1033
|
css: {
|
|
@@ -1037,20 +1037,20 @@ const Ot = ["image/"], Zr = () => {
|
|
|
1037
1037
|
right: "1rem",
|
|
1038
1038
|
display: "flex"
|
|
1039
1039
|
},
|
|
1040
|
-
children: /* @__PURE__ */
|
|
1040
|
+
children: /* @__PURE__ */ n(pt, {})
|
|
1041
1041
|
}
|
|
1042
1042
|
), jn = ({
|
|
1043
1043
|
isLoading: t,
|
|
1044
1044
|
children: r,
|
|
1045
1045
|
placeholderText: e,
|
|
1046
|
-
nodes:
|
|
1046
|
+
nodes: o,
|
|
1047
1047
|
plugins: i,
|
|
1048
|
-
toolbar:
|
|
1049
|
-
toolbarContent:
|
|
1048
|
+
toolbar: a,
|
|
1049
|
+
toolbarContent: l,
|
|
1050
1050
|
content: s,
|
|
1051
1051
|
hideBorder: d,
|
|
1052
1052
|
onBlur: c,
|
|
1053
|
-
defaultState:
|
|
1053
|
+
defaultState: h,
|
|
1054
1054
|
css: g,
|
|
1055
1055
|
signUrl: k,
|
|
1056
1056
|
fileUpload: E
|
|
@@ -1059,7 +1059,7 @@ const Ot = ["image/"], Zr = () => {
|
|
|
1059
1059
|
() => ({ hasFocus: S, editorRef: p, signUrl: k, fileUpload: E }),
|
|
1060
1060
|
[S, k, E]
|
|
1061
1061
|
);
|
|
1062
|
-
return /* @__PURE__ */
|
|
1062
|
+
return /* @__PURE__ */ n(oe.Provider, { value: C, children: /* @__PURE__ */ u(
|
|
1063
1063
|
Qe,
|
|
1064
1064
|
{
|
|
1065
1065
|
initialConfig: {
|
|
@@ -1068,11 +1068,11 @@ const Ot = ["image/"], Zr = () => {
|
|
|
1068
1068
|
console.error(m);
|
|
1069
1069
|
},
|
|
1070
1070
|
theme: bt,
|
|
1071
|
-
nodes:
|
|
1071
|
+
nodes: o,
|
|
1072
1072
|
editable: !0
|
|
1073
1073
|
},
|
|
1074
1074
|
children: [
|
|
1075
|
-
/* @__PURE__ */
|
|
1075
|
+
/* @__PURE__ */ u(
|
|
1076
1076
|
rn,
|
|
1077
1077
|
{
|
|
1078
1078
|
ref: p,
|
|
@@ -1081,12 +1081,12 @@ const Ot = ["image/"], Zr = () => {
|
|
|
1081
1081
|
css: g,
|
|
1082
1082
|
...M,
|
|
1083
1083
|
children: [
|
|
1084
|
-
|
|
1085
|
-
/* @__PURE__ */
|
|
1084
|
+
a,
|
|
1085
|
+
/* @__PURE__ */ n(
|
|
1086
1086
|
Ve,
|
|
1087
1087
|
{
|
|
1088
1088
|
contentEditable: s,
|
|
1089
|
-
placeholder: e ? /* @__PURE__ */
|
|
1089
|
+
placeholder: e ? /* @__PURE__ */ n(
|
|
1090
1090
|
H,
|
|
1091
1091
|
{
|
|
1092
1092
|
css: {
|
|
@@ -1103,15 +1103,15 @@ const Ot = ["image/"], Zr = () => {
|
|
|
1103
1103
|
ErrorBoundary: Ze
|
|
1104
1104
|
}
|
|
1105
1105
|
),
|
|
1106
|
-
/* @__PURE__ */
|
|
1106
|
+
/* @__PURE__ */ n(tn, {}),
|
|
1107
1107
|
i,
|
|
1108
|
-
/* @__PURE__ */
|
|
1109
|
-
!
|
|
1108
|
+
/* @__PURE__ */ n(nn, { isLoading: t }),
|
|
1109
|
+
!a && /* @__PURE__ */ n(Yr, { children: l })
|
|
1110
1110
|
]
|
|
1111
1111
|
}
|
|
1112
1112
|
),
|
|
1113
|
-
/* @__PURE__ */
|
|
1114
|
-
/* @__PURE__ */
|
|
1113
|
+
/* @__PURE__ */ n(en, { state: h }),
|
|
1114
|
+
/* @__PURE__ */ n(W, { children: r })
|
|
1115
1115
|
]
|
|
1116
1116
|
}
|
|
1117
1117
|
) });
|
|
@@ -1313,80 +1313,80 @@ const Ot = ["image/"], Zr = () => {
|
|
|
1313
1313
|
fileUpload: t,
|
|
1314
1314
|
...r
|
|
1315
1315
|
}) => {
|
|
1316
|
-
const [e] = x(), [
|
|
1316
|
+
const [e] = x(), [o, i] = b(null), a = (s) => {
|
|
1317
1317
|
var c;
|
|
1318
1318
|
const d = (c = s.target.files) == null ? void 0 : c[0];
|
|
1319
1319
|
if (d) {
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1320
|
+
const h = new Image(), g = window.URL.createObjectURL(d);
|
|
1321
|
+
h.onload = async () => {
|
|
1322
1322
|
const k = await t.uploadFile({ file: d });
|
|
1323
|
-
i({ url: k, width:
|
|
1324
|
-
},
|
|
1323
|
+
i({ url: k, width: h.naturalWidth, height: h.naturalHeight }), window.URL.revokeObjectURL(g);
|
|
1324
|
+
}, h.src = g;
|
|
1325
1325
|
}
|
|
1326
|
-
},
|
|
1327
|
-
|
|
1328
|
-
src:
|
|
1329
|
-
altText: `Image: ${
|
|
1330
|
-
meta: { width:
|
|
1326
|
+
}, 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 }
|
|
1331
1331
|
}), r.onOpenChange(!1));
|
|
1332
1332
|
};
|
|
1333
|
-
return /* @__PURE__ */
|
|
1334
|
-
/* @__PURE__ */
|
|
1335
|
-
t.isLoading && /* @__PURE__ */
|
|
1336
|
-
/* @__PURE__ */
|
|
1333
|
+
return /* @__PURE__ */ u(Xt, { ...r, children: [
|
|
1334
|
+
/* @__PURE__ */ n(We, { children: "Sett inn bilde" }),
|
|
1335
|
+
t.isLoading && /* @__PURE__ */ n(pt, {}),
|
|
1336
|
+
/* @__PURE__ */ n(
|
|
1337
1337
|
mt,
|
|
1338
1338
|
{
|
|
1339
1339
|
type: "file",
|
|
1340
1340
|
accept: "image/png, image/jpeg",
|
|
1341
|
-
onChange:
|
|
1341
|
+
onChange: a,
|
|
1342
1342
|
disabled: t.isLoading
|
|
1343
1343
|
}
|
|
1344
1344
|
),
|
|
1345
|
-
/* @__PURE__ */
|
|
1346
|
-
/* @__PURE__ */
|
|
1347
|
-
/* @__PURE__ */
|
|
1345
|
+
/* @__PURE__ */ u(et, { children: [
|
|
1346
|
+
/* @__PURE__ */ n(L, { onClick: () => r.onOpenChange(!1), children: "Avbryt" }),
|
|
1347
|
+
/* @__PURE__ */ n(
|
|
1348
1348
|
L,
|
|
1349
1349
|
{
|
|
1350
1350
|
variant: "primary",
|
|
1351
|
-
disabled: !
|
|
1352
|
-
onClick:
|
|
1351
|
+
disabled: !o || t.isLoading,
|
|
1352
|
+
onClick: l,
|
|
1353
1353
|
children: "Sett inn"
|
|
1354
1354
|
}
|
|
1355
1355
|
)
|
|
1356
1356
|
] })
|
|
1357
1357
|
] });
|
|
1358
1358
|
}, Gn = () => {
|
|
1359
|
-
const [t] = x(), { fileUpload: r } =
|
|
1359
|
+
const [t] = x(), { fileUpload: r } = z(), [e, o] = b(!1), i = T(() => {
|
|
1360
1360
|
t.dispatchCommand(Ie, {
|
|
1361
1361
|
rows: "3",
|
|
1362
1362
|
columns: "3",
|
|
1363
1363
|
includeHeaders: !1
|
|
1364
1364
|
});
|
|
1365
1365
|
}, [t]);
|
|
1366
|
-
return /* @__PURE__ */
|
|
1367
|
-
/* @__PURE__ */
|
|
1366
|
+
return /* @__PURE__ */ u(W, { children: [
|
|
1367
|
+
/* @__PURE__ */ u(
|
|
1368
1368
|
tt,
|
|
1369
1369
|
{
|
|
1370
|
-
trigger: /* @__PURE__ */
|
|
1370
|
+
trigger: /* @__PURE__ */ n(gt, { dropdown: !0, children: "Sett inn" }),
|
|
1371
1371
|
side: "bottom",
|
|
1372
1372
|
align: "end",
|
|
1373
1373
|
children: [
|
|
1374
|
-
/* @__PURE__ */
|
|
1375
|
-
/* @__PURE__ */
|
|
1374
|
+
/* @__PURE__ */ u(v, { onClick: i, children: [
|
|
1375
|
+
/* @__PURE__ */ n(Fr, { size: "1.25rem" }),
|
|
1376
1376
|
" Tabell"
|
|
1377
1377
|
] }),
|
|
1378
|
-
r && /* @__PURE__ */
|
|
1379
|
-
/* @__PURE__ */
|
|
1378
|
+
r && /* @__PURE__ */ u(v, { onClick: () => o(!0), children: [
|
|
1379
|
+
/* @__PURE__ */ n(Je, { size: "1.25rem" }),
|
|
1380
1380
|
" Bilde"
|
|
1381
1381
|
] })
|
|
1382
1382
|
]
|
|
1383
1383
|
}
|
|
1384
1384
|
),
|
|
1385
|
-
r && /* @__PURE__ */
|
|
1385
|
+
r && /* @__PURE__ */ n(
|
|
1386
1386
|
an,
|
|
1387
1387
|
{
|
|
1388
1388
|
open: e,
|
|
1389
|
-
onOpenChange:
|
|
1389
|
+
onOpenChange: o,
|
|
1390
1390
|
fileUpload: r
|
|
1391
1391
|
}
|
|
1392
1392
|
)
|
|
@@ -1396,11 +1396,11 @@ function ln(t) {
|
|
|
1396
1396
|
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
1397
|
}
|
|
1398
1398
|
const Yn = () => {
|
|
1399
|
-
const [t] = x(), [r, e] = b(null), { hasFocus:
|
|
1399
|
+
const [t] = x(), [r, e] = b(null), { hasFocus: o } = z();
|
|
1400
1400
|
_(() => {
|
|
1401
|
-
!
|
|
1402
|
-
}, [
|
|
1403
|
-
const { refs: i, floatingStyles:
|
|
1401
|
+
!o && r && e(null);
|
|
1402
|
+
}, [o, r]);
|
|
1403
|
+
const { refs: i, floatingStyles: a } = ft({
|
|
1404
1404
|
placement: "top-end",
|
|
1405
1405
|
open: !!r,
|
|
1406
1406
|
elements: {
|
|
@@ -1420,7 +1420,7 @@ const Yn = () => {
|
|
|
1420
1420
|
},
|
|
1421
1421
|
Te
|
|
1422
1422
|
), [t]);
|
|
1423
|
-
const
|
|
1423
|
+
const l = (s) => () => {
|
|
1424
1424
|
t.update(() => {
|
|
1425
1425
|
switch (s) {
|
|
1426
1426
|
case "add-row-over":
|
|
@@ -1444,42 +1444,42 @@ const Yn = () => {
|
|
|
1444
1444
|
}
|
|
1445
1445
|
});
|
|
1446
1446
|
};
|
|
1447
|
-
return r ? /* @__PURE__ */
|
|
1447
|
+
return r ? /* @__PURE__ */ u(
|
|
1448
1448
|
tt,
|
|
1449
1449
|
{
|
|
1450
|
-
trigger: /* @__PURE__ */
|
|
1450
|
+
trigger: /* @__PURE__ */ n(
|
|
1451
1451
|
L,
|
|
1452
1452
|
{
|
|
1453
1453
|
icon: !0,
|
|
1454
1454
|
variant: "primary",
|
|
1455
1455
|
color: "secondary",
|
|
1456
1456
|
ref: i.setFloating,
|
|
1457
|
-
style:
|
|
1457
|
+
style: a,
|
|
1458
1458
|
css: { padding: "2px", width: "18px", height: "18px" },
|
|
1459
|
-
children: /* @__PURE__ */
|
|
1459
|
+
children: /* @__PURE__ */ n(ln, {})
|
|
1460
1460
|
}
|
|
1461
1461
|
),
|
|
1462
1462
|
children: [
|
|
1463
|
-
/* @__PURE__ */
|
|
1464
|
-
/* @__PURE__ */
|
|
1465
|
-
/* @__PURE__ */
|
|
1466
|
-
/* @__PURE__ */
|
|
1467
|
-
/* @__PURE__ */
|
|
1468
|
-
/* @__PURE__ */
|
|
1469
|
-
/* @__PURE__ */
|
|
1470
|
-
/* @__PURE__ */
|
|
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" })
|
|
1471
1471
|
]
|
|
1472
1472
|
}
|
|
1473
1473
|
) : null;
|
|
1474
1474
|
};
|
|
1475
1475
|
function Tt(t) {
|
|
1476
1476
|
let r = t;
|
|
1477
|
-
const e = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,
|
|
1478
|
-
return r = String(r).trim(), r.match(e) || r.match(
|
|
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://";
|
|
1479
1479
|
}
|
|
1480
1480
|
function le(t) {
|
|
1481
|
-
const r = t.anchor, e = t.focus,
|
|
1482
|
-
return
|
|
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;
|
|
1483
1483
|
}
|
|
1484
1484
|
const qn = (t) => (A.baseURL = t, A), Q = class extends P {
|
|
1485
1485
|
static getType() {
|
|
@@ -1523,40 +1523,40 @@ const cn = ({ onClose: t }) => {
|
|
|
1523
1523
|
const [r] = x(), e = T(
|
|
1524
1524
|
(i) => {
|
|
1525
1525
|
r.update(() => {
|
|
1526
|
-
const
|
|
1527
|
-
if (N(
|
|
1528
|
-
const
|
|
1529
|
-
|
|
1530
|
-
const s =
|
|
1531
|
-
s.setTextNodeRange(
|
|
1526
|
+
const a = y();
|
|
1527
|
+
if (N(a) && a.isCollapsed()) {
|
|
1528
|
+
const l = I(i);
|
|
1529
|
+
a.insertNodes([l]);
|
|
1530
|
+
const s = Bt();
|
|
1531
|
+
s.setTextNodeRange(l, 0, l, i.length), V(s);
|
|
1532
1532
|
}
|
|
1533
1533
|
r.dispatchCommand(Z, Tt(i));
|
|
1534
1534
|
});
|
|
1535
1535
|
},
|
|
1536
1536
|
[r]
|
|
1537
1537
|
);
|
|
1538
|
-
return /* @__PURE__ */
|
|
1538
|
+
return /* @__PURE__ */ u("form", { onSubmit: (i) => {
|
|
1539
1539
|
e(i.currentTarget.url.value), t();
|
|
1540
1540
|
}, children: [
|
|
1541
|
-
/* @__PURE__ */
|
|
1542
|
-
/* @__PURE__ */
|
|
1543
|
-
/* @__PURE__ */
|
|
1544
|
-
/* @__PURE__ */
|
|
1541
|
+
/* @__PURE__ */ n(mt, { name: "url", label: "URL", type: "url", required: !0 }),
|
|
1542
|
+
/* @__PURE__ */ u(et, { children: [
|
|
1543
|
+
/* @__PURE__ */ n(L, { onClick: t, children: "Avbryt" }),
|
|
1544
|
+
/* @__PURE__ */ n(L, { type: "submit", variant: "primary", children: "Sett inn" })
|
|
1545
1545
|
] })
|
|
1546
1546
|
] });
|
|
1547
1547
|
}, dn = ({
|
|
1548
1548
|
onClose: t,
|
|
1549
1549
|
getDocs: r
|
|
1550
1550
|
}) => {
|
|
1551
|
-
const [e] = x(), [
|
|
1551
|
+
const [e] = x(), [o, i] = b([]), a = r(), l = T(
|
|
1552
1552
|
(s) => {
|
|
1553
1553
|
e.update(() => {
|
|
1554
1554
|
const d = y();
|
|
1555
1555
|
if (N(d)) {
|
|
1556
1556
|
const c = [];
|
|
1557
|
-
for (const [
|
|
1557
|
+
for (const [h, g] of s.entries()) {
|
|
1558
1558
|
const k = se(g.value);
|
|
1559
|
-
k.append(I(g.label)), c.push(k),
|
|
1559
|
+
k.append(I(g.label)), c.push(k), h !== s.length - 1 && c.push(I(" "));
|
|
1560
1560
|
}
|
|
1561
1561
|
d.insertNodes(c);
|
|
1562
1562
|
}
|
|
@@ -1564,23 +1564,23 @@ const cn = ({ onClose: t }) => {
|
|
|
1564
1564
|
},
|
|
1565
1565
|
[e]
|
|
1566
1566
|
);
|
|
1567
|
-
return /* @__PURE__ */
|
|
1568
|
-
/* @__PURE__ */
|
|
1567
|
+
return /* @__PURE__ */ u(W, { children: [
|
|
1568
|
+
/* @__PURE__ */ n(
|
|
1569
1569
|
Ke,
|
|
1570
1570
|
{
|
|
1571
1571
|
isMulti: !0,
|
|
1572
|
-
options:
|
|
1572
|
+
options: a,
|
|
1573
1573
|
onChange: (s) => i(s)
|
|
1574
1574
|
}
|
|
1575
1575
|
),
|
|
1576
|
-
/* @__PURE__ */
|
|
1577
|
-
/* @__PURE__ */
|
|
1578
|
-
/* @__PURE__ */
|
|
1576
|
+
/* @__PURE__ */ u(et, { children: [
|
|
1577
|
+
/* @__PURE__ */ n(L, { onClick: t, children: "Avbryt" }),
|
|
1578
|
+
/* @__PURE__ */ n(
|
|
1579
1579
|
L,
|
|
1580
1580
|
{
|
|
1581
1581
|
variant: "primary",
|
|
1582
1582
|
onClick: () => {
|
|
1583
|
-
|
|
1583
|
+
l(o), t();
|
|
1584
1584
|
},
|
|
1585
1585
|
children: "Sett inn"
|
|
1586
1586
|
}
|
|
@@ -1589,35 +1589,36 @@ const cn = ({ onClose: t }) => {
|
|
|
1589
1589
|
] });
|
|
1590
1590
|
}, hn = ({
|
|
1591
1591
|
onClose: t,
|
|
1592
|
-
|
|
1592
|
+
fileUpload: r,
|
|
1593
|
+
filePrefix: e
|
|
1593
1594
|
}) => {
|
|
1594
|
-
const [
|
|
1595
|
-
var
|
|
1596
|
-
const
|
|
1597
|
-
if (
|
|
1598
|
-
const
|
|
1599
|
-
|
|
1600
|
-
name:
|
|
1601
|
-
url:
|
|
1595
|
+
const [o] = x(), [i, a] = b(null), l = async (d) => {
|
|
1596
|
+
var h;
|
|
1597
|
+
const c = (h = d.target.files) == null ? void 0 : h[0];
|
|
1598
|
+
if (c) {
|
|
1599
|
+
const g = await r.uploadFile({ file: c });
|
|
1600
|
+
a({
|
|
1601
|
+
name: c.name,
|
|
1602
|
+
url: e ? `${e}${g}` : g
|
|
1602
1603
|
});
|
|
1603
1604
|
}
|
|
1604
|
-
},
|
|
1605
|
-
|
|
1606
|
-
if (!
|
|
1605
|
+
}, s = T(() => {
|
|
1606
|
+
o.update(() => {
|
|
1607
|
+
if (!i)
|
|
1607
1608
|
return;
|
|
1608
|
-
const
|
|
1609
|
-
if (N(
|
|
1610
|
-
const
|
|
1611
|
-
|
|
1612
|
-
const
|
|
1613
|
-
|
|
1609
|
+
const d = y();
|
|
1610
|
+
if (N(d) && d.isCollapsed()) {
|
|
1611
|
+
const c = I(i.name);
|
|
1612
|
+
d.insertNodes([c]);
|
|
1613
|
+
const h = Bt();
|
|
1614
|
+
h.setTextNodeRange(c, 0, c, i.name.length), V(h);
|
|
1614
1615
|
}
|
|
1615
|
-
|
|
1616
|
+
o.dispatchCommand(Z, Tt(i.url));
|
|
1616
1617
|
});
|
|
1617
|
-
}, [
|
|
1618
|
-
return /* @__PURE__ */
|
|
1619
|
-
r.isLoading && /* @__PURE__ */
|
|
1620
|
-
/* @__PURE__ */
|
|
1618
|
+
}, [o, i]);
|
|
1619
|
+
return /* @__PURE__ */ u(W, { children: [
|
|
1620
|
+
r.isLoading && /* @__PURE__ */ n(pt, {}),
|
|
1621
|
+
/* @__PURE__ */ n(
|
|
1621
1622
|
mt,
|
|
1622
1623
|
{
|
|
1623
1624
|
type: "file",
|
|
@@ -1625,16 +1626,16 @@ const cn = ({ onClose: t }) => {
|
|
|
1625
1626
|
disabled: r.isLoading
|
|
1626
1627
|
}
|
|
1627
1628
|
),
|
|
1628
|
-
/* @__PURE__ */
|
|
1629
|
-
/* @__PURE__ */
|
|
1630
|
-
/* @__PURE__ */
|
|
1629
|
+
/* @__PURE__ */ u(et, { children: [
|
|
1630
|
+
/* @__PURE__ */ n(L, { onClick: t, children: "Avbryt" }),
|
|
1631
|
+
/* @__PURE__ */ n(
|
|
1631
1632
|
L,
|
|
1632
1633
|
{
|
|
1633
1634
|
variant: "primary",
|
|
1634
1635
|
onClick: () => {
|
|
1635
|
-
|
|
1636
|
+
s(), t();
|
|
1636
1637
|
},
|
|
1637
|
-
disabled: !
|
|
1638
|
+
disabled: !i,
|
|
1638
1639
|
children: "Sett inn"
|
|
1639
1640
|
}
|
|
1640
1641
|
)
|
|
@@ -1644,73 +1645,80 @@ const cn = ({ onClose: t }) => {
|
|
|
1644
1645
|
open: t,
|
|
1645
1646
|
onOpenChange: r,
|
|
1646
1647
|
getDocs: e,
|
|
1647
|
-
|
|
1648
|
+
filePrefix: o
|
|
1648
1649
|
}) => {
|
|
1649
|
-
const
|
|
1650
|
+
const { fileUpload: i } = z(), [a, l] = b("url"), s = () => {
|
|
1650
1651
|
r(!1);
|
|
1651
1652
|
};
|
|
1652
|
-
return /* @__PURE__ */
|
|
1653
|
-
/* @__PURE__ */
|
|
1654
|
-
/* @__PURE__ */
|
|
1655
|
-
e && /* @__PURE__ */
|
|
1653
|
+
return /* @__PURE__ */ u(Xt, { open: t, onOpenChange: r, css: { width: "600px" }, children: [
|
|
1654
|
+
/* @__PURE__ */ u(je, { css: { marginBottom: "$8" }, children: [
|
|
1655
|
+
/* @__PURE__ */ n(lt, { active: a === "url", onClick: () => l("url"), children: "URL" }),
|
|
1656
|
+
e && /* @__PURE__ */ n(
|
|
1656
1657
|
lt,
|
|
1657
1658
|
{
|
|
1658
|
-
active:
|
|
1659
|
+
active: a === "rutine",
|
|
1659
1660
|
onClick: () => l("rutine"),
|
|
1660
1661
|
children: "Rutine"
|
|
1661
1662
|
}
|
|
1662
1663
|
),
|
|
1663
|
-
|
|
1664
|
+
i && /* @__PURE__ */ n(lt, { active: a === "file", onClick: () => l("file"), children: "Fil" })
|
|
1664
1665
|
] }),
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
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,
|
|
1670
|
+
{
|
|
1671
|
+
onClose: s,
|
|
1672
|
+
fileUpload: i,
|
|
1673
|
+
filePrefix: o
|
|
1674
|
+
}
|
|
1675
|
+
)
|
|
1668
1676
|
] });
|
|
1669
1677
|
}, Jn = ({
|
|
1670
1678
|
getDocs: t,
|
|
1671
|
-
|
|
1679
|
+
filePrefix: r
|
|
1672
1680
|
}) => {
|
|
1673
|
-
const [e] = x(), [
|
|
1681
|
+
const [e] = x(), [o, i] = b(!1), [a, l] = b(!1), s = T(() => {
|
|
1674
1682
|
const d = y();
|
|
1675
1683
|
if (N(d)) {
|
|
1676
|
-
const c = le(d),
|
|
1677
|
-
i(J(
|
|
1684
|
+
const c = le(d), h = c.getParent();
|
|
1685
|
+
i(J(h) || J(c));
|
|
1678
1686
|
}
|
|
1679
1687
|
}, []);
|
|
1680
1688
|
return _(() => e.registerCommand(
|
|
1681
1689
|
G,
|
|
1682
1690
|
() => (s(), !1),
|
|
1683
1691
|
ct
|
|
1684
|
-
), [e, s]), /* @__PURE__ */
|
|
1685
|
-
/* @__PURE__ */
|
|
1686
|
-
|
|
1692
|
+
), [e, s]), /* @__PURE__ */ u(qt, { type: "single", value: o ? "link" : "", children: [
|
|
1693
|
+
/* @__PURE__ */ n(
|
|
1694
|
+
B,
|
|
1687
1695
|
{
|
|
1688
1696
|
onClick: () => {
|
|
1689
|
-
|
|
1697
|
+
o ? e.dispatchCommand(Z, null) : l(!0);
|
|
1690
1698
|
},
|
|
1691
1699
|
title: "Lenke",
|
|
1692
1700
|
value: "link",
|
|
1693
|
-
children: /* @__PURE__ */
|
|
1701
|
+
children: /* @__PURE__ */ n(Ar, { size: "1.25rem" })
|
|
1694
1702
|
}
|
|
1695
1703
|
),
|
|
1696
|
-
/* @__PURE__ */
|
|
1704
|
+
/* @__PURE__ */ n(
|
|
1697
1705
|
un,
|
|
1698
1706
|
{
|
|
1699
|
-
open:
|
|
1700
|
-
onOpenChange:
|
|
1707
|
+
open: a,
|
|
1708
|
+
onOpenChange: l,
|
|
1701
1709
|
getDocs: t,
|
|
1702
|
-
|
|
1710
|
+
filePrefix: r
|
|
1703
1711
|
}
|
|
1704
1712
|
)
|
|
1705
1713
|
] });
|
|
1706
1714
|
}, Xn = () => {
|
|
1707
|
-
const [t] = x(), r = Y(null), [e,
|
|
1715
|
+
const [t] = x(), r = Y(null), [e, o] = b(null), [i, a] = b(""), { hasFocus: l } = z();
|
|
1708
1716
|
_(() => {
|
|
1709
1717
|
e ? t.update(() => {
|
|
1710
|
-
|
|
1711
|
-
}) :
|
|
1718
|
+
a(e.getURL());
|
|
1719
|
+
}) : a("");
|
|
1712
1720
|
}, [t, e]);
|
|
1713
|
-
const s = !!(e && i &&
|
|
1721
|
+
const s = !!(e && i && l), { refs: d, floatingStyles: c, context: h } = ft({
|
|
1714
1722
|
placement: "top",
|
|
1715
1723
|
strategy: "fixed",
|
|
1716
1724
|
open: s,
|
|
@@ -1720,8 +1728,8 @@ const cn = ({ onClose: t }) => {
|
|
|
1720
1728
|
},
|
|
1721
1729
|
middleware: [nr()]
|
|
1722
1730
|
}), { getFloatingProps: g } = Zt([
|
|
1723
|
-
te(
|
|
1724
|
-
or(
|
|
1731
|
+
te(h),
|
|
1732
|
+
or(h)
|
|
1725
1733
|
]), k = T(() => {
|
|
1726
1734
|
var p;
|
|
1727
1735
|
const M = y();
|
|
@@ -1732,7 +1740,7 @@ const cn = ({ onClose: t }) => {
|
|
|
1732
1740
|
const nt = window.getSelection(), _t = t.getRootElement();
|
|
1733
1741
|
M !== null && nt !== null && _t !== null && _t.contains(nt.anchorNode) && t.isEditable() && (r.current = ((p = nt.focusNode) == null ? void 0 : p.parentElement) ?? null);
|
|
1734
1742
|
}
|
|
1735
|
-
|
|
1743
|
+
o(q);
|
|
1736
1744
|
}
|
|
1737
1745
|
}, [t]), E = T(() => {
|
|
1738
1746
|
e && sn(e) && t.update(() => {
|
|
@@ -1755,14 +1763,14 @@ const cn = ({ onClose: t }) => {
|
|
|
1755
1763
|
R
|
|
1756
1764
|
),
|
|
1757
1765
|
t.registerCommand(
|
|
1758
|
-
|
|
1759
|
-
() => e ? (
|
|
1766
|
+
Dt,
|
|
1767
|
+
() => e ? (o(null), !0) : !1,
|
|
1760
1768
|
_e
|
|
1761
1769
|
)
|
|
1762
1770
|
), [t, k, e]), !s)
|
|
1763
1771
|
return null;
|
|
1764
1772
|
const S = Tt(i);
|
|
1765
|
-
return /* @__PURE__ */
|
|
1773
|
+
return /* @__PURE__ */ n(ee, { children: /* @__PURE__ */ u(
|
|
1766
1774
|
Jt,
|
|
1767
1775
|
{
|
|
1768
1776
|
ref: d.setFloating,
|
|
@@ -1776,7 +1784,7 @@ const cn = ({ onClose: t }) => {
|
|
|
1776
1784
|
style: c,
|
|
1777
1785
|
...g(),
|
|
1778
1786
|
children: [
|
|
1779
|
-
/* @__PURE__ */
|
|
1787
|
+
/* @__PURE__ */ n(
|
|
1780
1788
|
H,
|
|
1781
1789
|
{
|
|
1782
1790
|
as: "a",
|
|
@@ -1794,44 +1802,44 @@ const cn = ({ onClose: t }) => {
|
|
|
1794
1802
|
children: i
|
|
1795
1803
|
}
|
|
1796
1804
|
),
|
|
1797
|
-
/* @__PURE__ */
|
|
1805
|
+
/* @__PURE__ */ n(L, { color: "danger", icon: !0, size: "sm", onClick: E, children: /* @__PURE__ */ n(Xe, { size: 24 }) })
|
|
1798
1806
|
]
|
|
1799
1807
|
}
|
|
1800
1808
|
) });
|
|
1801
1809
|
}, Qn = () => {
|
|
1802
1810
|
const [t] = kt();
|
|
1803
|
-
return /* @__PURE__ */
|
|
1811
|
+
return /* @__PURE__ */ u(
|
|
1804
1812
|
tt,
|
|
1805
1813
|
{
|
|
1806
1814
|
align: "end",
|
|
1807
|
-
trigger: /* @__PURE__ */
|
|
1815
|
+
trigger: /* @__PURE__ */ n(gt, { dropdown: !0, children: /* @__PURE__ */ n(St, { size: "1.25rem" }) }),
|
|
1808
1816
|
children: [
|
|
1809
|
-
/* @__PURE__ */
|
|
1817
|
+
/* @__PURE__ */ u(
|
|
1810
1818
|
v,
|
|
1811
1819
|
{
|
|
1812
1820
|
onClick: () => t.dispatchCommand(it, "left"),
|
|
1813
1821
|
children: [
|
|
1814
|
-
/* @__PURE__ */
|
|
1822
|
+
/* @__PURE__ */ n(St, { size: "1.25rem" }),
|
|
1815
1823
|
"Venstre"
|
|
1816
1824
|
]
|
|
1817
1825
|
}
|
|
1818
1826
|
),
|
|
1819
|
-
/* @__PURE__ */
|
|
1827
|
+
/* @__PURE__ */ u(
|
|
1820
1828
|
v,
|
|
1821
1829
|
{
|
|
1822
1830
|
onClick: () => t.dispatchCommand(it, "center"),
|
|
1823
1831
|
children: [
|
|
1824
|
-
/* @__PURE__ */
|
|
1832
|
+
/* @__PURE__ */ n(Tr, { size: "1.25rem" }),
|
|
1825
1833
|
"Midt"
|
|
1826
1834
|
]
|
|
1827
1835
|
}
|
|
1828
1836
|
),
|
|
1829
|
-
/* @__PURE__ */
|
|
1837
|
+
/* @__PURE__ */ u(
|
|
1830
1838
|
v,
|
|
1831
1839
|
{
|
|
1832
1840
|
onClick: () => t.dispatchCommand(it, "right"),
|
|
1833
1841
|
children: [
|
|
1834
|
-
/* @__PURE__ */
|
|
1842
|
+
/* @__PURE__ */ n(_r, { size: "1.25rem" }),
|
|
1835
1843
|
"Høyre"
|
|
1836
1844
|
]
|
|
1837
1845
|
}
|
|
@@ -1843,11 +1851,11 @@ const cn = ({ onClose: t }) => {
|
|
|
1843
1851
|
export {
|
|
1844
1852
|
Ct as $createImageNode,
|
|
1845
1853
|
se as $createRutineLinkNode,
|
|
1846
|
-
|
|
1854
|
+
Hn as $isImageNode,
|
|
1847
1855
|
sn as $isRutineLinkNode,
|
|
1848
1856
|
Qn as AlignToolbarDropdown,
|
|
1849
1857
|
Yr as FloatingToolbar,
|
|
1850
|
-
|
|
1858
|
+
$ as ImageNode,
|
|
1851
1859
|
Gn as InsertSelector,
|
|
1852
1860
|
Xn as LinkEditPlugin,
|
|
1853
1861
|
X as LinkTargetNode,
|
|
@@ -1866,8 +1874,8 @@ export {
|
|
|
1866
1874
|
Kn as richTextCss,
|
|
1867
1875
|
on as richTextStyleObj,
|
|
1868
1876
|
br as setStateFromPlainText,
|
|
1869
|
-
|
|
1870
|
-
|
|
1877
|
+
Pn as stateToHTML,
|
|
1878
|
+
Fn as syncStateToHTML,
|
|
1871
1879
|
Mr as useHasFocusWithin,
|
|
1872
|
-
|
|
1880
|
+
z as useRichTextContext
|
|
1873
1881
|
};
|