@arkitektbedriftene/fe-lib 1.4.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/icons.es.js +10 -11
- package/dist/index.esm-297793f7.js +119 -0
- package/dist/rich-text/Editor.d.ts +2 -1
- package/dist/rich-text/Plugins/Image/ImageComponent.d.ts +8 -0
- package/dist/rich-text/Plugins/Image/ImageNode.d.ts +41 -0
- package/dist/rich-text/Plugins/Image/ImagePlugin.d.ts +6 -0
- package/dist/rich-text/Toolbar/InsertSelector.d.ts +10 -1
- package/dist/rich-text/config.d.ts +3 -2
- package/dist/rich-text/editorContext.d.ts +2 -0
- package/dist/rich-text/rich-text.d.ts +1 -0
- package/dist/rich-text/state.d.ts +5 -5
- package/dist/rich-text.es.js +916 -690
- package/dist/ui.es.js +68 -69
- package/package.json +1 -1
- package/dist/index.esm-67eba761.js +0 -95
- package/dist/index.esm-ab03d8db.js +0 -23
package/dist/rich-text.es.js
CHANGED
|
@@ -1,55 +1,56 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { createHeadlessEditor as
|
|
5
|
-
import { $generateHtmlFromNodes as
|
|
6
|
-
import { $getRoot as
|
|
7
|
-
import { trimTextContentFromAnchor as
|
|
8
|
-
import { LinkNode as
|
|
9
|
-
import { ListNode as
|
|
10
|
-
import { HeadingNode as
|
|
11
|
-
import { TableNode as
|
|
12
|
-
import { jsx as
|
|
13
|
-
import { createContext as
|
|
14
|
-
import { DropdownMenu as
|
|
15
|
-
import { LexicalComposer as
|
|
16
|
-
import { RichTextPlugin as
|
|
17
|
-
import
|
|
18
|
-
import { useFloating as
|
|
19
|
-
import { useLexicalComposerContext as
|
|
20
|
-
import { $getNearestNodeOfType as
|
|
21
|
-
import { G as
|
|
22
|
-
import { s as
|
|
23
|
-
import { ListPlugin as
|
|
24
|
-
import { HistoryPlugin as
|
|
25
|
-
import { TablePlugin as
|
|
26
|
-
import { TabIndentationPlugin as
|
|
1
|
+
var ee = Object.defineProperty;
|
|
2
|
+
var re = (t, r, e) => r in t ? ee(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
|
+
var I = (t, r, e) => (re(t, typeof r != "symbol" ? r + "" : r, e), e);
|
|
4
|
+
import { createHeadlessEditor as ne } from "@lexical/headless";
|
|
5
|
+
import { $generateHtmlFromNodes as oe } from "@lexical/html";
|
|
6
|
+
import { $getRoot as X, ParagraphNode as ie, $createParagraphNode as U, $createTextNode as $, $setSelection as Q, DecoratorNode as ae, $applyNodeReplacement as le, SELECTION_CHANGE_COMMAND as j, $getSelection as _, COMMAND_PRIORITY_CRITICAL as at, $isRangeSelection as T, $isRootOrShadowRoot as xt, FORMAT_TEXT_COMMAND as F, COMMAND_PRIORITY_LOW as R, KEY_ARROW_DOWN_COMMAND as se, KEY_ARROW_UP_COMMAND as ce, KEY_ESCAPE_COMMAND as Lt, KEY_SPACE_COMMAND as de, $getNearestNodeFromDOMNode as lt, KEY_ARROW_LEFT_COMMAND as he, $isElementNode as ue, createCommand as ge, $insertNodes as pe, COMMAND_PRIORITY_EDITOR as me, COMMAND_PRIORITY_NORMAL as fe, $createRangeSelection as yt, COMMAND_PRIORITY_HIGH as ke } from "lexical";
|
|
7
|
+
import { trimTextContentFromAnchor as be, $setBlocksType as nt, $isAtNodeEnd as ft } from "@lexical/selection";
|
|
8
|
+
import { LinkNode as B, AutoLinkNode as Nt, $isLinkNode as Y, TOGGLE_LINK_COMMAND as V } from "@lexical/link";
|
|
9
|
+
import { ListNode as st, ListItemNode as wt, $isListNode as ct, INSERT_UNORDERED_LIST_COMMAND as Ce, INSERT_ORDERED_LIST_COMMAND as ve, INSERT_CHECK_LIST_COMMAND as St, insertList as Me, $isListItemNode as P } from "@lexical/list";
|
|
10
|
+
import { HeadingNode as Et, QuoteNode as It, $isHeadingNode as _e, $createHeadingNode as Te, $createQuoteNode as xe } from "@lexical/rich-text";
|
|
11
|
+
import { TableNode as Rt, TableRowNode as Ot, TableCellNode as $t, INSERT_TABLE_COMMAND as Le, $getTableCellNodeFromLexicalNode as ye, $deleteTableColumn__EXPERIMENTAL as Ne, $deleteTableRow__EXPERIMENTAL as we, $insertTableColumn__EXPERIMENTAL as kt, $insertTableRow__EXPERIMENTAL as bt } from "@lexical/table";
|
|
12
|
+
import { jsx as o, jsxs as h, Fragment as H } from "react/jsx-runtime";
|
|
13
|
+
import { createContext as Se, useState as p, useRef as K, useCallback as C, useContext as Ee, useEffect as x, useMemo as zt, useLayoutEffect as Ie } from "react";
|
|
14
|
+
import { DropdownMenu as dt, ToolbarButton as At, DropdownMenuIconItem as v, Box as W, ToolbarToggleGroup as Dt, ToolbarToggleItem as D, OverlayCard as Bt, Toolbar as Re, ToolbarSeparator as Oe, styled as $e, Spinner as ht, Dialog as Pt, DialogHeader as ze, TextInput as Ht, DialogActions as Z, Button as y, DropdownMenuItem as A, DropdownMenuSeparator as Ct, NavBar as Ae, NavBarItem as ot, Combobox as De } from "./ui.es.js";
|
|
15
|
+
import { LexicalComposer as Be } from "@lexical/react/LexicalComposer.js";
|
|
16
|
+
import { RichTextPlugin as Pe } from "@lexical/react/LexicalRichTextPlugin.js";
|
|
17
|
+
import He from "@lexical/react/LexicalErrorBoundary.js";
|
|
18
|
+
import { useFloating as ut, autoUpdate as Ft, size as Fe, flip as We, offset as Wt, shift as Ue, useInteractions as Ut, useRole as jt, FloatingPortal as Kt, inline as je, useDismiss as Ke } from "@floating-ui/react";
|
|
19
|
+
import { useLexicalComposerContext as L } from "@lexical/react/LexicalComposerContext.js";
|
|
20
|
+
import { $getNearestNodeOfType as qe, $findMatchingParent as qt, mergeRegister as tt, isHTMLElement as vt, $wrapNodeInElement as Ye } from "@lexical/utils";
|
|
21
|
+
import { G as m, f as Ge, g as Je } from "./index.esm-297793f7.js";
|
|
22
|
+
import { s as Xe, c as Qe } from "./stitches.config-00c23cdb.js";
|
|
23
|
+
import { ListPlugin as Ve } from "@lexical/react/LexicalListPlugin.js";
|
|
24
|
+
import { HistoryPlugin as Ze } from "@lexical/react/LexicalHistoryPlugin.js";
|
|
25
|
+
import { TablePlugin as tr } from "@lexical/react/LexicalTablePlugin.js";
|
|
26
|
+
import { TabIndentationPlugin as er } from "@lexical/react/LexicalTabIndentationPlugin.js";
|
|
27
|
+
import { useLexicalComposerContext as rr } from "@lexical/react/LexicalComposerContext";
|
|
27
28
|
import "@stitches/react";
|
|
28
|
-
const
|
|
29
|
+
const nr = ({
|
|
29
30
|
text: t,
|
|
30
|
-
maxChars:
|
|
31
|
-
maxLines:
|
|
31
|
+
maxChars: r,
|
|
32
|
+
maxLines: e
|
|
32
33
|
}) => {
|
|
33
34
|
if (t.length === 0)
|
|
34
35
|
return 0;
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
36
|
+
const n = typeof e == "number", i = typeof r == "number";
|
|
37
|
+
if (!n && !i)
|
|
37
38
|
return t.length;
|
|
38
|
-
let
|
|
39
|
-
for (;
|
|
40
|
-
t[
|
|
41
|
-
` &&
|
|
42
|
-
return t.slice(0,
|
|
43
|
-
},
|
|
39
|
+
let a = 0, l = 0;
|
|
40
|
+
for (; l < t.length && (!n || a < e) && (!i || l < r); )
|
|
41
|
+
t[l] === `
|
|
42
|
+
` && a++, l++;
|
|
43
|
+
return t.slice(0, l).length;
|
|
44
|
+
}, or = ({
|
|
44
45
|
editor: t,
|
|
45
|
-
maxChars:
|
|
46
|
-
maxLines:
|
|
46
|
+
maxChars: r,
|
|
47
|
+
maxLines: e
|
|
47
48
|
}) => {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
const c =
|
|
51
|
-
return c instanceof
|
|
52
|
-
},
|
|
49
|
+
const n = X(), i = n.getTextContent(), a = nr({ text: i, maxChars: r, maxLines: e }), l = i.length - a, d = n.select().anchor;
|
|
50
|
+
be(t, d, l);
|
|
51
|
+
const c = n.getLastChild();
|
|
52
|
+
return c instanceof ie && c.getChildrenSize() === 0 && c.remove(), l;
|
|
53
|
+
}, Yt = {
|
|
53
54
|
quote: "ain-rich-text-quote",
|
|
54
55
|
text: {
|
|
55
56
|
bold: "ain-rich-text-bold",
|
|
@@ -61,192 +62,332 @@ const Ke = ({
|
|
|
61
62
|
listitem: "ain-rich-text-nested-list-item"
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
|
-
},
|
|
65
|
+
}, Gt = (t) => t[0] === "{", ir = (t) => t !== null && typeof t == "object" && "isEmpty" in t, ar = (t, r) => {
|
|
65
66
|
t.update(
|
|
66
67
|
() => {
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
68
|
+
const e = X();
|
|
69
|
+
e.clear();
|
|
70
|
+
const n = U();
|
|
71
|
+
n.append($("")), e.append(n), Q(null);
|
|
71
72
|
},
|
|
72
73
|
{
|
|
73
|
-
tag:
|
|
74
|
+
tag: r
|
|
74
75
|
}
|
|
75
76
|
);
|
|
76
|
-
},
|
|
77
|
-
|
|
77
|
+
}, lr = (t, r, e) => {
|
|
78
|
+
r.update(
|
|
78
79
|
() => {
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
const i =
|
|
82
|
-
i.append(
|
|
80
|
+
const n = X();
|
|
81
|
+
n.clear();
|
|
82
|
+
const i = U();
|
|
83
|
+
i.append($(t.trim())), n.append(i), Q(null);
|
|
83
84
|
},
|
|
84
85
|
{
|
|
85
|
-
tag:
|
|
86
|
+
tag: e
|
|
86
87
|
}
|
|
87
|
-
),
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
), r.blur();
|
|
89
|
+
}, yn = async (t, r, e) => {
|
|
90
|
+
var l;
|
|
91
|
+
let n = 0;
|
|
92
|
+
const i = ne({
|
|
93
|
+
nodes: r,
|
|
92
94
|
editable: !1,
|
|
93
|
-
theme:
|
|
95
|
+
theme: Yt
|
|
94
96
|
});
|
|
95
97
|
if (t)
|
|
96
98
|
try {
|
|
97
|
-
if (typeof t == "string" && !
|
|
99
|
+
if (typeof t == "string" && !Gt(t))
|
|
98
100
|
i.update(() => {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
+
const s = X(), d = U();
|
|
102
|
+
d.append($(t.trim())), s.append(d);
|
|
101
103
|
});
|
|
102
104
|
else {
|
|
103
|
-
const
|
|
104
|
-
(
|
|
105
|
+
const s = i.parseEditorState(t, () => {
|
|
106
|
+
(e == null ? void 0 : e.maxLines) !== void 0 && (n = or({
|
|
105
107
|
editor: i,
|
|
106
|
-
maxLines:
|
|
108
|
+
maxLines: e.maxLines
|
|
107
109
|
}));
|
|
108
110
|
});
|
|
109
|
-
|
|
111
|
+
s.isEmpty() || i.setEditorState(s);
|
|
110
112
|
}
|
|
111
|
-
} catch (
|
|
112
|
-
console.error(
|
|
113
|
+
} catch (s) {
|
|
114
|
+
console.error(s);
|
|
113
115
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}), { html:
|
|
116
|
+
await ((l = e == null ? void 0 : e.updateFn) == null ? void 0 : l.call(e, i));
|
|
117
|
+
let a = "";
|
|
118
|
+
return i.read(() => {
|
|
119
|
+
a = oe(i);
|
|
120
|
+
}), { html: a, trimCount: n };
|
|
119
121
|
};
|
|
120
|
-
class
|
|
122
|
+
class G extends B {
|
|
121
123
|
static getType() {
|
|
122
124
|
return "target-link";
|
|
123
125
|
}
|
|
124
|
-
constructor(
|
|
126
|
+
constructor(r, e, n) {
|
|
125
127
|
let i = !1;
|
|
126
|
-
const
|
|
128
|
+
const a = { ...e };
|
|
127
129
|
try {
|
|
128
|
-
const
|
|
129
|
-
window.location.hostname !==
|
|
130
|
+
const l = new URL(r);
|
|
131
|
+
window.location.hostname !== l.hostname && (i = !0);
|
|
130
132
|
} catch {
|
|
131
133
|
}
|
|
132
|
-
i && (
|
|
134
|
+
i && (a.target = "_blank", a.rel = "noopener noreferrer"), super(r, a, n);
|
|
133
135
|
}
|
|
134
|
-
static clone(
|
|
135
|
-
return new
|
|
136
|
-
|
|
137
|
-
{ rel:
|
|
138
|
-
|
|
136
|
+
static clone(r) {
|
|
137
|
+
return new G(
|
|
138
|
+
r.__url,
|
|
139
|
+
{ rel: r.__rel, target: r.__target, title: r.__title },
|
|
140
|
+
r.__key
|
|
139
141
|
);
|
|
140
142
|
}
|
|
141
143
|
exportJSON() {
|
|
142
144
|
return super.exportJSON();
|
|
143
145
|
}
|
|
146
|
+
static importJSON(r) {
|
|
147
|
+
return B.importJSON(r);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const Jt = Se({ hasFocus: !1, editorRef: { current: null }, signUrl: void 0 }), sr = ({ onBlur: t }) => {
|
|
151
|
+
const [r, e] = p(!1), n = K(null), i = C(() => {
|
|
152
|
+
e(!0), n.current && window.clearTimeout(n.current);
|
|
153
|
+
}, []), a = C(() => {
|
|
154
|
+
n.current = window.setTimeout(() => {
|
|
155
|
+
e(!1), t == null || t();
|
|
156
|
+
}, 0);
|
|
157
|
+
}, [t]);
|
|
158
|
+
return {
|
|
159
|
+
hasFocus: r,
|
|
160
|
+
attributes: {
|
|
161
|
+
onFocus: i,
|
|
162
|
+
onBlur: a
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
}, et = () => Ee(Jt), cr = (t) => t.startsWith("https://devfilesab.blob.core.windows.net") || t.startsWith("https://filesab.blob.core.windows.net");
|
|
166
|
+
function dr({
|
|
167
|
+
src: t,
|
|
168
|
+
altText: r,
|
|
169
|
+
width: e,
|
|
170
|
+
height: n,
|
|
171
|
+
maxWidth: i
|
|
172
|
+
}) {
|
|
173
|
+
const { signUrl: a } = et(), [l, s] = p(cr(t) ? "" : t), d = K(!1);
|
|
174
|
+
return x(() => {
|
|
175
|
+
const c = async () => {
|
|
176
|
+
s(await (a == null ? void 0 : a(t)) ?? t);
|
|
177
|
+
};
|
|
178
|
+
!l && !d.current && (d.current = !0, c());
|
|
179
|
+
}, []), l ? /* @__PURE__ */ o(
|
|
180
|
+
"img",
|
|
181
|
+
{
|
|
182
|
+
src: l,
|
|
183
|
+
alt: r,
|
|
184
|
+
style: {
|
|
185
|
+
height: n,
|
|
186
|
+
maxWidth: i,
|
|
187
|
+
width: e
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
) : /* @__PURE__ */ o("span", {});
|
|
191
|
+
}
|
|
192
|
+
function hr(t) {
|
|
193
|
+
const r = t, { alt: e, src: n, width: i, height: a } = r;
|
|
194
|
+
return { node: gt({ altText: e, height: a, src: n, width: i }) };
|
|
195
|
+
}
|
|
196
|
+
class z extends ae {
|
|
197
|
+
constructor(e, n, i, a, l, s) {
|
|
198
|
+
super(s);
|
|
199
|
+
I(this, "__src");
|
|
200
|
+
I(this, "__altText");
|
|
201
|
+
I(this, "__width");
|
|
202
|
+
I(this, "__height");
|
|
203
|
+
I(this, "__maxWidth");
|
|
204
|
+
this.__src = e, this.__altText = n, this.__maxWidth = i, this.__width = a || "inherit", this.__height = l || "inherit";
|
|
205
|
+
}
|
|
206
|
+
static getType() {
|
|
207
|
+
return "image";
|
|
208
|
+
}
|
|
209
|
+
static clone(e) {
|
|
210
|
+
return new z(
|
|
211
|
+
e.__src,
|
|
212
|
+
e.__altText,
|
|
213
|
+
e.__maxWidth,
|
|
214
|
+
e.__width,
|
|
215
|
+
e.__height,
|
|
216
|
+
e.__key
|
|
217
|
+
);
|
|
218
|
+
}
|
|
144
219
|
static importJSON(e) {
|
|
145
|
-
|
|
220
|
+
const { altText: n, height: i, width: a, maxWidth: l, src: s } = e;
|
|
221
|
+
return gt({
|
|
222
|
+
altText: n,
|
|
223
|
+
height: i,
|
|
224
|
+
maxWidth: l,
|
|
225
|
+
src: s,
|
|
226
|
+
width: a
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
exportDOM() {
|
|
230
|
+
const e = document.createElement("img");
|
|
231
|
+
return e.setAttribute("src", this.__src), e.setAttribute("alt", this.__altText), e.setAttribute("width", this.__width.toString()), e.setAttribute("height", this.__height.toString()), { element: e };
|
|
232
|
+
}
|
|
233
|
+
static importDOM() {
|
|
234
|
+
return {
|
|
235
|
+
img: (e) => ({
|
|
236
|
+
conversion: hr,
|
|
237
|
+
priority: 0
|
|
238
|
+
})
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
exportJSON() {
|
|
242
|
+
return {
|
|
243
|
+
altText: this.getAltText(),
|
|
244
|
+
height: this.__height === "inherit" ? 0 : this.__height,
|
|
245
|
+
maxWidth: this.__maxWidth,
|
|
246
|
+
src: this.getSrc(),
|
|
247
|
+
type: "image",
|
|
248
|
+
version: 1,
|
|
249
|
+
width: this.__width === "inherit" ? 0 : this.__width
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
setSrc(e) {
|
|
253
|
+
const n = this.getWritable();
|
|
254
|
+
n.__src = e;
|
|
255
|
+
}
|
|
256
|
+
setWidthAndHeight(e, n) {
|
|
257
|
+
const i = this.getWritable();
|
|
258
|
+
i.__width = e, i.__height = n;
|
|
259
|
+
}
|
|
260
|
+
// View
|
|
261
|
+
createDOM(e) {
|
|
262
|
+
const n = document.createElement("span"), a = e.theme.image;
|
|
263
|
+
return a !== void 0 && (n.className = a), n;
|
|
264
|
+
}
|
|
265
|
+
updateDOM() {
|
|
266
|
+
return !1;
|
|
267
|
+
}
|
|
268
|
+
getSrc() {
|
|
269
|
+
return this.__src;
|
|
270
|
+
}
|
|
271
|
+
getAltText() {
|
|
272
|
+
return this.__altText;
|
|
273
|
+
}
|
|
274
|
+
decorate() {
|
|
275
|
+
return /* @__PURE__ */ o(
|
|
276
|
+
dr,
|
|
277
|
+
{
|
|
278
|
+
src: this.__src,
|
|
279
|
+
altText: this.__altText,
|
|
280
|
+
width: this.__width,
|
|
281
|
+
height: this.__height,
|
|
282
|
+
maxWidth: this.__maxWidth
|
|
283
|
+
}
|
|
284
|
+
);
|
|
146
285
|
}
|
|
147
286
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
287
|
+
function gt({
|
|
288
|
+
altText: t,
|
|
289
|
+
height: r,
|
|
290
|
+
maxWidth: e = 500,
|
|
291
|
+
src: n,
|
|
292
|
+
width: i,
|
|
293
|
+
key: a
|
|
294
|
+
}) {
|
|
295
|
+
return le(
|
|
296
|
+
new z(n, t, e, i, r, a)
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
function Nn(t) {
|
|
300
|
+
return t instanceof z;
|
|
301
|
+
}
|
|
302
|
+
const wn = [
|
|
156
303
|
Et,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
Nt,
|
|
160
|
-
St,
|
|
161
|
-
rt,
|
|
162
|
-
yt,
|
|
163
|
-
Lt,
|
|
164
|
-
$,
|
|
304
|
+
It,
|
|
305
|
+
st,
|
|
165
306
|
wt,
|
|
307
|
+
Nt,
|
|
308
|
+
B,
|
|
309
|
+
Rt,
|
|
310
|
+
Ot,
|
|
311
|
+
$t,
|
|
312
|
+
z
|
|
313
|
+
], Sn = [
|
|
166
314
|
Et,
|
|
167
|
-
|
|
168
|
-
|
|
315
|
+
It,
|
|
316
|
+
st,
|
|
317
|
+
wt,
|
|
318
|
+
Nt,
|
|
319
|
+
B,
|
|
320
|
+
Rt,
|
|
321
|
+
Ot,
|
|
322
|
+
$t,
|
|
323
|
+
z,
|
|
324
|
+
G,
|
|
169
325
|
{
|
|
170
|
-
replace:
|
|
171
|
-
with: (t) => new
|
|
326
|
+
replace: B,
|
|
327
|
+
with: (t) => new G(
|
|
172
328
|
t.getURL(),
|
|
173
329
|
{ rel: t.__rel, target: t.__target, title: t.__title }
|
|
174
330
|
)
|
|
175
331
|
}
|
|
176
|
-
]
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}, []), l = v(() => {
|
|
180
|
-
o.current = window.setTimeout(() => {
|
|
181
|
-
r(!1), t == null || t();
|
|
182
|
-
}, 0);
|
|
183
|
-
}, [t]);
|
|
184
|
-
return {
|
|
185
|
-
hasFocus: e,
|
|
186
|
-
attributes: {
|
|
187
|
-
onFocus: i,
|
|
188
|
-
onBlur: l
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
}, ct = () => Ce(jt);
|
|
192
|
-
function Qe(t) {
|
|
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);
|
|
332
|
+
];
|
|
333
|
+
function ur(t) {
|
|
334
|
+
return m({ 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
335
|
}
|
|
195
|
-
function
|
|
196
|
-
return
|
|
336
|
+
function gr(t) {
|
|
337
|
+
return m({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 8l-4 4l4 4" } }, { tag: "path", attr: { d: "M17 8l4 4l-4 4" } }, { tag: "path", attr: { d: "M14 4l-4 16" } }] })(t);
|
|
197
338
|
}
|
|
198
|
-
function
|
|
199
|
-
return
|
|
339
|
+
function pr(t) {
|
|
340
|
+
return m({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 18v-8l-2 2" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
|
|
200
341
|
}
|
|
201
|
-
function
|
|
202
|
-
return
|
|
342
|
+
function mr(t) {
|
|
343
|
+
return m({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
|
|
203
344
|
}
|
|
204
|
-
function
|
|
205
|
-
return
|
|
345
|
+
function fr(t) {
|
|
346
|
+
return m({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 14a2 2 0 1 0 -2 -2" } }, { tag: "path", attr: { d: "M17 16a2 2 0 1 0 2 -2" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
|
|
206
347
|
}
|
|
207
|
-
function
|
|
208
|
-
return
|
|
348
|
+
function kr(t) {
|
|
349
|
+
return m({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M20 18v-8l-4 6h5" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
|
|
209
350
|
}
|
|
210
|
-
function
|
|
211
|
-
return
|
|
351
|
+
function br(t) {
|
|
352
|
+
return m({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17 18h2a2 2 0 1 0 0 -4h-2v-4h4" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
|
|
212
353
|
}
|
|
213
|
-
function
|
|
214
|
-
return
|
|
354
|
+
function Cr(t) {
|
|
355
|
+
return m({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 14a2 2 0 1 0 0 4a2 2 0 0 0 0 -4z" } }, { tag: "path", attr: { d: "M21 12a2 2 0 1 0 -4 0v4" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
|
|
215
356
|
}
|
|
216
|
-
function
|
|
217
|
-
return
|
|
357
|
+
function vr(t) {
|
|
358
|
+
return m({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M11 5l6 0" } }, { tag: "path", attr: { d: "M7 19l6 0" } }, { tag: "path", attr: { d: "M14 5l-4 14" } }] })(t);
|
|
218
359
|
}
|
|
219
|
-
function
|
|
220
|
-
return
|
|
360
|
+
function Mr(t) {
|
|
361
|
+
return m({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17.5 15.5m-3.5 0a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0" } }, { tag: "path", attr: { d: "M3 19v-10.5a3.5 3.5 0 0 1 7 0v10.5" } }, { tag: "path", attr: { d: "M3 13h7" } }, { tag: "path", attr: { d: "M21 12v7" } }] })(t);
|
|
221
362
|
}
|
|
222
|
-
function
|
|
223
|
-
return
|
|
363
|
+
function _r(t) {
|
|
364
|
+
return m({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" } }, { tag: "path", attr: { d: "M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" } }] })(t);
|
|
224
365
|
}
|
|
225
|
-
function
|
|
226
|
-
return
|
|
366
|
+
function Tr(t) {
|
|
367
|
+
return m({ 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);
|
|
227
368
|
}
|
|
228
|
-
function
|
|
229
|
-
return
|
|
369
|
+
function xr(t) {
|
|
370
|
+
return m({ 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);
|
|
230
371
|
}
|
|
231
|
-
function
|
|
232
|
-
return
|
|
372
|
+
function Lr(t) {
|
|
373
|
+
return m({ 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);
|
|
233
374
|
}
|
|
234
|
-
function
|
|
235
|
-
return
|
|
375
|
+
function yr(t) {
|
|
376
|
+
return m({ 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);
|
|
236
377
|
}
|
|
237
|
-
function
|
|
238
|
-
return
|
|
378
|
+
function Nr(t) {
|
|
379
|
+
return m({ 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);
|
|
239
380
|
}
|
|
240
|
-
function
|
|
241
|
-
return
|
|
381
|
+
function wr(t) {
|
|
382
|
+
return m({ 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);
|
|
242
383
|
}
|
|
243
|
-
function
|
|
244
|
-
return
|
|
384
|
+
function Sr(t) {
|
|
385
|
+
return m({ 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
386
|
}
|
|
246
|
-
const
|
|
387
|
+
const Er = Xe("div", {
|
|
247
388
|
width: "10rem",
|
|
248
389
|
display: "flex"
|
|
249
|
-
}),
|
|
390
|
+
}), Xt = {
|
|
250
391
|
bullet: "Punktliste",
|
|
251
392
|
h1: "Overskrift 1",
|
|
252
393
|
h2: "Overskrift 2",
|
|
@@ -258,24 +399,24 @@ const fr = Pe("div", {
|
|
|
258
399
|
paragraph: "Normal",
|
|
259
400
|
quote: "Sitat",
|
|
260
401
|
check: "Avkrysningsliste"
|
|
261
|
-
},
|
|
262
|
-
bullet: /* @__PURE__ */
|
|
263
|
-
h1: /* @__PURE__ */
|
|
264
|
-
h2: /* @__PURE__ */
|
|
265
|
-
h3: /* @__PURE__ */
|
|
266
|
-
h4: /* @__PURE__ */
|
|
267
|
-
h5: /* @__PURE__ */
|
|
268
|
-
h6: /* @__PURE__ */
|
|
269
|
-
number: /* @__PURE__ */
|
|
270
|
-
check: /* @__PURE__ */
|
|
271
|
-
paragraph: /* @__PURE__ */
|
|
272
|
-
quote: /* @__PURE__ */
|
|
273
|
-
},
|
|
402
|
+
}, Ir = {
|
|
403
|
+
bullet: /* @__PURE__ */ o(Lr, { size: "1.25rem" }),
|
|
404
|
+
h1: /* @__PURE__ */ o(pr, { size: "1.25rem" }),
|
|
405
|
+
h2: /* @__PURE__ */ o(mr, { size: "1.25rem" }),
|
|
406
|
+
h3: /* @__PURE__ */ o(fr, { size: "1.25rem" }),
|
|
407
|
+
h4: /* @__PURE__ */ o(kr, { size: "1.25rem" }),
|
|
408
|
+
h5: /* @__PURE__ */ o(br, { size: "1.25rem" }),
|
|
409
|
+
h6: /* @__PURE__ */ o(Cr, { size: "1.25rem" }),
|
|
410
|
+
number: /* @__PURE__ */ o(xr, { size: "1.25rem" }),
|
|
411
|
+
check: /* @__PURE__ */ o(Tr, { size: "1.25rem" }),
|
|
412
|
+
paragraph: /* @__PURE__ */ o(Mr, { size: "1.25rem" }),
|
|
413
|
+
quote: /* @__PURE__ */ o(yr, { size: "1.25rem" })
|
|
414
|
+
}, M = ({
|
|
274
415
|
blockType: t
|
|
275
|
-
}) => /* @__PURE__ */
|
|
276
|
-
/* @__PURE__ */
|
|
277
|
-
/* @__PURE__ */
|
|
278
|
-
|
|
416
|
+
}) => /* @__PURE__ */ h(H, { children: [
|
|
417
|
+
/* @__PURE__ */ o(W, { css: { display: "flex", flex: "0 0 auto" }, children: Ir[t] }),
|
|
418
|
+
/* @__PURE__ */ o(
|
|
419
|
+
W,
|
|
279
420
|
{
|
|
280
421
|
css: {
|
|
281
422
|
flex: "1 1 auto",
|
|
@@ -283,204 +424,204 @@ const fr = Pe("div", {
|
|
|
283
424
|
textOverflow: "ellipsis",
|
|
284
425
|
whiteSpace: "nowrap"
|
|
285
426
|
},
|
|
286
|
-
children:
|
|
427
|
+
children: Xt[t]
|
|
287
428
|
}
|
|
288
429
|
)
|
|
289
|
-
] }),
|
|
290
|
-
if (!
|
|
430
|
+
] }), Rr = (t) => {
|
|
431
|
+
if (!T(t))
|
|
291
432
|
return null;
|
|
292
|
-
const
|
|
293
|
-
let
|
|
294
|
-
const i =
|
|
295
|
-
return i !== null &&
|
|
433
|
+
const r = t.anchor.getNode();
|
|
434
|
+
let e = r.getKey() === "root" ? r : qt(r, (n) => {
|
|
435
|
+
const i = n.getParent();
|
|
436
|
+
return i !== null && xt(i);
|
|
296
437
|
});
|
|
297
|
-
return
|
|
298
|
-
anchorNode:
|
|
299
|
-
element:
|
|
438
|
+
return e === null && (e = r.getTopLevelElementOrThrow()), {
|
|
439
|
+
anchorNode: r,
|
|
440
|
+
element: e
|
|
300
441
|
};
|
|
301
|
-
},
|
|
302
|
-
const [t] =
|
|
442
|
+
}, Or = () => {
|
|
443
|
+
const [t] = L(), [r, e] = p("paragraph");
|
|
303
444
|
x(() => t.registerCommand(
|
|
304
|
-
|
|
445
|
+
j,
|
|
305
446
|
() => {
|
|
306
|
-
const c =
|
|
447
|
+
const c = _(), u = Rr(c);
|
|
307
448
|
if (!u)
|
|
308
449
|
return !1;
|
|
309
|
-
const { element:
|
|
310
|
-
if (t.getElementByKey(
|
|
311
|
-
if (
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
),
|
|
316
|
-
|
|
450
|
+
const { element: g, anchorNode: b } = u, N = g.getKey();
|
|
451
|
+
if (t.getElementByKey(N) !== null)
|
|
452
|
+
if (ct(g)) {
|
|
453
|
+
const k = qe(
|
|
454
|
+
b,
|
|
455
|
+
st
|
|
456
|
+
), w = k ? k.getListType() : g.getListType();
|
|
457
|
+
e(w);
|
|
317
458
|
} else {
|
|
318
|
-
const
|
|
319
|
-
|
|
459
|
+
const k = _e(g) ? g.getTag() : g.getType();
|
|
460
|
+
k in Xt && e(k);
|
|
320
461
|
}
|
|
321
462
|
return !1;
|
|
322
463
|
},
|
|
323
|
-
|
|
464
|
+
at
|
|
324
465
|
), [t]);
|
|
325
|
-
const
|
|
326
|
-
|
|
327
|
-
const u =
|
|
328
|
-
|
|
466
|
+
const n = (c) => {
|
|
467
|
+
r !== c && t.update(() => {
|
|
468
|
+
const u = _();
|
|
469
|
+
T(u) && (nt(u, () => Te(c)), e(c));
|
|
329
470
|
});
|
|
330
471
|
};
|
|
331
|
-
return /* @__PURE__ */
|
|
332
|
-
|
|
472
|
+
return /* @__PURE__ */ o(Er, { children: /* @__PURE__ */ h(
|
|
473
|
+
dt,
|
|
333
474
|
{
|
|
334
|
-
trigger: /* @__PURE__ */
|
|
335
|
-
|
|
475
|
+
trigger: /* @__PURE__ */ o(
|
|
476
|
+
At,
|
|
336
477
|
{
|
|
337
478
|
dropdown: !0,
|
|
338
479
|
css: { display: "flex", width: "100%", overflow: "hidden" },
|
|
339
|
-
children: /* @__PURE__ */
|
|
480
|
+
children: /* @__PURE__ */ o(M, { blockType: r })
|
|
340
481
|
}
|
|
341
482
|
),
|
|
342
483
|
side: "bottom",
|
|
343
484
|
align: "start",
|
|
344
485
|
children: [
|
|
345
|
-
/* @__PURE__ */
|
|
346
|
-
|
|
347
|
-
const c =
|
|
348
|
-
|
|
486
|
+
/* @__PURE__ */ o(v, { onClick: () => {
|
|
487
|
+
r !== "paragraph" && t.update(() => {
|
|
488
|
+
const c = _();
|
|
489
|
+
T(c) && (nt(c, () => U()), e("paragraph"));
|
|
349
490
|
});
|
|
350
|
-
}, children: /* @__PURE__ */
|
|
351
|
-
/* @__PURE__ */
|
|
352
|
-
/* @__PURE__ */
|
|
353
|
-
/* @__PURE__ */
|
|
354
|
-
/* @__PURE__ */
|
|
355
|
-
/* @__PURE__ */
|
|
356
|
-
/* @__PURE__ */
|
|
357
|
-
/* @__PURE__ */
|
|
358
|
-
|
|
359
|
-
}, children: /* @__PURE__ */
|
|
360
|
-
/* @__PURE__ */
|
|
361
|
-
|
|
362
|
-
}, children: /* @__PURE__ */
|
|
363
|
-
/* @__PURE__ */
|
|
364
|
-
|
|
365
|
-
}, children: /* @__PURE__ */
|
|
366
|
-
/* @__PURE__ */
|
|
367
|
-
|
|
368
|
-
const c =
|
|
369
|
-
|
|
491
|
+
}, children: /* @__PURE__ */ o(M, { blockType: "paragraph" }) }),
|
|
492
|
+
/* @__PURE__ */ o(v, { onClick: () => n("h1"), children: /* @__PURE__ */ o(M, { blockType: "h1" }) }),
|
|
493
|
+
/* @__PURE__ */ o(v, { onClick: () => n("h2"), children: /* @__PURE__ */ o(M, { blockType: "h2" }) }),
|
|
494
|
+
/* @__PURE__ */ o(v, { onClick: () => n("h3"), children: /* @__PURE__ */ o(M, { blockType: "h3" }) }),
|
|
495
|
+
/* @__PURE__ */ o(v, { onClick: () => n("h4"), children: /* @__PURE__ */ o(M, { blockType: "h4" }) }),
|
|
496
|
+
/* @__PURE__ */ o(v, { onClick: () => n("h5"), children: /* @__PURE__ */ o(M, { blockType: "h5" }) }),
|
|
497
|
+
/* @__PURE__ */ o(v, { onClick: () => n("h6"), children: /* @__PURE__ */ o(M, { blockType: "h6" }) }),
|
|
498
|
+
/* @__PURE__ */ o(v, { onClick: () => {
|
|
499
|
+
r !== "bullet" && (t.dispatchCommand(Ce, void 0), e("bullet"));
|
|
500
|
+
}, children: /* @__PURE__ */ o(M, { blockType: "bullet" }) }),
|
|
501
|
+
/* @__PURE__ */ o(v, { onClick: () => {
|
|
502
|
+
r !== "number" && (t.dispatchCommand(ve, void 0), e("number"));
|
|
503
|
+
}, children: /* @__PURE__ */ o(M, { blockType: "number" }) }),
|
|
504
|
+
/* @__PURE__ */ o(v, { onClick: () => {
|
|
505
|
+
r !== "check" && (t.dispatchCommand(St, void 0), e("check"));
|
|
506
|
+
}, children: /* @__PURE__ */ o(M, { blockType: "check" }) }),
|
|
507
|
+
/* @__PURE__ */ o(v, { onClick: () => {
|
|
508
|
+
r !== "quote" && t.update(() => {
|
|
509
|
+
const c = _();
|
|
510
|
+
T(c) && (nt(c, () => xe()), e("quote"));
|
|
370
511
|
});
|
|
371
|
-
}, children: /* @__PURE__ */
|
|
512
|
+
}, children: /* @__PURE__ */ o(M, { blockType: "quote" }) })
|
|
372
513
|
]
|
|
373
514
|
}
|
|
374
515
|
) });
|
|
375
|
-
},
|
|
376
|
-
const [t] =
|
|
377
|
-
const f =
|
|
378
|
-
|
|
516
|
+
}, $r = () => {
|
|
517
|
+
const [t] = L(), [r, e] = p(!1), [n, i] = p(!1), [a, l] = p(!1), [s, d] = p(!1), [c, u] = p(!1), g = C(() => {
|
|
518
|
+
const f = _();
|
|
519
|
+
T(f) && (e(f.hasFormat("bold")), i(f.hasFormat("italic")), l(f.hasFormat("underline")), d(f.hasFormat("code")), u(f.hasFormat("superscript")));
|
|
379
520
|
}, []);
|
|
380
|
-
x(() =>
|
|
521
|
+
x(() => tt(
|
|
381
522
|
t.registerCommand(
|
|
382
|
-
|
|
383
|
-
() => (
|
|
384
|
-
|
|
523
|
+
j,
|
|
524
|
+
() => (g(), !1),
|
|
525
|
+
at
|
|
385
526
|
),
|
|
386
527
|
t.registerUpdateListener(({ editorState: f }) => {
|
|
387
528
|
f.read(() => {
|
|
388
|
-
|
|
529
|
+
g();
|
|
389
530
|
});
|
|
390
531
|
})
|
|
391
|
-
), [t,
|
|
392
|
-
const
|
|
393
|
-
() => t.dispatchCommand(
|
|
532
|
+
), [t, g]);
|
|
533
|
+
const b = C(
|
|
534
|
+
() => t.dispatchCommand(F, "bold"),
|
|
394
535
|
[t]
|
|
395
|
-
),
|
|
396
|
-
() => t.dispatchCommand(
|
|
536
|
+
), N = C(
|
|
537
|
+
() => t.dispatchCommand(F, "italic"),
|
|
397
538
|
[t]
|
|
398
|
-
),
|
|
399
|
-
() => t.dispatchCommand(
|
|
539
|
+
), S = C(
|
|
540
|
+
() => t.dispatchCommand(F, "underline"),
|
|
400
541
|
[t]
|
|
401
|
-
),
|
|
402
|
-
() => t.dispatchCommand(
|
|
542
|
+
), k = C(
|
|
543
|
+
() => t.dispatchCommand(F, "code"),
|
|
403
544
|
[t]
|
|
404
|
-
),
|
|
405
|
-
() => t.dispatchCommand(
|
|
545
|
+
), w = C(
|
|
546
|
+
() => t.dispatchCommand(F, "superscript"),
|
|
406
547
|
[t]
|
|
407
|
-
),
|
|
548
|
+
), E = zt(() => {
|
|
408
549
|
const f = [];
|
|
409
|
-
return
|
|
410
|
-
}, [
|
|
411
|
-
return /* @__PURE__ */
|
|
412
|
-
|
|
550
|
+
return r && f.push("bold"), n && f.push("italic"), a && f.push("underline"), s && f.push("code"), c && f.push("superscript"), f;
|
|
551
|
+
}, [r, n, a, s, c]);
|
|
552
|
+
return /* @__PURE__ */ h(
|
|
553
|
+
Dt,
|
|
413
554
|
{
|
|
414
555
|
type: "multiple",
|
|
415
556
|
"aria-label": "Tekstformattering",
|
|
416
|
-
value:
|
|
557
|
+
value: E,
|
|
417
558
|
children: [
|
|
418
|
-
/* @__PURE__ */
|
|
419
|
-
/* @__PURE__ */
|
|
420
|
-
|
|
559
|
+
/* @__PURE__ */ o(D, { onClick: b, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ o(ur, { size: "1.25rem" }) }),
|
|
560
|
+
/* @__PURE__ */ o(
|
|
561
|
+
D,
|
|
421
562
|
{
|
|
422
|
-
onClick:
|
|
563
|
+
onClick: N,
|
|
423
564
|
title: "Kursiv tekst",
|
|
424
565
|
value: "italic",
|
|
425
|
-
children: /* @__PURE__ */
|
|
566
|
+
children: /* @__PURE__ */ o(vr, { size: "1.25rem" })
|
|
426
567
|
}
|
|
427
568
|
),
|
|
428
|
-
/* @__PURE__ */
|
|
429
|
-
|
|
569
|
+
/* @__PURE__ */ o(
|
|
570
|
+
D,
|
|
430
571
|
{
|
|
431
|
-
onClick:
|
|
572
|
+
onClick: S,
|
|
432
573
|
title: "Understreket tekst",
|
|
433
574
|
value: "underline",
|
|
434
|
-
children: /* @__PURE__ */
|
|
575
|
+
children: /* @__PURE__ */ o(Sr, { size: "1.25rem" })
|
|
435
576
|
}
|
|
436
577
|
),
|
|
437
|
-
/* @__PURE__ */
|
|
438
|
-
/* @__PURE__ */
|
|
439
|
-
|
|
578
|
+
/* @__PURE__ */ o(D, { onClick: k, title: "Kode", value: "code", children: /* @__PURE__ */ o(gr, { size: "1.25rem" }) }),
|
|
579
|
+
/* @__PURE__ */ o(
|
|
580
|
+
D,
|
|
440
581
|
{
|
|
441
|
-
onClick:
|
|
582
|
+
onClick: w,
|
|
442
583
|
title: "Superscript",
|
|
443
584
|
value: "superscript",
|
|
444
|
-
children: /* @__PURE__ */
|
|
585
|
+
children: /* @__PURE__ */ o(Nr, { size: "1.25rem" })
|
|
445
586
|
}
|
|
446
587
|
)
|
|
447
588
|
]
|
|
448
589
|
}
|
|
449
590
|
);
|
|
450
|
-
},
|
|
451
|
-
const { hasFocus:
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}, [
|
|
455
|
-
const { context:
|
|
591
|
+
}, zr = ({ children: t }) => {
|
|
592
|
+
const { hasFocus: r, editorRef: e } = et(), n = r, [i, a] = p(n);
|
|
593
|
+
Ie(() => {
|
|
594
|
+
a(n);
|
|
595
|
+
}, [n]);
|
|
596
|
+
const { context: l, refs: s, floatingStyles: d } = ut({
|
|
456
597
|
placement: "top",
|
|
457
|
-
whileElementsMounted:
|
|
598
|
+
whileElementsMounted: Ft,
|
|
458
599
|
middleware: [
|
|
459
|
-
|
|
460
|
-
apply: ({ rects: u, elements:
|
|
461
|
-
|
|
600
|
+
Fe({
|
|
601
|
+
apply: ({ rects: u, elements: g }) => {
|
|
602
|
+
g.floating.style.minWidth = `${u.reference.width}px`;
|
|
462
603
|
}
|
|
463
604
|
}),
|
|
464
|
-
|
|
465
|
-
|
|
605
|
+
We(),
|
|
606
|
+
Wt({
|
|
466
607
|
mainAxis: 8
|
|
467
608
|
}),
|
|
468
|
-
|
|
609
|
+
Ue({
|
|
469
610
|
padding: 8
|
|
470
611
|
})
|
|
471
612
|
],
|
|
472
613
|
open: i,
|
|
473
|
-
onOpenChange:
|
|
614
|
+
onOpenChange: a,
|
|
474
615
|
elements: {
|
|
475
|
-
reference:
|
|
616
|
+
reference: e.current
|
|
476
617
|
}
|
|
477
|
-
}), { getFloatingProps: c } =
|
|
478
|
-
|
|
618
|
+
}), { getFloatingProps: c } = Ut([
|
|
619
|
+
jt(l, {
|
|
479
620
|
role: "dialog"
|
|
480
621
|
})
|
|
481
622
|
]);
|
|
482
|
-
return i ? /* @__PURE__ */
|
|
483
|
-
|
|
623
|
+
return i ? /* @__PURE__ */ o(Kt, { children: /* @__PURE__ */ o(
|
|
624
|
+
Bt,
|
|
484
625
|
{
|
|
485
626
|
ref: s.setFloating,
|
|
486
627
|
style: d,
|
|
@@ -491,187 +632,207 @@ const fr = Pe("div", {
|
|
|
491
632
|
overflow: "hidden",
|
|
492
633
|
boxShadow: "$md"
|
|
493
634
|
},
|
|
494
|
-
children: /* @__PURE__ */
|
|
635
|
+
children: /* @__PURE__ */ o(Ar, { children: t })
|
|
495
636
|
}
|
|
496
637
|
) }) : null;
|
|
497
|
-
},
|
|
638
|
+
}, Ar = ({
|
|
498
639
|
children: t,
|
|
499
|
-
...
|
|
500
|
-
}) => /* @__PURE__ */
|
|
501
|
-
/* @__PURE__ */
|
|
502
|
-
/* @__PURE__ */
|
|
503
|
-
/* @__PURE__ */
|
|
640
|
+
...r
|
|
641
|
+
}) => /* @__PURE__ */ h(Re, { "aria-label": "Formattering", ...r, children: [
|
|
642
|
+
/* @__PURE__ */ o(Or, {}),
|
|
643
|
+
/* @__PURE__ */ o(Oe, {}),
|
|
644
|
+
/* @__PURE__ */ o($r, {}),
|
|
504
645
|
t
|
|
505
646
|
] });
|
|
506
|
-
function
|
|
507
|
-
const [t] =
|
|
508
|
-
return x(() =>
|
|
647
|
+
function Dr() {
|
|
648
|
+
const [t] = L();
|
|
649
|
+
return x(() => tt(
|
|
509
650
|
t.registerCommand(
|
|
510
|
-
|
|
511
|
-
() => (
|
|
512
|
-
|
|
651
|
+
St,
|
|
652
|
+
() => (Me(t, "check"), !0),
|
|
653
|
+
R
|
|
513
654
|
),
|
|
514
655
|
t.registerCommand(
|
|
515
|
-
|
|
516
|
-
(
|
|
517
|
-
|
|
656
|
+
se,
|
|
657
|
+
(r) => Tt(r, t, !1),
|
|
658
|
+
R
|
|
518
659
|
),
|
|
519
660
|
t.registerCommand(
|
|
520
|
-
|
|
521
|
-
(
|
|
522
|
-
|
|
661
|
+
ce,
|
|
662
|
+
(r) => Tt(r, t, !0),
|
|
663
|
+
R
|
|
523
664
|
),
|
|
524
665
|
t.registerCommand(
|
|
525
|
-
|
|
526
|
-
(
|
|
527
|
-
if (
|
|
528
|
-
const
|
|
529
|
-
return
|
|
666
|
+
Lt,
|
|
667
|
+
(r) => {
|
|
668
|
+
if (it() != null) {
|
|
669
|
+
const n = t.getRootElement();
|
|
670
|
+
return n != null && n.focus(), !0;
|
|
530
671
|
}
|
|
531
672
|
return !1;
|
|
532
673
|
},
|
|
533
|
-
|
|
674
|
+
R
|
|
534
675
|
),
|
|
535
676
|
t.registerCommand(
|
|
536
|
-
|
|
537
|
-
(
|
|
538
|
-
const
|
|
539
|
-
return
|
|
540
|
-
const
|
|
541
|
-
|
|
677
|
+
de,
|
|
678
|
+
(r) => {
|
|
679
|
+
const e = it();
|
|
680
|
+
return e != null && t.isEditable() ? (t.update(() => {
|
|
681
|
+
const n = lt(e);
|
|
682
|
+
P(n) && (r.preventDefault(), n.toggleChecked());
|
|
542
683
|
}), !0) : !1;
|
|
543
684
|
},
|
|
544
|
-
|
|
685
|
+
R
|
|
545
686
|
),
|
|
546
687
|
t.registerCommand(
|
|
547
|
-
|
|
548
|
-
(
|
|
549
|
-
const
|
|
550
|
-
if (
|
|
551
|
-
const { anchor:
|
|
552
|
-
if (i ||
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
(s) =>
|
|
688
|
+
he,
|
|
689
|
+
(r) => t.getEditorState().read(() => {
|
|
690
|
+
const e = _();
|
|
691
|
+
if (T(e) && e.isCollapsed()) {
|
|
692
|
+
const { anchor: n } = e, i = n.type === "element";
|
|
693
|
+
if (i || n.offset === 0) {
|
|
694
|
+
const a = n.getNode(), l = qt(
|
|
695
|
+
a,
|
|
696
|
+
(s) => ue(s) && !s.isInline()
|
|
556
697
|
);
|
|
557
|
-
if (
|
|
558
|
-
const s =
|
|
559
|
-
if (
|
|
560
|
-
const d = t.getElementByKey(
|
|
698
|
+
if (P(l)) {
|
|
699
|
+
const s = l.getParent();
|
|
700
|
+
if (ct(s) && s.getListType() === "check" && (i || l.getFirstDescendant() === a)) {
|
|
701
|
+
const d = t.getElementByKey(l.__key);
|
|
561
702
|
if (d != null && document.activeElement !== d)
|
|
562
|
-
return d.focus(),
|
|
703
|
+
return d.focus(), r.preventDefault(), !0;
|
|
563
704
|
}
|
|
564
705
|
}
|
|
565
706
|
}
|
|
566
707
|
}
|
|
567
708
|
return !1;
|
|
568
709
|
}),
|
|
569
|
-
|
|
710
|
+
R
|
|
570
711
|
),
|
|
571
|
-
t.registerRootListener((
|
|
572
|
-
|
|
712
|
+
t.registerRootListener((r, e) => {
|
|
713
|
+
r !== null && (r.addEventListener("click", Mt), r.addEventListener("pointerdown", _t)), e !== null && (e.removeEventListener("click", Mt), e.removeEventListener("pointerdown", _t));
|
|
573
714
|
})
|
|
574
715
|
), [t]), null;
|
|
575
716
|
}
|
|
576
|
-
function
|
|
577
|
-
const
|
|
578
|
-
if (
|
|
717
|
+
function Qt(t, r) {
|
|
718
|
+
const e = t.target;
|
|
719
|
+
if (e === null || !vt(e))
|
|
579
720
|
return;
|
|
580
|
-
const
|
|
581
|
-
if (
|
|
721
|
+
const n = e.firstChild;
|
|
722
|
+
if (n != null && vt(n) && (n.tagName === "UL" || n.tagName === "OL"))
|
|
582
723
|
return;
|
|
583
|
-
const i =
|
|
724
|
+
const i = e.parentNode;
|
|
584
725
|
if (!i || i.__lexicalListType !== "check")
|
|
585
726
|
return;
|
|
586
|
-
const
|
|
587
|
-
(
|
|
727
|
+
const a = t.pageX, l = e.getBoundingClientRect();
|
|
728
|
+
(e.dir === "rtl" ? a < l.right && a > l.right - 20 : a > l.left && a < l.left + 20) && r();
|
|
588
729
|
}
|
|
589
|
-
function
|
|
590
|
-
|
|
591
|
-
const
|
|
592
|
-
|
|
730
|
+
function Mt(t) {
|
|
731
|
+
Qt(t, () => {
|
|
732
|
+
const r = t.target, e = Br(r);
|
|
733
|
+
e != null && e.isEditable() && e.update(() => {
|
|
593
734
|
if (t.target) {
|
|
594
|
-
const
|
|
595
|
-
|
|
735
|
+
const n = lt(r);
|
|
736
|
+
P(n) && (r.focus(), n.toggleChecked());
|
|
596
737
|
}
|
|
597
738
|
});
|
|
598
739
|
});
|
|
599
740
|
}
|
|
600
|
-
function
|
|
601
|
-
|
|
741
|
+
function _t(t) {
|
|
742
|
+
Qt(t, () => {
|
|
602
743
|
t.preventDefault();
|
|
603
744
|
});
|
|
604
745
|
}
|
|
605
|
-
function
|
|
606
|
-
let
|
|
607
|
-
for (;
|
|
608
|
-
if (
|
|
609
|
-
return
|
|
610
|
-
|
|
746
|
+
function Br(t) {
|
|
747
|
+
let r = t;
|
|
748
|
+
for (; r; ) {
|
|
749
|
+
if (r.__lexicalEditor)
|
|
750
|
+
return r.__lexicalEditor;
|
|
751
|
+
r = r.parentNode;
|
|
611
752
|
}
|
|
612
753
|
return null;
|
|
613
754
|
}
|
|
614
|
-
function
|
|
755
|
+
function it() {
|
|
615
756
|
const t = document.activeElement;
|
|
616
757
|
return t != null && t.tagName === "LI" && t.parentNode != null && // @ts-ignore internal field
|
|
617
758
|
t.parentNode.__lexicalListType === "check" ? t : null;
|
|
618
759
|
}
|
|
619
|
-
function
|
|
620
|
-
let
|
|
621
|
-
for (;
|
|
622
|
-
|
|
623
|
-
for (;
|
|
624
|
-
const i =
|
|
625
|
-
if (!
|
|
626
|
-
return
|
|
627
|
-
|
|
760
|
+
function Pr(t, r) {
|
|
761
|
+
let e = r ? t.getPreviousSibling() : t.getNextSibling(), n = t;
|
|
762
|
+
for (; e == null && P(n); )
|
|
763
|
+
n = n.getParentOrThrow().getParent(), n != null && (e = r ? n.getPreviousSibling() : n.getNextSibling());
|
|
764
|
+
for (; P(e); ) {
|
|
765
|
+
const i = r ? e.getLastChild() : e.getFirstChild();
|
|
766
|
+
if (!ct(i))
|
|
767
|
+
return e;
|
|
768
|
+
e = r ? i.getLastChild() : i.getFirstChild();
|
|
628
769
|
}
|
|
629
770
|
return null;
|
|
630
771
|
}
|
|
631
|
-
function
|
|
632
|
-
const
|
|
633
|
-
return
|
|
634
|
-
const i =
|
|
635
|
-
if (!
|
|
772
|
+
function Tt(t, r, e) {
|
|
773
|
+
const n = it();
|
|
774
|
+
return n != null && r.update(() => {
|
|
775
|
+
const i = lt(n);
|
|
776
|
+
if (!P(i))
|
|
636
777
|
return;
|
|
637
|
-
const
|
|
638
|
-
if (
|
|
639
|
-
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
|
|
778
|
+
const a = Pr(i, e);
|
|
779
|
+
if (a != null) {
|
|
780
|
+
a.selectStart();
|
|
781
|
+
const l = r.getElementByKey(a.__key);
|
|
782
|
+
l != null && (t.preventDefault(), setTimeout(() => {
|
|
783
|
+
l.focus();
|
|
643
784
|
}, 0));
|
|
644
785
|
}
|
|
645
786
|
}), !1;
|
|
646
787
|
}
|
|
647
|
-
const
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
788
|
+
const Vt = ge("INSERT_IMAGE_COMMAND");
|
|
789
|
+
function Hr() {
|
|
790
|
+
const [t] = rr();
|
|
791
|
+
return x(() => {
|
|
792
|
+
if (!t.hasNodes([z]))
|
|
793
|
+
throw new Error("ImagePlugin: ImageNode not registered on editor");
|
|
794
|
+
return tt(
|
|
795
|
+
t.registerCommand(
|
|
796
|
+
Vt,
|
|
797
|
+
(r) => {
|
|
798
|
+
const e = gt(r);
|
|
799
|
+
return pe([e]), xt(e.getParentOrThrow()) && Ye(e, U).selectEnd(), !0;
|
|
800
|
+
},
|
|
801
|
+
me
|
|
802
|
+
)
|
|
803
|
+
);
|
|
804
|
+
}, [t]), null;
|
|
805
|
+
}
|
|
806
|
+
const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
807
|
+
/* @__PURE__ */ o(Ve, {}),
|
|
808
|
+
/* @__PURE__ */ o(tr, {}),
|
|
809
|
+
/* @__PURE__ */ o(Ze, {}),
|
|
810
|
+
/* @__PURE__ */ o(Dr, {}),
|
|
811
|
+
/* @__PURE__ */ o(er, {}),
|
|
812
|
+
/* @__PURE__ */ o(Hr, {})
|
|
813
|
+
] }), Wr = ({
|
|
654
814
|
state: t
|
|
655
815
|
}) => {
|
|
656
|
-
const [
|
|
816
|
+
const [r] = L(), e = K(!1);
|
|
657
817
|
return x(() => {
|
|
658
|
-
|
|
818
|
+
!t || e.current || (e.current = !0, window.queueMicrotask(() => {
|
|
659
819
|
try {
|
|
660
|
-
if (
|
|
661
|
-
t.isEmpty() ?
|
|
820
|
+
if (ir(t)) {
|
|
821
|
+
t.isEmpty() ? ar(r) : r.setEditorState(t);
|
|
662
822
|
return;
|
|
663
823
|
}
|
|
664
|
-
if (typeof t == "string" && !
|
|
665
|
-
|
|
824
|
+
if (typeof t == "string" && !Gt(t)) {
|
|
825
|
+
lr(t, r);
|
|
666
826
|
return;
|
|
667
827
|
}
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
} catch (
|
|
671
|
-
console.error("Could not parse"), console.error(
|
|
828
|
+
const n = r.parseEditorState(t);
|
|
829
|
+
n.isEmpty() || r.setEditorState(n);
|
|
830
|
+
} catch (n) {
|
|
831
|
+
console.error("Could not parse"), console.error(n);
|
|
672
832
|
}
|
|
833
|
+
}));
|
|
673
834
|
}, []), null;
|
|
674
|
-
},
|
|
835
|
+
}, Ur = $e("div", {
|
|
675
836
|
border: "1px solid $borderDarker",
|
|
676
837
|
borderRadius: "$md",
|
|
677
838
|
position: "relative",
|
|
@@ -708,10 +869,10 @@ const xr = () => /* @__PURE__ */ p(H, { children: [
|
|
|
708
869
|
}
|
|
709
870
|
}
|
|
710
871
|
]
|
|
711
|
-
}),
|
|
872
|
+
}), jr = ({
|
|
712
873
|
isLoading: t
|
|
713
|
-
}) => /* @__PURE__ */
|
|
714
|
-
|
|
874
|
+
}) => /* @__PURE__ */ o(
|
|
875
|
+
W,
|
|
715
876
|
{
|
|
716
877
|
css: {
|
|
717
878
|
visibility: t ? "visible" : "hidden",
|
|
@@ -720,52 +881,56 @@ const xr = () => /* @__PURE__ */ p(H, { children: [
|
|
|
720
881
|
right: "1rem",
|
|
721
882
|
display: "flex"
|
|
722
883
|
},
|
|
723
|
-
children: /* @__PURE__ */
|
|
884
|
+
children: /* @__PURE__ */ o(ht, {})
|
|
724
885
|
}
|
|
725
|
-
),
|
|
886
|
+
), En = ({
|
|
726
887
|
isLoading: t,
|
|
727
|
-
children:
|
|
728
|
-
placeholderText:
|
|
729
|
-
nodes:
|
|
888
|
+
children: r,
|
|
889
|
+
placeholderText: e,
|
|
890
|
+
nodes: n,
|
|
730
891
|
plugins: i,
|
|
731
|
-
toolbar:
|
|
732
|
-
toolbarContent:
|
|
892
|
+
toolbar: a,
|
|
893
|
+
toolbarContent: l,
|
|
733
894
|
content: s,
|
|
734
895
|
hideBorder: d,
|
|
735
896
|
onBlur: c,
|
|
736
897
|
defaultState: u,
|
|
737
|
-
css:
|
|
898
|
+
css: g,
|
|
899
|
+
signUrl: b
|
|
738
900
|
}) => {
|
|
739
|
-
const { hasFocus:
|
|
740
|
-
|
|
741
|
-
|
|
901
|
+
const { hasFocus: N, attributes: S } = sr({ onBlur: c }), k = K(null), w = zt(
|
|
902
|
+
() => ({ hasFocus: N, editorRef: k, signUrl: b }),
|
|
903
|
+
[N, b]
|
|
904
|
+
);
|
|
905
|
+
return /* @__PURE__ */ o(Jt.Provider, { value: w, children: /* @__PURE__ */ h(
|
|
906
|
+
Be,
|
|
742
907
|
{
|
|
743
908
|
initialConfig: {
|
|
744
909
|
namespace: "ain-rich-text",
|
|
745
|
-
onError: (
|
|
746
|
-
console.error(
|
|
910
|
+
onError: (E) => {
|
|
911
|
+
console.error(E);
|
|
747
912
|
},
|
|
748
|
-
theme:
|
|
749
|
-
nodes:
|
|
913
|
+
theme: Yt,
|
|
914
|
+
nodes: n,
|
|
750
915
|
editable: !0
|
|
751
916
|
},
|
|
752
917
|
children: [
|
|
753
|
-
/* @__PURE__ */
|
|
754
|
-
|
|
918
|
+
/* @__PURE__ */ h(
|
|
919
|
+
Ur,
|
|
755
920
|
{
|
|
756
|
-
ref:
|
|
757
|
-
hasFocus:
|
|
921
|
+
ref: k,
|
|
922
|
+
hasFocus: N,
|
|
758
923
|
hideBorder: d,
|
|
759
|
-
css:
|
|
760
|
-
...
|
|
924
|
+
css: g,
|
|
925
|
+
...S,
|
|
761
926
|
children: [
|
|
762
|
-
|
|
763
|
-
/* @__PURE__ */
|
|
764
|
-
|
|
927
|
+
a,
|
|
928
|
+
/* @__PURE__ */ o(
|
|
929
|
+
Pe,
|
|
765
930
|
{
|
|
766
931
|
contentEditable: s,
|
|
767
|
-
placeholder:
|
|
768
|
-
|
|
932
|
+
placeholder: e ? /* @__PURE__ */ o(
|
|
933
|
+
W,
|
|
769
934
|
{
|
|
770
935
|
css: {
|
|
771
936
|
position: "absolute",
|
|
@@ -775,25 +940,25 @@ const xr = () => /* @__PURE__ */ p(H, { children: [
|
|
|
775
940
|
pointerEvents: "none",
|
|
776
941
|
fontSize: "$sm"
|
|
777
942
|
},
|
|
778
|
-
children:
|
|
943
|
+
children: e
|
|
779
944
|
}
|
|
780
945
|
) : null,
|
|
781
|
-
ErrorBoundary:
|
|
946
|
+
ErrorBoundary: He
|
|
782
947
|
}
|
|
783
948
|
),
|
|
784
|
-
/* @__PURE__ */
|
|
949
|
+
/* @__PURE__ */ o(Fr, {}),
|
|
785
950
|
i,
|
|
786
|
-
/* @__PURE__ */
|
|
787
|
-
!
|
|
951
|
+
/* @__PURE__ */ o(jr, { isLoading: t }),
|
|
952
|
+
!a && /* @__PURE__ */ o(zr, { children: l })
|
|
788
953
|
]
|
|
789
954
|
}
|
|
790
955
|
),
|
|
791
|
-
/* @__PURE__ */
|
|
792
|
-
/* @__PURE__ */
|
|
956
|
+
/* @__PURE__ */ o(Wr, { state: u }),
|
|
957
|
+
/* @__PURE__ */ o(H, { children: r })
|
|
793
958
|
]
|
|
794
959
|
}
|
|
795
960
|
) });
|
|
796
|
-
},
|
|
961
|
+
}, Kr = {
|
|
797
962
|
fontSize: "1rem",
|
|
798
963
|
lineHeight: "1.5",
|
|
799
964
|
"h1, h2, h3, h4, h5, h6": {
|
|
@@ -983,129 +1148,187 @@ const xr = () => /* @__PURE__ */ p(H, { children: [
|
|
|
983
1148
|
defaultVariants: {
|
|
984
1149
|
size: "md"
|
|
985
1150
|
}
|
|
986
|
-
},
|
|
987
|
-
|
|
988
|
-
|
|
1151
|
+
}, In = Qe(Kr), qr = ({
|
|
1152
|
+
uploadFile: t,
|
|
1153
|
+
...r
|
|
1154
|
+
}) => {
|
|
1155
|
+
const [e] = L(), [n, i] = p(null), a = async (s) => {
|
|
1156
|
+
var c;
|
|
1157
|
+
const d = (c = s.target.files) == null ? void 0 : c[0];
|
|
1158
|
+
if (d) {
|
|
1159
|
+
const u = await t.uploadFile({ file: d });
|
|
1160
|
+
i(u);
|
|
1161
|
+
}
|
|
1162
|
+
}, l = () => {
|
|
1163
|
+
n && !t.isLoading && (e.dispatchCommand(Vt, {
|
|
1164
|
+
src: n,
|
|
1165
|
+
altText: `Image: ${n}`
|
|
1166
|
+
}), r.onOpenChange(!1));
|
|
1167
|
+
};
|
|
1168
|
+
return /* @__PURE__ */ h(Pt, { ...r, children: [
|
|
1169
|
+
/* @__PURE__ */ o(ze, { children: "Sett inn bilde" }),
|
|
1170
|
+
t.isLoading && /* @__PURE__ */ o(ht, {}),
|
|
1171
|
+
/* @__PURE__ */ o(
|
|
1172
|
+
Ht,
|
|
1173
|
+
{
|
|
1174
|
+
type: "file",
|
|
1175
|
+
accept: "image/png, image/jpeg",
|
|
1176
|
+
onChange: a,
|
|
1177
|
+
disabled: t.isLoading
|
|
1178
|
+
}
|
|
1179
|
+
),
|
|
1180
|
+
/* @__PURE__ */ h(Z, { children: [
|
|
1181
|
+
/* @__PURE__ */ o(y, { onClick: () => r.onOpenChange(!1), children: "Avbryt" }),
|
|
1182
|
+
/* @__PURE__ */ o(
|
|
1183
|
+
y,
|
|
1184
|
+
{
|
|
1185
|
+
variant: "primary",
|
|
1186
|
+
disabled: !n || t.isLoading,
|
|
1187
|
+
onClick: l,
|
|
1188
|
+
children: "Sett inn"
|
|
1189
|
+
}
|
|
1190
|
+
)
|
|
1191
|
+
] })
|
|
1192
|
+
] });
|
|
1193
|
+
}, Rn = ({ uploadFile: t }) => {
|
|
1194
|
+
const [r] = L(), [e, n] = p(!1), i = C(() => {
|
|
1195
|
+
r.dispatchCommand(Le, {
|
|
989
1196
|
rows: "3",
|
|
990
1197
|
columns: "3",
|
|
991
1198
|
includeHeaders: !1
|
|
992
1199
|
});
|
|
993
|
-
}, [
|
|
994
|
-
return /* @__PURE__ */
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1200
|
+
}, [r]);
|
|
1201
|
+
return /* @__PURE__ */ h(H, { children: [
|
|
1202
|
+
/* @__PURE__ */ h(
|
|
1203
|
+
dt,
|
|
1204
|
+
{
|
|
1205
|
+
trigger: /* @__PURE__ */ o(At, { dropdown: !0, children: "Sett inn" }),
|
|
1206
|
+
side: "bottom",
|
|
1207
|
+
align: "end",
|
|
1208
|
+
children: [
|
|
1209
|
+
/* @__PURE__ */ h(v, { onClick: i, children: [
|
|
1210
|
+
/* @__PURE__ */ o(wr, { size: "1.25rem" }),
|
|
1211
|
+
" Tabell"
|
|
1212
|
+
] }),
|
|
1213
|
+
t && /* @__PURE__ */ h(v, { onClick: () => n(!0), children: [
|
|
1214
|
+
/* @__PURE__ */ o(Ge, { size: "1.25rem" }),
|
|
1215
|
+
" Bilde"
|
|
1216
|
+
] })
|
|
1217
|
+
]
|
|
1218
|
+
}
|
|
1219
|
+
),
|
|
1220
|
+
t && /* @__PURE__ */ o(
|
|
1221
|
+
qr,
|
|
1222
|
+
{
|
|
1223
|
+
open: e,
|
|
1224
|
+
onOpenChange: n,
|
|
1225
|
+
uploadFile: t
|
|
1226
|
+
}
|
|
1227
|
+
)
|
|
1228
|
+
] });
|
|
1006
1229
|
};
|
|
1007
|
-
function
|
|
1008
|
-
return
|
|
1230
|
+
function Yr(t) {
|
|
1231
|
+
return m({ 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
1232
|
}
|
|
1010
|
-
const
|
|
1011
|
-
const [t] =
|
|
1233
|
+
const On = () => {
|
|
1234
|
+
const [t] = L(), [r, e] = p(null), { hasFocus: n } = et();
|
|
1012
1235
|
x(() => {
|
|
1013
|
-
!
|
|
1014
|
-
}, [
|
|
1015
|
-
const { refs: i, floatingStyles:
|
|
1236
|
+
!n && r && e(null);
|
|
1237
|
+
}, [n, r]);
|
|
1238
|
+
const { refs: i, floatingStyles: a } = ut({
|
|
1016
1239
|
placement: "top-end",
|
|
1017
|
-
open: !!
|
|
1240
|
+
open: !!r,
|
|
1018
1241
|
elements: {
|
|
1019
|
-
reference:
|
|
1242
|
+
reference: r
|
|
1020
1243
|
},
|
|
1021
|
-
middleware: [
|
|
1244
|
+
middleware: [Wt({ mainAxis: -20, crossAxis: -2 })]
|
|
1022
1245
|
});
|
|
1023
1246
|
x(() => t.registerCommand(
|
|
1024
|
-
|
|
1247
|
+
j,
|
|
1025
1248
|
() => {
|
|
1026
|
-
const s =
|
|
1027
|
-
if (
|
|
1028
|
-
const d = s.anchor.getNode(), c =
|
|
1029
|
-
|
|
1249
|
+
const s = _();
|
|
1250
|
+
if (T(s)) {
|
|
1251
|
+
const d = s.anchor.getNode(), c = ye(d);
|
|
1252
|
+
e(c ? t.getElementByKey(c.getKey()) : null);
|
|
1030
1253
|
}
|
|
1031
1254
|
return !1;
|
|
1032
1255
|
},
|
|
1033
|
-
|
|
1256
|
+
fe
|
|
1034
1257
|
), [t]);
|
|
1035
|
-
const
|
|
1258
|
+
const l = (s) => () => {
|
|
1036
1259
|
t.update(() => {
|
|
1037
1260
|
switch (s) {
|
|
1038
1261
|
case "add-row-over":
|
|
1039
|
-
|
|
1262
|
+
bt(!1);
|
|
1040
1263
|
break;
|
|
1041
1264
|
case "add-row-under":
|
|
1042
|
-
|
|
1265
|
+
bt(!0);
|
|
1043
1266
|
break;
|
|
1044
1267
|
case "add-column-left":
|
|
1045
|
-
|
|
1268
|
+
kt(!1);
|
|
1046
1269
|
break;
|
|
1047
1270
|
case "add-column-right":
|
|
1048
|
-
|
|
1271
|
+
kt(!0);
|
|
1049
1272
|
break;
|
|
1050
1273
|
case "delete-row":
|
|
1051
|
-
|
|
1274
|
+
we();
|
|
1052
1275
|
break;
|
|
1053
1276
|
case "delete-column":
|
|
1054
|
-
|
|
1277
|
+
Ne();
|
|
1055
1278
|
break;
|
|
1056
1279
|
}
|
|
1057
1280
|
});
|
|
1058
1281
|
};
|
|
1059
|
-
return
|
|
1060
|
-
|
|
1282
|
+
return r ? /* @__PURE__ */ h(
|
|
1283
|
+
dt,
|
|
1061
1284
|
{
|
|
1062
|
-
trigger: /* @__PURE__ */
|
|
1063
|
-
|
|
1285
|
+
trigger: /* @__PURE__ */ o(
|
|
1286
|
+
y,
|
|
1064
1287
|
{
|
|
1065
1288
|
icon: !0,
|
|
1066
1289
|
variant: "primary",
|
|
1067
1290
|
color: "secondary",
|
|
1068
1291
|
ref: i.setFloating,
|
|
1069
|
-
style:
|
|
1292
|
+
style: a,
|
|
1070
1293
|
css: { padding: "2px", width: "18px", height: "18px" },
|
|
1071
|
-
children: /* @__PURE__ */
|
|
1294
|
+
children: /* @__PURE__ */ o(Yr, {})
|
|
1072
1295
|
}
|
|
1073
1296
|
),
|
|
1074
1297
|
children: [
|
|
1075
|
-
/* @__PURE__ */
|
|
1076
|
-
/* @__PURE__ */
|
|
1077
|
-
/* @__PURE__ */
|
|
1078
|
-
/* @__PURE__ */
|
|
1079
|
-
/* @__PURE__ */
|
|
1080
|
-
/* @__PURE__ */
|
|
1081
|
-
/* @__PURE__ */
|
|
1082
|
-
/* @__PURE__ */
|
|
1298
|
+
/* @__PURE__ */ o(A, { onClick: l("add-row-over"), children: "Legg til rad over" }),
|
|
1299
|
+
/* @__PURE__ */ o(A, { onClick: l("add-row-under"), children: "Legg til rad under" }),
|
|
1300
|
+
/* @__PURE__ */ o(Ct, {}),
|
|
1301
|
+
/* @__PURE__ */ o(A, { onClick: l("add-column-left"), children: "Legg til kolonne venstre" }),
|
|
1302
|
+
/* @__PURE__ */ o(A, { onClick: l("add-column-right"), children: "Legg til kolonne høyre" }),
|
|
1303
|
+
/* @__PURE__ */ o(Ct, {}),
|
|
1304
|
+
/* @__PURE__ */ o(A, { onClick: l("delete-row"), children: "Fjern rad" }),
|
|
1305
|
+
/* @__PURE__ */ o(A, { onClick: l("delete-column"), children: "Fjern kolonne" })
|
|
1083
1306
|
]
|
|
1084
1307
|
}
|
|
1085
1308
|
) : null;
|
|
1086
1309
|
};
|
|
1087
|
-
function
|
|
1088
|
-
let
|
|
1089
|
-
const
|
|
1090
|
-
return
|
|
1310
|
+
function pt(t) {
|
|
1311
|
+
let r = t;
|
|
1312
|
+
const e = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi, n = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
|
|
1313
|
+
return r = String(r).trim(), r.match(e) || r.match(n) ? r : "https://";
|
|
1091
1314
|
}
|
|
1092
|
-
function
|
|
1093
|
-
const
|
|
1094
|
-
return
|
|
1315
|
+
function Zt(t) {
|
|
1316
|
+
const r = t.anchor, e = t.focus, n = t.anchor.getNode(), i = t.focus.getNode();
|
|
1317
|
+
return n === i ? n : t.isBackward() ? ft(e) ? n : i : ft(r) ? n : i;
|
|
1095
1318
|
}
|
|
1096
|
-
const
|
|
1319
|
+
const $n = (t) => (O.baseURL = t, O), J = class extends B {
|
|
1097
1320
|
static getType() {
|
|
1098
1321
|
return "rutine_link";
|
|
1099
1322
|
}
|
|
1100
|
-
static clone(
|
|
1101
|
-
return new
|
|
1323
|
+
static clone(r) {
|
|
1324
|
+
return new J(r.__url, {}, r.__key);
|
|
1102
1325
|
}
|
|
1103
|
-
createDOM(
|
|
1104
|
-
const
|
|
1105
|
-
return
|
|
1326
|
+
createDOM(r) {
|
|
1327
|
+
const e = super.createDOM(r);
|
|
1328
|
+
return e.setAttribute("href", this.getURL()), e.setAttribute("target", "_blank"), e.setAttribute("rel", "noopener noreferrer"), e.classList.add("rutine-link"), e;
|
|
1106
1329
|
}
|
|
1107
|
-
static importJSON(
|
|
1108
|
-
return
|
|
1330
|
+
static importJSON(r) {
|
|
1331
|
+
return te(r.url);
|
|
1109
1332
|
}
|
|
1110
1333
|
exportJSON() {
|
|
1111
1334
|
return {
|
|
@@ -1117,265 +1340,265 @@ const fn = (t) => (R.baseURL = t, R), K = class extends $ {
|
|
|
1117
1340
|
}
|
|
1118
1341
|
getURL() {
|
|
1119
1342
|
try {
|
|
1120
|
-
return new URL(this.__url,
|
|
1343
|
+
return new URL(this.__url, J.baseURL).toString();
|
|
1121
1344
|
} catch {
|
|
1122
1345
|
return "";
|
|
1123
1346
|
}
|
|
1124
1347
|
}
|
|
1125
1348
|
};
|
|
1126
|
-
let
|
|
1127
|
-
|
|
1128
|
-
function
|
|
1129
|
-
return new
|
|
1349
|
+
let O = J;
|
|
1350
|
+
I(O, "baseURL", "");
|
|
1351
|
+
function te(t) {
|
|
1352
|
+
return new O(t);
|
|
1130
1353
|
}
|
|
1131
|
-
function
|
|
1132
|
-
return t instanceof
|
|
1354
|
+
function Gr(t) {
|
|
1355
|
+
return t instanceof O;
|
|
1133
1356
|
}
|
|
1134
|
-
const
|
|
1135
|
-
const [
|
|
1357
|
+
const Jr = ({ onClose: t }) => {
|
|
1358
|
+
const [r] = L(), e = C(
|
|
1136
1359
|
(i) => {
|
|
1137
|
-
|
|
1138
|
-
const
|
|
1139
|
-
if (
|
|
1140
|
-
const
|
|
1141
|
-
|
|
1142
|
-
const s =
|
|
1143
|
-
s.setTextNodeRange(
|
|
1360
|
+
r.update(() => {
|
|
1361
|
+
const a = _();
|
|
1362
|
+
if (T(a) && a.isCollapsed()) {
|
|
1363
|
+
const l = $(i);
|
|
1364
|
+
a.insertNodes([l]);
|
|
1365
|
+
const s = yt();
|
|
1366
|
+
s.setTextNodeRange(l, 0, l, i.length), Q(s);
|
|
1144
1367
|
}
|
|
1145
|
-
|
|
1368
|
+
r.dispatchCommand(V, pt(i));
|
|
1146
1369
|
});
|
|
1147
1370
|
},
|
|
1148
|
-
[
|
|
1371
|
+
[r]
|
|
1149
1372
|
);
|
|
1150
|
-
return /* @__PURE__ */
|
|
1151
|
-
|
|
1373
|
+
return /* @__PURE__ */ h("form", { onSubmit: (i) => {
|
|
1374
|
+
e(i.currentTarget.url.value), t();
|
|
1152
1375
|
}, children: [
|
|
1153
|
-
/* @__PURE__ */
|
|
1154
|
-
/* @__PURE__ */
|
|
1155
|
-
/* @__PURE__ */
|
|
1156
|
-
/* @__PURE__ */
|
|
1376
|
+
/* @__PURE__ */ o(Ht, { name: "url", label: "URL", type: "url", required: !0 }),
|
|
1377
|
+
/* @__PURE__ */ h(Z, { children: [
|
|
1378
|
+
/* @__PURE__ */ o(y, { onClick: t, children: "Avbryt" }),
|
|
1379
|
+
/* @__PURE__ */ o(y, { type: "submit", variant: "primary", children: "Sett inn" })
|
|
1157
1380
|
] })
|
|
1158
1381
|
] });
|
|
1159
|
-
},
|
|
1382
|
+
}, Xr = ({
|
|
1160
1383
|
onClose: t,
|
|
1161
|
-
getDocs:
|
|
1384
|
+
getDocs: r
|
|
1162
1385
|
}) => {
|
|
1163
|
-
const [
|
|
1386
|
+
const [e] = L(), [n, i] = p([]), a = r(), l = C(
|
|
1164
1387
|
(s) => {
|
|
1165
|
-
|
|
1166
|
-
const d =
|
|
1167
|
-
if (
|
|
1388
|
+
e.update(() => {
|
|
1389
|
+
const d = _();
|
|
1390
|
+
if (T(d)) {
|
|
1168
1391
|
const c = [];
|
|
1169
|
-
for (const [u,
|
|
1170
|
-
const
|
|
1171
|
-
|
|
1392
|
+
for (const [u, g] of s.entries()) {
|
|
1393
|
+
const b = te(g.value);
|
|
1394
|
+
b.append($(g.label)), c.push(b), u !== s.length - 1 && c.push($(" "));
|
|
1172
1395
|
}
|
|
1173
1396
|
d.insertNodes(c);
|
|
1174
1397
|
}
|
|
1175
1398
|
});
|
|
1176
1399
|
},
|
|
1177
|
-
[
|
|
1400
|
+
[e]
|
|
1178
1401
|
);
|
|
1179
|
-
return /* @__PURE__ */
|
|
1180
|
-
/* @__PURE__ */
|
|
1181
|
-
|
|
1402
|
+
return /* @__PURE__ */ h(H, { children: [
|
|
1403
|
+
/* @__PURE__ */ o(
|
|
1404
|
+
De,
|
|
1182
1405
|
{
|
|
1183
1406
|
isMulti: !0,
|
|
1184
|
-
options:
|
|
1407
|
+
options: a,
|
|
1185
1408
|
onChange: (s) => i(s)
|
|
1186
1409
|
}
|
|
1187
1410
|
),
|
|
1188
|
-
/* @__PURE__ */
|
|
1189
|
-
/* @__PURE__ */
|
|
1190
|
-
/* @__PURE__ */
|
|
1191
|
-
|
|
1411
|
+
/* @__PURE__ */ h(Z, { children: [
|
|
1412
|
+
/* @__PURE__ */ o(y, { onClick: t, children: "Avbryt" }),
|
|
1413
|
+
/* @__PURE__ */ o(
|
|
1414
|
+
y,
|
|
1192
1415
|
{
|
|
1193
1416
|
variant: "primary",
|
|
1194
1417
|
onClick: () => {
|
|
1195
|
-
|
|
1418
|
+
l(n), t();
|
|
1196
1419
|
},
|
|
1197
1420
|
children: "Sett inn"
|
|
1198
1421
|
}
|
|
1199
1422
|
)
|
|
1200
1423
|
] })
|
|
1201
1424
|
] });
|
|
1202
|
-
},
|
|
1425
|
+
}, Qr = ({
|
|
1203
1426
|
onClose: t,
|
|
1204
|
-
uploadFile:
|
|
1427
|
+
uploadFile: r
|
|
1205
1428
|
}) => {
|
|
1206
|
-
const [
|
|
1429
|
+
const [e] = L(), [n, i] = p(null), a = async (s) => {
|
|
1207
1430
|
var c;
|
|
1208
1431
|
const d = (c = s.target.files) == null ? void 0 : c[0];
|
|
1209
1432
|
if (d) {
|
|
1210
|
-
const u = await
|
|
1433
|
+
const u = await r.uploadFile({ file: d });
|
|
1211
1434
|
i({
|
|
1212
1435
|
name: d.name,
|
|
1213
1436
|
url: u
|
|
1214
1437
|
});
|
|
1215
1438
|
}
|
|
1216
|
-
},
|
|
1217
|
-
|
|
1218
|
-
if (!
|
|
1439
|
+
}, l = C(() => {
|
|
1440
|
+
e.update(() => {
|
|
1441
|
+
if (!n)
|
|
1219
1442
|
return;
|
|
1220
|
-
const s =
|
|
1221
|
-
if (
|
|
1222
|
-
const d =
|
|
1443
|
+
const s = _();
|
|
1444
|
+
if (T(s) && s.isCollapsed()) {
|
|
1445
|
+
const d = $(n.name);
|
|
1223
1446
|
s.insertNodes([d]);
|
|
1224
|
-
const c =
|
|
1225
|
-
c.setTextNodeRange(d, 0, d,
|
|
1447
|
+
const c = yt();
|
|
1448
|
+
c.setTextNodeRange(d, 0, d, n.name.length), Q(c);
|
|
1226
1449
|
}
|
|
1227
|
-
|
|
1450
|
+
e.dispatchCommand(V, pt(n.url));
|
|
1228
1451
|
});
|
|
1229
|
-
}, [
|
|
1230
|
-
return /* @__PURE__ */
|
|
1231
|
-
|
|
1232
|
-
/* @__PURE__ */
|
|
1452
|
+
}, [e, n]);
|
|
1453
|
+
return /* @__PURE__ */ h(H, { children: [
|
|
1454
|
+
r.isLoading && /* @__PURE__ */ o(ht, {}),
|
|
1455
|
+
/* @__PURE__ */ o(
|
|
1233
1456
|
"input",
|
|
1234
1457
|
{
|
|
1235
1458
|
type: "file",
|
|
1236
|
-
onChange:
|
|
1237
|
-
disabled:
|
|
1459
|
+
onChange: a,
|
|
1460
|
+
disabled: r.isLoading
|
|
1238
1461
|
}
|
|
1239
1462
|
),
|
|
1240
|
-
/* @__PURE__ */
|
|
1241
|
-
/* @__PURE__ */
|
|
1242
|
-
/* @__PURE__ */
|
|
1243
|
-
|
|
1463
|
+
/* @__PURE__ */ h(Z, { children: [
|
|
1464
|
+
/* @__PURE__ */ o(y, { onClick: t, children: "Avbryt" }),
|
|
1465
|
+
/* @__PURE__ */ o(
|
|
1466
|
+
y,
|
|
1244
1467
|
{
|
|
1245
1468
|
variant: "primary",
|
|
1246
1469
|
onClick: () => {
|
|
1247
|
-
|
|
1470
|
+
l(), t();
|
|
1248
1471
|
},
|
|
1249
|
-
disabled: !
|
|
1472
|
+
disabled: !n,
|
|
1250
1473
|
children: "Sett inn"
|
|
1251
1474
|
}
|
|
1252
1475
|
)
|
|
1253
1476
|
] })
|
|
1254
1477
|
] });
|
|
1255
|
-
},
|
|
1478
|
+
}, Vr = ({
|
|
1256
1479
|
open: t,
|
|
1257
|
-
onOpenChange:
|
|
1258
|
-
getDocs:
|
|
1259
|
-
uploadFile:
|
|
1480
|
+
onOpenChange: r,
|
|
1481
|
+
getDocs: e,
|
|
1482
|
+
uploadFile: n
|
|
1260
1483
|
}) => {
|
|
1261
|
-
const [i,
|
|
1262
|
-
|
|
1484
|
+
const [i, a] = p("url"), l = () => {
|
|
1485
|
+
r(!1);
|
|
1263
1486
|
};
|
|
1264
|
-
return /* @__PURE__ */
|
|
1265
|
-
/* @__PURE__ */
|
|
1266
|
-
/* @__PURE__ */
|
|
1267
|
-
|
|
1268
|
-
|
|
1487
|
+
return /* @__PURE__ */ h(Pt, { open: t, onOpenChange: r, css: { width: "600px" }, children: [
|
|
1488
|
+
/* @__PURE__ */ h(Ae, { css: { marginBottom: "$8" }, children: [
|
|
1489
|
+
/* @__PURE__ */ o(ot, { active: i === "url", onClick: () => a("url"), children: "URL" }),
|
|
1490
|
+
e && /* @__PURE__ */ o(
|
|
1491
|
+
ot,
|
|
1269
1492
|
{
|
|
1270
1493
|
active: i === "rutine",
|
|
1271
|
-
onClick: () =>
|
|
1494
|
+
onClick: () => a("rutine"),
|
|
1272
1495
|
children: "Rutine"
|
|
1273
1496
|
}
|
|
1274
1497
|
),
|
|
1275
|
-
|
|
1498
|
+
n && /* @__PURE__ */ o(ot, { active: i === "file", onClick: () => a("file"), children: "Fil" })
|
|
1276
1499
|
] }),
|
|
1277
|
-
i === "url" && /* @__PURE__ */
|
|
1278
|
-
i === "rutine" &&
|
|
1279
|
-
i === "file" &&
|
|
1500
|
+
i === "url" && /* @__PURE__ */ o(Jr, { onClose: l }),
|
|
1501
|
+
i === "rutine" && e && /* @__PURE__ */ o(Xr, { onClose: l, getDocs: e }),
|
|
1502
|
+
i === "file" && n && /* @__PURE__ */ o(Qr, { onClose: l, uploadFile: n })
|
|
1280
1503
|
] });
|
|
1281
|
-
},
|
|
1504
|
+
}, zn = ({
|
|
1282
1505
|
getDocs: t,
|
|
1283
|
-
uploadFile:
|
|
1506
|
+
uploadFile: r
|
|
1284
1507
|
}) => {
|
|
1285
|
-
const [
|
|
1286
|
-
const d =
|
|
1287
|
-
if (
|
|
1288
|
-
const c =
|
|
1289
|
-
i(
|
|
1508
|
+
const [e] = L(), [n, i] = p(!1), [a, l] = p(!1), s = C(() => {
|
|
1509
|
+
const d = _();
|
|
1510
|
+
if (T(d)) {
|
|
1511
|
+
const c = Zt(d), u = c.getParent();
|
|
1512
|
+
i(Y(u) || Y(c));
|
|
1290
1513
|
}
|
|
1291
1514
|
}, []);
|
|
1292
|
-
return x(() =>
|
|
1293
|
-
|
|
1515
|
+
return x(() => e.registerCommand(
|
|
1516
|
+
j,
|
|
1294
1517
|
() => (s(), !1),
|
|
1295
|
-
|
|
1296
|
-
), [
|
|
1297
|
-
/* @__PURE__ */
|
|
1298
|
-
|
|
1518
|
+
at
|
|
1519
|
+
), [e, s]), /* @__PURE__ */ h(Dt, { type: "single", value: n ? "link" : "", children: [
|
|
1520
|
+
/* @__PURE__ */ o(
|
|
1521
|
+
D,
|
|
1299
1522
|
{
|
|
1300
1523
|
onClick: () => {
|
|
1301
|
-
|
|
1524
|
+
n ? e.dispatchCommand(V, null) : l(!0);
|
|
1302
1525
|
},
|
|
1303
1526
|
title: "Lenke",
|
|
1304
1527
|
value: "link",
|
|
1305
|
-
children: /* @__PURE__ */
|
|
1528
|
+
children: /* @__PURE__ */ o(_r, { size: "1.25rem" })
|
|
1306
1529
|
}
|
|
1307
1530
|
),
|
|
1308
|
-
/* @__PURE__ */
|
|
1309
|
-
|
|
1531
|
+
/* @__PURE__ */ o(
|
|
1532
|
+
Vr,
|
|
1310
1533
|
{
|
|
1311
|
-
open:
|
|
1312
|
-
onOpenChange:
|
|
1534
|
+
open: a,
|
|
1535
|
+
onOpenChange: l,
|
|
1313
1536
|
getDocs: t,
|
|
1314
|
-
uploadFile:
|
|
1537
|
+
uploadFile: r
|
|
1315
1538
|
}
|
|
1316
1539
|
)
|
|
1317
1540
|
] });
|
|
1318
|
-
},
|
|
1319
|
-
const [t] =
|
|
1541
|
+
}, An = () => {
|
|
1542
|
+
const [t] = L(), r = K(null), [e, n] = p(null), [i, a] = p(""), { hasFocus: l } = et();
|
|
1320
1543
|
x(() => {
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
}) :
|
|
1324
|
-
}, [t,
|
|
1325
|
-
const s = !!(
|
|
1544
|
+
e ? t.update(() => {
|
|
1545
|
+
a(e.getURL());
|
|
1546
|
+
}) : a("");
|
|
1547
|
+
}, [t, e]);
|
|
1548
|
+
const s = !!(e && i && l), { refs: d, floatingStyles: c, context: u } = ut({
|
|
1326
1549
|
placement: "top",
|
|
1327
1550
|
strategy: "fixed",
|
|
1328
1551
|
open: s,
|
|
1329
|
-
whileElementsMounted:
|
|
1552
|
+
whileElementsMounted: Ft,
|
|
1330
1553
|
elements: {
|
|
1331
|
-
reference:
|
|
1554
|
+
reference: r.current
|
|
1332
1555
|
},
|
|
1333
|
-
middleware: [
|
|
1334
|
-
}), { getFloatingProps:
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
]),
|
|
1338
|
-
var
|
|
1339
|
-
const
|
|
1340
|
-
if (
|
|
1341
|
-
const
|
|
1342
|
-
let
|
|
1343
|
-
if (
|
|
1344
|
-
const
|
|
1345
|
-
|
|
1556
|
+
middleware: [je()]
|
|
1557
|
+
}), { getFloatingProps: g } = Ut([
|
|
1558
|
+
jt(u),
|
|
1559
|
+
Ke(u)
|
|
1560
|
+
]), b = C(() => {
|
|
1561
|
+
var w;
|
|
1562
|
+
const k = _();
|
|
1563
|
+
if (T(k)) {
|
|
1564
|
+
const E = Zt(k), f = E.getParent();
|
|
1565
|
+
let q = null;
|
|
1566
|
+
if (Y(f) ? q = f : Y(E) && (q = E), q) {
|
|
1567
|
+
const rt = window.getSelection(), mt = t.getRootElement();
|
|
1568
|
+
k !== null && rt !== null && mt !== null && mt.contains(rt.anchorNode) && t.isEditable() && (r.current = ((w = rt.focusNode) == null ? void 0 : w.parentElement) ?? null);
|
|
1346
1569
|
}
|
|
1347
|
-
|
|
1570
|
+
n(q);
|
|
1348
1571
|
}
|
|
1349
|
-
}, [t]),
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
}), t.dispatchCommand(
|
|
1353
|
-
}, [t,
|
|
1572
|
+
}, [t]), N = C(() => {
|
|
1573
|
+
e && Gr(e) && t.update(() => {
|
|
1574
|
+
e.remove();
|
|
1575
|
+
}), t.dispatchCommand(V, null);
|
|
1576
|
+
}, [t, e]);
|
|
1354
1577
|
if (x(() => {
|
|
1355
1578
|
t.getEditorState().read(() => {
|
|
1356
|
-
|
|
1579
|
+
b();
|
|
1357
1580
|
});
|
|
1358
|
-
}, [t,
|
|
1359
|
-
t.registerUpdateListener(({ editorState:
|
|
1360
|
-
|
|
1361
|
-
|
|
1581
|
+
}, [t, b]), x(() => tt(
|
|
1582
|
+
t.registerUpdateListener(({ editorState: k }) => {
|
|
1583
|
+
k.read(() => {
|
|
1584
|
+
b();
|
|
1362
1585
|
});
|
|
1363
1586
|
}),
|
|
1364
1587
|
t.registerCommand(
|
|
1365
|
-
|
|
1366
|
-
() => (
|
|
1367
|
-
|
|
1588
|
+
j,
|
|
1589
|
+
() => (b(), !0),
|
|
1590
|
+
R
|
|
1368
1591
|
),
|
|
1369
1592
|
t.registerCommand(
|
|
1370
|
-
|
|
1371
|
-
() =>
|
|
1372
|
-
|
|
1593
|
+
Lt,
|
|
1594
|
+
() => e ? (n(null), !0) : !1,
|
|
1595
|
+
ke
|
|
1373
1596
|
)
|
|
1374
|
-
), [t,
|
|
1597
|
+
), [t, b, e]), !s)
|
|
1375
1598
|
return null;
|
|
1376
|
-
const
|
|
1377
|
-
return /* @__PURE__ */
|
|
1378
|
-
|
|
1599
|
+
const S = pt(i);
|
|
1600
|
+
return /* @__PURE__ */ o(Kt, { children: /* @__PURE__ */ h(
|
|
1601
|
+
Bt,
|
|
1379
1602
|
{
|
|
1380
1603
|
ref: d.setFloating,
|
|
1381
1604
|
css: {
|
|
@@ -1386,10 +1609,10 @@ const Ir = ({ onClose: t }) => {
|
|
|
1386
1609
|
alignItems: "center"
|
|
1387
1610
|
},
|
|
1388
1611
|
style: c,
|
|
1389
|
-
...
|
|
1612
|
+
...g(),
|
|
1390
1613
|
children: [
|
|
1391
|
-
/* @__PURE__ */
|
|
1392
|
-
|
|
1614
|
+
/* @__PURE__ */ o(
|
|
1615
|
+
W,
|
|
1393
1616
|
{
|
|
1394
1617
|
as: "a",
|
|
1395
1618
|
css: {
|
|
@@ -1399,41 +1622,44 @@ const Ir = ({ onClose: t }) => {
|
|
|
1399
1622
|
textOverflow: "ellipsis",
|
|
1400
1623
|
marginRight: "$4"
|
|
1401
1624
|
},
|
|
1402
|
-
href:
|
|
1403
|
-
title:
|
|
1625
|
+
href: S,
|
|
1626
|
+
title: S,
|
|
1404
1627
|
target: "_blank",
|
|
1405
1628
|
rel: "noreferrer",
|
|
1406
1629
|
children: i
|
|
1407
1630
|
}
|
|
1408
1631
|
),
|
|
1409
|
-
/* @__PURE__ */
|
|
1632
|
+
/* @__PURE__ */ o(y, { color: "danger", icon: !0, size: "sm", onClick: N, children: /* @__PURE__ */ o(Je, { size: 24 }) })
|
|
1410
1633
|
]
|
|
1411
1634
|
}
|
|
1412
1635
|
) });
|
|
1413
1636
|
};
|
|
1414
1637
|
export {
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1638
|
+
gt as $createImageNode,
|
|
1639
|
+
te as $createRutineLinkNode,
|
|
1640
|
+
Nn as $isImageNode,
|
|
1641
|
+
Gr as $isRutineLinkNode,
|
|
1642
|
+
zr as FloatingToolbar,
|
|
1643
|
+
z as ImageNode,
|
|
1644
|
+
Rn as InsertSelector,
|
|
1645
|
+
An as LinkEditPlugin,
|
|
1646
|
+
G as LinkTargetNode,
|
|
1647
|
+
zn as LinkToolbarButton,
|
|
1648
|
+
En as RichTextEditor,
|
|
1649
|
+
Ar as RichTextToolbar,
|
|
1650
|
+
O as RutineLinkNode,
|
|
1651
|
+
$n as RutineLinkNodeInit,
|
|
1652
|
+
On as TableEditPlugin,
|
|
1653
|
+
ar as clearEditorState,
|
|
1654
|
+
wn as defaultNodes,
|
|
1655
|
+
Sn as defaultViewNodes,
|
|
1656
|
+
ir as isEditorState,
|
|
1657
|
+
Gt as isJSON,
|
|
1658
|
+
Jt as richTextContext,
|
|
1659
|
+
In as richTextCss,
|
|
1660
|
+
Kr as richTextStyleObj,
|
|
1661
|
+
lr as setStateFromPlainText,
|
|
1662
|
+
yn as stateToHTML,
|
|
1663
|
+
sr as useHasFocusWithin,
|
|
1664
|
+
et as useRichTextContext
|
|
1439
1665
|
};
|