@arkitektbedriftene/fe-lib 1.5.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -29,6 +29,7 @@ export declare class ImageNode extends DecoratorNode<JSX.Element> {
|
|
|
29
29
|
static importDOM(): DOMConversionMap | null;
|
|
30
30
|
constructor(src: string, altText: string, maxWidth: number, width?: "inherit" | number, height?: "inherit" | number, key?: NodeKey);
|
|
31
31
|
exportJSON(): SerializedImageNode;
|
|
32
|
+
setSrc(src: string): void;
|
|
32
33
|
setWidthAndHeight(width: "inherit" | number, height: "inherit" | number): void;
|
|
33
34
|
createDOM(config: EditorConfig): HTMLElement;
|
|
34
35
|
updateDOM(): false;
|
|
@@ -4,10 +4,10 @@ export declare const isEditorState: (state: unknown) => state is EditorState;
|
|
|
4
4
|
export declare const clearEditorState: (editor: LexicalEditor, tag?: string) => void;
|
|
5
5
|
export declare const setStateFromPlainText: (str: string, editor: LexicalEditor, tag?: string) => void;
|
|
6
6
|
export declare const stateToHTML: (state: SerializedEditorState | string | null | undefined, nodes: CreateEditorArgs["nodes"], options?: {
|
|
7
|
-
maxLines?: number | null;
|
|
8
|
-
onlyMainContent?: boolean;
|
|
9
|
-
updateFn?: () => void;
|
|
10
|
-
}) => {
|
|
7
|
+
maxLines?: number | null | undefined;
|
|
8
|
+
onlyMainContent?: boolean | undefined;
|
|
9
|
+
updateFn?: ((editor: LexicalEditor) => Promise<void> | void) | undefined;
|
|
10
|
+
} | undefined) => Promise<{
|
|
11
11
|
html: string;
|
|
12
12
|
trimCount: number;
|
|
13
|
-
}
|
|
13
|
+
}>;
|
package/dist/rich-text.es.js
CHANGED
|
@@ -3,15 +3,15 @@ var re = (t, r, e) => r in t ? ee(t, r, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var I = (t, r, e) => (re(t, typeof r != "symbol" ? r + "" : r, e), e);
|
|
4
4
|
import { createHeadlessEditor as ne } from "@lexical/headless";
|
|
5
5
|
import { $generateHtmlFromNodes as oe } from "@lexical/html";
|
|
6
|
-
import { $getRoot as X, ParagraphNode as ie, $createParagraphNode as U, $createTextNode as
|
|
6
|
+
import { $getRoot as X, ParagraphNode as ie, $createParagraphNode as U, $createTextNode as $, $setSelection as Q, DecoratorNode as ae, $applyNodeReplacement as le, SELECTION_CHANGE_COMMAND as j, $getSelection as _, COMMAND_PRIORITY_CRITICAL as at, $isRangeSelection as T, $isRootOrShadowRoot as xt, FORMAT_TEXT_COMMAND as F, COMMAND_PRIORITY_LOW as R, KEY_ARROW_DOWN_COMMAND as se, KEY_ARROW_UP_COMMAND as ce, KEY_ESCAPE_COMMAND as Lt, KEY_SPACE_COMMAND as de, $getNearestNodeFromDOMNode as lt, KEY_ARROW_LEFT_COMMAND as he, $isElementNode as ue, createCommand as ge, $insertNodes as pe, COMMAND_PRIORITY_EDITOR as me, COMMAND_PRIORITY_NORMAL as fe, $createRangeSelection as yt, COMMAND_PRIORITY_HIGH as ke } from "lexical";
|
|
7
7
|
import { trimTextContentFromAnchor as be, $setBlocksType as nt, $isAtNodeEnd as ft } from "@lexical/selection";
|
|
8
|
-
import { LinkNode as
|
|
9
|
-
import { ListNode as st, ListItemNode as wt, $isListNode as ct, INSERT_UNORDERED_LIST_COMMAND as Ce, INSERT_ORDERED_LIST_COMMAND as ve, INSERT_CHECK_LIST_COMMAND as St, insertList as Me, $isListItemNode as
|
|
10
|
-
import { HeadingNode as Et, QuoteNode as It, $isHeadingNode as
|
|
11
|
-
import { TableNode as Rt, TableRowNode as Ot, TableCellNode as
|
|
12
|
-
import { jsx as o, jsxs as h, Fragment as
|
|
13
|
-
import { createContext as Se, useState as p, useRef as K, useCallback as C, useContext as Ee, useEffect as x, useMemo as
|
|
14
|
-
import { DropdownMenu as dt, ToolbarButton as At, DropdownMenuIconItem as v, Box as W, ToolbarToggleGroup as Dt, ToolbarToggleItem as
|
|
8
|
+
import { LinkNode as B, AutoLinkNode as Nt, $isLinkNode as Y, TOGGLE_LINK_COMMAND as V } from "@lexical/link";
|
|
9
|
+
import { ListNode as st, ListItemNode as wt, $isListNode as ct, INSERT_UNORDERED_LIST_COMMAND as Ce, INSERT_ORDERED_LIST_COMMAND as ve, INSERT_CHECK_LIST_COMMAND as St, insertList as Me, $isListItemNode as P } from "@lexical/list";
|
|
10
|
+
import { HeadingNode as Et, QuoteNode as It, $isHeadingNode as _e, $createHeadingNode as Te, $createQuoteNode as xe } from "@lexical/rich-text";
|
|
11
|
+
import { TableNode as Rt, TableRowNode as Ot, TableCellNode as $t, INSERT_TABLE_COMMAND as Le, $getTableCellNodeFromLexicalNode as ye, $deleteTableColumn__EXPERIMENTAL as Ne, $deleteTableRow__EXPERIMENTAL as we, $insertTableColumn__EXPERIMENTAL as kt, $insertTableRow__EXPERIMENTAL as bt } from "@lexical/table";
|
|
12
|
+
import { jsx as o, jsxs as h, Fragment as H } from "react/jsx-runtime";
|
|
13
|
+
import { createContext as Se, useState as p, useRef as K, useCallback as C, useContext as Ee, useEffect as x, useMemo as zt, useLayoutEffect as Ie } from "react";
|
|
14
|
+
import { DropdownMenu as dt, ToolbarButton as At, DropdownMenuIconItem as v, Box as W, ToolbarToggleGroup as Dt, ToolbarToggleItem as D, OverlayCard as Bt, Toolbar as Re, ToolbarSeparator as Oe, styled as $e, Spinner as ht, Dialog as Pt, DialogHeader as ze, TextInput as Ht, DialogActions as Z, Button as y, DropdownMenuItem as A, DropdownMenuSeparator as Ct, NavBar as Ae, NavBarItem as ot, Combobox as De } from "./ui.es.js";
|
|
15
15
|
import { LexicalComposer as Be } from "@lexical/react/LexicalComposer.js";
|
|
16
16
|
import { RichTextPlugin as Pe } from "@lexical/react/LexicalRichTextPlugin.js";
|
|
17
17
|
import He from "@lexical/react/LexicalErrorBoundary.js";
|
|
@@ -36,20 +36,20 @@ const nr = ({
|
|
|
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,
|
|
39
|
+
let a = 0, l = 0;
|
|
40
|
+
for (; l < t.length && (!n || a < e) && (!i || l < r); )
|
|
41
|
+
t[l] === `
|
|
42
|
+
` && a++, l++;
|
|
43
|
+
return t.slice(0, l).length;
|
|
44
44
|
}, or = ({
|
|
45
45
|
editor: t,
|
|
46
46
|
maxChars: r,
|
|
47
47
|
maxLines: e
|
|
48
48
|
}) => {
|
|
49
|
-
const n = X(), i = n.getTextContent(),
|
|
50
|
-
be(t, d,
|
|
49
|
+
const n = X(), i = n.getTextContent(), a = nr({ text: i, maxChars: r, maxLines: e }), l = i.length - a, d = n.select().anchor;
|
|
50
|
+
be(t, d, l);
|
|
51
51
|
const c = n.getLastChild();
|
|
52
|
-
return c instanceof ie && c.getChildrenSize() === 0 && c.remove(),
|
|
52
|
+
return c instanceof ie && c.getChildrenSize() === 0 && c.remove(), l;
|
|
53
53
|
}, Yt = {
|
|
54
54
|
quote: "ain-rich-text-quote",
|
|
55
55
|
text: {
|
|
@@ -68,7 +68,7 @@ const nr = ({
|
|
|
68
68
|
const e = X();
|
|
69
69
|
e.clear();
|
|
70
70
|
const n = U();
|
|
71
|
-
n.append(
|
|
71
|
+
n.append($("")), e.append(n), Q(null);
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
tag: r
|
|
@@ -80,13 +80,14 @@ const nr = ({
|
|
|
80
80
|
const n = X();
|
|
81
81
|
n.clear();
|
|
82
82
|
const i = U();
|
|
83
|
-
i.append(
|
|
83
|
+
i.append($(t.trim())), n.append(i), Q(null);
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
tag: e
|
|
87
87
|
}
|
|
88
88
|
), r.blur();
|
|
89
|
-
}, yn = (t, r, e) => {
|
|
89
|
+
}, yn = async (t, r, e) => {
|
|
90
|
+
var l;
|
|
90
91
|
let n = 0;
|
|
91
92
|
const i = ne({
|
|
92
93
|
nodes: r,
|
|
@@ -97,40 +98,40 @@ const nr = ({
|
|
|
97
98
|
try {
|
|
98
99
|
if (typeof t == "string" && !Gt(t))
|
|
99
100
|
i.update(() => {
|
|
100
|
-
const
|
|
101
|
-
|
|
101
|
+
const s = X(), d = U();
|
|
102
|
+
d.append($(t.trim())), s.append(d);
|
|
102
103
|
});
|
|
103
104
|
else {
|
|
104
|
-
const
|
|
105
|
+
const s = i.parseEditorState(t, () => {
|
|
105
106
|
(e == null ? void 0 : e.maxLines) !== void 0 && (n = or({
|
|
106
107
|
editor: i,
|
|
107
108
|
maxLines: e.maxLines
|
|
108
109
|
}));
|
|
109
110
|
});
|
|
110
|
-
|
|
111
|
+
s.isEmpty() || i.setEditorState(s);
|
|
111
112
|
}
|
|
112
|
-
} catch (
|
|
113
|
-
console.error(
|
|
113
|
+
} catch (s) {
|
|
114
|
+
console.error(s);
|
|
114
115
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}), { html:
|
|
116
|
+
await ((l = e == null ? void 0 : e.updateFn) == null ? void 0 : l.call(e, i));
|
|
117
|
+
let a = "";
|
|
118
|
+
return i.read(() => {
|
|
119
|
+
a = oe(i);
|
|
120
|
+
}), { html: a, trimCount: n };
|
|
120
121
|
};
|
|
121
|
-
class G extends
|
|
122
|
+
class G extends B {
|
|
122
123
|
static getType() {
|
|
123
124
|
return "target-link";
|
|
124
125
|
}
|
|
125
126
|
constructor(r, e, n) {
|
|
126
127
|
let i = !1;
|
|
127
|
-
const
|
|
128
|
+
const a = { ...e };
|
|
128
129
|
try {
|
|
129
|
-
const
|
|
130
|
-
window.location.hostname !==
|
|
130
|
+
const l = new URL(r);
|
|
131
|
+
window.location.hostname !== l.hostname && (i = !0);
|
|
131
132
|
} catch {
|
|
132
133
|
}
|
|
133
|
-
i && (
|
|
134
|
+
i && (a.target = "_blank", a.rel = "noopener noreferrer"), super(r, a, n);
|
|
134
135
|
}
|
|
135
136
|
static clone(r) {
|
|
136
137
|
return new G(
|
|
@@ -143,13 +144,13 @@ class G extends D {
|
|
|
143
144
|
return super.exportJSON();
|
|
144
145
|
}
|
|
145
146
|
static importJSON(r) {
|
|
146
|
-
return
|
|
147
|
+
return B.importJSON(r);
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
150
|
const Jt = Se({ hasFocus: !1, editorRef: { current: null }, signUrl: void 0 }), sr = ({ onBlur: t }) => {
|
|
150
151
|
const [r, e] = p(!1), n = K(null), i = C(() => {
|
|
151
152
|
e(!0), n.current && window.clearTimeout(n.current);
|
|
152
|
-
}, []),
|
|
153
|
+
}, []), a = C(() => {
|
|
153
154
|
n.current = window.setTimeout(() => {
|
|
154
155
|
e(!1), t == null || t();
|
|
155
156
|
}, 0);
|
|
@@ -158,7 +159,7 @@ const Jt = Se({ hasFocus: !1, editorRef: { current: null }, signUrl: void 0 }),
|
|
|
158
159
|
hasFocus: r,
|
|
159
160
|
attributes: {
|
|
160
161
|
onFocus: i,
|
|
161
|
-
onBlur:
|
|
162
|
+
onBlur: a
|
|
162
163
|
}
|
|
163
164
|
};
|
|
164
165
|
}, et = () => Ee(Jt), cr = (t) => t.startsWith("https://devfilesab.blob.core.windows.net") || t.startsWith("https://filesab.blob.core.windows.net");
|
|
@@ -169,16 +170,16 @@ function dr({
|
|
|
169
170
|
height: n,
|
|
170
171
|
maxWidth: i
|
|
171
172
|
}) {
|
|
172
|
-
const { signUrl:
|
|
173
|
+
const { signUrl: a } = et(), [l, s] = p(cr(t) ? "" : t), d = K(!1);
|
|
173
174
|
return x(() => {
|
|
174
175
|
const c = async () => {
|
|
175
|
-
s(await (
|
|
176
|
+
s(await (a == null ? void 0 : a(t)) ?? t);
|
|
176
177
|
};
|
|
177
|
-
!
|
|
178
|
-
}, []),
|
|
178
|
+
!l && !d.current && (d.current = !0, c());
|
|
179
|
+
}, []), l ? /* @__PURE__ */ o(
|
|
179
180
|
"img",
|
|
180
181
|
{
|
|
181
|
-
src:
|
|
182
|
+
src: l,
|
|
182
183
|
alt: r,
|
|
183
184
|
style: {
|
|
184
185
|
height: n,
|
|
@@ -189,24 +190,24 @@ function dr({
|
|
|
189
190
|
) : /* @__PURE__ */ o("span", {});
|
|
190
191
|
}
|
|
191
192
|
function hr(t) {
|
|
192
|
-
const r = t, { alt: e, src: n, width: i, height:
|
|
193
|
-
return { node: gt({ altText: e, height:
|
|
193
|
+
const r = t, { alt: e, src: n, width: i, height: a } = r;
|
|
194
|
+
return { node: gt({ altText: e, height: a, src: n, width: i }) };
|
|
194
195
|
}
|
|
195
|
-
class
|
|
196
|
-
constructor(e, n, i,
|
|
196
|
+
class z extends ae {
|
|
197
|
+
constructor(e, n, i, a, l, s) {
|
|
197
198
|
super(s);
|
|
198
199
|
I(this, "__src");
|
|
199
200
|
I(this, "__altText");
|
|
200
201
|
I(this, "__width");
|
|
201
202
|
I(this, "__height");
|
|
202
203
|
I(this, "__maxWidth");
|
|
203
|
-
this.__src = e, this.__altText = n, this.__maxWidth = i, this.__width =
|
|
204
|
+
this.__src = e, this.__altText = n, this.__maxWidth = i, this.__width = a || "inherit", this.__height = l || "inherit";
|
|
204
205
|
}
|
|
205
206
|
static getType() {
|
|
206
207
|
return "image";
|
|
207
208
|
}
|
|
208
209
|
static clone(e) {
|
|
209
|
-
return new
|
|
210
|
+
return new z(
|
|
210
211
|
e.__src,
|
|
211
212
|
e.__altText,
|
|
212
213
|
e.__maxWidth,
|
|
@@ -216,13 +217,13 @@ class H extends ae {
|
|
|
216
217
|
);
|
|
217
218
|
}
|
|
218
219
|
static importJSON(e) {
|
|
219
|
-
const { altText: n, height: i, width:
|
|
220
|
+
const { altText: n, height: i, width: a, maxWidth: l, src: s } = e;
|
|
220
221
|
return gt({
|
|
221
222
|
altText: n,
|
|
222
223
|
height: i,
|
|
223
|
-
maxWidth:
|
|
224
|
+
maxWidth: l,
|
|
224
225
|
src: s,
|
|
225
|
-
width:
|
|
226
|
+
width: a
|
|
226
227
|
});
|
|
227
228
|
}
|
|
228
229
|
exportDOM() {
|
|
@@ -248,14 +249,18 @@ class H extends ae {
|
|
|
248
249
|
width: this.__width === "inherit" ? 0 : this.__width
|
|
249
250
|
};
|
|
250
251
|
}
|
|
252
|
+
setSrc(e) {
|
|
253
|
+
const n = this.getWritable();
|
|
254
|
+
n.__src = e;
|
|
255
|
+
}
|
|
251
256
|
setWidthAndHeight(e, n) {
|
|
252
257
|
const i = this.getWritable();
|
|
253
258
|
i.__width = e, i.__height = n;
|
|
254
259
|
}
|
|
255
260
|
// View
|
|
256
261
|
createDOM(e) {
|
|
257
|
-
const n = document.createElement("span"),
|
|
258
|
-
return
|
|
262
|
+
const n = document.createElement("span"), a = e.theme.image;
|
|
263
|
+
return a !== void 0 && (n.className = a), n;
|
|
259
264
|
}
|
|
260
265
|
updateDOM() {
|
|
261
266
|
return !1;
|
|
@@ -285,37 +290,40 @@ function gt({
|
|
|
285
290
|
maxWidth: e = 500,
|
|
286
291
|
src: n,
|
|
287
292
|
width: i,
|
|
288
|
-
key:
|
|
293
|
+
key: a
|
|
289
294
|
}) {
|
|
290
295
|
return le(
|
|
291
|
-
new
|
|
296
|
+
new z(n, t, e, i, r, a)
|
|
292
297
|
);
|
|
293
298
|
}
|
|
294
|
-
|
|
299
|
+
function Nn(t) {
|
|
300
|
+
return t instanceof z;
|
|
301
|
+
}
|
|
302
|
+
const wn = [
|
|
295
303
|
Et,
|
|
296
304
|
It,
|
|
297
305
|
st,
|
|
298
306
|
wt,
|
|
299
307
|
Nt,
|
|
300
|
-
|
|
308
|
+
B,
|
|
301
309
|
Rt,
|
|
302
310
|
Ot,
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
],
|
|
311
|
+
$t,
|
|
312
|
+
z
|
|
313
|
+
], Sn = [
|
|
306
314
|
Et,
|
|
307
315
|
It,
|
|
308
316
|
st,
|
|
309
317
|
wt,
|
|
310
318
|
Nt,
|
|
311
|
-
|
|
319
|
+
B,
|
|
312
320
|
Rt,
|
|
313
321
|
Ot,
|
|
314
|
-
|
|
315
|
-
|
|
322
|
+
$t,
|
|
323
|
+
z,
|
|
316
324
|
G,
|
|
317
325
|
{
|
|
318
|
-
replace:
|
|
326
|
+
replace: B,
|
|
319
327
|
with: (t) => new G(
|
|
320
328
|
t.getURL(),
|
|
321
329
|
{ rel: t.__rel, target: t.__target, title: t.__title }
|
|
@@ -352,10 +360,10 @@ function vr(t) {
|
|
|
352
360
|
function Mr(t) {
|
|
353
361
|
return m({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17.5 15.5m-3.5 0a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0" } }, { tag: "path", attr: { d: "M3 19v-10.5a3.5 3.5 0 0 1 7 0v10.5" } }, { tag: "path", attr: { d: "M3 13h7" } }, { tag: "path", attr: { d: "M21 12v7" } }] })(t);
|
|
354
362
|
}
|
|
355
|
-
function
|
|
363
|
+
function _r(t) {
|
|
356
364
|
return m({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" } }, { tag: "path", attr: { d: "M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" } }] })(t);
|
|
357
365
|
}
|
|
358
|
-
function
|
|
366
|
+
function Tr(t) {
|
|
359
367
|
return m({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M3.5 5.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 11.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 17.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M11 6l9 0" } }, { tag: "path", attr: { d: "M11 12l9 0" } }, { tag: "path", attr: { d: "M11 18l9 0" } }] })(t);
|
|
360
368
|
}
|
|
361
369
|
function xr(t) {
|
|
@@ -400,12 +408,12 @@ const Er = Xe("div", {
|
|
|
400
408
|
h5: /* @__PURE__ */ o(br, { size: "1.25rem" }),
|
|
401
409
|
h6: /* @__PURE__ */ o(Cr, { size: "1.25rem" }),
|
|
402
410
|
number: /* @__PURE__ */ o(xr, { size: "1.25rem" }),
|
|
403
|
-
check: /* @__PURE__ */ o(
|
|
411
|
+
check: /* @__PURE__ */ o(Tr, { size: "1.25rem" }),
|
|
404
412
|
paragraph: /* @__PURE__ */ o(Mr, { size: "1.25rem" }),
|
|
405
413
|
quote: /* @__PURE__ */ o(yr, { size: "1.25rem" })
|
|
406
414
|
}, M = ({
|
|
407
415
|
blockType: t
|
|
408
|
-
}) => /* @__PURE__ */ h(
|
|
416
|
+
}) => /* @__PURE__ */ h(H, { children: [
|
|
409
417
|
/* @__PURE__ */ o(W, { css: { display: "flex", flex: "0 0 auto" }, children: Ir[t] }),
|
|
410
418
|
/* @__PURE__ */ o(
|
|
411
419
|
W,
|
|
@@ -420,7 +428,7 @@ const Er = Xe("div", {
|
|
|
420
428
|
}
|
|
421
429
|
)
|
|
422
430
|
] }), Rr = (t) => {
|
|
423
|
-
if (!
|
|
431
|
+
if (!T(t))
|
|
424
432
|
return null;
|
|
425
433
|
const r = t.anchor.getNode();
|
|
426
434
|
let e = r.getKey() === "root" ? r : qt(r, (n) => {
|
|
@@ -436,7 +444,7 @@ const Er = Xe("div", {
|
|
|
436
444
|
x(() => t.registerCommand(
|
|
437
445
|
j,
|
|
438
446
|
() => {
|
|
439
|
-
const c =
|
|
447
|
+
const c = _(), u = Rr(c);
|
|
440
448
|
if (!u)
|
|
441
449
|
return !1;
|
|
442
450
|
const { element: g, anchorNode: b } = u, N = g.getKey();
|
|
@@ -448,7 +456,7 @@ const Er = Xe("div", {
|
|
|
448
456
|
), w = k ? k.getListType() : g.getListType();
|
|
449
457
|
e(w);
|
|
450
458
|
} else {
|
|
451
|
-
const k =
|
|
459
|
+
const k = _e(g) ? g.getTag() : g.getType();
|
|
452
460
|
k in Xt && e(k);
|
|
453
461
|
}
|
|
454
462
|
return !1;
|
|
@@ -457,8 +465,8 @@ const Er = Xe("div", {
|
|
|
457
465
|
), [t]);
|
|
458
466
|
const n = (c) => {
|
|
459
467
|
r !== c && t.update(() => {
|
|
460
|
-
const u =
|
|
461
|
-
|
|
468
|
+
const u = _();
|
|
469
|
+
T(u) && (nt(u, () => Te(c)), e(c));
|
|
462
470
|
});
|
|
463
471
|
};
|
|
464
472
|
return /* @__PURE__ */ o(Er, { children: /* @__PURE__ */ h(
|
|
@@ -477,8 +485,8 @@ const Er = Xe("div", {
|
|
|
477
485
|
children: [
|
|
478
486
|
/* @__PURE__ */ o(v, { onClick: () => {
|
|
479
487
|
r !== "paragraph" && t.update(() => {
|
|
480
|
-
const c =
|
|
481
|
-
|
|
488
|
+
const c = _();
|
|
489
|
+
T(c) && (nt(c, () => U()), e("paragraph"));
|
|
482
490
|
});
|
|
483
491
|
}, children: /* @__PURE__ */ o(M, { blockType: "paragraph" }) }),
|
|
484
492
|
/* @__PURE__ */ o(v, { onClick: () => n("h1"), children: /* @__PURE__ */ o(M, { blockType: "h1" }) }),
|
|
@@ -498,17 +506,17 @@ const Er = Xe("div", {
|
|
|
498
506
|
}, children: /* @__PURE__ */ o(M, { blockType: "check" }) }),
|
|
499
507
|
/* @__PURE__ */ o(v, { onClick: () => {
|
|
500
508
|
r !== "quote" && t.update(() => {
|
|
501
|
-
const c =
|
|
502
|
-
|
|
509
|
+
const c = _();
|
|
510
|
+
T(c) && (nt(c, () => xe()), e("quote"));
|
|
503
511
|
});
|
|
504
512
|
}, children: /* @__PURE__ */ o(M, { blockType: "quote" }) })
|
|
505
513
|
]
|
|
506
514
|
}
|
|
507
515
|
) });
|
|
508
|
-
},
|
|
509
|
-
const [t] = L(), [r, e] = p(!1), [n, i] = p(!1), [
|
|
510
|
-
const f =
|
|
511
|
-
|
|
516
|
+
}, $r = () => {
|
|
517
|
+
const [t] = L(), [r, e] = p(!1), [n, i] = p(!1), [a, l] = p(!1), [s, d] = p(!1), [c, u] = p(!1), g = C(() => {
|
|
518
|
+
const f = _();
|
|
519
|
+
T(f) && (e(f.hasFormat("bold")), i(f.hasFormat("italic")), l(f.hasFormat("underline")), d(f.hasFormat("code")), u(f.hasFormat("superscript")));
|
|
512
520
|
}, []);
|
|
513
521
|
x(() => tt(
|
|
514
522
|
t.registerCommand(
|
|
@@ -537,10 +545,10 @@ const Er = Xe("div", {
|
|
|
537
545
|
), w = C(
|
|
538
546
|
() => t.dispatchCommand(F, "superscript"),
|
|
539
547
|
[t]
|
|
540
|
-
), E =
|
|
548
|
+
), E = zt(() => {
|
|
541
549
|
const f = [];
|
|
542
|
-
return r && f.push("bold"), n && f.push("italic"),
|
|
543
|
-
}, [r, n,
|
|
550
|
+
return r && f.push("bold"), n && f.push("italic"), a && f.push("underline"), s && f.push("code"), c && f.push("superscript"), f;
|
|
551
|
+
}, [r, n, a, s, c]);
|
|
544
552
|
return /* @__PURE__ */ h(
|
|
545
553
|
Dt,
|
|
546
554
|
{
|
|
@@ -548,9 +556,9 @@ const Er = Xe("div", {
|
|
|
548
556
|
"aria-label": "Tekstformattering",
|
|
549
557
|
value: E,
|
|
550
558
|
children: [
|
|
551
|
-
/* @__PURE__ */ o(
|
|
559
|
+
/* @__PURE__ */ o(D, { onClick: b, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ o(ur, { size: "1.25rem" }) }),
|
|
552
560
|
/* @__PURE__ */ o(
|
|
553
|
-
|
|
561
|
+
D,
|
|
554
562
|
{
|
|
555
563
|
onClick: N,
|
|
556
564
|
title: "Kursiv tekst",
|
|
@@ -559,7 +567,7 @@ const Er = Xe("div", {
|
|
|
559
567
|
}
|
|
560
568
|
),
|
|
561
569
|
/* @__PURE__ */ o(
|
|
562
|
-
|
|
570
|
+
D,
|
|
563
571
|
{
|
|
564
572
|
onClick: S,
|
|
565
573
|
title: "Understreket tekst",
|
|
@@ -567,9 +575,9 @@ const Er = Xe("div", {
|
|
|
567
575
|
children: /* @__PURE__ */ o(Sr, { size: "1.25rem" })
|
|
568
576
|
}
|
|
569
577
|
),
|
|
570
|
-
/* @__PURE__ */ o(
|
|
578
|
+
/* @__PURE__ */ o(D, { onClick: k, title: "Kode", value: "code", children: /* @__PURE__ */ o(gr, { size: "1.25rem" }) }),
|
|
571
579
|
/* @__PURE__ */ o(
|
|
572
|
-
|
|
580
|
+
D,
|
|
573
581
|
{
|
|
574
582
|
onClick: w,
|
|
575
583
|
title: "Superscript",
|
|
@@ -580,12 +588,12 @@ const Er = Xe("div", {
|
|
|
580
588
|
]
|
|
581
589
|
}
|
|
582
590
|
);
|
|
583
|
-
},
|
|
584
|
-
const { hasFocus: r, editorRef: e } = et(), n = r, [i,
|
|
591
|
+
}, zr = ({ children: t }) => {
|
|
592
|
+
const { hasFocus: r, editorRef: e } = et(), n = r, [i, a] = p(n);
|
|
585
593
|
Ie(() => {
|
|
586
|
-
|
|
594
|
+
a(n);
|
|
587
595
|
}, [n]);
|
|
588
|
-
const { context:
|
|
596
|
+
const { context: l, refs: s, floatingStyles: d } = ut({
|
|
589
597
|
placement: "top",
|
|
590
598
|
whileElementsMounted: Ft,
|
|
591
599
|
middleware: [
|
|
@@ -603,12 +611,12 @@ const Er = Xe("div", {
|
|
|
603
611
|
})
|
|
604
612
|
],
|
|
605
613
|
open: i,
|
|
606
|
-
onOpenChange:
|
|
614
|
+
onOpenChange: a,
|
|
607
615
|
elements: {
|
|
608
616
|
reference: e.current
|
|
609
617
|
}
|
|
610
618
|
}), { getFloatingProps: c } = Ut([
|
|
611
|
-
jt(
|
|
619
|
+
jt(l, {
|
|
612
620
|
role: "dialog"
|
|
613
621
|
})
|
|
614
622
|
]);
|
|
@@ -633,7 +641,7 @@ const Er = Xe("div", {
|
|
|
633
641
|
}) => /* @__PURE__ */ h(Re, { "aria-label": "Formattering", ...r, children: [
|
|
634
642
|
/* @__PURE__ */ o(Or, {}),
|
|
635
643
|
/* @__PURE__ */ o(Oe, {}),
|
|
636
|
-
/* @__PURE__ */ o(
|
|
644
|
+
/* @__PURE__ */ o($r, {}),
|
|
637
645
|
t
|
|
638
646
|
] });
|
|
639
647
|
function Dr() {
|
|
@@ -646,12 +654,12 @@ function Dr() {
|
|
|
646
654
|
),
|
|
647
655
|
t.registerCommand(
|
|
648
656
|
se,
|
|
649
|
-
(r) =>
|
|
657
|
+
(r) => Tt(r, t, !1),
|
|
650
658
|
R
|
|
651
659
|
),
|
|
652
660
|
t.registerCommand(
|
|
653
661
|
ce,
|
|
654
|
-
(r) =>
|
|
662
|
+
(r) => Tt(r, t, !0),
|
|
655
663
|
R
|
|
656
664
|
),
|
|
657
665
|
t.registerCommand(
|
|
@@ -671,7 +679,7 @@ function Dr() {
|
|
|
671
679
|
const e = it();
|
|
672
680
|
return e != null && t.isEditable() ? (t.update(() => {
|
|
673
681
|
const n = lt(e);
|
|
674
|
-
|
|
682
|
+
P(n) && (r.preventDefault(), n.toggleChecked());
|
|
675
683
|
}), !0) : !1;
|
|
676
684
|
},
|
|
677
685
|
R
|
|
@@ -679,18 +687,18 @@ function Dr() {
|
|
|
679
687
|
t.registerCommand(
|
|
680
688
|
he,
|
|
681
689
|
(r) => t.getEditorState().read(() => {
|
|
682
|
-
const e =
|
|
683
|
-
if (
|
|
690
|
+
const e = _();
|
|
691
|
+
if (T(e) && e.isCollapsed()) {
|
|
684
692
|
const { anchor: n } = e, i = n.type === "element";
|
|
685
693
|
if (i || n.offset === 0) {
|
|
686
|
-
const
|
|
687
|
-
|
|
694
|
+
const a = n.getNode(), l = qt(
|
|
695
|
+
a,
|
|
688
696
|
(s) => ue(s) && !s.isInline()
|
|
689
697
|
);
|
|
690
|
-
if (
|
|
691
|
-
const s =
|
|
692
|
-
if (ct(s) && s.getListType() === "check" && (i ||
|
|
693
|
-
const d = t.getElementByKey(
|
|
698
|
+
if (P(l)) {
|
|
699
|
+
const s = l.getParent();
|
|
700
|
+
if (ct(s) && s.getListType() === "check" && (i || l.getFirstDescendant() === a)) {
|
|
701
|
+
const d = t.getElementByKey(l.__key);
|
|
694
702
|
if (d != null && document.activeElement !== d)
|
|
695
703
|
return d.focus(), r.preventDefault(), !0;
|
|
696
704
|
}
|
|
@@ -702,7 +710,7 @@ function Dr() {
|
|
|
702
710
|
R
|
|
703
711
|
),
|
|
704
712
|
t.registerRootListener((r, e) => {
|
|
705
|
-
r !== null && (r.addEventListener("click", Mt), r.addEventListener("pointerdown",
|
|
713
|
+
r !== null && (r.addEventListener("click", Mt), r.addEventListener("pointerdown", _t)), e !== null && (e.removeEventListener("click", Mt), e.removeEventListener("pointerdown", _t));
|
|
706
714
|
})
|
|
707
715
|
), [t]), null;
|
|
708
716
|
}
|
|
@@ -716,8 +724,8 @@ function Qt(t, r) {
|
|
|
716
724
|
const i = e.parentNode;
|
|
717
725
|
if (!i || i.__lexicalListType !== "check")
|
|
718
726
|
return;
|
|
719
|
-
const
|
|
720
|
-
(e.dir === "rtl" ?
|
|
727
|
+
const a = t.pageX, l = e.getBoundingClientRect();
|
|
728
|
+
(e.dir === "rtl" ? a < l.right && a > l.right - 20 : a > l.left && a < l.left + 20) && r();
|
|
721
729
|
}
|
|
722
730
|
function Mt(t) {
|
|
723
731
|
Qt(t, () => {
|
|
@@ -725,12 +733,12 @@ function Mt(t) {
|
|
|
725
733
|
e != null && e.isEditable() && e.update(() => {
|
|
726
734
|
if (t.target) {
|
|
727
735
|
const n = lt(r);
|
|
728
|
-
|
|
736
|
+
P(n) && (r.focus(), n.toggleChecked());
|
|
729
737
|
}
|
|
730
738
|
});
|
|
731
739
|
});
|
|
732
740
|
}
|
|
733
|
-
function
|
|
741
|
+
function _t(t) {
|
|
734
742
|
Qt(t, () => {
|
|
735
743
|
t.preventDefault();
|
|
736
744
|
});
|
|
@@ -751,9 +759,9 @@ function it() {
|
|
|
751
759
|
}
|
|
752
760
|
function Pr(t, r) {
|
|
753
761
|
let e = r ? t.getPreviousSibling() : t.getNextSibling(), n = t;
|
|
754
|
-
for (; e == null &&
|
|
762
|
+
for (; e == null && P(n); )
|
|
755
763
|
n = n.getParentOrThrow().getParent(), n != null && (e = r ? n.getPreviousSibling() : n.getNextSibling());
|
|
756
|
-
for (;
|
|
764
|
+
for (; P(e); ) {
|
|
757
765
|
const i = r ? e.getLastChild() : e.getFirstChild();
|
|
758
766
|
if (!ct(i))
|
|
759
767
|
return e;
|
|
@@ -761,18 +769,18 @@ function Pr(t, r) {
|
|
|
761
769
|
}
|
|
762
770
|
return null;
|
|
763
771
|
}
|
|
764
|
-
function
|
|
772
|
+
function Tt(t, r, e) {
|
|
765
773
|
const n = it();
|
|
766
774
|
return n != null && r.update(() => {
|
|
767
775
|
const i = lt(n);
|
|
768
|
-
if (!
|
|
776
|
+
if (!P(i))
|
|
769
777
|
return;
|
|
770
|
-
const
|
|
771
|
-
if (
|
|
772
|
-
|
|
773
|
-
const
|
|
774
|
-
|
|
775
|
-
|
|
778
|
+
const a = Pr(i, e);
|
|
779
|
+
if (a != null) {
|
|
780
|
+
a.selectStart();
|
|
781
|
+
const l = r.getElementByKey(a.__key);
|
|
782
|
+
l != null && (t.preventDefault(), setTimeout(() => {
|
|
783
|
+
l.focus();
|
|
776
784
|
}, 0));
|
|
777
785
|
}
|
|
778
786
|
}), !1;
|
|
@@ -781,7 +789,7 @@ const Vt = ge("INSERT_IMAGE_COMMAND");
|
|
|
781
789
|
function Hr() {
|
|
782
790
|
const [t] = rr();
|
|
783
791
|
return x(() => {
|
|
784
|
-
if (!t.hasNodes([
|
|
792
|
+
if (!t.hasNodes([z]))
|
|
785
793
|
throw new Error("ImagePlugin: ImageNode not registered on editor");
|
|
786
794
|
return tt(
|
|
787
795
|
t.registerCommand(
|
|
@@ -795,7 +803,7 @@ function Hr() {
|
|
|
795
803
|
);
|
|
796
804
|
}, [t]), null;
|
|
797
805
|
}
|
|
798
|
-
const Fr = () => /* @__PURE__ */ h(
|
|
806
|
+
const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
799
807
|
/* @__PURE__ */ o(Ve, {}),
|
|
800
808
|
/* @__PURE__ */ o(tr, {}),
|
|
801
809
|
/* @__PURE__ */ o(Ze, {}),
|
|
@@ -824,7 +832,7 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
824
832
|
}
|
|
825
833
|
}));
|
|
826
834
|
}, []), null;
|
|
827
|
-
}, Ur =
|
|
835
|
+
}, Ur = $e("div", {
|
|
828
836
|
border: "1px solid $borderDarker",
|
|
829
837
|
borderRadius: "$md",
|
|
830
838
|
position: "relative",
|
|
@@ -875,14 +883,14 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
875
883
|
},
|
|
876
884
|
children: /* @__PURE__ */ o(ht, {})
|
|
877
885
|
}
|
|
878
|
-
),
|
|
886
|
+
), En = ({
|
|
879
887
|
isLoading: t,
|
|
880
888
|
children: r,
|
|
881
889
|
placeholderText: e,
|
|
882
890
|
nodes: n,
|
|
883
891
|
plugins: i,
|
|
884
|
-
toolbar:
|
|
885
|
-
toolbarContent:
|
|
892
|
+
toolbar: a,
|
|
893
|
+
toolbarContent: l,
|
|
886
894
|
content: s,
|
|
887
895
|
hideBorder: d,
|
|
888
896
|
onBlur: c,
|
|
@@ -890,7 +898,7 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
890
898
|
css: g,
|
|
891
899
|
signUrl: b
|
|
892
900
|
}) => {
|
|
893
|
-
const { hasFocus: N, attributes: S } = sr({ onBlur: c }), k = K(null), w =
|
|
901
|
+
const { hasFocus: N, attributes: S } = sr({ onBlur: c }), k = K(null), w = zt(
|
|
894
902
|
() => ({ hasFocus: N, editorRef: k, signUrl: b }),
|
|
895
903
|
[N, b]
|
|
896
904
|
);
|
|
@@ -916,7 +924,7 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
916
924
|
css: g,
|
|
917
925
|
...S,
|
|
918
926
|
children: [
|
|
919
|
-
|
|
927
|
+
a,
|
|
920
928
|
/* @__PURE__ */ o(
|
|
921
929
|
Pe,
|
|
922
930
|
{
|
|
@@ -941,12 +949,12 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
941
949
|
/* @__PURE__ */ o(Fr, {}),
|
|
942
950
|
i,
|
|
943
951
|
/* @__PURE__ */ o(jr, { isLoading: t }),
|
|
944
|
-
!
|
|
952
|
+
!a && /* @__PURE__ */ o(zr, { children: l })
|
|
945
953
|
]
|
|
946
954
|
}
|
|
947
955
|
),
|
|
948
956
|
/* @__PURE__ */ o(Wr, { state: u }),
|
|
949
|
-
/* @__PURE__ */ o(
|
|
957
|
+
/* @__PURE__ */ o(H, { children: r })
|
|
950
958
|
]
|
|
951
959
|
}
|
|
952
960
|
) });
|
|
@@ -1140,32 +1148,32 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1140
1148
|
defaultVariants: {
|
|
1141
1149
|
size: "md"
|
|
1142
1150
|
}
|
|
1143
|
-
},
|
|
1151
|
+
}, In = Qe(Kr), qr = ({
|
|
1144
1152
|
uploadFile: t,
|
|
1145
1153
|
...r
|
|
1146
1154
|
}) => {
|
|
1147
|
-
const [e] = L(), [n, i] = p(null),
|
|
1155
|
+
const [e] = L(), [n, i] = p(null), a = async (s) => {
|
|
1148
1156
|
var c;
|
|
1149
1157
|
const d = (c = s.target.files) == null ? void 0 : c[0];
|
|
1150
1158
|
if (d) {
|
|
1151
1159
|
const u = await t.uploadFile({ file: d });
|
|
1152
1160
|
i(u);
|
|
1153
1161
|
}
|
|
1154
|
-
},
|
|
1162
|
+
}, l = () => {
|
|
1155
1163
|
n && !t.isLoading && (e.dispatchCommand(Vt, {
|
|
1156
1164
|
src: n,
|
|
1157
1165
|
altText: `Image: ${n}`
|
|
1158
1166
|
}), r.onOpenChange(!1));
|
|
1159
1167
|
};
|
|
1160
1168
|
return /* @__PURE__ */ h(Pt, { ...r, children: [
|
|
1161
|
-
/* @__PURE__ */ o(
|
|
1169
|
+
/* @__PURE__ */ o(ze, { children: "Sett inn bilde" }),
|
|
1162
1170
|
t.isLoading && /* @__PURE__ */ o(ht, {}),
|
|
1163
1171
|
/* @__PURE__ */ o(
|
|
1164
1172
|
Ht,
|
|
1165
1173
|
{
|
|
1166
1174
|
type: "file",
|
|
1167
1175
|
accept: "image/png, image/jpeg",
|
|
1168
|
-
onChange:
|
|
1176
|
+
onChange: a,
|
|
1169
1177
|
disabled: t.isLoading
|
|
1170
1178
|
}
|
|
1171
1179
|
),
|
|
@@ -1176,13 +1184,13 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1176
1184
|
{
|
|
1177
1185
|
variant: "primary",
|
|
1178
1186
|
disabled: !n || t.isLoading,
|
|
1179
|
-
onClick:
|
|
1187
|
+
onClick: l,
|
|
1180
1188
|
children: "Sett inn"
|
|
1181
1189
|
}
|
|
1182
1190
|
)
|
|
1183
1191
|
] })
|
|
1184
1192
|
] });
|
|
1185
|
-
},
|
|
1193
|
+
}, Rn = ({ uploadFile: t }) => {
|
|
1186
1194
|
const [r] = L(), [e, n] = p(!1), i = C(() => {
|
|
1187
1195
|
r.dispatchCommand(Le, {
|
|
1188
1196
|
rows: "3",
|
|
@@ -1190,7 +1198,7 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1190
1198
|
includeHeaders: !1
|
|
1191
1199
|
});
|
|
1192
1200
|
}, [r]);
|
|
1193
|
-
return /* @__PURE__ */ h(
|
|
1201
|
+
return /* @__PURE__ */ h(H, { children: [
|
|
1194
1202
|
/* @__PURE__ */ h(
|
|
1195
1203
|
dt,
|
|
1196
1204
|
{
|
|
@@ -1222,12 +1230,12 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1222
1230
|
function Yr(t) {
|
|
1223
1231
|
return m({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "circle", attr: { cx: "256", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "416", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "96", cy: "256", r: "48" } }] })(t);
|
|
1224
1232
|
}
|
|
1225
|
-
const
|
|
1233
|
+
const On = () => {
|
|
1226
1234
|
const [t] = L(), [r, e] = p(null), { hasFocus: n } = et();
|
|
1227
1235
|
x(() => {
|
|
1228
1236
|
!n && r && e(null);
|
|
1229
1237
|
}, [n, r]);
|
|
1230
|
-
const { refs: i, floatingStyles:
|
|
1238
|
+
const { refs: i, floatingStyles: a } = ut({
|
|
1231
1239
|
placement: "top-end",
|
|
1232
1240
|
open: !!r,
|
|
1233
1241
|
elements: {
|
|
@@ -1238,8 +1246,8 @@ const Rn = () => {
|
|
|
1238
1246
|
x(() => t.registerCommand(
|
|
1239
1247
|
j,
|
|
1240
1248
|
() => {
|
|
1241
|
-
const s =
|
|
1242
|
-
if (
|
|
1249
|
+
const s = _();
|
|
1250
|
+
if (T(s)) {
|
|
1243
1251
|
const d = s.anchor.getNode(), c = ye(d);
|
|
1244
1252
|
e(c ? t.getElementByKey(c.getKey()) : null);
|
|
1245
1253
|
}
|
|
@@ -1247,7 +1255,7 @@ const Rn = () => {
|
|
|
1247
1255
|
},
|
|
1248
1256
|
fe
|
|
1249
1257
|
), [t]);
|
|
1250
|
-
const
|
|
1258
|
+
const l = (s) => () => {
|
|
1251
1259
|
t.update(() => {
|
|
1252
1260
|
switch (s) {
|
|
1253
1261
|
case "add-row-over":
|
|
@@ -1281,20 +1289,20 @@ const Rn = () => {
|
|
|
1281
1289
|
variant: "primary",
|
|
1282
1290
|
color: "secondary",
|
|
1283
1291
|
ref: i.setFloating,
|
|
1284
|
-
style:
|
|
1292
|
+
style: a,
|
|
1285
1293
|
css: { padding: "2px", width: "18px", height: "18px" },
|
|
1286
1294
|
children: /* @__PURE__ */ o(Yr, {})
|
|
1287
1295
|
}
|
|
1288
1296
|
),
|
|
1289
1297
|
children: [
|
|
1290
|
-
/* @__PURE__ */ o(
|
|
1291
|
-
/* @__PURE__ */ o(
|
|
1298
|
+
/* @__PURE__ */ o(A, { onClick: l("add-row-over"), children: "Legg til rad over" }),
|
|
1299
|
+
/* @__PURE__ */ o(A, { onClick: l("add-row-under"), children: "Legg til rad under" }),
|
|
1292
1300
|
/* @__PURE__ */ o(Ct, {}),
|
|
1293
|
-
/* @__PURE__ */ o(
|
|
1294
|
-
/* @__PURE__ */ o(
|
|
1301
|
+
/* @__PURE__ */ o(A, { onClick: l("add-column-left"), children: "Legg til kolonne venstre" }),
|
|
1302
|
+
/* @__PURE__ */ o(A, { onClick: l("add-column-right"), children: "Legg til kolonne høyre" }),
|
|
1295
1303
|
/* @__PURE__ */ o(Ct, {}),
|
|
1296
|
-
/* @__PURE__ */ o(
|
|
1297
|
-
/* @__PURE__ */ o(
|
|
1304
|
+
/* @__PURE__ */ o(A, { onClick: l("delete-row"), children: "Fjern rad" }),
|
|
1305
|
+
/* @__PURE__ */ o(A, { onClick: l("delete-column"), children: "Fjern kolonne" })
|
|
1298
1306
|
]
|
|
1299
1307
|
}
|
|
1300
1308
|
) : null;
|
|
@@ -1308,7 +1316,7 @@ function Zt(t) {
|
|
|
1308
1316
|
const r = t.anchor, e = t.focus, n = t.anchor.getNode(), i = t.focus.getNode();
|
|
1309
1317
|
return n === i ? n : t.isBackward() ? ft(e) ? n : i : ft(r) ? n : i;
|
|
1310
1318
|
}
|
|
1311
|
-
const
|
|
1319
|
+
const $n = (t) => (O.baseURL = t, O), J = class extends B {
|
|
1312
1320
|
static getType() {
|
|
1313
1321
|
return "rutine_link";
|
|
1314
1322
|
}
|
|
@@ -1350,12 +1358,12 @@ const Jr = ({ onClose: t }) => {
|
|
|
1350
1358
|
const [r] = L(), e = C(
|
|
1351
1359
|
(i) => {
|
|
1352
1360
|
r.update(() => {
|
|
1353
|
-
const
|
|
1354
|
-
if (
|
|
1355
|
-
const
|
|
1356
|
-
|
|
1361
|
+
const a = _();
|
|
1362
|
+
if (T(a) && a.isCollapsed()) {
|
|
1363
|
+
const l = $(i);
|
|
1364
|
+
a.insertNodes([l]);
|
|
1357
1365
|
const s = yt();
|
|
1358
|
-
s.setTextNodeRange(
|
|
1366
|
+
s.setTextNodeRange(l, 0, l, i.length), Q(s);
|
|
1359
1367
|
}
|
|
1360
1368
|
r.dispatchCommand(V, pt(i));
|
|
1361
1369
|
});
|
|
@@ -1375,15 +1383,15 @@ const Jr = ({ onClose: t }) => {
|
|
|
1375
1383
|
onClose: t,
|
|
1376
1384
|
getDocs: r
|
|
1377
1385
|
}) => {
|
|
1378
|
-
const [e] = L(), [n, i] = p([]),
|
|
1386
|
+
const [e] = L(), [n, i] = p([]), a = r(), l = C(
|
|
1379
1387
|
(s) => {
|
|
1380
1388
|
e.update(() => {
|
|
1381
|
-
const d =
|
|
1382
|
-
if (
|
|
1389
|
+
const d = _();
|
|
1390
|
+
if (T(d)) {
|
|
1383
1391
|
const c = [];
|
|
1384
1392
|
for (const [u, g] of s.entries()) {
|
|
1385
1393
|
const b = te(g.value);
|
|
1386
|
-
b.append(
|
|
1394
|
+
b.append($(g.label)), c.push(b), u !== s.length - 1 && c.push($(" "));
|
|
1387
1395
|
}
|
|
1388
1396
|
d.insertNodes(c);
|
|
1389
1397
|
}
|
|
@@ -1391,12 +1399,12 @@ const Jr = ({ onClose: t }) => {
|
|
|
1391
1399
|
},
|
|
1392
1400
|
[e]
|
|
1393
1401
|
);
|
|
1394
|
-
return /* @__PURE__ */ h(
|
|
1402
|
+
return /* @__PURE__ */ h(H, { children: [
|
|
1395
1403
|
/* @__PURE__ */ o(
|
|
1396
1404
|
De,
|
|
1397
1405
|
{
|
|
1398
1406
|
isMulti: !0,
|
|
1399
|
-
options:
|
|
1407
|
+
options: a,
|
|
1400
1408
|
onChange: (s) => i(s)
|
|
1401
1409
|
}
|
|
1402
1410
|
),
|
|
@@ -1407,7 +1415,7 @@ const Jr = ({ onClose: t }) => {
|
|
|
1407
1415
|
{
|
|
1408
1416
|
variant: "primary",
|
|
1409
1417
|
onClick: () => {
|
|
1410
|
-
|
|
1418
|
+
l(n), t();
|
|
1411
1419
|
},
|
|
1412
1420
|
children: "Sett inn"
|
|
1413
1421
|
}
|
|
@@ -1418,7 +1426,7 @@ const Jr = ({ onClose: t }) => {
|
|
|
1418
1426
|
onClose: t,
|
|
1419
1427
|
uploadFile: r
|
|
1420
1428
|
}) => {
|
|
1421
|
-
const [e] = L(), [n, i] = p(null),
|
|
1429
|
+
const [e] = L(), [n, i] = p(null), a = async (s) => {
|
|
1422
1430
|
var c;
|
|
1423
1431
|
const d = (c = s.target.files) == null ? void 0 : c[0];
|
|
1424
1432
|
if (d) {
|
|
@@ -1428,13 +1436,13 @@ const Jr = ({ onClose: t }) => {
|
|
|
1428
1436
|
url: u
|
|
1429
1437
|
});
|
|
1430
1438
|
}
|
|
1431
|
-
},
|
|
1439
|
+
}, l = C(() => {
|
|
1432
1440
|
e.update(() => {
|
|
1433
1441
|
if (!n)
|
|
1434
1442
|
return;
|
|
1435
|
-
const s =
|
|
1436
|
-
if (
|
|
1437
|
-
const d =
|
|
1443
|
+
const s = _();
|
|
1444
|
+
if (T(s) && s.isCollapsed()) {
|
|
1445
|
+
const d = $(n.name);
|
|
1438
1446
|
s.insertNodes([d]);
|
|
1439
1447
|
const c = yt();
|
|
1440
1448
|
c.setTextNodeRange(d, 0, d, n.name.length), Q(c);
|
|
@@ -1442,13 +1450,13 @@ const Jr = ({ onClose: t }) => {
|
|
|
1442
1450
|
e.dispatchCommand(V, pt(n.url));
|
|
1443
1451
|
});
|
|
1444
1452
|
}, [e, n]);
|
|
1445
|
-
return /* @__PURE__ */ h(
|
|
1453
|
+
return /* @__PURE__ */ h(H, { children: [
|
|
1446
1454
|
r.isLoading && /* @__PURE__ */ o(ht, {}),
|
|
1447
1455
|
/* @__PURE__ */ o(
|
|
1448
1456
|
"input",
|
|
1449
1457
|
{
|
|
1450
1458
|
type: "file",
|
|
1451
|
-
onChange:
|
|
1459
|
+
onChange: a,
|
|
1452
1460
|
disabled: r.isLoading
|
|
1453
1461
|
}
|
|
1454
1462
|
),
|
|
@@ -1459,7 +1467,7 @@ const Jr = ({ onClose: t }) => {
|
|
|
1459
1467
|
{
|
|
1460
1468
|
variant: "primary",
|
|
1461
1469
|
onClick: () => {
|
|
1462
|
-
|
|
1470
|
+
l(), t();
|
|
1463
1471
|
},
|
|
1464
1472
|
disabled: !n,
|
|
1465
1473
|
children: "Sett inn"
|
|
@@ -1473,33 +1481,33 @@ const Jr = ({ onClose: t }) => {
|
|
|
1473
1481
|
getDocs: e,
|
|
1474
1482
|
uploadFile: n
|
|
1475
1483
|
}) => {
|
|
1476
|
-
const [i,
|
|
1484
|
+
const [i, a] = p("url"), l = () => {
|
|
1477
1485
|
r(!1);
|
|
1478
1486
|
};
|
|
1479
1487
|
return /* @__PURE__ */ h(Pt, { open: t, onOpenChange: r, css: { width: "600px" }, children: [
|
|
1480
1488
|
/* @__PURE__ */ h(Ae, { css: { marginBottom: "$8" }, children: [
|
|
1481
|
-
/* @__PURE__ */ o(ot, { active: i === "url", onClick: () =>
|
|
1489
|
+
/* @__PURE__ */ o(ot, { active: i === "url", onClick: () => a("url"), children: "URL" }),
|
|
1482
1490
|
e && /* @__PURE__ */ o(
|
|
1483
1491
|
ot,
|
|
1484
1492
|
{
|
|
1485
1493
|
active: i === "rutine",
|
|
1486
|
-
onClick: () =>
|
|
1494
|
+
onClick: () => a("rutine"),
|
|
1487
1495
|
children: "Rutine"
|
|
1488
1496
|
}
|
|
1489
1497
|
),
|
|
1490
|
-
n && /* @__PURE__ */ o(ot, { active: i === "file", onClick: () =>
|
|
1498
|
+
n && /* @__PURE__ */ o(ot, { active: i === "file", onClick: () => a("file"), children: "Fil" })
|
|
1491
1499
|
] }),
|
|
1492
|
-
i === "url" && /* @__PURE__ */ o(Jr, { onClose:
|
|
1493
|
-
i === "rutine" && e && /* @__PURE__ */ o(Xr, { onClose:
|
|
1494
|
-
i === "file" && n && /* @__PURE__ */ o(Qr, { onClose:
|
|
1500
|
+
i === "url" && /* @__PURE__ */ o(Jr, { onClose: l }),
|
|
1501
|
+
i === "rutine" && e && /* @__PURE__ */ o(Xr, { onClose: l, getDocs: e }),
|
|
1502
|
+
i === "file" && n && /* @__PURE__ */ o(Qr, { onClose: l, uploadFile: n })
|
|
1495
1503
|
] });
|
|
1496
1504
|
}, zn = ({
|
|
1497
1505
|
getDocs: t,
|
|
1498
1506
|
uploadFile: r
|
|
1499
1507
|
}) => {
|
|
1500
|
-
const [e] = L(), [n, i] = p(!1), [
|
|
1501
|
-
const d =
|
|
1502
|
-
if (
|
|
1508
|
+
const [e] = L(), [n, i] = p(!1), [a, l] = p(!1), s = C(() => {
|
|
1509
|
+
const d = _();
|
|
1510
|
+
if (T(d)) {
|
|
1503
1511
|
const c = Zt(d), u = c.getParent();
|
|
1504
1512
|
i(Y(u) || Y(c));
|
|
1505
1513
|
}
|
|
@@ -1510,34 +1518,34 @@ const Jr = ({ onClose: t }) => {
|
|
|
1510
1518
|
at
|
|
1511
1519
|
), [e, s]), /* @__PURE__ */ h(Dt, { type: "single", value: n ? "link" : "", children: [
|
|
1512
1520
|
/* @__PURE__ */ o(
|
|
1513
|
-
|
|
1521
|
+
D,
|
|
1514
1522
|
{
|
|
1515
1523
|
onClick: () => {
|
|
1516
|
-
n ? e.dispatchCommand(V, null) :
|
|
1524
|
+
n ? e.dispatchCommand(V, null) : l(!0);
|
|
1517
1525
|
},
|
|
1518
1526
|
title: "Lenke",
|
|
1519
1527
|
value: "link",
|
|
1520
|
-
children: /* @__PURE__ */ o(
|
|
1528
|
+
children: /* @__PURE__ */ o(_r, { size: "1.25rem" })
|
|
1521
1529
|
}
|
|
1522
1530
|
),
|
|
1523
1531
|
/* @__PURE__ */ o(
|
|
1524
1532
|
Vr,
|
|
1525
1533
|
{
|
|
1526
|
-
open:
|
|
1527
|
-
onOpenChange:
|
|
1534
|
+
open: a,
|
|
1535
|
+
onOpenChange: l,
|
|
1528
1536
|
getDocs: t,
|
|
1529
1537
|
uploadFile: r
|
|
1530
1538
|
}
|
|
1531
1539
|
)
|
|
1532
1540
|
] });
|
|
1533
|
-
},
|
|
1534
|
-
const [t] = L(), r = K(null), [e, n] = p(null), [i,
|
|
1541
|
+
}, An = () => {
|
|
1542
|
+
const [t] = L(), r = K(null), [e, n] = p(null), [i, a] = p(""), { hasFocus: l } = et();
|
|
1535
1543
|
x(() => {
|
|
1536
1544
|
e ? t.update(() => {
|
|
1537
|
-
|
|
1538
|
-
}) :
|
|
1545
|
+
a(e.getURL());
|
|
1546
|
+
}) : a("");
|
|
1539
1547
|
}, [t, e]);
|
|
1540
|
-
const s = !!(e && i &&
|
|
1548
|
+
const s = !!(e && i && l), { refs: d, floatingStyles: c, context: u } = ut({
|
|
1541
1549
|
placement: "top",
|
|
1542
1550
|
strategy: "fixed",
|
|
1543
1551
|
open: s,
|
|
@@ -1551,8 +1559,8 @@ const Jr = ({ onClose: t }) => {
|
|
|
1551
1559
|
Ke(u)
|
|
1552
1560
|
]), b = C(() => {
|
|
1553
1561
|
var w;
|
|
1554
|
-
const k =
|
|
1555
|
-
if (
|
|
1562
|
+
const k = _();
|
|
1563
|
+
if (T(k)) {
|
|
1556
1564
|
const E = Zt(k), f = E.getParent();
|
|
1557
1565
|
let q = null;
|
|
1558
1566
|
if (Y(f) ? q = f : Y(E) && (q = E), q) {
|
|
@@ -1627,25 +1635,28 @@ const Jr = ({ onClose: t }) => {
|
|
|
1627
1635
|
) });
|
|
1628
1636
|
};
|
|
1629
1637
|
export {
|
|
1638
|
+
gt as $createImageNode,
|
|
1630
1639
|
te as $createRutineLinkNode,
|
|
1640
|
+
Nn as $isImageNode,
|
|
1631
1641
|
Gr as $isRutineLinkNode,
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1642
|
+
zr as FloatingToolbar,
|
|
1643
|
+
z as ImageNode,
|
|
1644
|
+
Rn as InsertSelector,
|
|
1645
|
+
An as LinkEditPlugin,
|
|
1635
1646
|
G as LinkTargetNode,
|
|
1636
1647
|
zn as LinkToolbarButton,
|
|
1637
|
-
|
|
1648
|
+
En as RichTextEditor,
|
|
1638
1649
|
Ar as RichTextToolbar,
|
|
1639
1650
|
O as RutineLinkNode,
|
|
1640
|
-
|
|
1641
|
-
|
|
1651
|
+
$n as RutineLinkNodeInit,
|
|
1652
|
+
On as TableEditPlugin,
|
|
1642
1653
|
ar as clearEditorState,
|
|
1643
|
-
|
|
1644
|
-
|
|
1654
|
+
wn as defaultNodes,
|
|
1655
|
+
Sn as defaultViewNodes,
|
|
1645
1656
|
ir as isEditorState,
|
|
1646
1657
|
Gt as isJSON,
|
|
1647
1658
|
Jt as richTextContext,
|
|
1648
|
-
|
|
1659
|
+
In as richTextCss,
|
|
1649
1660
|
Kr as richTextStyleObj,
|
|
1650
1661
|
lr as setStateFromPlainText,
|
|
1651
1662
|
yn as stateToHTML,
|