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