@arkitektbedriftene/fe-lib 1.3.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rich-text/Plugins/LinkInsertPlugin.d.ts +13 -2
- package/dist/rich-text.es.js +438 -361
- package/package.json +1 -1
package/dist/rich-text.es.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
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 n, jsxs as
|
|
13
|
-
import { createContext as
|
|
14
|
-
import { DropdownMenu as
|
|
1
|
+
var Jt = Object.defineProperty;
|
|
2
|
+
var Xt = (t, e, r) => e in t ? Jt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var ht = (t, e, r) => (Xt(t, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
|
+
import { createHeadlessEditor as Qt } from "@lexical/headless";
|
|
5
|
+
import { $generateHtmlFromNodes as Vt } from "@lexical/html";
|
|
6
|
+
import { $getRoot as q, ParagraphNode as Zt, $createParagraphNode as Y, $createTextNode as I, $setSelection as G, SELECTION_CHANGE_COMMAND as F, $getSelection as T, COMMAND_PRIORITY_CRITICAL as tt, $isRangeSelection as L, $isRootOrShadowRoot as te, FORMAT_TEXT_COMMAND as D, COMMAND_PRIORITY_LOW as _, KEY_ARROW_DOWN_COMMAND as ee, KEY_ARROW_UP_COMMAND as re, KEY_ESCAPE_COMMAND as Mt, KEY_SPACE_COMMAND as ne, $getNearestNodeFromDOMNode as et, KEY_ARROW_LEFT_COMMAND as oe, $isElementNode as ie, COMMAND_PRIORITY_NORMAL as ae, $createRangeSelection as Tt, COMMAND_PRIORITY_HIGH as le } from "lexical";
|
|
7
|
+
import { trimTextContentFromAnchor as se, $setBlocksType as Q, $isAtNodeEnd as pt } from "@lexical/selection";
|
|
8
|
+
import { LinkNode as $, AutoLinkNode as Lt, $isLinkNode as W, TOGGLE_LINK_COMMAND as J } from "@lexical/link";
|
|
9
|
+
import { ListNode as rt, ListItemNode as yt, $isListNode as nt, INSERT_UNORDERED_LIST_COMMAND as ce, INSERT_ORDERED_LIST_COMMAND as de, INSERT_CHECK_LIST_COMMAND as xt, insertList as ue, $isListItemNode as A } from "@lexical/list";
|
|
10
|
+
import { HeadingNode as Nt, QuoteNode as St, $isHeadingNode as he, $createHeadingNode as pe, $createQuoteNode as ge } from "@lexical/rich-text";
|
|
11
|
+
import { TableNode as wt, TableRowNode as Et, TableCellNode as _t, INSERT_TABLE_COMMAND as fe, $getTableCellNodeFromLexicalNode as me, $deleteTableColumn__EXPERIMENTAL as ke, $deleteTableRow__EXPERIMENTAL as be, $insertTableColumn__EXPERIMENTAL as gt, $insertTableRow__EXPERIMENTAL as ft } from "@lexical/table";
|
|
12
|
+
import { jsx as n, jsxs as p, Fragment as H } from "react/jsx-runtime";
|
|
13
|
+
import { createContext as ve, useState as k, useRef as ot, useCallback as v, useContext as Ce, useEffect as x, useMemo as Rt, useLayoutEffect as Me } from "react";
|
|
14
|
+
import { DropdownMenu as it, ToolbarButton as It, DropdownMenuIconItem as M, Box as P, ToolbarToggleGroup as zt, ToolbarToggleItem as O, OverlayCard as Ot, Toolbar as Te, ToolbarSeparator as Le, styled as ye, Spinner as $t, Button as w, DropdownMenuItem as z, DropdownMenuSeparator as mt, Dialog as xe, NavBar as Ne, NavBarItem as V, TextInput as Se, DialogActions as at, Combobox as we } from "./ui.es.js";
|
|
15
15
|
import { LexicalComposer as Ee } from "@lexical/react/LexicalComposer.js";
|
|
16
16
|
import { RichTextPlugin as _e } from "@lexical/react/LexicalRichTextPlugin.js";
|
|
17
17
|
import Re from "@lexical/react/LexicalErrorBoundary.js";
|
|
18
|
-
import { useFloating as
|
|
18
|
+
import { useFloating as lt, autoUpdate as At, size as Ie, flip as ze, offset as Bt, shift as Oe, useInteractions as Dt, useRole as Pt, FloatingPortal as Ft, inline as $e, useDismiss as Ae } from "@floating-ui/react";
|
|
19
19
|
import { useLexicalComposerContext as y } from "@lexical/react/LexicalComposerContext.js";
|
|
20
|
-
import { $getNearestNodeOfType as Be, $findMatchingParent as
|
|
21
|
-
import { G as
|
|
20
|
+
import { $getNearestNodeOfType as Be, $findMatchingParent as Ht, mergeRegister as st, isHTMLElement as kt } from "@lexical/utils";
|
|
21
|
+
import { G as g, e as De } from "./index.esm-67eba761.js";
|
|
22
22
|
import { s as Pe, c as Fe } from "./stitches.config-00c23cdb.js";
|
|
23
23
|
import { ListPlugin as He } from "@lexical/react/LexicalListPlugin.js";
|
|
24
24
|
import { HistoryPlugin as Ue } from "@lexical/react/LexicalHistoryPlugin.js";
|
|
@@ -45,11 +45,11 @@ const Ke = ({
|
|
|
45
45
|
maxChars: e,
|
|
46
46
|
maxLines: r
|
|
47
47
|
}) => {
|
|
48
|
-
const o =
|
|
49
|
-
|
|
48
|
+
const o = q(), i = o.getTextContent(), l = Ke({ text: i, maxChars: e, maxLines: r }), a = i.length - l, d = o.select().anchor;
|
|
49
|
+
se(t, d, a);
|
|
50
50
|
const c = o.getLastChild();
|
|
51
|
-
return c instanceof
|
|
52
|
-
},
|
|
51
|
+
return c instanceof Zt && c.getChildrenSize() === 0 && c.remove(), a;
|
|
52
|
+
}, Ut = {
|
|
53
53
|
quote: "ain-rich-text-quote",
|
|
54
54
|
text: {
|
|
55
55
|
bold: "ain-rich-text-bold",
|
|
@@ -61,13 +61,13 @@ const Ke = ({
|
|
|
61
61
|
listitem: "ain-rich-text-nested-list-item"
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
},
|
|
64
|
+
}, Wt = (t) => t[0] === "{", Ye = (t) => t !== null && typeof t == "object" && "isEmpty" in t, Ge = (t, e) => {
|
|
65
65
|
t.update(
|
|
66
66
|
() => {
|
|
67
|
-
const r =
|
|
67
|
+
const r = q();
|
|
68
68
|
r.clear();
|
|
69
|
-
const o =
|
|
70
|
-
o.append(
|
|
69
|
+
const o = Y();
|
|
70
|
+
o.append(I("")), r.append(o), G(null);
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
tag: e
|
|
@@ -76,28 +76,28 @@ const Ke = ({
|
|
|
76
76
|
}, Je = (t, e, r) => {
|
|
77
77
|
e.update(
|
|
78
78
|
() => {
|
|
79
|
-
const o =
|
|
79
|
+
const o = q();
|
|
80
80
|
o.clear();
|
|
81
|
-
const i =
|
|
82
|
-
i.append(
|
|
81
|
+
const i = Y();
|
|
82
|
+
i.append(I(t.trim())), o.append(i), G(null);
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
tag: r
|
|
86
86
|
}
|
|
87
87
|
), e.blur();
|
|
88
|
-
},
|
|
88
|
+
}, sn = (t, e, r) => {
|
|
89
89
|
let o = 0;
|
|
90
|
-
const i =
|
|
90
|
+
const i = Qt({
|
|
91
91
|
nodes: e,
|
|
92
92
|
editable: !1,
|
|
93
|
-
theme:
|
|
93
|
+
theme: Ut
|
|
94
94
|
});
|
|
95
95
|
if (t)
|
|
96
96
|
try {
|
|
97
|
-
if (typeof t == "string" && !
|
|
97
|
+
if (typeof t == "string" && !Wt(t))
|
|
98
98
|
i.update(() => {
|
|
99
|
-
const a =
|
|
100
|
-
s.append(
|
|
99
|
+
const a = q(), s = Y();
|
|
100
|
+
s.append(I(t.trim())), a.append(s);
|
|
101
101
|
});
|
|
102
102
|
else {
|
|
103
103
|
const a = i.parseEditorState(t, () => {
|
|
@@ -114,10 +114,10 @@ const Ke = ({
|
|
|
114
114
|
let l = "";
|
|
115
115
|
return i.update(() => {
|
|
116
116
|
var a;
|
|
117
|
-
r != null && r.updateFn && ((a = r.updateFn) == null || a.call(r)), l =
|
|
117
|
+
r != null && r.updateFn && ((a = r.updateFn) == null || a.call(r)), l = Vt(i);
|
|
118
118
|
}), { html: l, trimCount: o };
|
|
119
119
|
};
|
|
120
|
-
class
|
|
120
|
+
class j extends $ {
|
|
121
121
|
static getType() {
|
|
122
122
|
return "target-link";
|
|
123
123
|
}
|
|
@@ -132,7 +132,7 @@ class W extends z {
|
|
|
132
132
|
i && (l.target = "_blank", l.rel = "noopener noreferrer"), super(e, l, o);
|
|
133
133
|
}
|
|
134
134
|
static clone(e) {
|
|
135
|
-
return new
|
|
135
|
+
return new j(
|
|
136
136
|
e.__url,
|
|
137
137
|
{ rel: e.__rel, target: e.__target, title: e.__title },
|
|
138
138
|
e.__key
|
|
@@ -142,39 +142,39 @@ class W extends z {
|
|
|
142
142
|
return super.exportJSON();
|
|
143
143
|
}
|
|
144
144
|
static importJSON(e) {
|
|
145
|
-
return
|
|
145
|
+
return $.importJSON(e);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
const
|
|
149
|
-
Lt,
|
|
150
|
-
xt,
|
|
151
|
-
tt,
|
|
152
|
-
Ct,
|
|
153
|
-
Mt,
|
|
154
|
-
z,
|
|
155
|
-
yt,
|
|
148
|
+
const cn = [
|
|
156
149
|
Nt,
|
|
157
|
-
St
|
|
158
|
-
|
|
159
|
-
Lt,
|
|
160
|
-
xt,
|
|
161
|
-
tt,
|
|
162
|
-
Ct,
|
|
163
|
-
Mt,
|
|
164
|
-
z,
|
|
150
|
+
St,
|
|
151
|
+
rt,
|
|
165
152
|
yt,
|
|
153
|
+
Lt,
|
|
154
|
+
$,
|
|
155
|
+
wt,
|
|
156
|
+
Et,
|
|
157
|
+
_t
|
|
158
|
+
], dn = [
|
|
166
159
|
Nt,
|
|
167
160
|
St,
|
|
168
|
-
|
|
161
|
+
rt,
|
|
162
|
+
yt,
|
|
163
|
+
Lt,
|
|
164
|
+
$,
|
|
165
|
+
wt,
|
|
166
|
+
Et,
|
|
167
|
+
_t,
|
|
168
|
+
j,
|
|
169
169
|
{
|
|
170
|
-
replace:
|
|
171
|
-
with: (t) => new
|
|
170
|
+
replace: $,
|
|
171
|
+
with: (t) => new j(
|
|
172
172
|
t.getURL(),
|
|
173
173
|
{ rel: t.__rel, target: t.__target, title: t.__title }
|
|
174
174
|
)
|
|
175
175
|
}
|
|
176
|
-
],
|
|
177
|
-
const [e, r] =
|
|
176
|
+
], jt = ve({ hasFocus: !1, editorRef: { current: null } }), Xe = ({ onBlur: t }) => {
|
|
177
|
+
const [e, r] = k(!1), o = ot(null), i = v(() => {
|
|
178
178
|
r(!0), o.current && window.clearTimeout(o.current);
|
|
179
179
|
}, []), l = v(() => {
|
|
180
180
|
o.current = window.setTimeout(() => {
|
|
@@ -188,65 +188,65 @@ const sn = [
|
|
|
188
188
|
onBlur: l
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
|
-
},
|
|
191
|
+
}, ct = () => Ce(jt);
|
|
192
192
|
function Qe(t) {
|
|
193
|
-
return
|
|
193
|
+
return g({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 5h6a3.5 3.5 0 0 1 0 7h-6z" } }, { tag: "path", attr: { d: "M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7" } }] })(t);
|
|
194
194
|
}
|
|
195
195
|
function Ve(t) {
|
|
196
|
-
return
|
|
196
|
+
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 8l-4 4l4 4" } }, { tag: "path", attr: { d: "M17 8l4 4l-4 4" } }, { tag: "path", attr: { d: "M14 4l-4 16" } }] })(t);
|
|
197
197
|
}
|
|
198
198
|
function Ze(t) {
|
|
199
|
-
return
|
|
199
|
+
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: "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
200
|
}
|
|
201
201
|
function tr(t) {
|
|
202
|
-
return
|
|
202
|
+
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: "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
203
|
}
|
|
204
204
|
function er(t) {
|
|
205
|
-
return
|
|
205
|
+
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: "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
206
|
}
|
|
207
207
|
function rr(t) {
|
|
208
|
-
return
|
|
208
|
+
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: "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
209
|
}
|
|
210
210
|
function nr(t) {
|
|
211
|
-
return
|
|
211
|
+
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: "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
212
|
}
|
|
213
213
|
function or(t) {
|
|
214
|
-
return
|
|
214
|
+
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: "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
215
|
}
|
|
216
216
|
function ir(t) {
|
|
217
|
-
return
|
|
217
|
+
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: "M11 5l6 0" } }, { tag: "path", attr: { d: "M7 19l6 0" } }, { tag: "path", attr: { d: "M14 5l-4 14" } }] })(t);
|
|
218
218
|
}
|
|
219
219
|
function ar(t) {
|
|
220
|
-
return
|
|
220
|
+
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: "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
221
|
}
|
|
222
222
|
function lr(t) {
|
|
223
|
-
return
|
|
223
|
+
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: "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
224
|
}
|
|
225
225
|
function sr(t) {
|
|
226
|
-
return
|
|
226
|
+
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: "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
227
|
}
|
|
228
228
|
function cr(t) {
|
|
229
|
-
return
|
|
229
|
+
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: "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
230
|
}
|
|
231
231
|
function dr(t) {
|
|
232
|
-
return
|
|
232
|
+
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: "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
233
|
}
|
|
234
234
|
function ur(t) {
|
|
235
|
-
return
|
|
235
|
+
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: "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
236
|
}
|
|
237
237
|
function hr(t) {
|
|
238
|
-
return
|
|
238
|
+
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: "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
239
|
}
|
|
240
240
|
function pr(t) {
|
|
241
|
-
return
|
|
241
|
+
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: "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
242
|
}
|
|
243
243
|
function gr(t) {
|
|
244
|
-
return
|
|
244
|
+
return g({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 5v5a5 5 0 0 0 10 0v-5" } }, { tag: "path", attr: { d: "M5 19h14" } }] })(t);
|
|
245
245
|
}
|
|
246
246
|
const fr = Pe("div", {
|
|
247
247
|
width: "10rem",
|
|
248
248
|
display: "flex"
|
|
249
|
-
}),
|
|
249
|
+
}), Kt = {
|
|
250
250
|
bullet: "Punktliste",
|
|
251
251
|
h1: "Overskrift 1",
|
|
252
252
|
h2: "Overskrift 2",
|
|
@@ -270,9 +270,9 @@ const fr = Pe("div", {
|
|
|
270
270
|
check: /* @__PURE__ */ n(sr, { size: "1.25rem" }),
|
|
271
271
|
paragraph: /* @__PURE__ */ n(ar, { size: "1.25rem" }),
|
|
272
272
|
quote: /* @__PURE__ */ n(ur, { size: "1.25rem" })
|
|
273
|
-
},
|
|
273
|
+
}, C = ({
|
|
274
274
|
blockType: t
|
|
275
|
-
}) => /* @__PURE__ */
|
|
275
|
+
}) => /* @__PURE__ */ p(H, { children: [
|
|
276
276
|
/* @__PURE__ */ n(P, { css: { display: "flex", flex: "0 0 auto" }, children: mr[t] }),
|
|
277
277
|
/* @__PURE__ */ n(
|
|
278
278
|
P,
|
|
@@ -283,150 +283,150 @@ const fr = Pe("div", {
|
|
|
283
283
|
textOverflow: "ellipsis",
|
|
284
284
|
whiteSpace: "nowrap"
|
|
285
285
|
},
|
|
286
|
-
children:
|
|
286
|
+
children: Kt[t]
|
|
287
287
|
}
|
|
288
288
|
)
|
|
289
289
|
] }), kr = (t) => {
|
|
290
290
|
if (!L(t))
|
|
291
291
|
return null;
|
|
292
292
|
const e = t.anchor.getNode();
|
|
293
|
-
let r = e.getKey() === "root" ? e :
|
|
293
|
+
let r = e.getKey() === "root" ? e : Ht(e, (o) => {
|
|
294
294
|
const i = o.getParent();
|
|
295
|
-
return i !== null &&
|
|
295
|
+
return i !== null && te(i);
|
|
296
296
|
});
|
|
297
297
|
return r === null && (r = e.getTopLevelElementOrThrow()), {
|
|
298
298
|
anchorNode: e,
|
|
299
299
|
element: r
|
|
300
300
|
};
|
|
301
301
|
}, br = () => {
|
|
302
|
-
const [t] = y(), [e, r] =
|
|
302
|
+
const [t] = y(), [e, r] = k("paragraph");
|
|
303
303
|
x(() => t.registerCommand(
|
|
304
304
|
F,
|
|
305
305
|
() => {
|
|
306
|
-
const c = T(),
|
|
307
|
-
if (!
|
|
306
|
+
const c = T(), u = kr(c);
|
|
307
|
+
if (!u)
|
|
308
308
|
return !1;
|
|
309
|
-
const { element:
|
|
310
|
-
if (t.getElementByKey(
|
|
311
|
-
if (
|
|
312
|
-
const
|
|
309
|
+
const { element: h, anchorNode: m } = u, E = h.getKey();
|
|
310
|
+
if (t.getElementByKey(E) !== null)
|
|
311
|
+
if (nt(h)) {
|
|
312
|
+
const b = Be(
|
|
313
313
|
m,
|
|
314
|
-
|
|
315
|
-
), S =
|
|
314
|
+
rt
|
|
315
|
+
), S = b ? b.getListType() : h.getListType();
|
|
316
316
|
r(S);
|
|
317
317
|
} else {
|
|
318
|
-
const
|
|
319
|
-
|
|
318
|
+
const b = he(h) ? h.getTag() : h.getType();
|
|
319
|
+
b in Kt && r(b);
|
|
320
320
|
}
|
|
321
321
|
return !1;
|
|
322
322
|
},
|
|
323
|
-
|
|
323
|
+
tt
|
|
324
324
|
), [t]);
|
|
325
325
|
const o = (c) => {
|
|
326
326
|
e !== c && t.update(() => {
|
|
327
|
-
const
|
|
328
|
-
L(
|
|
327
|
+
const u = T();
|
|
328
|
+
L(u) && (Q(u, () => pe(c)), r(c));
|
|
329
329
|
});
|
|
330
330
|
};
|
|
331
|
-
return /* @__PURE__ */ n(fr, { children: /* @__PURE__ */
|
|
332
|
-
|
|
331
|
+
return /* @__PURE__ */ n(fr, { children: /* @__PURE__ */ p(
|
|
332
|
+
it,
|
|
333
333
|
{
|
|
334
334
|
trigger: /* @__PURE__ */ n(
|
|
335
|
-
|
|
335
|
+
It,
|
|
336
336
|
{
|
|
337
337
|
dropdown: !0,
|
|
338
338
|
css: { display: "flex", width: "100%", overflow: "hidden" },
|
|
339
|
-
children: /* @__PURE__ */ n(
|
|
339
|
+
children: /* @__PURE__ */ n(C, { blockType: e })
|
|
340
340
|
}
|
|
341
341
|
),
|
|
342
342
|
side: "bottom",
|
|
343
343
|
align: "start",
|
|
344
344
|
children: [
|
|
345
|
-
/* @__PURE__ */ n(
|
|
345
|
+
/* @__PURE__ */ n(M, { onClick: () => {
|
|
346
346
|
e !== "paragraph" && t.update(() => {
|
|
347
347
|
const c = T();
|
|
348
|
-
L(c) && (
|
|
348
|
+
L(c) && (Q(c, () => Y()), r("paragraph"));
|
|
349
349
|
});
|
|
350
|
-
}, children: /* @__PURE__ */ n(
|
|
351
|
-
/* @__PURE__ */ n(
|
|
352
|
-
/* @__PURE__ */ n(
|
|
353
|
-
/* @__PURE__ */ n(
|
|
354
|
-
/* @__PURE__ */ n(
|
|
355
|
-
/* @__PURE__ */ n(
|
|
356
|
-
/* @__PURE__ */ n(
|
|
357
|
-
/* @__PURE__ */ n(
|
|
358
|
-
e !== "bullet" && (t.dispatchCommand(
|
|
359
|
-
}, children: /* @__PURE__ */ n(
|
|
360
|
-
/* @__PURE__ */ n(
|
|
361
|
-
e !== "number" && (t.dispatchCommand(
|
|
362
|
-
}, children: /* @__PURE__ */ n(
|
|
363
|
-
/* @__PURE__ */ n(
|
|
364
|
-
e !== "check" && (t.dispatchCommand(
|
|
365
|
-
}, children: /* @__PURE__ */ n(
|
|
366
|
-
/* @__PURE__ */ n(
|
|
350
|
+
}, children: /* @__PURE__ */ n(C, { blockType: "paragraph" }) }),
|
|
351
|
+
/* @__PURE__ */ n(M, { onClick: () => o("h1"), children: /* @__PURE__ */ n(C, { blockType: "h1" }) }),
|
|
352
|
+
/* @__PURE__ */ n(M, { onClick: () => o("h2"), children: /* @__PURE__ */ n(C, { blockType: "h2" }) }),
|
|
353
|
+
/* @__PURE__ */ n(M, { onClick: () => o("h3"), children: /* @__PURE__ */ n(C, { blockType: "h3" }) }),
|
|
354
|
+
/* @__PURE__ */ n(M, { onClick: () => o("h4"), children: /* @__PURE__ */ n(C, { blockType: "h4" }) }),
|
|
355
|
+
/* @__PURE__ */ n(M, { onClick: () => o("h5"), children: /* @__PURE__ */ n(C, { blockType: "h5" }) }),
|
|
356
|
+
/* @__PURE__ */ n(M, { onClick: () => o("h6"), children: /* @__PURE__ */ n(C, { blockType: "h6" }) }),
|
|
357
|
+
/* @__PURE__ */ n(M, { onClick: () => {
|
|
358
|
+
e !== "bullet" && (t.dispatchCommand(ce, void 0), r("bullet"));
|
|
359
|
+
}, children: /* @__PURE__ */ n(C, { blockType: "bullet" }) }),
|
|
360
|
+
/* @__PURE__ */ n(M, { onClick: () => {
|
|
361
|
+
e !== "number" && (t.dispatchCommand(de, void 0), r("number"));
|
|
362
|
+
}, children: /* @__PURE__ */ n(C, { blockType: "number" }) }),
|
|
363
|
+
/* @__PURE__ */ n(M, { onClick: () => {
|
|
364
|
+
e !== "check" && (t.dispatchCommand(xt, void 0), r("check"));
|
|
365
|
+
}, children: /* @__PURE__ */ n(C, { blockType: "check" }) }),
|
|
366
|
+
/* @__PURE__ */ n(M, { onClick: () => {
|
|
367
367
|
e !== "quote" && t.update(() => {
|
|
368
368
|
const c = T();
|
|
369
|
-
L(c) && (
|
|
369
|
+
L(c) && (Q(c, () => ge()), r("quote"));
|
|
370
370
|
});
|
|
371
|
-
}, children: /* @__PURE__ */ n(
|
|
371
|
+
}, children: /* @__PURE__ */ n(C, { blockType: "quote" }) })
|
|
372
372
|
]
|
|
373
373
|
}
|
|
374
374
|
) });
|
|
375
375
|
}, vr = () => {
|
|
376
|
-
const [t] = y(), [e, r] =
|
|
377
|
-
const
|
|
378
|
-
L(
|
|
376
|
+
const [t] = y(), [e, r] = k(!1), [o, i] = k(!1), [l, a] = k(!1), [s, d] = k(!1), [c, u] = k(!1), h = v(() => {
|
|
377
|
+
const f = T();
|
|
378
|
+
L(f) && (r(f.hasFormat("bold")), i(f.hasFormat("italic")), a(f.hasFormat("underline")), d(f.hasFormat("code")), u(f.hasFormat("superscript")));
|
|
379
379
|
}, []);
|
|
380
|
-
x(() =>
|
|
380
|
+
x(() => st(
|
|
381
381
|
t.registerCommand(
|
|
382
382
|
F,
|
|
383
|
-
() => (
|
|
384
|
-
|
|
383
|
+
() => (h(), !1),
|
|
384
|
+
tt
|
|
385
385
|
),
|
|
386
|
-
t.registerUpdateListener(({ editorState:
|
|
387
|
-
|
|
388
|
-
|
|
386
|
+
t.registerUpdateListener(({ editorState: f }) => {
|
|
387
|
+
f.read(() => {
|
|
388
|
+
h();
|
|
389
389
|
});
|
|
390
390
|
})
|
|
391
|
-
), [t,
|
|
391
|
+
), [t, h]);
|
|
392
392
|
const m = v(
|
|
393
|
-
() => t.dispatchCommand(
|
|
393
|
+
() => t.dispatchCommand(D, "bold"),
|
|
394
394
|
[t]
|
|
395
|
-
),
|
|
396
|
-
() => t.dispatchCommand(
|
|
395
|
+
), E = v(
|
|
396
|
+
() => t.dispatchCommand(D, "italic"),
|
|
397
397
|
[t]
|
|
398
398
|
), N = v(
|
|
399
|
-
() => t.dispatchCommand(
|
|
399
|
+
() => t.dispatchCommand(D, "underline"),
|
|
400
400
|
[t]
|
|
401
|
-
),
|
|
402
|
-
() => t.dispatchCommand(
|
|
401
|
+
), b = v(
|
|
402
|
+
() => t.dispatchCommand(D, "code"),
|
|
403
403
|
[t]
|
|
404
404
|
), S = v(
|
|
405
|
-
() => t.dispatchCommand(
|
|
405
|
+
() => t.dispatchCommand(D, "superscript"),
|
|
406
406
|
[t]
|
|
407
|
-
),
|
|
408
|
-
const
|
|
409
|
-
return e &&
|
|
407
|
+
), B = Rt(() => {
|
|
408
|
+
const f = [];
|
|
409
|
+
return e && f.push("bold"), o && f.push("italic"), l && f.push("underline"), s && f.push("code"), c && f.push("superscript"), f;
|
|
410
410
|
}, [e, o, l, s, c]);
|
|
411
|
-
return /* @__PURE__ */
|
|
412
|
-
|
|
411
|
+
return /* @__PURE__ */ p(
|
|
412
|
+
zt,
|
|
413
413
|
{
|
|
414
414
|
type: "multiple",
|
|
415
415
|
"aria-label": "Tekstformattering",
|
|
416
|
-
value:
|
|
416
|
+
value: B,
|
|
417
417
|
children: [
|
|
418
|
-
/* @__PURE__ */ n(
|
|
418
|
+
/* @__PURE__ */ n(O, { onClick: m, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ n(Qe, { size: "1.25rem" }) }),
|
|
419
419
|
/* @__PURE__ */ n(
|
|
420
|
-
|
|
420
|
+
O,
|
|
421
421
|
{
|
|
422
|
-
onClick:
|
|
422
|
+
onClick: E,
|
|
423
423
|
title: "Kursiv tekst",
|
|
424
424
|
value: "italic",
|
|
425
425
|
children: /* @__PURE__ */ n(ir, { size: "1.25rem" })
|
|
426
426
|
}
|
|
427
427
|
),
|
|
428
428
|
/* @__PURE__ */ n(
|
|
429
|
-
|
|
429
|
+
O,
|
|
430
430
|
{
|
|
431
431
|
onClick: N,
|
|
432
432
|
title: "Understreket tekst",
|
|
@@ -434,9 +434,9 @@ const fr = Pe("div", {
|
|
|
434
434
|
children: /* @__PURE__ */ n(gr, { size: "1.25rem" })
|
|
435
435
|
}
|
|
436
436
|
),
|
|
437
|
-
/* @__PURE__ */ n(
|
|
437
|
+
/* @__PURE__ */ n(O, { onClick: b, title: "Kode", value: "code", children: /* @__PURE__ */ n(Ve, { size: "1.25rem" }) }),
|
|
438
438
|
/* @__PURE__ */ n(
|
|
439
|
-
|
|
439
|
+
O,
|
|
440
440
|
{
|
|
441
441
|
onClick: S,
|
|
442
442
|
title: "Superscript",
|
|
@@ -447,22 +447,22 @@ const fr = Pe("div", {
|
|
|
447
447
|
]
|
|
448
448
|
}
|
|
449
449
|
);
|
|
450
|
-
},
|
|
451
|
-
const { hasFocus: e, editorRef: r } =
|
|
450
|
+
}, Cr = ({ children: t }) => {
|
|
451
|
+
const { hasFocus: e, editorRef: r } = ct(), o = e, [i, l] = k(o);
|
|
452
452
|
Me(() => {
|
|
453
453
|
l(o);
|
|
454
454
|
}, [o]);
|
|
455
|
-
const { context: a, refs: s, floatingStyles: d } =
|
|
455
|
+
const { context: a, refs: s, floatingStyles: d } = lt({
|
|
456
456
|
placement: "top",
|
|
457
|
-
whileElementsMounted:
|
|
457
|
+
whileElementsMounted: At,
|
|
458
458
|
middleware: [
|
|
459
459
|
Ie({
|
|
460
|
-
apply: ({ rects:
|
|
461
|
-
|
|
460
|
+
apply: ({ rects: u, elements: h }) => {
|
|
461
|
+
h.floating.style.minWidth = `${u.reference.width}px`;
|
|
462
462
|
}
|
|
463
463
|
}),
|
|
464
464
|
ze(),
|
|
465
|
-
|
|
465
|
+
Bt({
|
|
466
466
|
mainAxis: 8
|
|
467
467
|
}),
|
|
468
468
|
Oe({
|
|
@@ -474,13 +474,13 @@ const fr = Pe("div", {
|
|
|
474
474
|
elements: {
|
|
475
475
|
reference: r.current
|
|
476
476
|
}
|
|
477
|
-
}), { getFloatingProps: c } =
|
|
478
|
-
|
|
477
|
+
}), { getFloatingProps: c } = Dt([
|
|
478
|
+
Pt(a, {
|
|
479
479
|
role: "dialog"
|
|
480
480
|
})
|
|
481
481
|
]);
|
|
482
|
-
return i ? /* @__PURE__ */ n(
|
|
483
|
-
|
|
482
|
+
return i ? /* @__PURE__ */ n(Ft, { children: /* @__PURE__ */ n(
|
|
483
|
+
Ot,
|
|
484
484
|
{
|
|
485
485
|
ref: s.setFloating,
|
|
486
486
|
style: d,
|
|
@@ -491,72 +491,72 @@ const fr = Pe("div", {
|
|
|
491
491
|
overflow: "hidden",
|
|
492
492
|
boxShadow: "$md"
|
|
493
493
|
},
|
|
494
|
-
children: /* @__PURE__ */ n(
|
|
494
|
+
children: /* @__PURE__ */ n(Mr, { children: t })
|
|
495
495
|
}
|
|
496
496
|
) }) : null;
|
|
497
|
-
},
|
|
497
|
+
}, Mr = ({
|
|
498
498
|
children: t,
|
|
499
499
|
...e
|
|
500
|
-
}) => /* @__PURE__ */
|
|
500
|
+
}) => /* @__PURE__ */ p(Te, { "aria-label": "Formattering", ...e, children: [
|
|
501
501
|
/* @__PURE__ */ n(br, {}),
|
|
502
|
-
/* @__PURE__ */ n(
|
|
502
|
+
/* @__PURE__ */ n(Le, {}),
|
|
503
503
|
/* @__PURE__ */ n(vr, {}),
|
|
504
504
|
t
|
|
505
505
|
] });
|
|
506
506
|
function Tr() {
|
|
507
507
|
const [t] = y();
|
|
508
|
-
return x(() =>
|
|
508
|
+
return x(() => st(
|
|
509
509
|
t.registerCommand(
|
|
510
|
-
|
|
511
|
-
() => (
|
|
512
|
-
|
|
510
|
+
xt,
|
|
511
|
+
() => (ue(t, "check"), !0),
|
|
512
|
+
_
|
|
513
513
|
),
|
|
514
514
|
t.registerCommand(
|
|
515
|
-
|
|
516
|
-
(e) =>
|
|
517
|
-
|
|
515
|
+
ee,
|
|
516
|
+
(e) => Ct(e, t, !1),
|
|
517
|
+
_
|
|
518
518
|
),
|
|
519
519
|
t.registerCommand(
|
|
520
|
-
|
|
521
|
-
(e) =>
|
|
522
|
-
|
|
520
|
+
re,
|
|
521
|
+
(e) => Ct(e, t, !0),
|
|
522
|
+
_
|
|
523
523
|
),
|
|
524
524
|
t.registerCommand(
|
|
525
|
-
|
|
525
|
+
Mt,
|
|
526
526
|
(e) => {
|
|
527
|
-
if (
|
|
527
|
+
if (Z() != null) {
|
|
528
528
|
const o = t.getRootElement();
|
|
529
529
|
return o != null && o.focus(), !0;
|
|
530
530
|
}
|
|
531
531
|
return !1;
|
|
532
532
|
},
|
|
533
|
-
|
|
533
|
+
_
|
|
534
534
|
),
|
|
535
535
|
t.registerCommand(
|
|
536
|
-
|
|
536
|
+
ne,
|
|
537
537
|
(e) => {
|
|
538
|
-
const r =
|
|
538
|
+
const r = Z();
|
|
539
539
|
return r != null && t.isEditable() ? (t.update(() => {
|
|
540
|
-
const o =
|
|
541
|
-
|
|
540
|
+
const o = et(r);
|
|
541
|
+
A(o) && (e.preventDefault(), o.toggleChecked());
|
|
542
542
|
}), !0) : !1;
|
|
543
543
|
},
|
|
544
|
-
|
|
544
|
+
_
|
|
545
545
|
),
|
|
546
546
|
t.registerCommand(
|
|
547
|
-
|
|
547
|
+
oe,
|
|
548
548
|
(e) => t.getEditorState().read(() => {
|
|
549
549
|
const r = T();
|
|
550
550
|
if (L(r) && r.isCollapsed()) {
|
|
551
551
|
const { anchor: o } = r, i = o.type === "element";
|
|
552
552
|
if (i || o.offset === 0) {
|
|
553
|
-
const l = o.getNode(), a =
|
|
553
|
+
const l = o.getNode(), a = Ht(
|
|
554
554
|
l,
|
|
555
|
-
(s) =>
|
|
555
|
+
(s) => ie(s) && !s.isInline()
|
|
556
556
|
);
|
|
557
|
-
if (
|
|
557
|
+
if (A(a)) {
|
|
558
558
|
const s = a.getParent();
|
|
559
|
-
if (
|
|
559
|
+
if (nt(s) && s.getListType() === "check" && (i || a.getFirstDescendant() === l)) {
|
|
560
560
|
const d = t.getElementByKey(a.__key);
|
|
561
561
|
if (d != null && document.activeElement !== d)
|
|
562
562
|
return d.focus(), e.preventDefault(), !0;
|
|
@@ -566,19 +566,19 @@ function Tr() {
|
|
|
566
566
|
}
|
|
567
567
|
return !1;
|
|
568
568
|
}),
|
|
569
|
-
|
|
569
|
+
_
|
|
570
570
|
),
|
|
571
571
|
t.registerRootListener((e, r) => {
|
|
572
|
-
e !== null && (e.addEventListener("click",
|
|
572
|
+
e !== null && (e.addEventListener("click", bt), e.addEventListener("pointerdown", vt)), r !== null && (r.removeEventListener("click", bt), r.removeEventListener("pointerdown", vt));
|
|
573
573
|
})
|
|
574
574
|
), [t]), null;
|
|
575
575
|
}
|
|
576
|
-
function
|
|
576
|
+
function qt(t, e) {
|
|
577
577
|
const r = t.target;
|
|
578
|
-
if (r === null || !
|
|
578
|
+
if (r === null || !kt(r))
|
|
579
579
|
return;
|
|
580
580
|
const o = r.firstChild;
|
|
581
|
-
if (o != null &&
|
|
581
|
+
if (o != null && kt(o) && (o.tagName === "UL" || o.tagName === "OL"))
|
|
582
582
|
return;
|
|
583
583
|
const i = r.parentNode;
|
|
584
584
|
if (!i || i.__lexicalListType !== "check")
|
|
@@ -586,19 +586,19 @@ function Wt(t, e) {
|
|
|
586
586
|
const l = t.pageX, a = r.getBoundingClientRect();
|
|
587
587
|
(r.dir === "rtl" ? l < a.right && l > a.right - 20 : l > a.left && l < a.left + 20) && e();
|
|
588
588
|
}
|
|
589
|
-
function
|
|
590
|
-
|
|
589
|
+
function bt(t) {
|
|
590
|
+
qt(t, () => {
|
|
591
591
|
const e = t.target, r = Lr(e);
|
|
592
592
|
r != null && r.isEditable() && r.update(() => {
|
|
593
593
|
if (t.target) {
|
|
594
|
-
const o =
|
|
595
|
-
|
|
594
|
+
const o = et(e);
|
|
595
|
+
A(o) && (e.focus(), o.toggleChecked());
|
|
596
596
|
}
|
|
597
597
|
});
|
|
598
598
|
});
|
|
599
599
|
}
|
|
600
|
-
function
|
|
601
|
-
|
|
600
|
+
function vt(t) {
|
|
601
|
+
qt(t, () => {
|
|
602
602
|
t.preventDefault();
|
|
603
603
|
});
|
|
604
604
|
}
|
|
@@ -611,30 +611,30 @@ function Lr(t) {
|
|
|
611
611
|
}
|
|
612
612
|
return null;
|
|
613
613
|
}
|
|
614
|
-
function
|
|
614
|
+
function Z() {
|
|
615
615
|
const t = document.activeElement;
|
|
616
616
|
return t != null && t.tagName === "LI" && t.parentNode != null && // @ts-ignore internal field
|
|
617
617
|
t.parentNode.__lexicalListType === "check" ? t : null;
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function yr(t, e) {
|
|
620
620
|
let r = e ? t.getPreviousSibling() : t.getNextSibling(), o = t;
|
|
621
|
-
for (; r == null &&
|
|
621
|
+
for (; r == null && A(o); )
|
|
622
622
|
o = o.getParentOrThrow().getParent(), o != null && (r = e ? o.getPreviousSibling() : o.getNextSibling());
|
|
623
|
-
for (;
|
|
623
|
+
for (; A(r); ) {
|
|
624
624
|
const i = e ? r.getLastChild() : r.getFirstChild();
|
|
625
|
-
if (!
|
|
625
|
+
if (!nt(i))
|
|
626
626
|
return r;
|
|
627
627
|
r = e ? i.getLastChild() : i.getFirstChild();
|
|
628
628
|
}
|
|
629
629
|
return null;
|
|
630
630
|
}
|
|
631
|
-
function
|
|
632
|
-
const o =
|
|
631
|
+
function Ct(t, e, r) {
|
|
632
|
+
const o = Z();
|
|
633
633
|
return o != null && e.update(() => {
|
|
634
|
-
const i =
|
|
635
|
-
if (!
|
|
634
|
+
const i = et(o);
|
|
635
|
+
if (!A(i))
|
|
636
636
|
return;
|
|
637
|
-
const l =
|
|
637
|
+
const l = yr(i, r);
|
|
638
638
|
if (l != null) {
|
|
639
639
|
l.selectStart();
|
|
640
640
|
const a = e.getElementByKey(l.__key);
|
|
@@ -644,7 +644,7 @@ function kt(t, e, r) {
|
|
|
644
644
|
}
|
|
645
645
|
}), !1;
|
|
646
646
|
}
|
|
647
|
-
const
|
|
647
|
+
const xr = () => /* @__PURE__ */ p(H, { children: [
|
|
648
648
|
/* @__PURE__ */ n(He, {}),
|
|
649
649
|
/* @__PURE__ */ n(We, {}),
|
|
650
650
|
/* @__PURE__ */ n(Ue, {}),
|
|
@@ -661,7 +661,7 @@ const yr = () => /* @__PURE__ */ g(Y, { children: [
|
|
|
661
661
|
t.isEmpty() ? Ge(e) : e.setEditorState(t);
|
|
662
662
|
return;
|
|
663
663
|
}
|
|
664
|
-
if (typeof t == "string" && !
|
|
664
|
+
if (typeof t == "string" && !Wt(t)) {
|
|
665
665
|
Je(t, e);
|
|
666
666
|
return;
|
|
667
667
|
}
|
|
@@ -671,7 +671,7 @@ const yr = () => /* @__PURE__ */ g(Y, { children: [
|
|
|
671
671
|
console.error("Could not parse"), console.error(r);
|
|
672
672
|
}
|
|
673
673
|
}, []), null;
|
|
674
|
-
}, Sr =
|
|
674
|
+
}, Sr = ye("div", {
|
|
675
675
|
border: "1px solid $borderDarker",
|
|
676
676
|
borderRadius: "$md",
|
|
677
677
|
position: "relative",
|
|
@@ -720,9 +720,9 @@ const yr = () => /* @__PURE__ */ g(Y, { children: [
|
|
|
720
720
|
right: "1rem",
|
|
721
721
|
display: "flex"
|
|
722
722
|
},
|
|
723
|
-
children: /* @__PURE__ */ n(
|
|
723
|
+
children: /* @__PURE__ */ n($t, {})
|
|
724
724
|
}
|
|
725
|
-
),
|
|
725
|
+
), un = ({
|
|
726
726
|
isLoading: t,
|
|
727
727
|
children: e,
|
|
728
728
|
placeholderText: r,
|
|
@@ -733,11 +733,11 @@ const yr = () => /* @__PURE__ */ g(Y, { children: [
|
|
|
733
733
|
content: s,
|
|
734
734
|
hideBorder: d,
|
|
735
735
|
onBlur: c,
|
|
736
|
-
defaultState:
|
|
737
|
-
css:
|
|
736
|
+
defaultState: u,
|
|
737
|
+
css: h
|
|
738
738
|
}) => {
|
|
739
|
-
const { hasFocus: m, attributes:
|
|
740
|
-
return /* @__PURE__ */ n(
|
|
739
|
+
const { hasFocus: m, attributes: E } = Xe({ onBlur: c }), N = ot(null), b = Rt(() => ({ hasFocus: m, editorRef: N }), [m]);
|
|
740
|
+
return /* @__PURE__ */ n(jt.Provider, { value: b, children: /* @__PURE__ */ p(
|
|
741
741
|
Ee,
|
|
742
742
|
{
|
|
743
743
|
initialConfig: {
|
|
@@ -745,19 +745,19 @@ const yr = () => /* @__PURE__ */ g(Y, { children: [
|
|
|
745
745
|
onError: (S) => {
|
|
746
746
|
console.error(S);
|
|
747
747
|
},
|
|
748
|
-
theme:
|
|
748
|
+
theme: Ut,
|
|
749
749
|
nodes: o,
|
|
750
750
|
editable: !0
|
|
751
751
|
},
|
|
752
752
|
children: [
|
|
753
|
-
/* @__PURE__ */
|
|
753
|
+
/* @__PURE__ */ p(
|
|
754
754
|
Sr,
|
|
755
755
|
{
|
|
756
756
|
ref: N,
|
|
757
757
|
hasFocus: m,
|
|
758
758
|
hideBorder: d,
|
|
759
|
-
css:
|
|
760
|
-
...
|
|
759
|
+
css: h,
|
|
760
|
+
...E,
|
|
761
761
|
children: [
|
|
762
762
|
l,
|
|
763
763
|
/* @__PURE__ */ n(
|
|
@@ -781,15 +781,15 @@ const yr = () => /* @__PURE__ */ g(Y, { children: [
|
|
|
781
781
|
ErrorBoundary: Re
|
|
782
782
|
}
|
|
783
783
|
),
|
|
784
|
-
/* @__PURE__ */ n(
|
|
784
|
+
/* @__PURE__ */ n(xr, {}),
|
|
785
785
|
i,
|
|
786
786
|
/* @__PURE__ */ n(wr, { isLoading: t }),
|
|
787
|
-
!l && /* @__PURE__ */ n(
|
|
787
|
+
!l && /* @__PURE__ */ n(Cr, { children: a })
|
|
788
788
|
]
|
|
789
789
|
}
|
|
790
790
|
),
|
|
791
|
-
/* @__PURE__ */ n(Nr, { state:
|
|
792
|
-
/* @__PURE__ */ n(
|
|
791
|
+
/* @__PURE__ */ n(Nr, { state: u }),
|
|
792
|
+
/* @__PURE__ */ n(H, { children: e })
|
|
793
793
|
]
|
|
794
794
|
}
|
|
795
795
|
) });
|
|
@@ -983,21 +983,21 @@ const yr = () => /* @__PURE__ */ g(Y, { children: [
|
|
|
983
983
|
defaultVariants: {
|
|
984
984
|
size: "md"
|
|
985
985
|
}
|
|
986
|
-
},
|
|
986
|
+
}, hn = Fe(Er), pn = () => {
|
|
987
987
|
const [t] = y(), e = v(() => {
|
|
988
|
-
t.dispatchCommand(
|
|
988
|
+
t.dispatchCommand(fe, {
|
|
989
989
|
rows: "3",
|
|
990
990
|
columns: "3",
|
|
991
991
|
includeHeaders: !1
|
|
992
992
|
});
|
|
993
993
|
}, [t]);
|
|
994
994
|
return /* @__PURE__ */ n(
|
|
995
|
-
|
|
995
|
+
it,
|
|
996
996
|
{
|
|
997
|
-
trigger: /* @__PURE__ */ n(
|
|
997
|
+
trigger: /* @__PURE__ */ n(It, { dropdown: !0, children: "Sett inn" }),
|
|
998
998
|
side: "bottom",
|
|
999
999
|
align: "end",
|
|
1000
|
-
children: /* @__PURE__ */
|
|
1000
|
+
children: /* @__PURE__ */ p(M, { onClick: e, children: [
|
|
1001
1001
|
/* @__PURE__ */ n(pr, { size: "1.25rem" }),
|
|
1002
1002
|
" Tabell"
|
|
1003
1003
|
] })
|
|
@@ -1005,62 +1005,62 @@ const yr = () => /* @__PURE__ */ g(Y, { children: [
|
|
|
1005
1005
|
);
|
|
1006
1006
|
};
|
|
1007
1007
|
function _r(t) {
|
|
1008
|
-
return
|
|
1008
|
+
return g({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "circle", attr: { cx: "256", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "416", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "96", cy: "256", r: "48" } }] })(t);
|
|
1009
1009
|
}
|
|
1010
|
-
const
|
|
1011
|
-
const [t] = y(), [e, r] =
|
|
1010
|
+
const gn = () => {
|
|
1011
|
+
const [t] = y(), [e, r] = k(null), { hasFocus: o } = ct();
|
|
1012
1012
|
x(() => {
|
|
1013
1013
|
!o && e && r(null);
|
|
1014
1014
|
}, [o, e]);
|
|
1015
|
-
const { refs: i, floatingStyles: l } =
|
|
1015
|
+
const { refs: i, floatingStyles: l } = lt({
|
|
1016
1016
|
placement: "top-end",
|
|
1017
1017
|
open: !!e,
|
|
1018
1018
|
elements: {
|
|
1019
1019
|
reference: e
|
|
1020
1020
|
},
|
|
1021
|
-
middleware: [
|
|
1021
|
+
middleware: [Bt({ mainAxis: -20, crossAxis: -2 })]
|
|
1022
1022
|
});
|
|
1023
1023
|
x(() => t.registerCommand(
|
|
1024
1024
|
F,
|
|
1025
1025
|
() => {
|
|
1026
1026
|
const s = T();
|
|
1027
1027
|
if (L(s)) {
|
|
1028
|
-
const d = s.anchor.getNode(), c =
|
|
1028
|
+
const d = s.anchor.getNode(), c = me(d);
|
|
1029
1029
|
r(c ? t.getElementByKey(c.getKey()) : null);
|
|
1030
1030
|
}
|
|
1031
1031
|
return !1;
|
|
1032
1032
|
},
|
|
1033
|
-
|
|
1033
|
+
ae
|
|
1034
1034
|
), [t]);
|
|
1035
1035
|
const a = (s) => () => {
|
|
1036
1036
|
t.update(() => {
|
|
1037
1037
|
switch (s) {
|
|
1038
1038
|
case "add-row-over":
|
|
1039
|
-
|
|
1039
|
+
ft(!1);
|
|
1040
1040
|
break;
|
|
1041
1041
|
case "add-row-under":
|
|
1042
|
-
|
|
1042
|
+
ft(!0);
|
|
1043
1043
|
break;
|
|
1044
1044
|
case "add-column-left":
|
|
1045
|
-
|
|
1045
|
+
gt(!1);
|
|
1046
1046
|
break;
|
|
1047
1047
|
case "add-column-right":
|
|
1048
|
-
|
|
1048
|
+
gt(!0);
|
|
1049
1049
|
break;
|
|
1050
1050
|
case "delete-row":
|
|
1051
|
-
|
|
1051
|
+
be();
|
|
1052
1052
|
break;
|
|
1053
1053
|
case "delete-column":
|
|
1054
|
-
|
|
1054
|
+
ke();
|
|
1055
1055
|
break;
|
|
1056
1056
|
}
|
|
1057
1057
|
});
|
|
1058
1058
|
};
|
|
1059
|
-
return e ? /* @__PURE__ */
|
|
1060
|
-
|
|
1059
|
+
return e ? /* @__PURE__ */ p(
|
|
1060
|
+
it,
|
|
1061
1061
|
{
|
|
1062
1062
|
trigger: /* @__PURE__ */ n(
|
|
1063
|
-
|
|
1063
|
+
w,
|
|
1064
1064
|
{
|
|
1065
1065
|
icon: !0,
|
|
1066
1066
|
variant: "primary",
|
|
@@ -1072,40 +1072,40 @@ const pn = () => {
|
|
|
1072
1072
|
}
|
|
1073
1073
|
),
|
|
1074
1074
|
children: [
|
|
1075
|
-
/* @__PURE__ */ n(
|
|
1076
|
-
/* @__PURE__ */ n(
|
|
1077
|
-
/* @__PURE__ */ n(
|
|
1078
|
-
/* @__PURE__ */ n(
|
|
1079
|
-
/* @__PURE__ */ n(
|
|
1080
|
-
/* @__PURE__ */ n(
|
|
1081
|
-
/* @__PURE__ */ n(
|
|
1082
|
-
/* @__PURE__ */ n(
|
|
1075
|
+
/* @__PURE__ */ n(z, { onClick: a("add-row-over"), children: "Legg til rad over" }),
|
|
1076
|
+
/* @__PURE__ */ n(z, { onClick: a("add-row-under"), children: "Legg til rad under" }),
|
|
1077
|
+
/* @__PURE__ */ n(mt, {}),
|
|
1078
|
+
/* @__PURE__ */ n(z, { onClick: a("add-column-left"), children: "Legg til kolonne venstre" }),
|
|
1079
|
+
/* @__PURE__ */ n(z, { onClick: a("add-column-right"), children: "Legg til kolonne høyre" }),
|
|
1080
|
+
/* @__PURE__ */ n(mt, {}),
|
|
1081
|
+
/* @__PURE__ */ n(z, { onClick: a("delete-row"), children: "Fjern rad" }),
|
|
1082
|
+
/* @__PURE__ */ n(z, { onClick: a("delete-column"), children: "Fjern kolonne" })
|
|
1083
1083
|
]
|
|
1084
1084
|
}
|
|
1085
1085
|
) : null;
|
|
1086
1086
|
};
|
|
1087
|
-
function
|
|
1087
|
+
function dt(t) {
|
|
1088
1088
|
let e = t;
|
|
1089
1089
|
const r = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi, o = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
|
|
1090
1090
|
return e = String(e).trim(), e.match(r) || e.match(o) ? e : "https://";
|
|
1091
1091
|
}
|
|
1092
|
-
function
|
|
1092
|
+
function Yt(t) {
|
|
1093
1093
|
const e = t.anchor, r = t.focus, o = t.anchor.getNode(), i = t.focus.getNode();
|
|
1094
|
-
return o === i ? o : t.isBackward() ?
|
|
1094
|
+
return o === i ? o : t.isBackward() ? pt(r) ? o : i : pt(e) ? o : i;
|
|
1095
1095
|
}
|
|
1096
|
-
const
|
|
1096
|
+
const fn = (t) => (R.baseURL = t, R), K = class extends $ {
|
|
1097
1097
|
static getType() {
|
|
1098
1098
|
return "rutine_link";
|
|
1099
1099
|
}
|
|
1100
1100
|
static clone(e) {
|
|
1101
|
-
return new
|
|
1101
|
+
return new K(e.__url, {}, e.__key);
|
|
1102
1102
|
}
|
|
1103
1103
|
createDOM(e) {
|
|
1104
1104
|
const r = super.createDOM(e);
|
|
1105
1105
|
return r.setAttribute("href", this.getURL()), r.setAttribute("target", "_blank"), r.setAttribute("rel", "noopener noreferrer"), r.classList.add("rutine-link"), r;
|
|
1106
1106
|
}
|
|
1107
1107
|
static importJSON(e) {
|
|
1108
|
-
return
|
|
1108
|
+
return Gt(e.url);
|
|
1109
1109
|
}
|
|
1110
1110
|
exportJSON() {
|
|
1111
1111
|
return {
|
|
@@ -1117,19 +1117,19 @@ const gn = (t) => (_.baseURL = t, _), j = class extends z {
|
|
|
1117
1117
|
}
|
|
1118
1118
|
getURL() {
|
|
1119
1119
|
try {
|
|
1120
|
-
return new URL(this.__url,
|
|
1120
|
+
return new URL(this.__url, K.baseURL).toString();
|
|
1121
1121
|
} catch {
|
|
1122
1122
|
return "";
|
|
1123
1123
|
}
|
|
1124
1124
|
}
|
|
1125
1125
|
};
|
|
1126
|
-
let
|
|
1127
|
-
|
|
1128
|
-
function
|
|
1129
|
-
return new
|
|
1126
|
+
let R = K;
|
|
1127
|
+
ht(R, "baseURL", "");
|
|
1128
|
+
function Gt(t) {
|
|
1129
|
+
return new R(t);
|
|
1130
1130
|
}
|
|
1131
1131
|
function Rr(t) {
|
|
1132
|
-
return t instanceof
|
|
1132
|
+
return t instanceof R;
|
|
1133
1133
|
}
|
|
1134
1134
|
const Ir = ({ onClose: t }) => {
|
|
1135
1135
|
const [e] = y(), r = v(
|
|
@@ -1137,35 +1137,38 @@ const Ir = ({ onClose: t }) => {
|
|
|
1137
1137
|
e.update(() => {
|
|
1138
1138
|
const l = T();
|
|
1139
1139
|
if (L(l) && l.isCollapsed()) {
|
|
1140
|
-
const a =
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
}
|
|
1140
|
+
const a = I(i);
|
|
1141
|
+
l.insertNodes([a]);
|
|
1142
|
+
const s = Tt();
|
|
1143
|
+
s.setTextNodeRange(a, 0, a, i.length), G(s);
|
|
1145
1144
|
}
|
|
1146
|
-
|
|
1145
|
+
e.dispatchCommand(J, dt(i));
|
|
1146
|
+
});
|
|
1147
1147
|
},
|
|
1148
1148
|
[e]
|
|
1149
1149
|
);
|
|
1150
|
-
return /* @__PURE__ */
|
|
1151
|
-
r(i.
|
|
1150
|
+
return /* @__PURE__ */ p("form", { onSubmit: (i) => {
|
|
1151
|
+
r(i.currentTarget.url.value), t();
|
|
1152
1152
|
}, children: [
|
|
1153
1153
|
/* @__PURE__ */ n(Se, { name: "url", label: "URL", type: "url", required: !0 }),
|
|
1154
|
-
/* @__PURE__ */
|
|
1155
|
-
/* @__PURE__ */ n(
|
|
1156
|
-
/* @__PURE__ */ n(
|
|
1154
|
+
/* @__PURE__ */ p(at, { children: [
|
|
1155
|
+
/* @__PURE__ */ n(w, { onClick: t, children: "Avbryt" }),
|
|
1156
|
+
/* @__PURE__ */ n(w, { type: "submit", variant: "primary", children: "Sett inn" })
|
|
1157
1157
|
] })
|
|
1158
1158
|
] });
|
|
1159
|
-
}, zr = ({
|
|
1160
|
-
|
|
1159
|
+
}, zr = ({
|
|
1160
|
+
onClose: t,
|
|
1161
|
+
getDocs: e
|
|
1162
|
+
}) => {
|
|
1163
|
+
const [r] = y(), [o, i] = k([]), l = e(), a = v(
|
|
1161
1164
|
(s) => {
|
|
1162
1165
|
r.update(() => {
|
|
1163
1166
|
const d = T();
|
|
1164
1167
|
if (L(d)) {
|
|
1165
1168
|
const c = [];
|
|
1166
|
-
for (const [
|
|
1167
|
-
const m =
|
|
1168
|
-
m.append(
|
|
1169
|
+
for (const [u, h] of s.entries()) {
|
|
1170
|
+
const m = Gt(h.value);
|
|
1171
|
+
m.append(I(h.label)), c.push(m), u !== s.length - 1 && c.push(I(" "));
|
|
1169
1172
|
}
|
|
1170
1173
|
d.insertNodes(c);
|
|
1171
1174
|
}
|
|
@@ -1173,56 +1176,129 @@ const Ir = ({ onClose: t }) => {
|
|
|
1173
1176
|
},
|
|
1174
1177
|
[r]
|
|
1175
1178
|
);
|
|
1176
|
-
return /* @__PURE__ */
|
|
1177
|
-
/* @__PURE__ */ n(
|
|
1178
|
-
|
|
1179
|
-
|
|
1179
|
+
return /* @__PURE__ */ p(H, { children: [
|
|
1180
|
+
/* @__PURE__ */ n(
|
|
1181
|
+
we,
|
|
1182
|
+
{
|
|
1183
|
+
isMulti: !0,
|
|
1184
|
+
options: l,
|
|
1185
|
+
onChange: (s) => i(s)
|
|
1186
|
+
}
|
|
1187
|
+
),
|
|
1188
|
+
/* @__PURE__ */ p(at, { children: [
|
|
1189
|
+
/* @__PURE__ */ n(w, { onClick: t, children: "Avbryt" }),
|
|
1180
1190
|
/* @__PURE__ */ n(
|
|
1181
|
-
|
|
1191
|
+
w,
|
|
1182
1192
|
{
|
|
1183
1193
|
variant: "primary",
|
|
1184
1194
|
onClick: () => {
|
|
1185
1195
|
a(o), t();
|
|
1186
1196
|
},
|
|
1187
|
-
children: "
|
|
1197
|
+
children: "Sett inn"
|
|
1188
1198
|
}
|
|
1189
1199
|
)
|
|
1190
1200
|
] })
|
|
1191
1201
|
] });
|
|
1192
1202
|
}, Or = ({
|
|
1203
|
+
onClose: t,
|
|
1204
|
+
uploadFile: e
|
|
1205
|
+
}) => {
|
|
1206
|
+
const [r] = y(), [o, i] = k(null), l = async (s) => {
|
|
1207
|
+
var c;
|
|
1208
|
+
const d = (c = s.target.files) == null ? void 0 : c[0];
|
|
1209
|
+
if (d) {
|
|
1210
|
+
const u = await e.uploadFile({ file: d });
|
|
1211
|
+
i({
|
|
1212
|
+
name: d.name,
|
|
1213
|
+
url: u
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
}, a = v(() => {
|
|
1217
|
+
r.update(() => {
|
|
1218
|
+
if (!o)
|
|
1219
|
+
return;
|
|
1220
|
+
const s = T();
|
|
1221
|
+
if (L(s) && s.isCollapsed()) {
|
|
1222
|
+
const d = I(o.name);
|
|
1223
|
+
s.insertNodes([d]);
|
|
1224
|
+
const c = Tt();
|
|
1225
|
+
c.setTextNodeRange(d, 0, d, o.name.length), G(c);
|
|
1226
|
+
}
|
|
1227
|
+
r.dispatchCommand(J, dt(o.url));
|
|
1228
|
+
});
|
|
1229
|
+
}, [r, o]);
|
|
1230
|
+
return /* @__PURE__ */ p(H, { children: [
|
|
1231
|
+
e.isLoading && /* @__PURE__ */ n($t, {}),
|
|
1232
|
+
/* @__PURE__ */ n(
|
|
1233
|
+
"input",
|
|
1234
|
+
{
|
|
1235
|
+
type: "file",
|
|
1236
|
+
onChange: l,
|
|
1237
|
+
disabled: e.isLoading
|
|
1238
|
+
}
|
|
1239
|
+
),
|
|
1240
|
+
/* @__PURE__ */ p(at, { children: [
|
|
1241
|
+
/* @__PURE__ */ n(w, { onClick: t, children: "Avbryt" }),
|
|
1242
|
+
/* @__PURE__ */ n(
|
|
1243
|
+
w,
|
|
1244
|
+
{
|
|
1245
|
+
variant: "primary",
|
|
1246
|
+
onClick: () => {
|
|
1247
|
+
a(), t();
|
|
1248
|
+
},
|
|
1249
|
+
disabled: !o,
|
|
1250
|
+
children: "Sett inn"
|
|
1251
|
+
}
|
|
1252
|
+
)
|
|
1253
|
+
] })
|
|
1254
|
+
] });
|
|
1255
|
+
}, $r = ({
|
|
1193
1256
|
open: t,
|
|
1194
1257
|
onOpenChange: e,
|
|
1195
|
-
getDocs: r
|
|
1258
|
+
getDocs: r,
|
|
1259
|
+
uploadFile: o
|
|
1196
1260
|
}) => {
|
|
1197
|
-
const [
|
|
1261
|
+
const [i, l] = k("url"), a = () => {
|
|
1198
1262
|
e(!1);
|
|
1199
1263
|
};
|
|
1200
|
-
return /* @__PURE__ */
|
|
1201
|
-
/* @__PURE__ */
|
|
1202
|
-
/* @__PURE__ */ n(
|
|
1203
|
-
/* @__PURE__ */ n(
|
|
1264
|
+
return /* @__PURE__ */ p(xe, { open: t, onOpenChange: e, css: { width: "600px" }, children: [
|
|
1265
|
+
/* @__PURE__ */ p(Ne, { css: { marginBottom: "$8" }, children: [
|
|
1266
|
+
/* @__PURE__ */ n(V, { active: i === "url", onClick: () => l("url"), children: "URL" }),
|
|
1267
|
+
r && /* @__PURE__ */ n(
|
|
1268
|
+
V,
|
|
1269
|
+
{
|
|
1270
|
+
active: i === "rutine",
|
|
1271
|
+
onClick: () => l("rutine"),
|
|
1272
|
+
children: "Rutine"
|
|
1273
|
+
}
|
|
1274
|
+
),
|
|
1275
|
+
o && /* @__PURE__ */ n(V, { active: i === "file", onClick: () => l("file"), children: "Fil" })
|
|
1204
1276
|
] }),
|
|
1205
|
-
|
|
1206
|
-
|
|
1277
|
+
i === "url" && /* @__PURE__ */ n(Ir, { onClose: a }),
|
|
1278
|
+
i === "rutine" && r && /* @__PURE__ */ n(zr, { onClose: a, getDocs: r }),
|
|
1279
|
+
i === "file" && o && /* @__PURE__ */ n(Or, { onClose: a, uploadFile: o })
|
|
1207
1280
|
] });
|
|
1208
|
-
},
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1281
|
+
}, mn = ({
|
|
1282
|
+
getDocs: t,
|
|
1283
|
+
uploadFile: e
|
|
1284
|
+
}) => {
|
|
1285
|
+
const [r] = y(), [o, i] = k(!1), [l, a] = k(!1), s = v(() => {
|
|
1286
|
+
const d = T();
|
|
1287
|
+
if (L(d)) {
|
|
1288
|
+
const c = Yt(d), u = c.getParent();
|
|
1289
|
+
i(W(u) || W(c));
|
|
1214
1290
|
}
|
|
1215
1291
|
}, []);
|
|
1216
|
-
return x(() =>
|
|
1292
|
+
return x(() => r.registerCommand(
|
|
1217
1293
|
F,
|
|
1218
|
-
() => (
|
|
1219
|
-
|
|
1220
|
-
), [
|
|
1294
|
+
() => (s(), !1),
|
|
1295
|
+
tt
|
|
1296
|
+
), [r, s]), /* @__PURE__ */ p(zt, { type: "single", value: o ? "link" : "", children: [
|
|
1221
1297
|
/* @__PURE__ */ n(
|
|
1222
|
-
|
|
1298
|
+
O,
|
|
1223
1299
|
{
|
|
1224
1300
|
onClick: () => {
|
|
1225
|
-
|
|
1301
|
+
o ? r.dispatchCommand(J, null) : a(!0);
|
|
1226
1302
|
},
|
|
1227
1303
|
title: "Lenke",
|
|
1228
1304
|
value: "link",
|
|
@@ -1230,75 +1306,76 @@ const Ir = ({ onClose: t }) => {
|
|
|
1230
1306
|
}
|
|
1231
1307
|
),
|
|
1232
1308
|
/* @__PURE__ */ n(
|
|
1233
|
-
|
|
1309
|
+
$r,
|
|
1234
1310
|
{
|
|
1235
|
-
open:
|
|
1236
|
-
onOpenChange:
|
|
1237
|
-
getDocs: t
|
|
1311
|
+
open: l,
|
|
1312
|
+
onOpenChange: a,
|
|
1313
|
+
getDocs: t,
|
|
1314
|
+
uploadFile: e
|
|
1238
1315
|
}
|
|
1239
1316
|
)
|
|
1240
1317
|
] });
|
|
1241
|
-
},
|
|
1242
|
-
const [t] = y(), e =
|
|
1318
|
+
}, kn = () => {
|
|
1319
|
+
const [t] = y(), e = ot(null), [r, o] = k(null), [i, l] = k(""), { hasFocus: a } = ct();
|
|
1243
1320
|
x(() => {
|
|
1244
1321
|
r ? t.update(() => {
|
|
1245
1322
|
l(r.getURL());
|
|
1246
1323
|
}) : l("");
|
|
1247
1324
|
}, [t, r]);
|
|
1248
|
-
const s = !!(r && i && a), { refs: d, floatingStyles: c, context:
|
|
1325
|
+
const s = !!(r && i && a), { refs: d, floatingStyles: c, context: u } = lt({
|
|
1249
1326
|
placement: "top",
|
|
1250
1327
|
strategy: "fixed",
|
|
1251
1328
|
open: s,
|
|
1252
|
-
whileElementsMounted:
|
|
1329
|
+
whileElementsMounted: At,
|
|
1253
1330
|
elements: {
|
|
1254
1331
|
reference: e.current
|
|
1255
1332
|
},
|
|
1256
1333
|
middleware: [$e()]
|
|
1257
|
-
}), { getFloatingProps:
|
|
1258
|
-
|
|
1259
|
-
Ae(
|
|
1334
|
+
}), { getFloatingProps: h } = Dt([
|
|
1335
|
+
Pt(u),
|
|
1336
|
+
Ae(u)
|
|
1260
1337
|
]), m = v(() => {
|
|
1261
1338
|
var S;
|
|
1262
|
-
const
|
|
1263
|
-
if (L(
|
|
1264
|
-
const
|
|
1265
|
-
let
|
|
1266
|
-
if (
|
|
1267
|
-
const
|
|
1268
|
-
|
|
1339
|
+
const b = T();
|
|
1340
|
+
if (L(b)) {
|
|
1341
|
+
const B = Yt(b), f = B.getParent();
|
|
1342
|
+
let U = null;
|
|
1343
|
+
if (W(f) ? U = f : W(B) && (U = B), U) {
|
|
1344
|
+
const X = window.getSelection(), ut = t.getRootElement();
|
|
1345
|
+
b !== null && X !== null && ut !== null && ut.contains(X.anchorNode) && t.isEditable() && (e.current = ((S = X.focusNode) == null ? void 0 : S.parentElement) ?? null);
|
|
1269
1346
|
}
|
|
1270
|
-
o(
|
|
1347
|
+
o(U);
|
|
1271
1348
|
}
|
|
1272
|
-
}, [t]),
|
|
1349
|
+
}, [t]), E = v(() => {
|
|
1273
1350
|
r && Rr(r) && t.update(() => {
|
|
1274
1351
|
r.remove();
|
|
1275
|
-
}), t.dispatchCommand(
|
|
1352
|
+
}), t.dispatchCommand(J, null);
|
|
1276
1353
|
}, [t, r]);
|
|
1277
1354
|
if (x(() => {
|
|
1278
1355
|
t.getEditorState().read(() => {
|
|
1279
1356
|
m();
|
|
1280
1357
|
});
|
|
1281
|
-
}, [t, m]), x(() =>
|
|
1282
|
-
t.registerUpdateListener(({ editorState:
|
|
1283
|
-
|
|
1358
|
+
}, [t, m]), x(() => st(
|
|
1359
|
+
t.registerUpdateListener(({ editorState: b }) => {
|
|
1360
|
+
b.read(() => {
|
|
1284
1361
|
m();
|
|
1285
1362
|
});
|
|
1286
1363
|
}),
|
|
1287
1364
|
t.registerCommand(
|
|
1288
1365
|
F,
|
|
1289
1366
|
() => (m(), !0),
|
|
1290
|
-
|
|
1367
|
+
_
|
|
1291
1368
|
),
|
|
1292
1369
|
t.registerCommand(
|
|
1293
|
-
|
|
1370
|
+
Mt,
|
|
1294
1371
|
() => r ? (o(null), !0) : !1,
|
|
1295
|
-
|
|
1372
|
+
le
|
|
1296
1373
|
)
|
|
1297
1374
|
), [t, m, r]), !s)
|
|
1298
1375
|
return null;
|
|
1299
|
-
const N =
|
|
1300
|
-
return /* @__PURE__ */ n(
|
|
1301
|
-
|
|
1376
|
+
const N = dt(i);
|
|
1377
|
+
return /* @__PURE__ */ n(Ft, { children: /* @__PURE__ */ p(
|
|
1378
|
+
Ot,
|
|
1302
1379
|
{
|
|
1303
1380
|
ref: d.setFloating,
|
|
1304
1381
|
css: {
|
|
@@ -1309,7 +1386,7 @@ const Ir = ({ onClose: t }) => {
|
|
|
1309
1386
|
alignItems: "center"
|
|
1310
1387
|
},
|
|
1311
1388
|
style: c,
|
|
1312
|
-
...
|
|
1389
|
+
...h(),
|
|
1313
1390
|
children: [
|
|
1314
1391
|
/* @__PURE__ */ n(
|
|
1315
1392
|
P,
|
|
@@ -1329,34 +1406,34 @@ const Ir = ({ onClose: t }) => {
|
|
|
1329
1406
|
children: i
|
|
1330
1407
|
}
|
|
1331
1408
|
),
|
|
1332
|
-
/* @__PURE__ */ n(
|
|
1409
|
+
/* @__PURE__ */ n(w, { color: "danger", icon: !0, size: "sm", onClick: E, children: /* @__PURE__ */ n(De, { size: 24 }) })
|
|
1333
1410
|
]
|
|
1334
1411
|
}
|
|
1335
1412
|
) });
|
|
1336
1413
|
};
|
|
1337
1414
|
export {
|
|
1338
|
-
|
|
1415
|
+
Gt as $createRutineLinkNode,
|
|
1339
1416
|
Rr as $isRutineLinkNode,
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1417
|
+
Cr as FloatingToolbar,
|
|
1418
|
+
pn as InsertSelector,
|
|
1419
|
+
kn as LinkEditPlugin,
|
|
1420
|
+
j as LinkTargetNode,
|
|
1421
|
+
mn as LinkToolbarButton,
|
|
1422
|
+
un as RichTextEditor,
|
|
1423
|
+
Mr as RichTextToolbar,
|
|
1424
|
+
R as RutineLinkNode,
|
|
1425
|
+
fn as RutineLinkNodeInit,
|
|
1426
|
+
gn as TableEditPlugin,
|
|
1350
1427
|
Ge as clearEditorState,
|
|
1351
|
-
|
|
1352
|
-
|
|
1428
|
+
cn as defaultNodes,
|
|
1429
|
+
dn as defaultViewNodes,
|
|
1353
1430
|
Ye as isEditorState,
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1431
|
+
Wt as isJSON,
|
|
1432
|
+
jt as richTextContext,
|
|
1433
|
+
hn as richTextCss,
|
|
1357
1434
|
Er as richTextStyleObj,
|
|
1358
1435
|
Je as setStateFromPlainText,
|
|
1359
|
-
|
|
1436
|
+
sn as stateToHTML,
|
|
1360
1437
|
Xe as useHasFocusWithin,
|
|
1361
|
-
|
|
1438
|
+
ct as useRichTextContext
|
|
1362
1439
|
};
|