@arkitektbedriftene/fe-lib 2.0.6 → 2.0.8
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/state.d.ts +7 -0
- package/dist/rich-text.es.js +380 -349
- package/package.json +1 -1
package/dist/rich-text.es.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
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 B, AutoLinkNode as
|
|
9
|
-
import { ListNode as st, ListItemNode as
|
|
10
|
-
import { HeadingNode as
|
|
11
|
-
import { TableNode as
|
|
12
|
-
import { jsx as o, jsxs as g, Fragment as
|
|
13
|
-
import { createContext as
|
|
14
|
-
import { Box as H, Stack as
|
|
15
|
-
import { f as
|
|
1
|
+
var ie = Object.defineProperty;
|
|
2
|
+
var ae = (t, r, e) => r in t ? ie(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
|
+
var R = (t, r, e) => (ae(t, typeof r != "symbol" ? r + "" : r, e), e);
|
|
4
|
+
import { createHeadlessEditor as Nt } from "@lexical/headless";
|
|
5
|
+
import { $generateHtmlFromNodes as St } from "@lexical/html";
|
|
6
|
+
import { $getRoot as j, ParagraphNode as le, $createParagraphNode as F, $createTextNode as I, $setSelection as Q, $getNodeByKey as vt, DecoratorNode as se, $applyNodeReplacement as ce, SELECTION_CHANGE_COMMAND as K, $getSelection as L, COMMAND_PRIORITY_CRITICAL as at, $isRangeSelection as w, $isRootOrShadowRoot as Et, FORMAT_TEXT_COMMAND as W, COMMAND_PRIORITY_LOW as O, KEY_ARROW_DOWN_COMMAND as de, KEY_ARROW_UP_COMMAND as he, KEY_ESCAPE_COMMAND as It, KEY_SPACE_COMMAND as ue, $getNearestNodeFromDOMNode as lt, KEY_ARROW_LEFT_COMMAND as ge, $isElementNode as pe, createCommand as me, $insertNodes as fe, COMMAND_PRIORITY_EDITOR as ke, COMMAND_PRIORITY_NORMAL as be, $createRangeSelection as Rt, COMMAND_PRIORITY_HIGH as ve } from "lexical";
|
|
7
|
+
import { trimTextContentFromAnchor as Ce, $setBlocksType as nt, $isAtNodeEnd as Ct } from "@lexical/selection";
|
|
8
|
+
import { LinkNode as B, AutoLinkNode as Ot, $isLinkNode as G, TOGGLE_LINK_COMMAND as V } from "@lexical/link";
|
|
9
|
+
import { ListNode as st, ListItemNode as zt, $isListNode as ct, INSERT_UNORDERED_LIST_COMMAND as Me, INSERT_ORDERED_LIST_COMMAND as _e, INSERT_CHECK_LIST_COMMAND as At, insertList as Te, $isListItemNode as P } from "@lexical/list";
|
|
10
|
+
import { HeadingNode as $t, QuoteNode as Dt, $isHeadingNode as xe, $createHeadingNode as Le, $createQuoteNode as we } from "@lexical/rich-text";
|
|
11
|
+
import { TableNode as Bt, TableRowNode as Pt, TableCellNode as Ht, INSERT_TABLE_COMMAND as ye, $getTableCellNodeFromLexicalNode as Ne, $deleteTableColumn__EXPERIMENTAL as Se, $deleteTableRow__EXPERIMENTAL as Ee, $insertTableColumn__EXPERIMENTAL as Mt, $insertTableRow__EXPERIMENTAL as _t } from "@lexical/table";
|
|
12
|
+
import { jsx as o, jsxs as g, Fragment as U } from "react/jsx-runtime";
|
|
13
|
+
import { createContext as Ie, useState as f, useRef as q, useCallback as C, useContext as Re, useEffect as y, useMemo as Ft, useLayoutEffect as Oe } from "react";
|
|
14
|
+
import { Box as H, Stack as ze, Button as N, DropdownMenu as dt, ToolbarButton as Ut, DropdownMenuIconItem as _, ToolbarToggleGroup as Wt, ToolbarToggleItem as D, OverlayCard as jt, Toolbar as Ae, ToolbarSeparator as $e, styled as De, Spinner as ht, Dialog as Kt, DialogHeader as Be, TextInput as ut, DialogActions as Z, DropdownMenuItem as $, DropdownMenuSeparator as Tt, NavBar as Pe, NavBarItem as ot, Combobox as He } from "./ui.es.js";
|
|
15
|
+
import { f as Fe, g as Ue, G as k, h as We, i as je } from "./index.esm-da01383a.js";
|
|
16
16
|
import { useLexicalComposerContext as T } from "@lexical/react/LexicalComposerContext.js";
|
|
17
|
-
import { LexicalComposer as
|
|
18
|
-
import { RichTextPlugin as
|
|
19
|
-
import
|
|
20
|
-
import { useFloating as gt, autoUpdate as
|
|
21
|
-
import { $getNearestNodeOfType as
|
|
22
|
-
import { s as
|
|
23
|
-
import { ListPlugin as
|
|
24
|
-
import { HistoryPlugin as
|
|
25
|
-
import { TablePlugin as
|
|
26
|
-
import { TabIndentationPlugin as
|
|
27
|
-
import { useLexicalComposerContext as
|
|
17
|
+
import { LexicalComposer as Ke } from "@lexical/react/LexicalComposer.js";
|
|
18
|
+
import { RichTextPlugin as qe } from "@lexical/react/LexicalRichTextPlugin.js";
|
|
19
|
+
import Ye from "@lexical/react/LexicalErrorBoundary.js";
|
|
20
|
+
import { useFloating as gt, autoUpdate as qt, size as Ge, flip as Je, offset as Yt, shift as Xe, useInteractions as Gt, useRole as Jt, FloatingPortal as Xt, inline as Qe, useDismiss as Ve } from "@floating-ui/react";
|
|
21
|
+
import { $getNearestNodeOfType as Ze, $findMatchingParent as Qt, mergeRegister as tt, isHTMLElement as xt, $wrapNodeInElement as tr } from "@lexical/utils";
|
|
22
|
+
import { s as er, c as rr } from "./stitches.config-00c23cdb.js";
|
|
23
|
+
import { ListPlugin as nr } from "@lexical/react/LexicalListPlugin.js";
|
|
24
|
+
import { HistoryPlugin as or } from "@lexical/react/LexicalHistoryPlugin.js";
|
|
25
|
+
import { TablePlugin as ir } from "@lexical/react/LexicalTablePlugin.js";
|
|
26
|
+
import { TabIndentationPlugin as ar } from "@lexical/react/LexicalTabIndentationPlugin.js";
|
|
27
|
+
import { useLexicalComposerContext as lr } from "@lexical/react/LexicalComposerContext";
|
|
28
28
|
import "@stitches/react";
|
|
29
|
-
const
|
|
29
|
+
const sr = ({
|
|
30
30
|
text: t,
|
|
31
31
|
maxChars: r,
|
|
32
32
|
maxLines: e
|
|
@@ -36,21 +36,21 @@ const lr = ({
|
|
|
36
36
|
const n = typeof e == "number", i = typeof r == "number";
|
|
37
37
|
if (!n && !i)
|
|
38
38
|
return t.length;
|
|
39
|
-
let
|
|
40
|
-
for (;
|
|
41
|
-
t[
|
|
42
|
-
` &&
|
|
43
|
-
return t.slice(0,
|
|
44
|
-
},
|
|
39
|
+
let l = 0, a = 0;
|
|
40
|
+
for (; a < t.length && (!n || l < e) && (!i || a < r); )
|
|
41
|
+
t[a] === `
|
|
42
|
+
` && l++, a++;
|
|
43
|
+
return t.slice(0, a).length;
|
|
44
|
+
}, Vt = ({
|
|
45
45
|
editor: t,
|
|
46
46
|
maxChars: r,
|
|
47
47
|
maxLines: e
|
|
48
48
|
}) => {
|
|
49
|
-
const n =
|
|
50
|
-
|
|
49
|
+
const n = j(), i = n.getTextContent(), l = sr({ text: i, maxChars: r, maxLines: e }), a = i.length - l, d = n.select().anchor;
|
|
50
|
+
Ce(t, d, a);
|
|
51
51
|
const c = n.getLastChild();
|
|
52
|
-
return c instanceof
|
|
53
|
-
},
|
|
52
|
+
return c instanceof le && c.getChildrenSize() === 0 && c.remove(), a;
|
|
53
|
+
}, pt = {
|
|
54
54
|
quote: "ain-rich-text-quote",
|
|
55
55
|
text: {
|
|
56
56
|
bold: "ain-rich-text-bold",
|
|
@@ -62,13 +62,13 @@ const lr = ({
|
|
|
62
62
|
listitem: "ain-rich-text-nested-list-item"
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
},
|
|
65
|
+
}, mt = (t) => t[0] === "{", cr = (t) => t !== null && typeof t == "object" && "isEmpty" in t, dr = (t, r) => {
|
|
66
66
|
t.update(
|
|
67
67
|
() => {
|
|
68
|
-
const e =
|
|
68
|
+
const e = j();
|
|
69
69
|
e.clear();
|
|
70
|
-
const n =
|
|
71
|
-
n.append(
|
|
70
|
+
const n = F();
|
|
71
|
+
n.append(I("")), e.append(n), Q(null);
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
tag: r
|
|
@@ -77,33 +77,33 @@ const lr = ({
|
|
|
77
77
|
}, hr = (t, r, e) => {
|
|
78
78
|
r.update(
|
|
79
79
|
() => {
|
|
80
|
-
const n =
|
|
80
|
+
const n = j();
|
|
81
81
|
n.clear();
|
|
82
|
-
const i =
|
|
83
|
-
i.append(
|
|
82
|
+
const i = F();
|
|
83
|
+
i.append(I(t.trim())), n.append(i), Q(null);
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
tag: e
|
|
87
87
|
}
|
|
88
88
|
), r.blur();
|
|
89
89
|
}, En = async (t, r, e) => {
|
|
90
|
-
var
|
|
90
|
+
var a;
|
|
91
91
|
let n = 0;
|
|
92
|
-
const i =
|
|
92
|
+
const i = Nt({
|
|
93
93
|
nodes: r,
|
|
94
94
|
editable: !1,
|
|
95
|
-
theme:
|
|
95
|
+
theme: pt
|
|
96
96
|
});
|
|
97
97
|
if (t)
|
|
98
98
|
try {
|
|
99
|
-
if (typeof t == "string" && !
|
|
99
|
+
if (typeof t == "string" && !mt(t))
|
|
100
100
|
i.update(() => {
|
|
101
|
-
const s =
|
|
102
|
-
d.append(
|
|
101
|
+
const s = j(), d = F();
|
|
102
|
+
d.append(I(t.trim())), s.append(d);
|
|
103
103
|
});
|
|
104
104
|
else {
|
|
105
105
|
const s = i.parseEditorState(t, () => {
|
|
106
|
-
(e == null ? void 0 : e.maxLines) !== void 0 && (n =
|
|
106
|
+
(e == null ? void 0 : e.maxLines) !== void 0 && (n = Vt({
|
|
107
107
|
editor: i,
|
|
108
108
|
maxLines: e.maxLines
|
|
109
109
|
}));
|
|
@@ -113,28 +113,58 @@ const lr = ({
|
|
|
113
113
|
} catch (s) {
|
|
114
114
|
console.error(s);
|
|
115
115
|
}
|
|
116
|
-
await ((
|
|
117
|
-
let
|
|
116
|
+
await ((a = e == null ? void 0 : e.updateFn) == null ? void 0 : a.call(e, i));
|
|
117
|
+
let l = "";
|
|
118
118
|
return i.read(() => {
|
|
119
|
-
|
|
120
|
-
}), { html:
|
|
119
|
+
l = St(i);
|
|
120
|
+
}), { html: l, trimCount: n };
|
|
121
|
+
}, In = (t, r, e) => {
|
|
122
|
+
let n = 0;
|
|
123
|
+
const i = Nt({
|
|
124
|
+
nodes: r,
|
|
125
|
+
editable: !1,
|
|
126
|
+
theme: pt
|
|
127
|
+
});
|
|
128
|
+
if (t)
|
|
129
|
+
try {
|
|
130
|
+
if (typeof t == "string" && !mt(t))
|
|
131
|
+
i.update(() => {
|
|
132
|
+
const a = j(), s = F();
|
|
133
|
+
s.append(I(t.trim())), a.append(s);
|
|
134
|
+
});
|
|
135
|
+
else {
|
|
136
|
+
const a = i.parseEditorState(t, () => {
|
|
137
|
+
(e == null ? void 0 : e.maxLines) !== void 0 && (n = Vt({
|
|
138
|
+
editor: i,
|
|
139
|
+
maxLines: e.maxLines
|
|
140
|
+
}));
|
|
141
|
+
});
|
|
142
|
+
a.isEmpty() || i.setEditorState(a);
|
|
143
|
+
}
|
|
144
|
+
} catch (a) {
|
|
145
|
+
console.error(a);
|
|
146
|
+
}
|
|
147
|
+
let l = "";
|
|
148
|
+
return i.read(() => {
|
|
149
|
+
l = St(i);
|
|
150
|
+
}), { html: l, trimCount: n };
|
|
121
151
|
};
|
|
122
|
-
class
|
|
152
|
+
class J extends B {
|
|
123
153
|
static getType() {
|
|
124
154
|
return "target-link";
|
|
125
155
|
}
|
|
126
156
|
constructor(r, e, n) {
|
|
127
157
|
let i = !1;
|
|
128
|
-
const
|
|
158
|
+
const l = { ...e };
|
|
129
159
|
try {
|
|
130
|
-
const
|
|
131
|
-
window.location.hostname !==
|
|
160
|
+
const a = new URL(r);
|
|
161
|
+
window.location.hostname !== a.hostname && (i = !0);
|
|
132
162
|
} catch {
|
|
133
163
|
}
|
|
134
|
-
i && (
|
|
164
|
+
i && (l.target = "_blank", l.rel = "noopener noreferrer"), super(r, l, n);
|
|
135
165
|
}
|
|
136
166
|
static clone(r) {
|
|
137
|
-
return new
|
|
167
|
+
return new J(
|
|
138
168
|
r.__url,
|
|
139
169
|
{ rel: r.__rel, target: r.__target, title: r.__title },
|
|
140
170
|
r.__key
|
|
@@ -147,10 +177,10 @@ class G extends B {
|
|
|
147
177
|
return B.importJSON(r);
|
|
148
178
|
}
|
|
149
179
|
}
|
|
150
|
-
const
|
|
151
|
-
const [r, e] = f(!1), n =
|
|
180
|
+
const Zt = Ie({ hasFocus: !1, editorRef: { current: null }, signUrl: void 0 }), ur = ({ onBlur: t }) => {
|
|
181
|
+
const [r, e] = f(!1), n = q(null), i = C(() => {
|
|
152
182
|
e(!0), n.current && window.clearTimeout(n.current);
|
|
153
|
-
}, []),
|
|
183
|
+
}, []), l = C(() => {
|
|
154
184
|
n.current = window.setTimeout(() => {
|
|
155
185
|
e(!1), t == null || t();
|
|
156
186
|
}, 0);
|
|
@@ -159,10 +189,10 @@ const Xt = Ee({ hasFocus: !1, editorRef: { current: null }, signUrl: void 0 }),
|
|
|
159
189
|
hasFocus: r,
|
|
160
190
|
attributes: {
|
|
161
191
|
onFocus: i,
|
|
162
|
-
onBlur:
|
|
192
|
+
onBlur: l
|
|
163
193
|
}
|
|
164
194
|
};
|
|
165
|
-
}, et = () =>
|
|
195
|
+
}, et = () => Re(Zt), gr = (t) => t.startsWith("https://devfilesab.blob.core.windows.net") || t.startsWith("https://filesab.blob.core.windows.net");
|
|
166
196
|
function pr({
|
|
167
197
|
src: t,
|
|
168
198
|
altText: r,
|
|
@@ -170,19 +200,19 @@ function pr({
|
|
|
170
200
|
height: n,
|
|
171
201
|
nodeKey: i
|
|
172
202
|
}) {
|
|
173
|
-
const { signUrl:
|
|
203
|
+
const { signUrl: l } = et(), [a, s] = f(gr(t) ? "" : t), [d, c] = f(!1), u = q(!1), [p] = T();
|
|
174
204
|
y(() => {
|
|
175
205
|
const h = async () => {
|
|
176
|
-
s(await (
|
|
206
|
+
s(await (l == null ? void 0 : l(t)) ?? t);
|
|
177
207
|
};
|
|
178
|
-
!
|
|
208
|
+
!a && !u.current && (u.current = !0, h());
|
|
179
209
|
}, []);
|
|
180
210
|
const m = (h) => (v) => {
|
|
181
211
|
v.relatedTarget instanceof HTMLElement && v.relatedTarget.dataset.controls === "true" || c(h);
|
|
182
212
|
}, S = () => {
|
|
183
213
|
p.update(() => {
|
|
184
214
|
var M;
|
|
185
|
-
const h =
|
|
215
|
+
const h = vt(i);
|
|
186
216
|
if (!h)
|
|
187
217
|
return;
|
|
188
218
|
const v = h.getPreviousSibling() || ((M = h.getParent()) == null ? void 0 : M.getPreviousSibling());
|
|
@@ -191,16 +221,16 @@ function pr({
|
|
|
191
221
|
}, E = () => {
|
|
192
222
|
p.update(() => {
|
|
193
223
|
var M;
|
|
194
|
-
const h =
|
|
224
|
+
const h = vt(i);
|
|
195
225
|
if (!h)
|
|
196
226
|
return;
|
|
197
227
|
const v = h.getNextSibling() || ((M = h.getParent()) == null ? void 0 : M.getNextSibling());
|
|
198
228
|
v && v.insertAfter(h);
|
|
199
229
|
});
|
|
200
230
|
};
|
|
201
|
-
return
|
|
231
|
+
return a ? /* @__PURE__ */ g(H, { css: { position: "relative" }, children: [
|
|
202
232
|
/* @__PURE__ */ g(
|
|
203
|
-
|
|
233
|
+
ze,
|
|
204
234
|
{
|
|
205
235
|
css: {
|
|
206
236
|
position: "absolute",
|
|
@@ -221,7 +251,7 @@ function pr({
|
|
|
221
251
|
size: "sm",
|
|
222
252
|
css: { width: "20px", height: "20px" },
|
|
223
253
|
onClick: S,
|
|
224
|
-
children: /* @__PURE__ */ o(
|
|
254
|
+
children: /* @__PURE__ */ o(Fe, {})
|
|
225
255
|
}
|
|
226
256
|
),
|
|
227
257
|
/* @__PURE__ */ o(
|
|
@@ -231,7 +261,7 @@ function pr({
|
|
|
231
261
|
size: "sm",
|
|
232
262
|
css: { width: "20px", height: "20px" },
|
|
233
263
|
onClick: E,
|
|
234
|
-
children: /* @__PURE__ */ o(
|
|
264
|
+
children: /* @__PURE__ */ o(Ue, {})
|
|
235
265
|
}
|
|
236
266
|
)
|
|
237
267
|
]
|
|
@@ -240,7 +270,7 @@ function pr({
|
|
|
240
270
|
/* @__PURE__ */ o(
|
|
241
271
|
"img",
|
|
242
272
|
{
|
|
243
|
-
src:
|
|
273
|
+
src: a,
|
|
244
274
|
alt: r,
|
|
245
275
|
style: {
|
|
246
276
|
height: n,
|
|
@@ -255,18 +285,18 @@ function pr({
|
|
|
255
285
|
] }) : /* @__PURE__ */ o("span", {});
|
|
256
286
|
}
|
|
257
287
|
function mr(t) {
|
|
258
|
-
const r = t, { alt: e, src: n, width: i, height:
|
|
259
|
-
return { node:
|
|
288
|
+
const r = t, { alt: e, src: n, width: i, height: l } = r;
|
|
289
|
+
return { node: ft({ altText: e, height: l, src: n, width: i }) };
|
|
260
290
|
}
|
|
261
|
-
class A extends
|
|
262
|
-
constructor(e, n, i,
|
|
291
|
+
class A extends se {
|
|
292
|
+
constructor(e, n, i, l, a, s) {
|
|
263
293
|
super(s);
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
this.__src = e, this.__altText = n, this.__width = i || "inherit", this.__height =
|
|
294
|
+
R(this, "__src");
|
|
295
|
+
R(this, "__altText");
|
|
296
|
+
R(this, "__width");
|
|
297
|
+
R(this, "__height");
|
|
298
|
+
R(this, "__meta");
|
|
299
|
+
this.__src = e, this.__altText = n, this.__width = i || "inherit", this.__height = l || "inherit", this.__meta = a;
|
|
270
300
|
}
|
|
271
301
|
static getType() {
|
|
272
302
|
return "image";
|
|
@@ -282,12 +312,12 @@ class A extends le {
|
|
|
282
312
|
);
|
|
283
313
|
}
|
|
284
314
|
static importJSON(e) {
|
|
285
|
-
const { altText: n, height: i, width:
|
|
286
|
-
return
|
|
315
|
+
const { altText: n, height: i, width: l, src: a, meta: s } = e;
|
|
316
|
+
return ft({
|
|
287
317
|
altText: n,
|
|
288
318
|
height: i,
|
|
289
|
-
src:
|
|
290
|
-
width:
|
|
319
|
+
src: a,
|
|
320
|
+
width: l,
|
|
291
321
|
meta: s
|
|
292
322
|
});
|
|
293
323
|
}
|
|
@@ -351,47 +381,47 @@ class A extends le {
|
|
|
351
381
|
);
|
|
352
382
|
}
|
|
353
383
|
}
|
|
354
|
-
function
|
|
384
|
+
function ft({
|
|
355
385
|
altText: t,
|
|
356
386
|
height: r,
|
|
357
387
|
src: e,
|
|
358
388
|
width: n,
|
|
359
389
|
meta: i,
|
|
360
|
-
key:
|
|
390
|
+
key: l
|
|
361
391
|
}) {
|
|
362
|
-
return
|
|
363
|
-
new A(e, t, n, r, i,
|
|
392
|
+
return ce(
|
|
393
|
+
new A(e, t, n, r, i, l)
|
|
364
394
|
);
|
|
365
395
|
}
|
|
366
|
-
function
|
|
396
|
+
function Rn(t) {
|
|
367
397
|
return t instanceof A;
|
|
368
398
|
}
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
|
|
399
|
+
const On = [
|
|
400
|
+
$t,
|
|
401
|
+
Dt,
|
|
372
402
|
st,
|
|
373
|
-
Et,
|
|
374
|
-
St,
|
|
375
|
-
B,
|
|
376
403
|
zt,
|
|
377
|
-
At,
|
|
378
|
-
$t,
|
|
379
|
-
A
|
|
380
|
-
], On = [
|
|
381
|
-
Rt,
|
|
382
404
|
Ot,
|
|
383
|
-
st,
|
|
384
|
-
Et,
|
|
385
|
-
St,
|
|
386
405
|
B,
|
|
387
|
-
|
|
388
|
-
|
|
406
|
+
Bt,
|
|
407
|
+
Pt,
|
|
408
|
+
Ht,
|
|
409
|
+
A
|
|
410
|
+
], zn = [
|
|
389
411
|
$t,
|
|
412
|
+
Dt,
|
|
413
|
+
st,
|
|
414
|
+
zt,
|
|
415
|
+
Ot,
|
|
416
|
+
B,
|
|
417
|
+
Bt,
|
|
418
|
+
Pt,
|
|
419
|
+
Ht,
|
|
390
420
|
A,
|
|
391
|
-
|
|
421
|
+
J,
|
|
392
422
|
{
|
|
393
423
|
replace: B,
|
|
394
|
-
with: (t) => new
|
|
424
|
+
with: (t) => new J(
|
|
395
425
|
t.getURL(),
|
|
396
426
|
{ rel: t.__rel, target: t.__target, title: t.__title }
|
|
397
427
|
)
|
|
@@ -451,10 +481,10 @@ function Rr(t) {
|
|
|
451
481
|
function Or(t) {
|
|
452
482
|
return k({ 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);
|
|
453
483
|
}
|
|
454
|
-
const zr =
|
|
484
|
+
const zr = er("div", {
|
|
455
485
|
width: "10rem",
|
|
456
486
|
display: "flex"
|
|
457
|
-
}),
|
|
487
|
+
}), te = {
|
|
458
488
|
bullet: "Punktliste",
|
|
459
489
|
h1: "Overskrift 1",
|
|
460
490
|
h2: "Overskrift 2",
|
|
@@ -480,7 +510,7 @@ const zr = tr("div", {
|
|
|
480
510
|
quote: /* @__PURE__ */ o(Er, { size: "1.25rem" })
|
|
481
511
|
}, x = ({
|
|
482
512
|
blockType: t
|
|
483
|
-
}) => /* @__PURE__ */ g(
|
|
513
|
+
}) => /* @__PURE__ */ g(U, { children: [
|
|
484
514
|
/* @__PURE__ */ o(H, { css: { display: "flex", flex: "0 0 auto" }, children: Ar[t] }),
|
|
485
515
|
/* @__PURE__ */ o(
|
|
486
516
|
H,
|
|
@@ -491,16 +521,16 @@ const zr = tr("div", {
|
|
|
491
521
|
textOverflow: "ellipsis",
|
|
492
522
|
whiteSpace: "nowrap"
|
|
493
523
|
},
|
|
494
|
-
children:
|
|
524
|
+
children: te[t]
|
|
495
525
|
}
|
|
496
526
|
)
|
|
497
527
|
] }), $r = (t) => {
|
|
498
528
|
if (!w(t))
|
|
499
529
|
return null;
|
|
500
530
|
const r = t.anchor.getNode();
|
|
501
|
-
let e = r.getKey() === "root" ? r :
|
|
531
|
+
let e = r.getKey() === "root" ? r : Qt(r, (n) => {
|
|
502
532
|
const i = n.getParent();
|
|
503
|
-
return i !== null &&
|
|
533
|
+
return i !== null && Et(i);
|
|
504
534
|
});
|
|
505
535
|
return e === null && (e = r.getTopLevelElementOrThrow()), {
|
|
506
536
|
anchorNode: r,
|
|
@@ -509,7 +539,7 @@ const zr = tr("div", {
|
|
|
509
539
|
}, Dr = () => {
|
|
510
540
|
const [t] = T(), [r, e] = f("paragraph");
|
|
511
541
|
y(() => t.registerCommand(
|
|
512
|
-
|
|
542
|
+
K,
|
|
513
543
|
() => {
|
|
514
544
|
const c = L(), u = $r(c);
|
|
515
545
|
if (!u)
|
|
@@ -517,14 +547,14 @@ const zr = tr("div", {
|
|
|
517
547
|
const { element: p, anchorNode: m } = u, S = p.getKey();
|
|
518
548
|
if (t.getElementByKey(S) !== null)
|
|
519
549
|
if (ct(p)) {
|
|
520
|
-
const h =
|
|
550
|
+
const h = Ze(
|
|
521
551
|
m,
|
|
522
552
|
st
|
|
523
553
|
), v = h ? h.getListType() : p.getListType();
|
|
524
554
|
e(v);
|
|
525
555
|
} else {
|
|
526
|
-
const h =
|
|
527
|
-
h in
|
|
556
|
+
const h = xe(p) ? p.getTag() : p.getType();
|
|
557
|
+
h in te && e(h);
|
|
528
558
|
}
|
|
529
559
|
return !1;
|
|
530
560
|
},
|
|
@@ -533,14 +563,14 @@ const zr = tr("div", {
|
|
|
533
563
|
const n = (c) => {
|
|
534
564
|
r !== c && t.update(() => {
|
|
535
565
|
const u = L();
|
|
536
|
-
w(u) && (nt(u, () =>
|
|
566
|
+
w(u) && (nt(u, () => Le(c)), e(c));
|
|
537
567
|
});
|
|
538
568
|
};
|
|
539
569
|
return /* @__PURE__ */ o(zr, { children: /* @__PURE__ */ g(
|
|
540
570
|
dt,
|
|
541
571
|
{
|
|
542
572
|
trigger: /* @__PURE__ */ o(
|
|
543
|
-
|
|
573
|
+
Ut,
|
|
544
574
|
{
|
|
545
575
|
dropdown: !0,
|
|
546
576
|
css: { display: "flex", width: "100%", overflow: "hidden" },
|
|
@@ -553,7 +583,7 @@ const zr = tr("div", {
|
|
|
553
583
|
/* @__PURE__ */ o(_, { onClick: () => {
|
|
554
584
|
r !== "paragraph" && t.update(() => {
|
|
555
585
|
const c = L();
|
|
556
|
-
w(c) && (nt(c, () =>
|
|
586
|
+
w(c) && (nt(c, () => F()), e("paragraph"));
|
|
557
587
|
});
|
|
558
588
|
}, children: /* @__PURE__ */ o(x, { blockType: "paragraph" }) }),
|
|
559
589
|
/* @__PURE__ */ o(_, { onClick: () => n("h1"), children: /* @__PURE__ */ o(x, { blockType: "h1" }) }),
|
|
@@ -563,31 +593,31 @@ const zr = tr("div", {
|
|
|
563
593
|
/* @__PURE__ */ o(_, { onClick: () => n("h5"), children: /* @__PURE__ */ o(x, { blockType: "h5" }) }),
|
|
564
594
|
/* @__PURE__ */ o(_, { onClick: () => n("h6"), children: /* @__PURE__ */ o(x, { blockType: "h6" }) }),
|
|
565
595
|
/* @__PURE__ */ o(_, { onClick: () => {
|
|
566
|
-
r !== "bullet" && (t.dispatchCommand(
|
|
596
|
+
r !== "bullet" && (t.dispatchCommand(Me, void 0), e("bullet"));
|
|
567
597
|
}, children: /* @__PURE__ */ o(x, { blockType: "bullet" }) }),
|
|
568
598
|
/* @__PURE__ */ o(_, { onClick: () => {
|
|
569
|
-
r !== "number" && (t.dispatchCommand(
|
|
599
|
+
r !== "number" && (t.dispatchCommand(_e, void 0), e("number"));
|
|
570
600
|
}, children: /* @__PURE__ */ o(x, { blockType: "number" }) }),
|
|
571
601
|
/* @__PURE__ */ o(_, { onClick: () => {
|
|
572
|
-
r !== "check" && (t.dispatchCommand(
|
|
602
|
+
r !== "check" && (t.dispatchCommand(At, void 0), e("check"));
|
|
573
603
|
}, children: /* @__PURE__ */ o(x, { blockType: "check" }) }),
|
|
574
604
|
/* @__PURE__ */ o(_, { onClick: () => {
|
|
575
605
|
r !== "quote" && t.update(() => {
|
|
576
606
|
const c = L();
|
|
577
|
-
w(c) && (nt(c, () =>
|
|
607
|
+
w(c) && (nt(c, () => we()), e("quote"));
|
|
578
608
|
});
|
|
579
609
|
}, children: /* @__PURE__ */ o(x, { blockType: "quote" }) })
|
|
580
610
|
]
|
|
581
611
|
}
|
|
582
612
|
) });
|
|
583
613
|
}, Br = () => {
|
|
584
|
-
const [t] = T(), [r, e] = f(!1), [n, i] = f(!1), [
|
|
614
|
+
const [t] = T(), [r, e] = f(!1), [n, i] = f(!1), [l, a] = f(!1), [s, d] = f(!1), [c, u] = f(!1), p = C(() => {
|
|
585
615
|
const b = L();
|
|
586
|
-
w(b) && (e(b.hasFormat("bold")), i(b.hasFormat("italic")),
|
|
616
|
+
w(b) && (e(b.hasFormat("bold")), i(b.hasFormat("italic")), a(b.hasFormat("underline")), d(b.hasFormat("code")), u(b.hasFormat("superscript")));
|
|
587
617
|
}, []);
|
|
588
618
|
y(() => tt(
|
|
589
619
|
t.registerCommand(
|
|
590
|
-
|
|
620
|
+
K,
|
|
591
621
|
() => (p(), !1),
|
|
592
622
|
at
|
|
593
623
|
),
|
|
@@ -598,26 +628,26 @@ const zr = tr("div", {
|
|
|
598
628
|
})
|
|
599
629
|
), [t, p]);
|
|
600
630
|
const m = C(
|
|
601
|
-
() => t.dispatchCommand(
|
|
631
|
+
() => t.dispatchCommand(W, "bold"),
|
|
602
632
|
[t]
|
|
603
633
|
), S = C(
|
|
604
|
-
() => t.dispatchCommand(
|
|
634
|
+
() => t.dispatchCommand(W, "italic"),
|
|
605
635
|
[t]
|
|
606
636
|
), E = C(
|
|
607
|
-
() => t.dispatchCommand(
|
|
637
|
+
() => t.dispatchCommand(W, "underline"),
|
|
608
638
|
[t]
|
|
609
639
|
), h = C(
|
|
610
|
-
() => t.dispatchCommand(
|
|
640
|
+
() => t.dispatchCommand(W, "code"),
|
|
611
641
|
[t]
|
|
612
642
|
), v = C(
|
|
613
|
-
() => t.dispatchCommand(
|
|
643
|
+
() => t.dispatchCommand(W, "superscript"),
|
|
614
644
|
[t]
|
|
615
|
-
), M =
|
|
645
|
+
), M = Ft(() => {
|
|
616
646
|
const b = [];
|
|
617
|
-
return r && b.push("bold"), n && b.push("italic"),
|
|
618
|
-
}, [r, n,
|
|
647
|
+
return r && b.push("bold"), n && b.push("italic"), l && b.push("underline"), s && b.push("code"), c && b.push("superscript"), b;
|
|
648
|
+
}, [r, n, l, s, c]);
|
|
619
649
|
return /* @__PURE__ */ g(
|
|
620
|
-
|
|
650
|
+
Wt,
|
|
621
651
|
{
|
|
622
652
|
type: "multiple",
|
|
623
653
|
"aria-label": "Tekstformattering",
|
|
@@ -656,39 +686,39 @@ const zr = tr("div", {
|
|
|
656
686
|
}
|
|
657
687
|
);
|
|
658
688
|
}, Pr = ({ children: t }) => {
|
|
659
|
-
const { hasFocus: r, editorRef: e } = et(), n = r, [i,
|
|
660
|
-
|
|
661
|
-
|
|
689
|
+
const { hasFocus: r, editorRef: e } = et(), n = r, [i, l] = f(n);
|
|
690
|
+
Oe(() => {
|
|
691
|
+
l(n);
|
|
662
692
|
}, [n]);
|
|
663
|
-
const { context:
|
|
693
|
+
const { context: a, refs: s, floatingStyles: d } = gt({
|
|
664
694
|
placement: "top",
|
|
665
|
-
whileElementsMounted:
|
|
695
|
+
whileElementsMounted: qt,
|
|
666
696
|
middleware: [
|
|
667
|
-
|
|
697
|
+
Ge({
|
|
668
698
|
apply: ({ rects: u, elements: p }) => {
|
|
669
699
|
p.floating.style.minWidth = `${u.reference.width}px`;
|
|
670
700
|
}
|
|
671
701
|
}),
|
|
672
|
-
|
|
673
|
-
|
|
702
|
+
Je(),
|
|
703
|
+
Yt({
|
|
674
704
|
mainAxis: 8
|
|
675
705
|
}),
|
|
676
|
-
|
|
706
|
+
Xe({
|
|
677
707
|
padding: 8
|
|
678
708
|
})
|
|
679
709
|
],
|
|
680
710
|
open: i,
|
|
681
|
-
onOpenChange:
|
|
711
|
+
onOpenChange: l,
|
|
682
712
|
elements: {
|
|
683
713
|
reference: e.current
|
|
684
714
|
}
|
|
685
|
-
}), { getFloatingProps: c } =
|
|
686
|
-
|
|
715
|
+
}), { getFloatingProps: c } = Gt([
|
|
716
|
+
Jt(a, {
|
|
687
717
|
role: "dialog"
|
|
688
718
|
})
|
|
689
719
|
]);
|
|
690
|
-
return i ? /* @__PURE__ */ o(
|
|
691
|
-
|
|
720
|
+
return i ? /* @__PURE__ */ o(Xt, { children: /* @__PURE__ */ o(
|
|
721
|
+
jt,
|
|
692
722
|
{
|
|
693
723
|
ref: s.setFloating,
|
|
694
724
|
style: d,
|
|
@@ -705,9 +735,9 @@ const zr = tr("div", {
|
|
|
705
735
|
}, Hr = ({
|
|
706
736
|
children: t,
|
|
707
737
|
...r
|
|
708
|
-
}) => /* @__PURE__ */ g(
|
|
738
|
+
}) => /* @__PURE__ */ g(Ae, { "aria-label": "Formattering", ...r, children: [
|
|
709
739
|
/* @__PURE__ */ o(Dr, {}),
|
|
710
|
-
/* @__PURE__ */ o(
|
|
740
|
+
/* @__PURE__ */ o($e, {}),
|
|
711
741
|
/* @__PURE__ */ o(Br, {}),
|
|
712
742
|
t
|
|
713
743
|
] });
|
|
@@ -715,22 +745,22 @@ function Fr() {
|
|
|
715
745
|
const [t] = T();
|
|
716
746
|
return y(() => tt(
|
|
717
747
|
t.registerCommand(
|
|
718
|
-
|
|
719
|
-
() => (
|
|
720
|
-
|
|
748
|
+
At,
|
|
749
|
+
() => (Te(t, "check"), !0),
|
|
750
|
+
O
|
|
721
751
|
),
|
|
722
752
|
t.registerCommand(
|
|
723
|
-
|
|
724
|
-
(r) =>
|
|
725
|
-
|
|
753
|
+
de,
|
|
754
|
+
(r) => yt(r, t, !1),
|
|
755
|
+
O
|
|
726
756
|
),
|
|
727
757
|
t.registerCommand(
|
|
728
|
-
|
|
729
|
-
(r) =>
|
|
730
|
-
|
|
758
|
+
he,
|
|
759
|
+
(r) => yt(r, t, !0),
|
|
760
|
+
O
|
|
731
761
|
),
|
|
732
762
|
t.registerCommand(
|
|
733
|
-
|
|
763
|
+
It,
|
|
734
764
|
(r) => {
|
|
735
765
|
if (it() != null) {
|
|
736
766
|
const n = t.getRootElement();
|
|
@@ -738,10 +768,10 @@ function Fr() {
|
|
|
738
768
|
}
|
|
739
769
|
return !1;
|
|
740
770
|
},
|
|
741
|
-
|
|
771
|
+
O
|
|
742
772
|
),
|
|
743
773
|
t.registerCommand(
|
|
744
|
-
|
|
774
|
+
ue,
|
|
745
775
|
(r) => {
|
|
746
776
|
const e = it();
|
|
747
777
|
return e != null && t.isEditable() ? (t.update(() => {
|
|
@@ -749,23 +779,23 @@ function Fr() {
|
|
|
749
779
|
P(n) && (r.preventDefault(), n.toggleChecked());
|
|
750
780
|
}), !0) : !1;
|
|
751
781
|
},
|
|
752
|
-
|
|
782
|
+
O
|
|
753
783
|
),
|
|
754
784
|
t.registerCommand(
|
|
755
|
-
|
|
785
|
+
ge,
|
|
756
786
|
(r) => t.getEditorState().read(() => {
|
|
757
787
|
const e = L();
|
|
758
788
|
if (w(e) && e.isCollapsed()) {
|
|
759
789
|
const { anchor: n } = e, i = n.type === "element";
|
|
760
790
|
if (i || n.offset === 0) {
|
|
761
|
-
const
|
|
762
|
-
|
|
763
|
-
(s) =>
|
|
791
|
+
const l = n.getNode(), a = Qt(
|
|
792
|
+
l,
|
|
793
|
+
(s) => pe(s) && !s.isInline()
|
|
764
794
|
);
|
|
765
|
-
if (P(
|
|
766
|
-
const s =
|
|
767
|
-
if (ct(s) && s.getListType() === "check" && (i ||
|
|
768
|
-
const d = t.getElementByKey(
|
|
795
|
+
if (P(a)) {
|
|
796
|
+
const s = a.getParent();
|
|
797
|
+
if (ct(s) && s.getListType() === "check" && (i || a.getFirstDescendant() === l)) {
|
|
798
|
+
const d = t.getElementByKey(a.__key);
|
|
769
799
|
if (d != null && document.activeElement !== d)
|
|
770
800
|
return d.focus(), r.preventDefault(), !0;
|
|
771
801
|
}
|
|
@@ -774,28 +804,28 @@ function Fr() {
|
|
|
774
804
|
}
|
|
775
805
|
return !1;
|
|
776
806
|
}),
|
|
777
|
-
|
|
807
|
+
O
|
|
778
808
|
),
|
|
779
809
|
t.registerRootListener((r, e) => {
|
|
780
|
-
r !== null && (r.addEventListener("click",
|
|
810
|
+
r !== null && (r.addEventListener("click", Lt), r.addEventListener("pointerdown", wt)), e !== null && (e.removeEventListener("click", Lt), e.removeEventListener("pointerdown", wt));
|
|
781
811
|
})
|
|
782
812
|
), [t]), null;
|
|
783
813
|
}
|
|
784
|
-
function
|
|
814
|
+
function ee(t, r) {
|
|
785
815
|
const e = t.target;
|
|
786
|
-
if (e === null || !
|
|
816
|
+
if (e === null || !xt(e))
|
|
787
817
|
return;
|
|
788
818
|
const n = e.firstChild;
|
|
789
|
-
if (n != null &&
|
|
819
|
+
if (n != null && xt(n) && (n.tagName === "UL" || n.tagName === "OL"))
|
|
790
820
|
return;
|
|
791
821
|
const i = e.parentNode;
|
|
792
822
|
if (!i || i.__lexicalListType !== "check")
|
|
793
823
|
return;
|
|
794
|
-
const
|
|
795
|
-
(e.dir === "rtl" ?
|
|
824
|
+
const l = t.pageX, a = e.getBoundingClientRect();
|
|
825
|
+
(e.dir === "rtl" ? l < a.right && l > a.right - 20 : l > a.left && l < a.left + 20) && r();
|
|
796
826
|
}
|
|
797
|
-
function
|
|
798
|
-
|
|
827
|
+
function Lt(t) {
|
|
828
|
+
ee(t, () => {
|
|
799
829
|
const r = t.target, e = Ur(r);
|
|
800
830
|
e != null && e.isEditable() && e.update(() => {
|
|
801
831
|
if (t.target) {
|
|
@@ -805,8 +835,8 @@ function Tt(t) {
|
|
|
805
835
|
});
|
|
806
836
|
});
|
|
807
837
|
}
|
|
808
|
-
function
|
|
809
|
-
|
|
838
|
+
function wt(t) {
|
|
839
|
+
ee(t, () => {
|
|
810
840
|
t.preventDefault();
|
|
811
841
|
});
|
|
812
842
|
}
|
|
@@ -836,51 +866,51 @@ function Wr(t, r) {
|
|
|
836
866
|
}
|
|
837
867
|
return null;
|
|
838
868
|
}
|
|
839
|
-
function
|
|
869
|
+
function yt(t, r, e) {
|
|
840
870
|
const n = it();
|
|
841
871
|
return n != null && r.update(() => {
|
|
842
872
|
const i = lt(n);
|
|
843
873
|
if (!P(i))
|
|
844
874
|
return;
|
|
845
|
-
const
|
|
846
|
-
if (
|
|
847
|
-
|
|
848
|
-
const
|
|
849
|
-
|
|
850
|
-
|
|
875
|
+
const l = Wr(i, e);
|
|
876
|
+
if (l != null) {
|
|
877
|
+
l.selectStart();
|
|
878
|
+
const a = r.getElementByKey(l.__key);
|
|
879
|
+
a != null && (t.preventDefault(), setTimeout(() => {
|
|
880
|
+
a.focus();
|
|
851
881
|
}, 0));
|
|
852
882
|
}
|
|
853
883
|
}), !1;
|
|
854
884
|
}
|
|
855
|
-
const
|
|
885
|
+
const re = me("INSERT_IMAGE_COMMAND");
|
|
856
886
|
function jr() {
|
|
857
|
-
const [t] =
|
|
887
|
+
const [t] = lr();
|
|
858
888
|
return y(() => {
|
|
859
889
|
if (!t.hasNodes([A]))
|
|
860
890
|
throw new Error("ImagePlugin: ImageNode not registered on editor");
|
|
861
891
|
return tt(
|
|
862
892
|
t.registerCommand(
|
|
863
|
-
|
|
893
|
+
re,
|
|
864
894
|
(r) => {
|
|
865
|
-
const e =
|
|
866
|
-
return
|
|
895
|
+
const e = ft(r);
|
|
896
|
+
return fe([e]), Et(e.getParentOrThrow()) && tr(e, F).selectEnd(), !0;
|
|
867
897
|
},
|
|
868
|
-
|
|
898
|
+
ke
|
|
869
899
|
)
|
|
870
900
|
);
|
|
871
901
|
}, [t]), null;
|
|
872
902
|
}
|
|
873
|
-
const Kr = () => /* @__PURE__ */ g(
|
|
874
|
-
/* @__PURE__ */ o(rr, {}),
|
|
875
|
-
/* @__PURE__ */ o(or, {}),
|
|
903
|
+
const Kr = () => /* @__PURE__ */ g(U, { children: [
|
|
876
904
|
/* @__PURE__ */ o(nr, {}),
|
|
877
|
-
/* @__PURE__ */ o(Fr, {}),
|
|
878
905
|
/* @__PURE__ */ o(ir, {}),
|
|
906
|
+
/* @__PURE__ */ o(or, {}),
|
|
907
|
+
/* @__PURE__ */ o(Fr, {}),
|
|
908
|
+
/* @__PURE__ */ o(ar, {}),
|
|
879
909
|
/* @__PURE__ */ o(jr, {})
|
|
880
910
|
] }), qr = ({
|
|
881
911
|
state: t
|
|
882
912
|
}) => {
|
|
883
|
-
const [r] = T(), e =
|
|
913
|
+
const [r] = T(), e = q(!1);
|
|
884
914
|
return y(() => {
|
|
885
915
|
!t || e.current || (e.current = !0, window.queueMicrotask(() => {
|
|
886
916
|
try {
|
|
@@ -888,7 +918,7 @@ const Kr = () => /* @__PURE__ */ g(F, { children: [
|
|
|
888
918
|
t.isEmpty() ? dr(r) : r.setEditorState(t);
|
|
889
919
|
return;
|
|
890
920
|
}
|
|
891
|
-
if (typeof t == "string" && !
|
|
921
|
+
if (typeof t == "string" && !mt(t)) {
|
|
892
922
|
hr(t, r);
|
|
893
923
|
return;
|
|
894
924
|
}
|
|
@@ -899,7 +929,7 @@ const Kr = () => /* @__PURE__ */ g(F, { children: [
|
|
|
899
929
|
}
|
|
900
930
|
}));
|
|
901
931
|
}, []), null;
|
|
902
|
-
}, Yr =
|
|
932
|
+
}, Yr = De("div", {
|
|
903
933
|
border: "1px solid $borderDarker",
|
|
904
934
|
borderRadius: "$md",
|
|
905
935
|
position: "relative",
|
|
@@ -950,14 +980,14 @@ const Kr = () => /* @__PURE__ */ g(F, { children: [
|
|
|
950
980
|
},
|
|
951
981
|
children: /* @__PURE__ */ o(ht, {})
|
|
952
982
|
}
|
|
953
|
-
),
|
|
983
|
+
), An = ({
|
|
954
984
|
isLoading: t,
|
|
955
985
|
children: r,
|
|
956
986
|
placeholderText: e,
|
|
957
987
|
nodes: n,
|
|
958
988
|
plugins: i,
|
|
959
|
-
toolbar:
|
|
960
|
-
toolbarContent:
|
|
989
|
+
toolbar: l,
|
|
990
|
+
toolbarContent: a,
|
|
961
991
|
content: s,
|
|
962
992
|
hideBorder: d,
|
|
963
993
|
onBlur: c,
|
|
@@ -965,19 +995,19 @@ const Kr = () => /* @__PURE__ */ g(F, { children: [
|
|
|
965
995
|
css: p,
|
|
966
996
|
signUrl: m
|
|
967
997
|
}) => {
|
|
968
|
-
const { hasFocus: S, attributes: E } = ur({ onBlur: c }), h =
|
|
998
|
+
const { hasFocus: S, attributes: E } = ur({ onBlur: c }), h = q(null), v = Ft(
|
|
969
999
|
() => ({ hasFocus: S, editorRef: h, signUrl: m }),
|
|
970
1000
|
[S, m]
|
|
971
1001
|
);
|
|
972
|
-
return /* @__PURE__ */ o(
|
|
973
|
-
|
|
1002
|
+
return /* @__PURE__ */ o(Zt.Provider, { value: v, children: /* @__PURE__ */ g(
|
|
1003
|
+
Ke,
|
|
974
1004
|
{
|
|
975
1005
|
initialConfig: {
|
|
976
1006
|
namespace: "ain-rich-text",
|
|
977
1007
|
onError: (M) => {
|
|
978
1008
|
console.error(M);
|
|
979
1009
|
},
|
|
980
|
-
theme:
|
|
1010
|
+
theme: pt,
|
|
981
1011
|
nodes: n,
|
|
982
1012
|
editable: !0
|
|
983
1013
|
},
|
|
@@ -991,9 +1021,9 @@ const Kr = () => /* @__PURE__ */ g(F, { children: [
|
|
|
991
1021
|
css: p,
|
|
992
1022
|
...E,
|
|
993
1023
|
children: [
|
|
994
|
-
|
|
1024
|
+
l,
|
|
995
1025
|
/* @__PURE__ */ o(
|
|
996
|
-
|
|
1026
|
+
qe,
|
|
997
1027
|
{
|
|
998
1028
|
contentEditable: s,
|
|
999
1029
|
placeholder: e ? /* @__PURE__ */ o(
|
|
@@ -1010,18 +1040,18 @@ const Kr = () => /* @__PURE__ */ g(F, { children: [
|
|
|
1010
1040
|
children: e
|
|
1011
1041
|
}
|
|
1012
1042
|
) : null,
|
|
1013
|
-
ErrorBoundary:
|
|
1043
|
+
ErrorBoundary: Ye
|
|
1014
1044
|
}
|
|
1015
1045
|
),
|
|
1016
1046
|
/* @__PURE__ */ o(Kr, {}),
|
|
1017
1047
|
i,
|
|
1018
1048
|
/* @__PURE__ */ o(Gr, { isLoading: t }),
|
|
1019
|
-
!
|
|
1049
|
+
!l && /* @__PURE__ */ o(Pr, { children: a })
|
|
1020
1050
|
]
|
|
1021
1051
|
}
|
|
1022
1052
|
),
|
|
1023
1053
|
/* @__PURE__ */ o(qr, { state: u }),
|
|
1024
|
-
/* @__PURE__ */ o(
|
|
1054
|
+
/* @__PURE__ */ o(U, { children: r })
|
|
1025
1055
|
]
|
|
1026
1056
|
}
|
|
1027
1057
|
) });
|
|
@@ -1219,11 +1249,11 @@ const Kr = () => /* @__PURE__ */ g(F, { children: [
|
|
|
1219
1249
|
defaultVariants: {
|
|
1220
1250
|
size: "md"
|
|
1221
1251
|
}
|
|
1222
|
-
},
|
|
1252
|
+
}, $n = rr(Jr), Xr = ({
|
|
1223
1253
|
uploadFile: t,
|
|
1224
1254
|
...r
|
|
1225
1255
|
}) => {
|
|
1226
|
-
const [e] = T(), [n, i] = f(null),
|
|
1256
|
+
const [e] = T(), [n, i] = f(null), l = (s) => {
|
|
1227
1257
|
var c;
|
|
1228
1258
|
const d = (c = s.target.files) == null ? void 0 : c[0];
|
|
1229
1259
|
if (d) {
|
|
@@ -1233,22 +1263,22 @@ const Kr = () => /* @__PURE__ */ g(F, { children: [
|
|
|
1233
1263
|
i({ url: m, width: u.naturalWidth, height: u.naturalHeight }), window.URL.revokeObjectURL(p);
|
|
1234
1264
|
}, u.src = p;
|
|
1235
1265
|
}
|
|
1236
|
-
},
|
|
1237
|
-
n && !t.isLoading && (e.dispatchCommand(
|
|
1266
|
+
}, a = () => {
|
|
1267
|
+
n && !t.isLoading && (e.dispatchCommand(re, {
|
|
1238
1268
|
src: n.url,
|
|
1239
1269
|
altText: `Image: ${n.url}`,
|
|
1240
1270
|
meta: { width: n.width, height: n.height }
|
|
1241
1271
|
}), r.onOpenChange(!1));
|
|
1242
1272
|
};
|
|
1243
|
-
return /* @__PURE__ */ g(
|
|
1244
|
-
/* @__PURE__ */ o(
|
|
1273
|
+
return /* @__PURE__ */ g(Kt, { ...r, children: [
|
|
1274
|
+
/* @__PURE__ */ o(Be, { children: "Sett inn bilde" }),
|
|
1245
1275
|
t.isLoading && /* @__PURE__ */ o(ht, {}),
|
|
1246
1276
|
/* @__PURE__ */ o(
|
|
1247
1277
|
ut,
|
|
1248
1278
|
{
|
|
1249
1279
|
type: "file",
|
|
1250
1280
|
accept: "image/png, image/jpeg",
|
|
1251
|
-
onChange:
|
|
1281
|
+
onChange: l,
|
|
1252
1282
|
disabled: t.isLoading
|
|
1253
1283
|
}
|
|
1254
1284
|
),
|
|
@@ -1259,25 +1289,25 @@ const Kr = () => /* @__PURE__ */ g(F, { children: [
|
|
|
1259
1289
|
{
|
|
1260
1290
|
variant: "primary",
|
|
1261
1291
|
disabled: !n || t.isLoading,
|
|
1262
|
-
onClick:
|
|
1292
|
+
onClick: a,
|
|
1263
1293
|
children: "Sett inn"
|
|
1264
1294
|
}
|
|
1265
1295
|
)
|
|
1266
1296
|
] })
|
|
1267
1297
|
] });
|
|
1268
|
-
},
|
|
1298
|
+
}, Dn = ({ uploadFile: t }) => {
|
|
1269
1299
|
const [r] = T(), [e, n] = f(!1), i = C(() => {
|
|
1270
|
-
r.dispatchCommand(
|
|
1300
|
+
r.dispatchCommand(ye, {
|
|
1271
1301
|
rows: "3",
|
|
1272
1302
|
columns: "3",
|
|
1273
1303
|
includeHeaders: !1
|
|
1274
1304
|
});
|
|
1275
1305
|
}, [r]);
|
|
1276
|
-
return /* @__PURE__ */ g(
|
|
1306
|
+
return /* @__PURE__ */ g(U, { children: [
|
|
1277
1307
|
/* @__PURE__ */ g(
|
|
1278
1308
|
dt,
|
|
1279
1309
|
{
|
|
1280
|
-
trigger: /* @__PURE__ */ o(
|
|
1310
|
+
trigger: /* @__PURE__ */ o(Ut, { dropdown: !0, children: "Sett inn" }),
|
|
1281
1311
|
side: "bottom",
|
|
1282
1312
|
align: "end",
|
|
1283
1313
|
children: [
|
|
@@ -1286,7 +1316,7 @@ const Kr = () => /* @__PURE__ */ g(F, { children: [
|
|
|
1286
1316
|
" Tabell"
|
|
1287
1317
|
] }),
|
|
1288
1318
|
t && /* @__PURE__ */ g(_, { onClick: () => n(!0), children: [
|
|
1289
|
-
/* @__PURE__ */ o(
|
|
1319
|
+
/* @__PURE__ */ o(We, { size: "1.25rem" }),
|
|
1290
1320
|
" Bilde"
|
|
1291
1321
|
] })
|
|
1292
1322
|
]
|
|
@@ -1305,51 +1335,51 @@ const Kr = () => /* @__PURE__ */ g(F, { children: [
|
|
|
1305
1335
|
function Qr(t) {
|
|
1306
1336
|
return k({ 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);
|
|
1307
1337
|
}
|
|
1308
|
-
const
|
|
1338
|
+
const Bn = () => {
|
|
1309
1339
|
const [t] = T(), [r, e] = f(null), { hasFocus: n } = et();
|
|
1310
1340
|
y(() => {
|
|
1311
1341
|
!n && r && e(null);
|
|
1312
1342
|
}, [n, r]);
|
|
1313
|
-
const { refs: i, floatingStyles:
|
|
1343
|
+
const { refs: i, floatingStyles: l } = gt({
|
|
1314
1344
|
placement: "top-end",
|
|
1315
1345
|
open: !!r,
|
|
1316
1346
|
elements: {
|
|
1317
1347
|
reference: r
|
|
1318
1348
|
},
|
|
1319
|
-
middleware: [
|
|
1349
|
+
middleware: [Yt({ mainAxis: -20, crossAxis: -2 })]
|
|
1320
1350
|
});
|
|
1321
1351
|
y(() => t.registerCommand(
|
|
1322
|
-
|
|
1352
|
+
K,
|
|
1323
1353
|
() => {
|
|
1324
1354
|
const s = L();
|
|
1325
1355
|
if (w(s)) {
|
|
1326
|
-
const d = s.anchor.getNode(), c =
|
|
1356
|
+
const d = s.anchor.getNode(), c = Ne(d);
|
|
1327
1357
|
e(c ? t.getElementByKey(c.getKey()) : null);
|
|
1328
1358
|
}
|
|
1329
1359
|
return !1;
|
|
1330
1360
|
},
|
|
1331
|
-
|
|
1361
|
+
be
|
|
1332
1362
|
), [t]);
|
|
1333
|
-
const
|
|
1363
|
+
const a = (s) => () => {
|
|
1334
1364
|
t.update(() => {
|
|
1335
1365
|
switch (s) {
|
|
1336
1366
|
case "add-row-over":
|
|
1337
|
-
|
|
1367
|
+
_t(!1);
|
|
1338
1368
|
break;
|
|
1339
1369
|
case "add-row-under":
|
|
1340
|
-
|
|
1370
|
+
_t(!0);
|
|
1341
1371
|
break;
|
|
1342
1372
|
case "add-column-left":
|
|
1343
|
-
|
|
1373
|
+
Mt(!1);
|
|
1344
1374
|
break;
|
|
1345
1375
|
case "add-column-right":
|
|
1346
|
-
|
|
1376
|
+
Mt(!0);
|
|
1347
1377
|
break;
|
|
1348
1378
|
case "delete-row":
|
|
1349
|
-
|
|
1379
|
+
Ee();
|
|
1350
1380
|
break;
|
|
1351
1381
|
case "delete-column":
|
|
1352
|
-
|
|
1382
|
+
Se();
|
|
1353
1383
|
break;
|
|
1354
1384
|
}
|
|
1355
1385
|
});
|
|
@@ -1364,46 +1394,46 @@ const Dn = () => {
|
|
|
1364
1394
|
variant: "primary",
|
|
1365
1395
|
color: "secondary",
|
|
1366
1396
|
ref: i.setFloating,
|
|
1367
|
-
style:
|
|
1397
|
+
style: l,
|
|
1368
1398
|
css: { padding: "2px", width: "18px", height: "18px" },
|
|
1369
1399
|
children: /* @__PURE__ */ o(Qr, {})
|
|
1370
1400
|
}
|
|
1371
1401
|
),
|
|
1372
1402
|
children: [
|
|
1373
|
-
/* @__PURE__ */ o($, { onClick:
|
|
1374
|
-
/* @__PURE__ */ o($, { onClick:
|
|
1375
|
-
/* @__PURE__ */ o(
|
|
1376
|
-
/* @__PURE__ */ o($, { onClick:
|
|
1377
|
-
/* @__PURE__ */ o($, { onClick:
|
|
1378
|
-
/* @__PURE__ */ o(
|
|
1379
|
-
/* @__PURE__ */ o($, { onClick:
|
|
1380
|
-
/* @__PURE__ */ o($, { onClick:
|
|
1403
|
+
/* @__PURE__ */ o($, { onClick: a("add-row-over"), children: "Legg til rad over" }),
|
|
1404
|
+
/* @__PURE__ */ o($, { onClick: a("add-row-under"), children: "Legg til rad under" }),
|
|
1405
|
+
/* @__PURE__ */ o(Tt, {}),
|
|
1406
|
+
/* @__PURE__ */ o($, { onClick: a("add-column-left"), children: "Legg til kolonne venstre" }),
|
|
1407
|
+
/* @__PURE__ */ o($, { onClick: a("add-column-right"), children: "Legg til kolonne høyre" }),
|
|
1408
|
+
/* @__PURE__ */ o(Tt, {}),
|
|
1409
|
+
/* @__PURE__ */ o($, { onClick: a("delete-row"), children: "Fjern rad" }),
|
|
1410
|
+
/* @__PURE__ */ o($, { onClick: a("delete-column"), children: "Fjern kolonne" })
|
|
1381
1411
|
]
|
|
1382
1412
|
}
|
|
1383
1413
|
) : null;
|
|
1384
1414
|
};
|
|
1385
|
-
function
|
|
1415
|
+
function kt(t) {
|
|
1386
1416
|
let r = t;
|
|
1387
1417
|
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;
|
|
1388
1418
|
return r = String(r).trim(), r.match(e) || r.match(n) ? r : "https://";
|
|
1389
1419
|
}
|
|
1390
|
-
function
|
|
1420
|
+
function ne(t) {
|
|
1391
1421
|
const r = t.anchor, e = t.focus, n = t.anchor.getNode(), i = t.focus.getNode();
|
|
1392
|
-
return n === i ? n : t.isBackward() ?
|
|
1422
|
+
return n === i ? n : t.isBackward() ? Ct(e) ? n : i : Ct(r) ? n : i;
|
|
1393
1423
|
}
|
|
1394
|
-
const
|
|
1424
|
+
const Pn = (t) => (z.baseURL = t, z), X = class extends B {
|
|
1395
1425
|
static getType() {
|
|
1396
1426
|
return "rutine_link";
|
|
1397
1427
|
}
|
|
1398
1428
|
static clone(r) {
|
|
1399
|
-
return new
|
|
1429
|
+
return new X(r.__url, {}, r.__key);
|
|
1400
1430
|
}
|
|
1401
1431
|
createDOM(r) {
|
|
1402
1432
|
const e = super.createDOM(r);
|
|
1403
1433
|
return e.setAttribute("href", this.getURL()), e.setAttribute("target", "_blank"), e.setAttribute("rel", "noopener noreferrer"), e.classList.add("rutine-link"), e;
|
|
1404
1434
|
}
|
|
1405
1435
|
static importJSON(r) {
|
|
1406
|
-
return
|
|
1436
|
+
return oe(r.url);
|
|
1407
1437
|
}
|
|
1408
1438
|
exportJSON() {
|
|
1409
1439
|
return {
|
|
@@ -1415,32 +1445,32 @@ const Bn = (t) => (O.baseURL = t, O), J = class extends B {
|
|
|
1415
1445
|
}
|
|
1416
1446
|
getURL() {
|
|
1417
1447
|
try {
|
|
1418
|
-
return new URL(this.__url,
|
|
1448
|
+
return new URL(this.__url, X.baseURL).toString();
|
|
1419
1449
|
} catch {
|
|
1420
1450
|
return "";
|
|
1421
1451
|
}
|
|
1422
1452
|
}
|
|
1423
1453
|
};
|
|
1424
|
-
let
|
|
1425
|
-
|
|
1426
|
-
function
|
|
1427
|
-
return new
|
|
1454
|
+
let z = X;
|
|
1455
|
+
R(z, "baseURL", "");
|
|
1456
|
+
function oe(t) {
|
|
1457
|
+
return new z(t);
|
|
1428
1458
|
}
|
|
1429
1459
|
function Vr(t) {
|
|
1430
|
-
return t instanceof
|
|
1460
|
+
return t instanceof z;
|
|
1431
1461
|
}
|
|
1432
1462
|
const Zr = ({ onClose: t }) => {
|
|
1433
1463
|
const [r] = T(), e = C(
|
|
1434
1464
|
(i) => {
|
|
1435
1465
|
r.update(() => {
|
|
1436
|
-
const
|
|
1437
|
-
if (w(
|
|
1438
|
-
const
|
|
1439
|
-
|
|
1440
|
-
const s =
|
|
1441
|
-
s.setTextNodeRange(
|
|
1466
|
+
const l = L();
|
|
1467
|
+
if (w(l) && l.isCollapsed()) {
|
|
1468
|
+
const a = I(i);
|
|
1469
|
+
l.insertNodes([a]);
|
|
1470
|
+
const s = Rt();
|
|
1471
|
+
s.setTextNodeRange(a, 0, a, i.length), Q(s);
|
|
1442
1472
|
}
|
|
1443
|
-
r.dispatchCommand(V,
|
|
1473
|
+
r.dispatchCommand(V, kt(i));
|
|
1444
1474
|
});
|
|
1445
1475
|
},
|
|
1446
1476
|
[r]
|
|
@@ -1458,15 +1488,15 @@ const Zr = ({ onClose: t }) => {
|
|
|
1458
1488
|
onClose: t,
|
|
1459
1489
|
getDocs: r
|
|
1460
1490
|
}) => {
|
|
1461
|
-
const [e] = T(), [n, i] = f([]),
|
|
1491
|
+
const [e] = T(), [n, i] = f([]), l = r(), a = C(
|
|
1462
1492
|
(s) => {
|
|
1463
1493
|
e.update(() => {
|
|
1464
1494
|
const d = L();
|
|
1465
1495
|
if (w(d)) {
|
|
1466
1496
|
const c = [];
|
|
1467
1497
|
for (const [u, p] of s.entries()) {
|
|
1468
|
-
const m =
|
|
1469
|
-
m.append(
|
|
1498
|
+
const m = oe(p.value);
|
|
1499
|
+
m.append(I(p.label)), c.push(m), u !== s.length - 1 && c.push(I(" "));
|
|
1470
1500
|
}
|
|
1471
1501
|
d.insertNodes(c);
|
|
1472
1502
|
}
|
|
@@ -1474,12 +1504,12 @@ const Zr = ({ onClose: t }) => {
|
|
|
1474
1504
|
},
|
|
1475
1505
|
[e]
|
|
1476
1506
|
);
|
|
1477
|
-
return /* @__PURE__ */ g(
|
|
1507
|
+
return /* @__PURE__ */ g(U, { children: [
|
|
1478
1508
|
/* @__PURE__ */ o(
|
|
1479
|
-
|
|
1509
|
+
He,
|
|
1480
1510
|
{
|
|
1481
1511
|
isMulti: !0,
|
|
1482
|
-
options:
|
|
1512
|
+
options: l,
|
|
1483
1513
|
onChange: (s) => i(s)
|
|
1484
1514
|
}
|
|
1485
1515
|
),
|
|
@@ -1490,7 +1520,7 @@ const Zr = ({ onClose: t }) => {
|
|
|
1490
1520
|
{
|
|
1491
1521
|
variant: "primary",
|
|
1492
1522
|
onClick: () => {
|
|
1493
|
-
|
|
1523
|
+
a(n), t();
|
|
1494
1524
|
},
|
|
1495
1525
|
children: "Sett inn"
|
|
1496
1526
|
}
|
|
@@ -1501,7 +1531,7 @@ const Zr = ({ onClose: t }) => {
|
|
|
1501
1531
|
onClose: t,
|
|
1502
1532
|
uploadFile: r
|
|
1503
1533
|
}) => {
|
|
1504
|
-
const [e] = T(), [n, i] = f(null),
|
|
1534
|
+
const [e] = T(), [n, i] = f(null), l = async (s) => {
|
|
1505
1535
|
var c;
|
|
1506
1536
|
const d = (c = s.target.files) == null ? void 0 : c[0];
|
|
1507
1537
|
if (d) {
|
|
@@ -1511,27 +1541,27 @@ const Zr = ({ onClose: t }) => {
|
|
|
1511
1541
|
url: u
|
|
1512
1542
|
});
|
|
1513
1543
|
}
|
|
1514
|
-
},
|
|
1544
|
+
}, a = C(() => {
|
|
1515
1545
|
e.update(() => {
|
|
1516
1546
|
if (!n)
|
|
1517
1547
|
return;
|
|
1518
1548
|
const s = L();
|
|
1519
1549
|
if (w(s) && s.isCollapsed()) {
|
|
1520
|
-
const d =
|
|
1550
|
+
const d = I(n.name);
|
|
1521
1551
|
s.insertNodes([d]);
|
|
1522
|
-
const c =
|
|
1552
|
+
const c = Rt();
|
|
1523
1553
|
c.setTextNodeRange(d, 0, d, n.name.length), Q(c);
|
|
1524
1554
|
}
|
|
1525
|
-
e.dispatchCommand(V,
|
|
1555
|
+
e.dispatchCommand(V, kt(n.url));
|
|
1526
1556
|
});
|
|
1527
1557
|
}, [e, n]);
|
|
1528
|
-
return /* @__PURE__ */ g(
|
|
1558
|
+
return /* @__PURE__ */ g(U, { children: [
|
|
1529
1559
|
r.isLoading && /* @__PURE__ */ o(ht, {}),
|
|
1530
1560
|
/* @__PURE__ */ o(
|
|
1531
1561
|
ut,
|
|
1532
1562
|
{
|
|
1533
1563
|
type: "file",
|
|
1534
|
-
onChange:
|
|
1564
|
+
onChange: l,
|
|
1535
1565
|
disabled: r.isLoading
|
|
1536
1566
|
}
|
|
1537
1567
|
),
|
|
@@ -1542,7 +1572,7 @@ const Zr = ({ onClose: t }) => {
|
|
|
1542
1572
|
{
|
|
1543
1573
|
variant: "primary",
|
|
1544
1574
|
onClick: () => {
|
|
1545
|
-
|
|
1575
|
+
a(), t();
|
|
1546
1576
|
},
|
|
1547
1577
|
disabled: !n,
|
|
1548
1578
|
children: "Sett inn"
|
|
@@ -1556,47 +1586,47 @@ const Zr = ({ onClose: t }) => {
|
|
|
1556
1586
|
getDocs: e,
|
|
1557
1587
|
uploadFile: n
|
|
1558
1588
|
}) => {
|
|
1559
|
-
const [i,
|
|
1589
|
+
const [i, l] = f("url"), a = () => {
|
|
1560
1590
|
r(!1);
|
|
1561
1591
|
};
|
|
1562
|
-
return /* @__PURE__ */ g(
|
|
1563
|
-
/* @__PURE__ */ g(
|
|
1564
|
-
/* @__PURE__ */ o(ot, { active: i === "url", onClick: () =>
|
|
1592
|
+
return /* @__PURE__ */ g(Kt, { open: t, onOpenChange: r, css: { width: "600px" }, children: [
|
|
1593
|
+
/* @__PURE__ */ g(Pe, { css: { marginBottom: "$8" }, children: [
|
|
1594
|
+
/* @__PURE__ */ o(ot, { active: i === "url", onClick: () => l("url"), children: "URL" }),
|
|
1565
1595
|
e && /* @__PURE__ */ o(
|
|
1566
1596
|
ot,
|
|
1567
1597
|
{
|
|
1568
1598
|
active: i === "rutine",
|
|
1569
|
-
onClick: () =>
|
|
1599
|
+
onClick: () => l("rutine"),
|
|
1570
1600
|
children: "Rutine"
|
|
1571
1601
|
}
|
|
1572
1602
|
),
|
|
1573
|
-
n && /* @__PURE__ */ o(ot, { active: i === "file", onClick: () =>
|
|
1603
|
+
n && /* @__PURE__ */ o(ot, { active: i === "file", onClick: () => l("file"), children: "Fil" })
|
|
1574
1604
|
] }),
|
|
1575
|
-
i === "url" && /* @__PURE__ */ o(Zr, { onClose:
|
|
1576
|
-
i === "rutine" && e && /* @__PURE__ */ o(tn, { onClose:
|
|
1577
|
-
i === "file" && n && /* @__PURE__ */ o(en, { onClose:
|
|
1605
|
+
i === "url" && /* @__PURE__ */ o(Zr, { onClose: a }),
|
|
1606
|
+
i === "rutine" && e && /* @__PURE__ */ o(tn, { onClose: a, getDocs: e }),
|
|
1607
|
+
i === "file" && n && /* @__PURE__ */ o(en, { onClose: a, uploadFile: n })
|
|
1578
1608
|
] });
|
|
1579
|
-
},
|
|
1609
|
+
}, Hn = ({
|
|
1580
1610
|
getDocs: t,
|
|
1581
1611
|
uploadFile: r
|
|
1582
1612
|
}) => {
|
|
1583
|
-
const [e] = T(), [n, i] = f(!1), [
|
|
1613
|
+
const [e] = T(), [n, i] = f(!1), [l, a] = f(!1), s = C(() => {
|
|
1584
1614
|
const d = L();
|
|
1585
1615
|
if (w(d)) {
|
|
1586
|
-
const c =
|
|
1587
|
-
i(
|
|
1616
|
+
const c = ne(d), u = c.getParent();
|
|
1617
|
+
i(G(u) || G(c));
|
|
1588
1618
|
}
|
|
1589
1619
|
}, []);
|
|
1590
1620
|
return y(() => e.registerCommand(
|
|
1591
|
-
|
|
1621
|
+
K,
|
|
1592
1622
|
() => (s(), !1),
|
|
1593
1623
|
at
|
|
1594
|
-
), [e, s]), /* @__PURE__ */ g(
|
|
1624
|
+
), [e, s]), /* @__PURE__ */ g(Wt, { type: "single", value: n ? "link" : "", children: [
|
|
1595
1625
|
/* @__PURE__ */ o(
|
|
1596
1626
|
D,
|
|
1597
1627
|
{
|
|
1598
1628
|
onClick: () => {
|
|
1599
|
-
n ? e.dispatchCommand(V, null) :
|
|
1629
|
+
n ? e.dispatchCommand(V, null) : a(!0);
|
|
1600
1630
|
},
|
|
1601
1631
|
title: "Lenke",
|
|
1602
1632
|
value: "link",
|
|
@@ -1606,43 +1636,43 @@ const Zr = ({ onClose: t }) => {
|
|
|
1606
1636
|
/* @__PURE__ */ o(
|
|
1607
1637
|
rn,
|
|
1608
1638
|
{
|
|
1609
|
-
open:
|
|
1610
|
-
onOpenChange:
|
|
1639
|
+
open: l,
|
|
1640
|
+
onOpenChange: a,
|
|
1611
1641
|
getDocs: t,
|
|
1612
1642
|
uploadFile: r
|
|
1613
1643
|
}
|
|
1614
1644
|
)
|
|
1615
1645
|
] });
|
|
1616
|
-
},
|
|
1617
|
-
const [t] = T(), r =
|
|
1646
|
+
}, Fn = () => {
|
|
1647
|
+
const [t] = T(), r = q(null), [e, n] = f(null), [i, l] = f(""), { hasFocus: a } = et();
|
|
1618
1648
|
y(() => {
|
|
1619
1649
|
e ? t.update(() => {
|
|
1620
|
-
|
|
1621
|
-
}) :
|
|
1650
|
+
l(e.getURL());
|
|
1651
|
+
}) : l("");
|
|
1622
1652
|
}, [t, e]);
|
|
1623
|
-
const s = !!(e && i &&
|
|
1653
|
+
const s = !!(e && i && a), { refs: d, floatingStyles: c, context: u } = gt({
|
|
1624
1654
|
placement: "top",
|
|
1625
1655
|
strategy: "fixed",
|
|
1626
1656
|
open: s,
|
|
1627
|
-
whileElementsMounted:
|
|
1657
|
+
whileElementsMounted: qt,
|
|
1628
1658
|
elements: {
|
|
1629
1659
|
reference: r.current
|
|
1630
1660
|
},
|
|
1631
|
-
middleware: [
|
|
1632
|
-
}), { getFloatingProps: p } =
|
|
1633
|
-
|
|
1634
|
-
|
|
1661
|
+
middleware: [Qe()]
|
|
1662
|
+
}), { getFloatingProps: p } = Gt([
|
|
1663
|
+
Jt(u),
|
|
1664
|
+
Ve(u)
|
|
1635
1665
|
]), m = C(() => {
|
|
1636
1666
|
var v;
|
|
1637
1667
|
const h = L();
|
|
1638
1668
|
if (w(h)) {
|
|
1639
|
-
const M =
|
|
1640
|
-
let
|
|
1641
|
-
if (
|
|
1642
|
-
const rt = window.getSelection(),
|
|
1643
|
-
h !== null && rt !== null &&
|
|
1669
|
+
const M = ne(h), b = M.getParent();
|
|
1670
|
+
let Y = null;
|
|
1671
|
+
if (G(b) ? Y = b : G(M) && (Y = M), Y) {
|
|
1672
|
+
const rt = window.getSelection(), bt = t.getRootElement();
|
|
1673
|
+
h !== null && rt !== null && bt !== null && bt.contains(rt.anchorNode) && t.isEditable() && (r.current = ((v = rt.focusNode) == null ? void 0 : v.parentElement) ?? null);
|
|
1644
1674
|
}
|
|
1645
|
-
n(
|
|
1675
|
+
n(Y);
|
|
1646
1676
|
}
|
|
1647
1677
|
}, [t]), S = C(() => {
|
|
1648
1678
|
e && Vr(e) && t.update(() => {
|
|
@@ -1660,20 +1690,20 @@ const Zr = ({ onClose: t }) => {
|
|
|
1660
1690
|
});
|
|
1661
1691
|
}),
|
|
1662
1692
|
t.registerCommand(
|
|
1663
|
-
|
|
1693
|
+
K,
|
|
1664
1694
|
() => (m(), !0),
|
|
1665
|
-
|
|
1695
|
+
O
|
|
1666
1696
|
),
|
|
1667
1697
|
t.registerCommand(
|
|
1668
|
-
|
|
1698
|
+
It,
|
|
1669
1699
|
() => e ? (n(null), !0) : !1,
|
|
1670
|
-
|
|
1700
|
+
ve
|
|
1671
1701
|
)
|
|
1672
1702
|
), [t, m, e]), !s)
|
|
1673
1703
|
return null;
|
|
1674
|
-
const E =
|
|
1675
|
-
return /* @__PURE__ */ o(
|
|
1676
|
-
|
|
1704
|
+
const E = kt(i);
|
|
1705
|
+
return /* @__PURE__ */ o(Xt, { children: /* @__PURE__ */ g(
|
|
1706
|
+
jt,
|
|
1677
1707
|
{
|
|
1678
1708
|
ref: d.setFloating,
|
|
1679
1709
|
css: {
|
|
@@ -1704,37 +1734,38 @@ const Zr = ({ onClose: t }) => {
|
|
|
1704
1734
|
children: i
|
|
1705
1735
|
}
|
|
1706
1736
|
),
|
|
1707
|
-
/* @__PURE__ */ o(N, { color: "danger", icon: !0, size: "sm", onClick: S, children: /* @__PURE__ */ o(
|
|
1737
|
+
/* @__PURE__ */ o(N, { color: "danger", icon: !0, size: "sm", onClick: S, children: /* @__PURE__ */ o(je, { size: 24 }) })
|
|
1708
1738
|
]
|
|
1709
1739
|
}
|
|
1710
1740
|
) });
|
|
1711
1741
|
};
|
|
1712
1742
|
export {
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1743
|
+
ft as $createImageNode,
|
|
1744
|
+
oe as $createRutineLinkNode,
|
|
1745
|
+
Rn as $isImageNode,
|
|
1716
1746
|
Vr as $isRutineLinkNode,
|
|
1717
1747
|
Pr as FloatingToolbar,
|
|
1718
1748
|
A as ImageNode,
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1749
|
+
Dn as InsertSelector,
|
|
1750
|
+
Fn as LinkEditPlugin,
|
|
1751
|
+
J as LinkTargetNode,
|
|
1752
|
+
Hn as LinkToolbarButton,
|
|
1753
|
+
An as RichTextEditor,
|
|
1724
1754
|
Hr as RichTextToolbar,
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1755
|
+
z as RutineLinkNode,
|
|
1756
|
+
Pn as RutineLinkNodeInit,
|
|
1757
|
+
Bn as TableEditPlugin,
|
|
1728
1758
|
dr as clearEditorState,
|
|
1729
|
-
|
|
1730
|
-
|
|
1759
|
+
On as defaultNodes,
|
|
1760
|
+
zn as defaultViewNodes,
|
|
1731
1761
|
cr as isEditorState,
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1762
|
+
mt as isJSON,
|
|
1763
|
+
Zt as richTextContext,
|
|
1764
|
+
$n as richTextCss,
|
|
1735
1765
|
Jr as richTextStyleObj,
|
|
1736
1766
|
hr as setStateFromPlainText,
|
|
1737
1767
|
En as stateToHTML,
|
|
1768
|
+
In as syncStateToHTML,
|
|
1738
1769
|
ur as useHasFocusWithin,
|
|
1739
1770
|
et as useRichTextContext
|
|
1740
1771
|
};
|