@arkitektbedriftene/fe-lib 0.4.29 → 0.4.31
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.es.js
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { createHeadlessEditor as
|
|
5
|
-
import { $generateHtmlFromNodes as
|
|
6
|
-
import { $getRoot as
|
|
7
|
-
import { trimTextContentFromAnchor as
|
|
8
|
-
import {
|
|
9
|
-
import { ListNode as
|
|
10
|
-
import { HeadingNode as
|
|
11
|
-
import { TableNode as
|
|
12
|
-
import { jsx as n, jsxs as g, Fragment as
|
|
13
|
-
import { createContext as
|
|
14
|
-
import { s as
|
|
1
|
+
var Gt = Object.defineProperty;
|
|
2
|
+
var Jt = (t, e, r) => e in t ? Gt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var st = (t, e, r) => (Jt(t, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
|
+
import { createHeadlessEditor as Xt } from "@lexical/headless";
|
|
5
|
+
import { $generateHtmlFromNodes as Qt } from "@lexical/html";
|
|
6
|
+
import { $getRoot as K, ParagraphNode as Vt, $createParagraphNode as q, $createTextNode as B, $setSelection as bt, SELECTION_CHANGE_COMMAND as F, $getSelection as T, COMMAND_PRIORITY_CRITICAL as Q, $isRangeSelection as L, $isRootOrShadowRoot as Zt, FORMAT_TEXT_COMMAND as D, COMMAND_PRIORITY_LOW as E, KEY_ARROW_DOWN_COMMAND as te, KEY_ARROW_UP_COMMAND as ee, KEY_ESCAPE_COMMAND as vt, KEY_SPACE_COMMAND as re, $getNearestNodeFromDOMNode as V, KEY_ARROW_LEFT_COMMAND as ne, $isElementNode as oe, COMMAND_PRIORITY_NORMAL as ie, $isParagraphNode as ae, COMMAND_PRIORITY_HIGH as le } from "lexical";
|
|
7
|
+
import { trimTextContentFromAnchor as se, $setBlocksType as J, $isAtNodeEnd as ct } from "@lexical/selection";
|
|
8
|
+
import { LinkNode as z, AutoLinkNode as Mt, $isLinkNode as U, TOGGLE_LINK_COMMAND as Z } from "@lexical/link";
|
|
9
|
+
import { ListNode as tt, ListItemNode as Ct, $isListNode as et, INSERT_UNORDERED_LIST_COMMAND as ce, INSERT_ORDERED_LIST_COMMAND as de, INSERT_CHECK_LIST_COMMAND as Tt, insertList as ue, $isListItemNode as O } from "@lexical/list";
|
|
10
|
+
import { HeadingNode as Lt, QuoteNode as xt, $isHeadingNode as he, $createHeadingNode as pe, $createQuoteNode as ge } from "@lexical/rich-text";
|
|
11
|
+
import { TableNode as yt, TableRowNode as Nt, TableCellNode as St, INSERT_TABLE_COMMAND as fe, $getTableCellNodeFromLexicalNode as me, $deleteTableColumn__EXPERIMENTAL as ke, $deleteTableRow__EXPERIMENTAL as be, $insertTableColumn__EXPERIMENTAL as dt, $insertTableRow__EXPERIMENTAL as ut } from "@lexical/table";
|
|
12
|
+
import { jsx as n, jsxs as g, Fragment as Y } from "react/jsx-runtime";
|
|
13
|
+
import { createContext as ve, useState as b, useRef as rt, useCallback as v, useContext as Me, useEffect as x, useMemo as wt, useLayoutEffect as Ce } from "react";
|
|
14
|
+
import { s as Et, D as nt, T as _t, a as C, B as P, b as Rt, c as I, u as ot, d as It, e as Te, f as Le, o as zt, g as xe, h as Ot, i as $t, F as At, O as Dt, j as ye, k as Ne, S as Se, l as we, m as $, n as R, p as ht, q as Ee, N as _e, r as pt, t as Re, v as Bt, C as Ie, w as ze, x as Oe } from "./Checkbox-0c1030b1.js";
|
|
15
15
|
import "react-select";
|
|
16
|
-
import { LexicalComposer as
|
|
17
|
-
import { RichTextPlugin as
|
|
18
|
-
import
|
|
16
|
+
import { LexicalComposer as $e } from "@lexical/react/LexicalComposer.js";
|
|
17
|
+
import { RichTextPlugin as Ae } from "@lexical/react/LexicalRichTextPlugin.js";
|
|
18
|
+
import De from "@lexical/react/LexicalErrorBoundary.js";
|
|
19
19
|
import { useLexicalComposerContext as y } from "@lexical/react/LexicalComposerContext.js";
|
|
20
|
-
import { $getNearestNodeOfType as
|
|
21
|
-
import { G as h, f as
|
|
22
|
-
import { ListPlugin as
|
|
23
|
-
import { HistoryPlugin as
|
|
24
|
-
import { TablePlugin as
|
|
20
|
+
import { $getNearestNodeOfType as Be, $findMatchingParent as Pt, mergeRegister as it, isHTMLElement as gt } from "@lexical/utils";
|
|
21
|
+
import { G as h, f as Pe } from "./index.esm-3266b7f8.js";
|
|
22
|
+
import { ListPlugin as Fe } from "@lexical/react/LexicalListPlugin.js";
|
|
23
|
+
import { HistoryPlugin as He } from "@lexical/react/LexicalHistoryPlugin.js";
|
|
24
|
+
import { TablePlugin as Ue } from "@lexical/react/LexicalTablePlugin.js";
|
|
25
25
|
import { TabIndentationPlugin as We } from "@lexical/react/LexicalTabIndentationPlugin.js";
|
|
26
26
|
import "react-dom";
|
|
27
27
|
import "@radix-ui/react-toolbar";
|
|
28
28
|
import "@radix-ui/react-dialog";
|
|
29
29
|
import "@radix-ui/react-dropdown-menu";
|
|
30
30
|
import "@radix-ui/react-checkbox";
|
|
31
|
-
const
|
|
31
|
+
const je = ({
|
|
32
32
|
text: t,
|
|
33
|
-
maxChars:
|
|
34
|
-
maxLines:
|
|
33
|
+
maxChars: e,
|
|
34
|
+
maxLines: r
|
|
35
35
|
}) => {
|
|
36
36
|
if (t.length === 0)
|
|
37
37
|
return 0;
|
|
38
|
-
const o = typeof
|
|
38
|
+
const o = typeof r == "number", i = typeof e == "number";
|
|
39
39
|
if (!o && !i)
|
|
40
40
|
return t.length;
|
|
41
41
|
let l = 0, a = 0;
|
|
42
|
-
for (; a < t.length && (!o || l <
|
|
42
|
+
for (; a < t.length && (!o || l < r) && (!i || a < e); )
|
|
43
43
|
t[a] === `
|
|
44
44
|
` && l++, a++;
|
|
45
45
|
return t.slice(0, a).length;
|
|
46
|
-
},
|
|
46
|
+
}, Ke = ({
|
|
47
47
|
editor: t,
|
|
48
|
-
maxChars:
|
|
49
|
-
maxLines:
|
|
48
|
+
maxChars: e,
|
|
49
|
+
maxLines: r
|
|
50
50
|
}) => {
|
|
51
|
-
const o =
|
|
52
|
-
|
|
51
|
+
const o = K(), i = o.getTextContent(), l = je({ text: i, maxChars: e, maxLines: r }), a = i.length - l, d = o.select().anchor;
|
|
52
|
+
se(t, d, a);
|
|
53
53
|
const c = o.getLastChild();
|
|
54
|
-
return c instanceof
|
|
55
|
-
},
|
|
54
|
+
return c instanceof Vt && c.getChildrenSize() === 0 && c.remove(), a;
|
|
55
|
+
}, Ft = {
|
|
56
56
|
quote: "ain-rich-text-quote",
|
|
57
57
|
text: {
|
|
58
58
|
bold: "ain-rich-text-bold",
|
|
@@ -64,49 +64,49 @@ const Ue = ({
|
|
|
64
64
|
listitem: "ain-rich-text-nested-list-item"
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
},
|
|
67
|
+
}, Ht = (t) => t[0] === "{", qe = (t) => t !== null && typeof t == "object" && "isEmpty" in t, Ye = (t, e) => {
|
|
68
68
|
t.update(
|
|
69
69
|
() => {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
const o =
|
|
73
|
-
o.append(
|
|
70
|
+
const r = K();
|
|
71
|
+
r.clear();
|
|
72
|
+
const o = q();
|
|
73
|
+
o.append(B("")), r.append(o), bt(null);
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
|
-
tag:
|
|
76
|
+
tag: e
|
|
77
77
|
}
|
|
78
78
|
);
|
|
79
|
-
},
|
|
80
|
-
|
|
79
|
+
}, Ge = (t, e, r) => {
|
|
80
|
+
e.update(
|
|
81
81
|
() => {
|
|
82
|
-
const o =
|
|
82
|
+
const o = K();
|
|
83
83
|
o.clear();
|
|
84
|
-
const i =
|
|
85
|
-
i.append(
|
|
84
|
+
const i = q();
|
|
85
|
+
i.append(B(t.trim())), o.append(i), bt(null);
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
|
-
tag:
|
|
88
|
+
tag: r
|
|
89
89
|
}
|
|
90
|
-
),
|
|
91
|
-
},
|
|
90
|
+
), e.blur();
|
|
91
|
+
}, cn = (t, e, r) => {
|
|
92
92
|
let o = 0;
|
|
93
|
-
const i =
|
|
94
|
-
nodes:
|
|
93
|
+
const i = Xt({
|
|
94
|
+
nodes: e,
|
|
95
95
|
editable: !1,
|
|
96
|
-
theme:
|
|
96
|
+
theme: Ft
|
|
97
97
|
});
|
|
98
98
|
if (t)
|
|
99
99
|
try {
|
|
100
|
-
if (typeof t == "string" && !
|
|
100
|
+
if (typeof t == "string" && !Ht(t))
|
|
101
101
|
i.update(() => {
|
|
102
|
-
const a =
|
|
103
|
-
s.append(
|
|
102
|
+
const a = K(), s = q();
|
|
103
|
+
s.append(B(t.trim())), a.append(s);
|
|
104
104
|
});
|
|
105
105
|
else {
|
|
106
106
|
const a = i.parseEditorState(t, () => {
|
|
107
|
-
(
|
|
107
|
+
(r == null ? void 0 : r.maxLines) !== void 0 && (o = Ke({
|
|
108
108
|
editor: i,
|
|
109
|
-
maxLines:
|
|
109
|
+
maxLines: r.maxLines
|
|
110
110
|
}));
|
|
111
111
|
});
|
|
112
112
|
a.isEmpty() || i.setEditorState(a);
|
|
@@ -117,92 +117,134 @@ const Ue = ({
|
|
|
117
117
|
let l = "";
|
|
118
118
|
return i.update(() => {
|
|
119
119
|
var a;
|
|
120
|
-
|
|
120
|
+
r != null && r.updateFn && ((a = r.updateFn) == null || a.call(r)), l = Qt(i);
|
|
121
121
|
}), { html: l, trimCount: o };
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
122
|
+
};
|
|
123
|
+
class W extends z {
|
|
124
|
+
static getType() {
|
|
125
|
+
return "target-link";
|
|
126
|
+
}
|
|
127
|
+
static clone(e) {
|
|
128
|
+
return new W(
|
|
129
|
+
e.__url,
|
|
130
|
+
{ rel: e.__rel, target: e.__target, title: e.__title },
|
|
131
|
+
e.__key
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
createDOM(e) {
|
|
135
|
+
const r = super.createDOM(e);
|
|
136
|
+
return r.setAttribute("target", "_blank"), r.setAttribute("rel", "noopener noreferrer"), r;
|
|
137
|
+
}
|
|
138
|
+
exportJSON() {
|
|
139
|
+
return super.exportJSON();
|
|
140
|
+
}
|
|
141
|
+
static importJSON(e) {
|
|
142
|
+
return z.importJSON(e);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const dn = [
|
|
146
|
+
Lt,
|
|
147
|
+
xt,
|
|
148
|
+
tt,
|
|
149
|
+
Ct,
|
|
150
|
+
Mt,
|
|
151
|
+
z,
|
|
152
|
+
yt,
|
|
153
|
+
Nt,
|
|
154
|
+
St
|
|
155
|
+
], un = [
|
|
156
|
+
Lt,
|
|
157
|
+
xt,
|
|
158
|
+
tt,
|
|
159
|
+
Ct,
|
|
160
|
+
Mt,
|
|
161
|
+
z,
|
|
162
|
+
yt,
|
|
163
|
+
Nt,
|
|
164
|
+
St,
|
|
165
|
+
W,
|
|
166
|
+
{
|
|
167
|
+
replace: z,
|
|
168
|
+
with: (t) => new W(
|
|
169
|
+
t.getURL(),
|
|
170
|
+
{ rel: t.__rel, target: t.__target, title: t.__title },
|
|
171
|
+
t.getKey()
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
], Ut = ve({ hasFocus: !1, editorRef: { current: null } }), Je = ({ onBlur: t }) => {
|
|
175
|
+
const [e, r] = b(!1), o = rt(null), i = v(() => {
|
|
176
|
+
r(!0), o.current && window.clearTimeout(o.current);
|
|
135
177
|
}, []), l = v(() => {
|
|
136
178
|
o.current = window.setTimeout(() => {
|
|
137
|
-
|
|
179
|
+
r(!1), t == null || t();
|
|
138
180
|
}, 0);
|
|
139
181
|
}, [t]);
|
|
140
182
|
return {
|
|
141
|
-
hasFocus:
|
|
183
|
+
hasFocus: e,
|
|
142
184
|
attributes: {
|
|
143
185
|
onFocus: i,
|
|
144
186
|
onBlur: l
|
|
145
187
|
}
|
|
146
188
|
};
|
|
147
|
-
},
|
|
189
|
+
}, at = () => Me(Ut);
|
|
148
190
|
function Xe(t) {
|
|
149
191
|
return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 5h6a3.5 3.5 0 0 1 0 7h-6z" } }, { tag: "path", attr: { d: "M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7" } }] })(t);
|
|
150
192
|
}
|
|
151
193
|
function Qe(t) {
|
|
152
194
|
return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 8l-4 4l4 4" } }, { tag: "path", attr: { d: "M17 8l4 4l-4 4" } }, { tag: "path", attr: { d: "M14 4l-4 16" } }] })(t);
|
|
153
195
|
}
|
|
154
|
-
function
|
|
196
|
+
function Ve(t) {
|
|
155
197
|
return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 18v-8l-2 2" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
|
|
156
198
|
}
|
|
157
|
-
function
|
|
199
|
+
function Ze(t) {
|
|
158
200
|
return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
|
|
159
201
|
}
|
|
160
|
-
function
|
|
202
|
+
function tr(t) {
|
|
161
203
|
return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 14a2 2 0 1 0 -2 -2" } }, { tag: "path", attr: { d: "M17 16a2 2 0 1 0 2 -2" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
|
|
162
204
|
}
|
|
163
|
-
function
|
|
205
|
+
function er(t) {
|
|
164
206
|
return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M20 18v-8l-4 6h5" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
|
|
165
207
|
}
|
|
166
|
-
function
|
|
208
|
+
function rr(t) {
|
|
167
209
|
return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17 18h2a2 2 0 1 0 0 -4h-2v-4h4" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
|
|
168
210
|
}
|
|
169
|
-
function
|
|
211
|
+
function nr(t) {
|
|
170
212
|
return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 14a2 2 0 1 0 0 4a2 2 0 0 0 0 -4z" } }, { tag: "path", attr: { d: "M21 12a2 2 0 1 0 -4 0v4" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
|
|
171
213
|
}
|
|
172
|
-
function
|
|
214
|
+
function or(t) {
|
|
173
215
|
return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M11 5l6 0" } }, { tag: "path", attr: { d: "M7 19l6 0" } }, { tag: "path", attr: { d: "M14 5l-4 14" } }] })(t);
|
|
174
216
|
}
|
|
175
|
-
function
|
|
217
|
+
function ir(t) {
|
|
176
218
|
return h({ 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);
|
|
177
219
|
}
|
|
178
|
-
function
|
|
220
|
+
function ar(t) {
|
|
179
221
|
return h({ 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);
|
|
180
222
|
}
|
|
181
|
-
function
|
|
223
|
+
function lr(t) {
|
|
182
224
|
return h({ 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);
|
|
183
225
|
}
|
|
184
|
-
function
|
|
226
|
+
function sr(t) {
|
|
185
227
|
return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M11 6h9" } }, { tag: "path", attr: { d: "M11 12h9" } }, { tag: "path", attr: { d: "M12 18h8" } }, { tag: "path", attr: { d: "M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4" } }, { tag: "path", attr: { d: "M6 10v-6l-2 2" } }] })(t);
|
|
186
228
|
}
|
|
187
|
-
function
|
|
229
|
+
function cr(t) {
|
|
188
230
|
return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M9 6l11 0" } }, { tag: "path", attr: { d: "M9 12l11 0" } }, { tag: "path", attr: { d: "M9 18l11 0" } }, { tag: "path", attr: { d: "M5 6l0 .01" } }, { tag: "path", attr: { d: "M5 12l0 .01" } }, { tag: "path", attr: { d: "M5 18l0 .01" } }] })(t);
|
|
189
231
|
}
|
|
190
|
-
function
|
|
232
|
+
function dr(t) {
|
|
191
233
|
return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M10 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5" } }, { tag: "path", attr: { d: "M19 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5" } }] })(t);
|
|
192
234
|
}
|
|
193
|
-
function
|
|
235
|
+
function ur(t) {
|
|
194
236
|
return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M5 7l8 10m-8 0l8 -10" } }, { tag: "path", attr: { d: "M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2" } }] })(t);
|
|
195
237
|
}
|
|
196
|
-
function
|
|
238
|
+
function hr(t) {
|
|
197
239
|
return h({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z" } }, { tag: "path", attr: { d: "M4 10l16 0" } }, { tag: "path", attr: { d: "M10 4l0 16" } }] })(t);
|
|
198
240
|
}
|
|
199
|
-
function
|
|
241
|
+
function pr(t) {
|
|
200
242
|
return h({ 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);
|
|
201
243
|
}
|
|
202
|
-
const
|
|
244
|
+
const gr = Et("div", {
|
|
203
245
|
width: "10rem",
|
|
204
246
|
display: "flex"
|
|
205
|
-
}),
|
|
247
|
+
}), Wt = {
|
|
206
248
|
bullet: "Punktliste",
|
|
207
249
|
h1: "Overskrift 1",
|
|
208
250
|
h2: "Overskrift 2",
|
|
@@ -214,24 +256,24 @@ const pr = Ct("div", {
|
|
|
214
256
|
paragraph: "Normal",
|
|
215
257
|
quote: "Sitat",
|
|
216
258
|
check: "Avkrysningsliste"
|
|
217
|
-
},
|
|
218
|
-
bullet: /* @__PURE__ */ n(
|
|
219
|
-
h1: /* @__PURE__ */ n(
|
|
220
|
-
h2: /* @__PURE__ */ n(
|
|
221
|
-
h3: /* @__PURE__ */ n(
|
|
222
|
-
h4: /* @__PURE__ */ n(
|
|
223
|
-
h5: /* @__PURE__ */ n(
|
|
224
|
-
h6: /* @__PURE__ */ n(
|
|
225
|
-
number: /* @__PURE__ */ n(
|
|
226
|
-
check: /* @__PURE__ */ n(
|
|
227
|
-
paragraph: /* @__PURE__ */ n(
|
|
228
|
-
quote: /* @__PURE__ */ n(
|
|
259
|
+
}, fr = {
|
|
260
|
+
bullet: /* @__PURE__ */ n(cr, { size: "1.25rem" }),
|
|
261
|
+
h1: /* @__PURE__ */ n(Ve, { size: "1.25rem" }),
|
|
262
|
+
h2: /* @__PURE__ */ n(Ze, { size: "1.25rem" }),
|
|
263
|
+
h3: /* @__PURE__ */ n(tr, { size: "1.25rem" }),
|
|
264
|
+
h4: /* @__PURE__ */ n(er, { size: "1.25rem" }),
|
|
265
|
+
h5: /* @__PURE__ */ n(rr, { size: "1.25rem" }),
|
|
266
|
+
h6: /* @__PURE__ */ n(nr, { size: "1.25rem" }),
|
|
267
|
+
number: /* @__PURE__ */ n(sr, { size: "1.25rem" }),
|
|
268
|
+
check: /* @__PURE__ */ n(lr, { size: "1.25rem" }),
|
|
269
|
+
paragraph: /* @__PURE__ */ n(ir, { size: "1.25rem" }),
|
|
270
|
+
quote: /* @__PURE__ */ n(dr, { size: "1.25rem" })
|
|
229
271
|
}, M = ({
|
|
230
272
|
blockType: t
|
|
231
|
-
}) => /* @__PURE__ */ g(
|
|
232
|
-
/* @__PURE__ */ n(
|
|
273
|
+
}) => /* @__PURE__ */ g(Y, { children: [
|
|
274
|
+
/* @__PURE__ */ n(P, { css: { display: "flex", flex: "0 0 auto" }, children: fr[t] }),
|
|
233
275
|
/* @__PURE__ */ n(
|
|
234
|
-
|
|
276
|
+
P,
|
|
235
277
|
{
|
|
236
278
|
css: {
|
|
237
279
|
flex: "1 1 auto",
|
|
@@ -239,69 +281,69 @@ const pr = Ct("div", {
|
|
|
239
281
|
textOverflow: "ellipsis",
|
|
240
282
|
whiteSpace: "nowrap"
|
|
241
283
|
},
|
|
242
|
-
children:
|
|
284
|
+
children: Wt[t]
|
|
243
285
|
}
|
|
244
286
|
)
|
|
245
|
-
] }),
|
|
287
|
+
] }), mr = (t) => {
|
|
246
288
|
if (!L(t))
|
|
247
289
|
return null;
|
|
248
|
-
const
|
|
249
|
-
let
|
|
290
|
+
const e = t.anchor.getNode();
|
|
291
|
+
let r = e.getKey() === "root" ? e : Pt(e, (o) => {
|
|
250
292
|
const i = o.getParent();
|
|
251
|
-
return i !== null &&
|
|
293
|
+
return i !== null && Zt(i);
|
|
252
294
|
});
|
|
253
|
-
return
|
|
254
|
-
anchorNode:
|
|
255
|
-
element:
|
|
295
|
+
return r === null && (r = e.getTopLevelElementOrThrow()), {
|
|
296
|
+
anchorNode: e,
|
|
297
|
+
element: r
|
|
256
298
|
};
|
|
257
|
-
},
|
|
258
|
-
const [t] = y(), [
|
|
299
|
+
}, kr = () => {
|
|
300
|
+
const [t] = y(), [e, r] = b("paragraph");
|
|
259
301
|
x(() => t.registerCommand(
|
|
260
|
-
|
|
302
|
+
F,
|
|
261
303
|
() => {
|
|
262
|
-
const c = T(), f =
|
|
304
|
+
const c = T(), f = mr(c);
|
|
263
305
|
if (!f)
|
|
264
306
|
return !1;
|
|
265
|
-
const { element: u, anchorNode: m } = f,
|
|
266
|
-
if (t.getElementByKey(
|
|
267
|
-
if (
|
|
268
|
-
const k =
|
|
307
|
+
const { element: u, anchorNode: m } = f, w = u.getKey();
|
|
308
|
+
if (t.getElementByKey(w) !== null)
|
|
309
|
+
if (et(u)) {
|
|
310
|
+
const k = Be(
|
|
269
311
|
m,
|
|
270
|
-
|
|
312
|
+
tt
|
|
271
313
|
), S = k ? k.getListType() : u.getListType();
|
|
272
|
-
|
|
314
|
+
r(S);
|
|
273
315
|
} else {
|
|
274
|
-
const k =
|
|
275
|
-
k in
|
|
316
|
+
const k = he(u) ? u.getTag() : u.getType();
|
|
317
|
+
k in Wt && r(k);
|
|
276
318
|
}
|
|
277
319
|
return !1;
|
|
278
320
|
},
|
|
279
|
-
|
|
321
|
+
Q
|
|
280
322
|
), [t]);
|
|
281
323
|
const o = (c) => {
|
|
282
|
-
|
|
324
|
+
e !== c && t.update(() => {
|
|
283
325
|
const f = T();
|
|
284
|
-
L(f) && (
|
|
326
|
+
L(f) && (J(f, () => pe(c)), r(c));
|
|
285
327
|
});
|
|
286
328
|
};
|
|
287
|
-
return /* @__PURE__ */ n(
|
|
288
|
-
|
|
329
|
+
return /* @__PURE__ */ n(gr, { children: /* @__PURE__ */ g(
|
|
330
|
+
nt,
|
|
289
331
|
{
|
|
290
332
|
trigger: /* @__PURE__ */ n(
|
|
291
|
-
|
|
333
|
+
_t,
|
|
292
334
|
{
|
|
293
335
|
dropdown: !0,
|
|
294
336
|
css: { display: "flex", width: "100%", overflow: "hidden" },
|
|
295
|
-
children: /* @__PURE__ */ n(M, { blockType:
|
|
337
|
+
children: /* @__PURE__ */ n(M, { blockType: e })
|
|
296
338
|
}
|
|
297
339
|
),
|
|
298
340
|
side: "bottom",
|
|
299
341
|
align: "start",
|
|
300
342
|
children: [
|
|
301
343
|
/* @__PURE__ */ n(C, { onClick: () => {
|
|
302
|
-
|
|
344
|
+
e !== "paragraph" && t.update(() => {
|
|
303
345
|
const c = T();
|
|
304
|
-
L(c) && (
|
|
346
|
+
L(c) && (J(c, () => q()), r("paragraph"));
|
|
305
347
|
});
|
|
306
348
|
}, children: /* @__PURE__ */ n(M, { blockType: "paragraph" }) }),
|
|
307
349
|
/* @__PURE__ */ n(C, { onClick: () => o("h1"), children: /* @__PURE__ */ n(M, { blockType: "h1" }) }),
|
|
@@ -311,33 +353,33 @@ const pr = Ct("div", {
|
|
|
311
353
|
/* @__PURE__ */ n(C, { onClick: () => o("h5"), children: /* @__PURE__ */ n(M, { blockType: "h5" }) }),
|
|
312
354
|
/* @__PURE__ */ n(C, { onClick: () => o("h6"), children: /* @__PURE__ */ n(M, { blockType: "h6" }) }),
|
|
313
355
|
/* @__PURE__ */ n(C, { onClick: () => {
|
|
314
|
-
|
|
356
|
+
e !== "bullet" && (t.dispatchCommand(ce, void 0), r("bullet"));
|
|
315
357
|
}, children: /* @__PURE__ */ n(M, { blockType: "bullet" }) }),
|
|
316
358
|
/* @__PURE__ */ n(C, { onClick: () => {
|
|
317
|
-
|
|
359
|
+
e !== "number" && (t.dispatchCommand(de, void 0), r("number"));
|
|
318
360
|
}, children: /* @__PURE__ */ n(M, { blockType: "number" }) }),
|
|
319
361
|
/* @__PURE__ */ n(C, { onClick: () => {
|
|
320
|
-
|
|
362
|
+
e !== "check" && (t.dispatchCommand(Tt, void 0), r("check"));
|
|
321
363
|
}, children: /* @__PURE__ */ n(M, { blockType: "check" }) }),
|
|
322
364
|
/* @__PURE__ */ n(C, { onClick: () => {
|
|
323
|
-
|
|
365
|
+
e !== "quote" && t.update(() => {
|
|
324
366
|
const c = T();
|
|
325
|
-
L(c) && (
|
|
367
|
+
L(c) && (J(c, () => ge()), r("quote"));
|
|
326
368
|
});
|
|
327
369
|
}, children: /* @__PURE__ */ n(M, { blockType: "quote" }) })
|
|
328
370
|
]
|
|
329
371
|
}
|
|
330
372
|
) });
|
|
331
|
-
},
|
|
332
|
-
const [t] = y(), [
|
|
373
|
+
}, br = () => {
|
|
374
|
+
const [t] = y(), [e, r] = b(!1), [o, i] = b(!1), [l, a] = b(!1), [s, d] = b(!1), [c, f] = b(!1), u = v(() => {
|
|
333
375
|
const p = T();
|
|
334
|
-
L(p) && (
|
|
376
|
+
L(p) && (r(p.hasFormat("bold")), i(p.hasFormat("italic")), a(p.hasFormat("underline")), d(p.hasFormat("code")), f(p.hasFormat("superscript")));
|
|
335
377
|
}, []);
|
|
336
|
-
x(() =>
|
|
378
|
+
x(() => it(
|
|
337
379
|
t.registerCommand(
|
|
338
|
-
|
|
380
|
+
F,
|
|
339
381
|
() => (u(), !1),
|
|
340
|
-
|
|
382
|
+
Q
|
|
341
383
|
),
|
|
342
384
|
t.registerUpdateListener(({ editorState: p }) => {
|
|
343
385
|
p.read(() => {
|
|
@@ -346,30 +388,30 @@ const pr = Ct("div", {
|
|
|
346
388
|
})
|
|
347
389
|
), [t, u]);
|
|
348
390
|
const m = v(
|
|
349
|
-
() => t.dispatchCommand(
|
|
391
|
+
() => t.dispatchCommand(D, "bold"),
|
|
350
392
|
[t]
|
|
351
|
-
),
|
|
352
|
-
() => t.dispatchCommand(
|
|
393
|
+
), w = v(
|
|
394
|
+
() => t.dispatchCommand(D, "italic"),
|
|
353
395
|
[t]
|
|
354
396
|
), N = v(
|
|
355
|
-
() => t.dispatchCommand(
|
|
397
|
+
() => t.dispatchCommand(D, "underline"),
|
|
356
398
|
[t]
|
|
357
399
|
), k = v(
|
|
358
|
-
() => t.dispatchCommand(
|
|
400
|
+
() => t.dispatchCommand(D, "code"),
|
|
359
401
|
[t]
|
|
360
402
|
), S = v(
|
|
361
|
-
() => t.dispatchCommand(
|
|
403
|
+
() => t.dispatchCommand(D, "superscript"),
|
|
362
404
|
[t]
|
|
363
|
-
),
|
|
405
|
+
), A = wt(() => {
|
|
364
406
|
const p = [];
|
|
365
|
-
return
|
|
366
|
-
}, [
|
|
407
|
+
return e && p.push("bold"), o && p.push("italic"), l && p.push("underline"), s && p.push("code"), c && p.push("superscript"), p;
|
|
408
|
+
}, [e, o, l, s, c]);
|
|
367
409
|
return /* @__PURE__ */ g(
|
|
368
|
-
|
|
410
|
+
Rt,
|
|
369
411
|
{
|
|
370
412
|
type: "multiple",
|
|
371
413
|
"aria-label": "Tekstformattering",
|
|
372
|
-
value:
|
|
414
|
+
value: A,
|
|
373
415
|
children: [
|
|
374
416
|
/* @__PURE__ */ n(
|
|
375
417
|
I,
|
|
@@ -383,10 +425,10 @@ const pr = Ct("div", {
|
|
|
383
425
|
/* @__PURE__ */ n(
|
|
384
426
|
I,
|
|
385
427
|
{
|
|
386
|
-
onClick:
|
|
428
|
+
onClick: w,
|
|
387
429
|
title: "Kursiv tekst",
|
|
388
430
|
value: "italic",
|
|
389
|
-
children: /* @__PURE__ */ n(
|
|
431
|
+
children: /* @__PURE__ */ n(or, { size: "1.25rem" })
|
|
390
432
|
}
|
|
391
433
|
),
|
|
392
434
|
/* @__PURE__ */ n(
|
|
@@ -395,7 +437,7 @@ const pr = Ct("div", {
|
|
|
395
437
|
onClick: N,
|
|
396
438
|
title: "Understreket tekst",
|
|
397
439
|
value: "underline",
|
|
398
|
-
children: /* @__PURE__ */ n(
|
|
440
|
+
children: /* @__PURE__ */ n(pr, { size: "1.25rem" })
|
|
399
441
|
}
|
|
400
442
|
),
|
|
401
443
|
/* @__PURE__ */ n(
|
|
@@ -413,46 +455,46 @@ const pr = Ct("div", {
|
|
|
413
455
|
onClick: S,
|
|
414
456
|
title: "Superscript",
|
|
415
457
|
value: "superscript",
|
|
416
|
-
children: /* @__PURE__ */ n(
|
|
458
|
+
children: /* @__PURE__ */ n(ur, { size: "1.25rem" })
|
|
417
459
|
}
|
|
418
460
|
)
|
|
419
461
|
]
|
|
420
462
|
}
|
|
421
463
|
);
|
|
422
|
-
},
|
|
423
|
-
const { hasFocus:
|
|
424
|
-
|
|
464
|
+
}, vr = ({ children: t }) => {
|
|
465
|
+
const { hasFocus: e, editorRef: r } = at(), o = e, [i, l] = b(o);
|
|
466
|
+
Ce(() => {
|
|
425
467
|
l(o);
|
|
426
468
|
}, [o]);
|
|
427
|
-
const { context: a, refs: s, floatingStyles: d } =
|
|
469
|
+
const { context: a, refs: s, floatingStyles: d } = ot({
|
|
428
470
|
placement: "top",
|
|
429
|
-
whileElementsMounted:
|
|
471
|
+
whileElementsMounted: It,
|
|
430
472
|
middleware: [
|
|
431
|
-
|
|
473
|
+
Te({
|
|
432
474
|
apply: ({ rects: f, elements: u }) => {
|
|
433
475
|
u.floating.style.minWidth = `${f.reference.width}px`;
|
|
434
476
|
}
|
|
435
477
|
}),
|
|
436
|
-
|
|
437
|
-
|
|
478
|
+
Le(),
|
|
479
|
+
zt({
|
|
438
480
|
mainAxis: 8
|
|
439
481
|
}),
|
|
440
|
-
|
|
482
|
+
xe({
|
|
441
483
|
padding: 8
|
|
442
484
|
})
|
|
443
485
|
],
|
|
444
486
|
open: i,
|
|
445
487
|
onOpenChange: l,
|
|
446
488
|
elements: {
|
|
447
|
-
reference:
|
|
489
|
+
reference: r.current
|
|
448
490
|
}
|
|
449
|
-
}), { getFloatingProps: c } =
|
|
450
|
-
|
|
491
|
+
}), { getFloatingProps: c } = Ot([
|
|
492
|
+
$t(a, {
|
|
451
493
|
role: "dialog"
|
|
452
494
|
})
|
|
453
495
|
]);
|
|
454
|
-
return i ? /* @__PURE__ */ n(
|
|
455
|
-
|
|
496
|
+
return i ? /* @__PURE__ */ n(At, { children: /* @__PURE__ */ n(
|
|
497
|
+
Dt,
|
|
456
498
|
{
|
|
457
499
|
ref: s.setFloating,
|
|
458
500
|
style: d,
|
|
@@ -463,187 +505,187 @@ const pr = Ct("div", {
|
|
|
463
505
|
overflow: "hidden",
|
|
464
506
|
boxShadow: "$md"
|
|
465
507
|
},
|
|
466
|
-
children: /* @__PURE__ */ n(
|
|
508
|
+
children: /* @__PURE__ */ n(Mr, { children: t })
|
|
467
509
|
}
|
|
468
510
|
) }) : null;
|
|
469
|
-
},
|
|
511
|
+
}, Mr = ({
|
|
470
512
|
children: t,
|
|
471
|
-
...
|
|
472
|
-
}) => /* @__PURE__ */ g(
|
|
473
|
-
/* @__PURE__ */ n(mr, {}),
|
|
474
|
-
/* @__PURE__ */ n(ye, {}),
|
|
513
|
+
...e
|
|
514
|
+
}) => /* @__PURE__ */ g(ye, { "aria-label": "Formattering", ...e, children: [
|
|
475
515
|
/* @__PURE__ */ n(kr, {}),
|
|
516
|
+
/* @__PURE__ */ n(Ne, {}),
|
|
517
|
+
/* @__PURE__ */ n(br, {}),
|
|
476
518
|
t
|
|
477
519
|
] });
|
|
478
|
-
function
|
|
520
|
+
function Cr() {
|
|
479
521
|
const [t] = y();
|
|
480
|
-
return x(() =>
|
|
522
|
+
return x(() => it(
|
|
481
523
|
t.registerCommand(
|
|
482
|
-
|
|
483
|
-
() => (
|
|
484
|
-
|
|
524
|
+
Tt,
|
|
525
|
+
() => (ue(t, "check"), !0),
|
|
526
|
+
E
|
|
485
527
|
),
|
|
486
528
|
t.registerCommand(
|
|
487
|
-
|
|
488
|
-
(
|
|
489
|
-
|
|
529
|
+
te,
|
|
530
|
+
(e) => kt(e, t, !1),
|
|
531
|
+
E
|
|
490
532
|
),
|
|
491
533
|
t.registerCommand(
|
|
492
|
-
|
|
493
|
-
(
|
|
494
|
-
|
|
534
|
+
ee,
|
|
535
|
+
(e) => kt(e, t, !0),
|
|
536
|
+
E
|
|
495
537
|
),
|
|
496
538
|
t.registerCommand(
|
|
497
|
-
|
|
498
|
-
(
|
|
499
|
-
if (
|
|
539
|
+
vt,
|
|
540
|
+
(e) => {
|
|
541
|
+
if (X() != null) {
|
|
500
542
|
const o = t.getRootElement();
|
|
501
543
|
return o != null && o.focus(), !0;
|
|
502
544
|
}
|
|
503
545
|
return !1;
|
|
504
546
|
},
|
|
505
|
-
|
|
547
|
+
E
|
|
506
548
|
),
|
|
507
549
|
t.registerCommand(
|
|
508
|
-
|
|
509
|
-
(
|
|
510
|
-
const
|
|
511
|
-
return
|
|
512
|
-
const o =
|
|
513
|
-
|
|
550
|
+
re,
|
|
551
|
+
(e) => {
|
|
552
|
+
const r = X();
|
|
553
|
+
return r != null && t.isEditable() ? (t.update(() => {
|
|
554
|
+
const o = V(r);
|
|
555
|
+
O(o) && (e.preventDefault(), o.toggleChecked());
|
|
514
556
|
}), !0) : !1;
|
|
515
557
|
},
|
|
516
|
-
|
|
558
|
+
E
|
|
517
559
|
),
|
|
518
560
|
t.registerCommand(
|
|
519
|
-
|
|
520
|
-
(
|
|
521
|
-
const
|
|
522
|
-
if (L(
|
|
523
|
-
const { anchor: o } =
|
|
561
|
+
ne,
|
|
562
|
+
(e) => t.getEditorState().read(() => {
|
|
563
|
+
const r = T();
|
|
564
|
+
if (L(r) && r.isCollapsed()) {
|
|
565
|
+
const { anchor: o } = r, i = o.type === "element";
|
|
524
566
|
if (i || o.offset === 0) {
|
|
525
|
-
const l = o.getNode(), a =
|
|
567
|
+
const l = o.getNode(), a = Pt(
|
|
526
568
|
l,
|
|
527
|
-
(s) =>
|
|
569
|
+
(s) => oe(s) && !s.isInline()
|
|
528
570
|
);
|
|
529
|
-
if (
|
|
571
|
+
if (O(a)) {
|
|
530
572
|
const s = a.getParent();
|
|
531
|
-
if (
|
|
573
|
+
if (et(s) && s.getListType() === "check" && (i || a.getFirstDescendant() === l)) {
|
|
532
574
|
const d = t.getElementByKey(a.__key);
|
|
533
575
|
if (d != null && document.activeElement !== d)
|
|
534
|
-
return d.focus(),
|
|
576
|
+
return d.focus(), e.preventDefault(), !0;
|
|
535
577
|
}
|
|
536
578
|
}
|
|
537
579
|
}
|
|
538
580
|
}
|
|
539
581
|
return !1;
|
|
540
582
|
}),
|
|
541
|
-
|
|
583
|
+
E
|
|
542
584
|
),
|
|
543
|
-
t.registerRootListener((
|
|
544
|
-
|
|
585
|
+
t.registerRootListener((e, r) => {
|
|
586
|
+
e !== null && (e.addEventListener("click", ft), e.addEventListener("pointerdown", mt)), r !== null && (r.removeEventListener("click", ft), r.removeEventListener("pointerdown", mt));
|
|
545
587
|
})
|
|
546
588
|
), [t]), null;
|
|
547
589
|
}
|
|
548
|
-
function
|
|
549
|
-
const
|
|
550
|
-
if (
|
|
590
|
+
function jt(t, e) {
|
|
591
|
+
const r = t.target;
|
|
592
|
+
if (r === null || !gt(r))
|
|
551
593
|
return;
|
|
552
|
-
const o =
|
|
553
|
-
if (o != null &&
|
|
594
|
+
const o = r.firstChild;
|
|
595
|
+
if (o != null && gt(o) && (o.tagName === "UL" || o.tagName === "OL"))
|
|
554
596
|
return;
|
|
555
|
-
const i =
|
|
597
|
+
const i = r.parentNode;
|
|
556
598
|
if (!i || i.__lexicalListType !== "check")
|
|
557
599
|
return;
|
|
558
|
-
const l = t.pageX, a =
|
|
559
|
-
(
|
|
600
|
+
const l = t.pageX, a = r.getBoundingClientRect();
|
|
601
|
+
(r.dir === "rtl" ? l < a.right && l > a.right - 20 : l > a.left && l < a.left + 20) && e();
|
|
560
602
|
}
|
|
561
|
-
function
|
|
562
|
-
|
|
563
|
-
const
|
|
564
|
-
|
|
603
|
+
function ft(t) {
|
|
604
|
+
jt(t, () => {
|
|
605
|
+
const e = t.target, r = Tr(e);
|
|
606
|
+
r != null && r.isEditable() && r.update(() => {
|
|
565
607
|
if (t.target) {
|
|
566
|
-
const o =
|
|
567
|
-
|
|
608
|
+
const o = V(e);
|
|
609
|
+
O(o) && (e.focus(), o.toggleChecked());
|
|
568
610
|
}
|
|
569
611
|
});
|
|
570
612
|
});
|
|
571
613
|
}
|
|
572
|
-
function
|
|
573
|
-
|
|
614
|
+
function mt(t) {
|
|
615
|
+
jt(t, () => {
|
|
574
616
|
t.preventDefault();
|
|
575
617
|
});
|
|
576
618
|
}
|
|
577
|
-
function
|
|
578
|
-
let
|
|
579
|
-
for (;
|
|
580
|
-
if (
|
|
581
|
-
return
|
|
582
|
-
|
|
619
|
+
function Tr(t) {
|
|
620
|
+
let e = t;
|
|
621
|
+
for (; e; ) {
|
|
622
|
+
if (e.__lexicalEditor)
|
|
623
|
+
return e.__lexicalEditor;
|
|
624
|
+
e = e.parentNode;
|
|
583
625
|
}
|
|
584
626
|
return null;
|
|
585
627
|
}
|
|
586
|
-
function
|
|
628
|
+
function X() {
|
|
587
629
|
const t = document.activeElement;
|
|
588
630
|
return t != null && t.tagName === "LI" && t.parentNode != null && // @ts-ignore internal field
|
|
589
631
|
t.parentNode.__lexicalListType === "check" ? t : null;
|
|
590
632
|
}
|
|
591
|
-
function
|
|
592
|
-
let
|
|
593
|
-
for (;
|
|
594
|
-
o = o.getParentOrThrow().getParent(), o != null && (
|
|
595
|
-
for (;
|
|
596
|
-
const i =
|
|
597
|
-
if (!
|
|
598
|
-
return
|
|
599
|
-
|
|
633
|
+
function Lr(t, e) {
|
|
634
|
+
let r = e ? t.getPreviousSibling() : t.getNextSibling(), o = t;
|
|
635
|
+
for (; r == null && O(o); )
|
|
636
|
+
o = o.getParentOrThrow().getParent(), o != null && (r = e ? o.getPreviousSibling() : o.getNextSibling());
|
|
637
|
+
for (; O(r); ) {
|
|
638
|
+
const i = e ? r.getLastChild() : r.getFirstChild();
|
|
639
|
+
if (!et(i))
|
|
640
|
+
return r;
|
|
641
|
+
r = e ? i.getLastChild() : i.getFirstChild();
|
|
600
642
|
}
|
|
601
643
|
return null;
|
|
602
644
|
}
|
|
603
|
-
function
|
|
604
|
-
const o =
|
|
605
|
-
return o != null &&
|
|
606
|
-
const i =
|
|
607
|
-
if (!
|
|
645
|
+
function kt(t, e, r) {
|
|
646
|
+
const o = X();
|
|
647
|
+
return o != null && e.update(() => {
|
|
648
|
+
const i = V(o);
|
|
649
|
+
if (!O(i))
|
|
608
650
|
return;
|
|
609
|
-
const l =
|
|
651
|
+
const l = Lr(i, r);
|
|
610
652
|
if (l != null) {
|
|
611
653
|
l.selectStart();
|
|
612
|
-
const a =
|
|
654
|
+
const a = e.getElementByKey(l.__key);
|
|
613
655
|
a != null && (t.preventDefault(), setTimeout(() => {
|
|
614
656
|
a.focus();
|
|
615
657
|
}, 0));
|
|
616
658
|
}
|
|
617
659
|
}), !1;
|
|
618
660
|
}
|
|
619
|
-
const
|
|
620
|
-
/* @__PURE__ */ n(Pe, {}),
|
|
621
|
-
/* @__PURE__ */ n(He, {}),
|
|
661
|
+
const xr = () => /* @__PURE__ */ g(Y, { children: [
|
|
622
662
|
/* @__PURE__ */ n(Fe, {}),
|
|
623
|
-
/* @__PURE__ */ n(
|
|
663
|
+
/* @__PURE__ */ n(Ue, {}),
|
|
664
|
+
/* @__PURE__ */ n(He, {}),
|
|
665
|
+
/* @__PURE__ */ n(Cr, {}),
|
|
624
666
|
/* @__PURE__ */ n(We, {})
|
|
625
|
-
] }),
|
|
667
|
+
] }), yr = ({
|
|
626
668
|
state: t
|
|
627
669
|
}) => {
|
|
628
|
-
const [
|
|
670
|
+
const [e] = y();
|
|
629
671
|
return x(() => {
|
|
630
672
|
if (t)
|
|
631
673
|
try {
|
|
632
|
-
if (
|
|
633
|
-
t.isEmpty() ?
|
|
674
|
+
if (qe(t)) {
|
|
675
|
+
t.isEmpty() ? Ye(e) : e.setEditorState(t);
|
|
634
676
|
return;
|
|
635
677
|
}
|
|
636
|
-
if (typeof t == "string" && !
|
|
637
|
-
|
|
678
|
+
if (typeof t == "string" && !Ht(t)) {
|
|
679
|
+
Ge(t, e);
|
|
638
680
|
return;
|
|
639
681
|
}
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
} catch (
|
|
643
|
-
console.error("Could not parse"), console.error(
|
|
682
|
+
const r = e.parseEditorState(t);
|
|
683
|
+
r.isEmpty() || e.setEditorState(r);
|
|
684
|
+
} catch (r) {
|
|
685
|
+
console.error("Could not parse"), console.error(r);
|
|
644
686
|
}
|
|
645
687
|
}, []), null;
|
|
646
|
-
},
|
|
688
|
+
}, Nr = Et("div", {
|
|
647
689
|
border: "1px solid $borderDarker",
|
|
648
690
|
borderRadius: "$md",
|
|
649
691
|
position: "relative",
|
|
@@ -680,10 +722,10 @@ const Lr = () => /* @__PURE__ */ g(K, { children: [
|
|
|
680
722
|
}
|
|
681
723
|
}
|
|
682
724
|
]
|
|
683
|
-
}),
|
|
725
|
+
}), Sr = ({
|
|
684
726
|
isLoading: t
|
|
685
727
|
}) => /* @__PURE__ */ n(
|
|
686
|
-
|
|
728
|
+
P,
|
|
687
729
|
{
|
|
688
730
|
css: {
|
|
689
731
|
visibility: t ? "visible" : "hidden",
|
|
@@ -692,12 +734,12 @@ const Lr = () => /* @__PURE__ */ g(K, { children: [
|
|
|
692
734
|
right: "1rem",
|
|
693
735
|
display: "flex"
|
|
694
736
|
},
|
|
695
|
-
children: /* @__PURE__ */ n(
|
|
737
|
+
children: /* @__PURE__ */ n(Se, {})
|
|
696
738
|
}
|
|
697
|
-
),
|
|
739
|
+
), hn = ({
|
|
698
740
|
isLoading: t,
|
|
699
|
-
children:
|
|
700
|
-
placeholderText:
|
|
741
|
+
children: e,
|
|
742
|
+
placeholderText: r,
|
|
701
743
|
nodes: o,
|
|
702
744
|
plugins: i,
|
|
703
745
|
toolbar: l,
|
|
@@ -708,36 +750,36 @@ const Lr = () => /* @__PURE__ */ g(K, { children: [
|
|
|
708
750
|
defaultState: f,
|
|
709
751
|
css: u
|
|
710
752
|
}) => {
|
|
711
|
-
const { hasFocus: m, attributes:
|
|
712
|
-
return /* @__PURE__ */ n(
|
|
713
|
-
|
|
753
|
+
const { hasFocus: m, attributes: w } = Je({ onBlur: c }), N = rt(null), k = wt(() => ({ hasFocus: m, editorRef: N }), [m]);
|
|
754
|
+
return /* @__PURE__ */ n(Ut.Provider, { value: k, children: /* @__PURE__ */ g(
|
|
755
|
+
$e,
|
|
714
756
|
{
|
|
715
757
|
initialConfig: {
|
|
716
758
|
namespace: "ain-rich-text",
|
|
717
759
|
onError: (S) => {
|
|
718
760
|
console.error(S);
|
|
719
761
|
},
|
|
720
|
-
theme:
|
|
762
|
+
theme: Ft,
|
|
721
763
|
nodes: o,
|
|
722
764
|
editable: !0
|
|
723
765
|
},
|
|
724
766
|
children: [
|
|
725
767
|
/* @__PURE__ */ g(
|
|
726
|
-
|
|
768
|
+
Nr,
|
|
727
769
|
{
|
|
728
770
|
ref: N,
|
|
729
771
|
hasFocus: m,
|
|
730
772
|
hideBorder: d,
|
|
731
773
|
css: u,
|
|
732
|
-
...
|
|
774
|
+
...w,
|
|
733
775
|
children: [
|
|
734
776
|
l,
|
|
735
777
|
/* @__PURE__ */ n(
|
|
736
|
-
|
|
778
|
+
Ae,
|
|
737
779
|
{
|
|
738
780
|
contentEditable: s,
|
|
739
|
-
placeholder:
|
|
740
|
-
|
|
781
|
+
placeholder: r ? /* @__PURE__ */ n(
|
|
782
|
+
P,
|
|
741
783
|
{
|
|
742
784
|
css: {
|
|
743
785
|
position: "absolute",
|
|
@@ -747,25 +789,25 @@ const Lr = () => /* @__PURE__ */ g(K, { children: [
|
|
|
747
789
|
pointerEvents: "none",
|
|
748
790
|
fontSize: "$sm"
|
|
749
791
|
},
|
|
750
|
-
children:
|
|
792
|
+
children: r
|
|
751
793
|
}
|
|
752
794
|
) : null,
|
|
753
|
-
ErrorBoundary:
|
|
795
|
+
ErrorBoundary: De
|
|
754
796
|
}
|
|
755
797
|
),
|
|
756
|
-
/* @__PURE__ */ n(
|
|
798
|
+
/* @__PURE__ */ n(xr, {}),
|
|
757
799
|
i,
|
|
758
|
-
/* @__PURE__ */ n(
|
|
759
|
-
!l && /* @__PURE__ */ n(
|
|
800
|
+
/* @__PURE__ */ n(Sr, { isLoading: t }),
|
|
801
|
+
!l && /* @__PURE__ */ n(vr, { children: a })
|
|
760
802
|
]
|
|
761
803
|
}
|
|
762
804
|
),
|
|
763
|
-
/* @__PURE__ */ n(
|
|
764
|
-
/* @__PURE__ */ n(
|
|
805
|
+
/* @__PURE__ */ n(yr, { state: f }),
|
|
806
|
+
/* @__PURE__ */ n(Y, { children: e })
|
|
765
807
|
]
|
|
766
808
|
}
|
|
767
809
|
) });
|
|
768
|
-
},
|
|
810
|
+
}, wr = {
|
|
769
811
|
fontSize: "1rem",
|
|
770
812
|
lineHeight: "1.5",
|
|
771
813
|
"h1, h2, h3, h4, h5, h6": {
|
|
@@ -955,22 +997,22 @@ const Lr = () => /* @__PURE__ */ g(K, { children: [
|
|
|
955
997
|
defaultVariants: {
|
|
956
998
|
size: "md"
|
|
957
999
|
}
|
|
958
|
-
},
|
|
959
|
-
const [t] = y(),
|
|
960
|
-
t.dispatchCommand(
|
|
1000
|
+
}, pn = we(wr), gn = () => {
|
|
1001
|
+
const [t] = y(), e = v(() => {
|
|
1002
|
+
t.dispatchCommand(fe, {
|
|
961
1003
|
rows: "3",
|
|
962
1004
|
columns: "3",
|
|
963
1005
|
includeHeaders: !1
|
|
964
1006
|
});
|
|
965
1007
|
}, [t]);
|
|
966
1008
|
return /* @__PURE__ */ n(
|
|
967
|
-
|
|
1009
|
+
nt,
|
|
968
1010
|
{
|
|
969
|
-
trigger: /* @__PURE__ */ n(
|
|
1011
|
+
trigger: /* @__PURE__ */ n(_t, { dropdown: !0, children: "Sett inn" }),
|
|
970
1012
|
side: "bottom",
|
|
971
1013
|
align: "end",
|
|
972
|
-
children: /* @__PURE__ */ g(C, { onClick:
|
|
973
|
-
/* @__PURE__ */ n(
|
|
1014
|
+
children: /* @__PURE__ */ g(C, { onClick: e, children: [
|
|
1015
|
+
/* @__PURE__ */ n(hr, { size: "1.25rem" }),
|
|
974
1016
|
" Tabell"
|
|
975
1017
|
] })
|
|
976
1018
|
}
|
|
@@ -979,60 +1021,60 @@ const Lr = () => /* @__PURE__ */ g(K, { children: [
|
|
|
979
1021
|
function Er(t) {
|
|
980
1022
|
return h({ 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);
|
|
981
1023
|
}
|
|
982
|
-
const
|
|
983
|
-
const [t] = y(), [
|
|
1024
|
+
const fn = () => {
|
|
1025
|
+
const [t] = y(), [e, r] = b(null), { hasFocus: o } = at();
|
|
984
1026
|
x(() => {
|
|
985
|
-
!o &&
|
|
986
|
-
}, [o,
|
|
987
|
-
const { refs: i, floatingStyles: l } =
|
|
1027
|
+
!o && e && r(null);
|
|
1028
|
+
}, [o, e]);
|
|
1029
|
+
const { refs: i, floatingStyles: l } = ot({
|
|
988
1030
|
placement: "top-end",
|
|
989
|
-
open: !!
|
|
1031
|
+
open: !!e,
|
|
990
1032
|
elements: {
|
|
991
|
-
reference:
|
|
1033
|
+
reference: e
|
|
992
1034
|
},
|
|
993
|
-
middleware: [
|
|
1035
|
+
middleware: [zt({ mainAxis: -20, crossAxis: -2 })]
|
|
994
1036
|
});
|
|
995
1037
|
x(() => t.registerCommand(
|
|
996
|
-
|
|
1038
|
+
F,
|
|
997
1039
|
() => {
|
|
998
1040
|
const s = T();
|
|
999
1041
|
if (L(s)) {
|
|
1000
|
-
const d = s.anchor.getNode(), c =
|
|
1001
|
-
|
|
1042
|
+
const d = s.anchor.getNode(), c = me(d);
|
|
1043
|
+
r(c ? t.getElementByKey(c.getKey()) : null);
|
|
1002
1044
|
}
|
|
1003
1045
|
return !1;
|
|
1004
1046
|
},
|
|
1005
|
-
|
|
1047
|
+
ie
|
|
1006
1048
|
), [t]);
|
|
1007
1049
|
const a = (s) => () => {
|
|
1008
1050
|
t.update(() => {
|
|
1009
1051
|
switch (s) {
|
|
1010
1052
|
case "add-row-over":
|
|
1011
|
-
|
|
1053
|
+
ut(!1);
|
|
1012
1054
|
break;
|
|
1013
1055
|
case "add-row-under":
|
|
1014
|
-
|
|
1056
|
+
ut(!0);
|
|
1015
1057
|
break;
|
|
1016
1058
|
case "add-column-left":
|
|
1017
|
-
|
|
1059
|
+
dt(!1);
|
|
1018
1060
|
break;
|
|
1019
1061
|
case "add-column-right":
|
|
1020
|
-
|
|
1062
|
+
dt(!0);
|
|
1021
1063
|
break;
|
|
1022
1064
|
case "delete-row":
|
|
1023
|
-
|
|
1065
|
+
be();
|
|
1024
1066
|
break;
|
|
1025
1067
|
case "delete-column":
|
|
1026
|
-
|
|
1068
|
+
ke();
|
|
1027
1069
|
break;
|
|
1028
1070
|
}
|
|
1029
1071
|
});
|
|
1030
1072
|
};
|
|
1031
|
-
return
|
|
1032
|
-
|
|
1073
|
+
return e ? /* @__PURE__ */ g(
|
|
1074
|
+
nt,
|
|
1033
1075
|
{
|
|
1034
1076
|
trigger: /* @__PURE__ */ n(
|
|
1035
|
-
|
|
1077
|
+
$,
|
|
1036
1078
|
{
|
|
1037
1079
|
icon: !0,
|
|
1038
1080
|
variant: "primary",
|
|
@@ -1044,40 +1086,40 @@ const pn = () => {
|
|
|
1044
1086
|
}
|
|
1045
1087
|
),
|
|
1046
1088
|
children: [
|
|
1047
|
-
/* @__PURE__ */ n(
|
|
1048
|
-
/* @__PURE__ */ n(
|
|
1049
|
-
/* @__PURE__ */ n(
|
|
1050
|
-
/* @__PURE__ */ n(
|
|
1051
|
-
/* @__PURE__ */ n(
|
|
1052
|
-
/* @__PURE__ */ n(
|
|
1053
|
-
/* @__PURE__ */ n(
|
|
1054
|
-
/* @__PURE__ */ n(
|
|
1089
|
+
/* @__PURE__ */ n(R, { onClick: a("add-row-over"), children: "Legg til rad over" }),
|
|
1090
|
+
/* @__PURE__ */ n(R, { onClick: a("add-row-under"), children: "Legg til rad under" }),
|
|
1091
|
+
/* @__PURE__ */ n(ht, {}),
|
|
1092
|
+
/* @__PURE__ */ n(R, { onClick: a("add-column-left"), children: "Legg til kolonne venstre" }),
|
|
1093
|
+
/* @__PURE__ */ n(R, { onClick: a("add-column-right"), children: "Legg til kolonne høyre" }),
|
|
1094
|
+
/* @__PURE__ */ n(ht, {}),
|
|
1095
|
+
/* @__PURE__ */ n(R, { onClick: a("delete-row"), children: "Fjern rad" }),
|
|
1096
|
+
/* @__PURE__ */ n(R, { onClick: a("delete-column"), children: "Fjern kolonne" })
|
|
1055
1097
|
]
|
|
1056
1098
|
}
|
|
1057
1099
|
) : null;
|
|
1058
1100
|
};
|
|
1059
|
-
function
|
|
1060
|
-
let
|
|
1061
|
-
const
|
|
1062
|
-
return
|
|
1101
|
+
function Kt(t) {
|
|
1102
|
+
let e = t;
|
|
1103
|
+
const r = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi, o = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
|
|
1104
|
+
return e = String(e).trim(), e.match(r) || e.match(o) ? e : "https://";
|
|
1063
1105
|
}
|
|
1064
|
-
function
|
|
1065
|
-
const
|
|
1066
|
-
return o === i ? o : t.isBackward() ?
|
|
1106
|
+
function qt(t) {
|
|
1107
|
+
const e = t.anchor, r = t.focus, o = t.anchor.getNode(), i = t.focus.getNode();
|
|
1108
|
+
return o === i ? o : t.isBackward() ? ct(r) ? o : i : ct(e) ? o : i;
|
|
1067
1109
|
}
|
|
1068
|
-
const
|
|
1110
|
+
const mn = (t) => (_.baseURL = t, _), j = class extends z {
|
|
1069
1111
|
static getType() {
|
|
1070
1112
|
return "rutine_link";
|
|
1071
1113
|
}
|
|
1072
|
-
static clone(
|
|
1073
|
-
return new
|
|
1114
|
+
static clone(e) {
|
|
1115
|
+
return new j(e.__url, {}, e.__key);
|
|
1074
1116
|
}
|
|
1075
|
-
createDOM(
|
|
1076
|
-
const
|
|
1077
|
-
return
|
|
1117
|
+
createDOM(e) {
|
|
1118
|
+
const r = super.createDOM(e);
|
|
1119
|
+
return r.setAttribute("href", this.getURL()), r.setAttribute("target", "_blank"), r.setAttribute("rel", "noopener noreferrer"), r.classList.add("rutine-link"), r;
|
|
1078
1120
|
}
|
|
1079
|
-
static importJSON(
|
|
1080
|
-
return
|
|
1121
|
+
static importJSON(e) {
|
|
1122
|
+
return Yt(e.url);
|
|
1081
1123
|
}
|
|
1082
1124
|
exportJSON() {
|
|
1083
1125
|
return {
|
|
@@ -1089,68 +1131,68 @@ const gn = (t) => (R.baseURL = t, R), W = class extends kt {
|
|
|
1089
1131
|
}
|
|
1090
1132
|
getURL() {
|
|
1091
1133
|
try {
|
|
1092
|
-
return new URL(this.__url,
|
|
1134
|
+
return new URL(this.__url, j.baseURL).toString();
|
|
1093
1135
|
} catch {
|
|
1094
1136
|
return "";
|
|
1095
1137
|
}
|
|
1096
1138
|
}
|
|
1097
1139
|
};
|
|
1098
|
-
let
|
|
1099
|
-
|
|
1100
|
-
function
|
|
1101
|
-
return new
|
|
1140
|
+
let _ = j;
|
|
1141
|
+
st(_, "baseURL", "");
|
|
1142
|
+
function Yt(t) {
|
|
1143
|
+
return new _(t);
|
|
1102
1144
|
}
|
|
1103
|
-
function
|
|
1104
|
-
return t instanceof
|
|
1145
|
+
function _r(t) {
|
|
1146
|
+
return t instanceof _;
|
|
1105
1147
|
}
|
|
1106
1148
|
const Rr = ({ onClose: t }) => {
|
|
1107
|
-
const [
|
|
1149
|
+
const [e] = y(), r = v(
|
|
1108
1150
|
(i) => {
|
|
1109
|
-
|
|
1151
|
+
e.update(() => {
|
|
1110
1152
|
const l = T();
|
|
1111
1153
|
if (L(l) && l.isCollapsed()) {
|
|
1112
1154
|
const a = l.getNodes();
|
|
1113
1155
|
if (a.length === 1) {
|
|
1114
1156
|
const s = a[0];
|
|
1115
|
-
|
|
1157
|
+
ae(s) && s.getChildren().length === 0 && l.insertText(i);
|
|
1116
1158
|
}
|
|
1117
1159
|
}
|
|
1118
|
-
}),
|
|
1160
|
+
}), e.dispatchCommand(Z, Kt(i));
|
|
1119
1161
|
},
|
|
1120
|
-
[
|
|
1162
|
+
[e]
|
|
1121
1163
|
);
|
|
1122
1164
|
return /* @__PURE__ */ g("form", { onSubmit: (i) => {
|
|
1123
|
-
|
|
1165
|
+
r(i.target.url.value), t();
|
|
1124
1166
|
}, children: [
|
|
1125
1167
|
/* @__PURE__ */ n(Re, { name: "url", label: "URL", type: "url", required: !0 }),
|
|
1126
|
-
/* @__PURE__ */ g(
|
|
1127
|
-
/* @__PURE__ */ n(
|
|
1128
|
-
/* @__PURE__ */ n(
|
|
1168
|
+
/* @__PURE__ */ g(Bt, { children: [
|
|
1169
|
+
/* @__PURE__ */ n($, { onClick: t, children: "Avbryt" }),
|
|
1170
|
+
/* @__PURE__ */ n($, { type: "submit", variant: "primary", children: "Lagre" })
|
|
1129
1171
|
] })
|
|
1130
1172
|
] });
|
|
1131
|
-
},
|
|
1132
|
-
const [
|
|
1173
|
+
}, Ir = ({ onClose: t, getDocs: e }) => {
|
|
1174
|
+
const [r] = y(), [o, i] = b([]), l = e(), a = v(
|
|
1133
1175
|
(s) => {
|
|
1134
|
-
|
|
1176
|
+
r.update(() => {
|
|
1135
1177
|
const d = T();
|
|
1136
1178
|
if (L(d)) {
|
|
1137
1179
|
const c = [];
|
|
1138
1180
|
for (const [f, u] of s.entries()) {
|
|
1139
|
-
const m =
|
|
1140
|
-
m.append(
|
|
1181
|
+
const m = Yt(u.value);
|
|
1182
|
+
m.append(B(u.label)), c.push(m), f !== s.length - 1 && c.push(B(" "));
|
|
1141
1183
|
}
|
|
1142
1184
|
d.insertNodes(c);
|
|
1143
1185
|
}
|
|
1144
1186
|
});
|
|
1145
1187
|
},
|
|
1146
|
-
[
|
|
1188
|
+
[r]
|
|
1147
1189
|
);
|
|
1148
|
-
return /* @__PURE__ */ g(
|
|
1149
|
-
/* @__PURE__ */ n(
|
|
1150
|
-
/* @__PURE__ */ g(
|
|
1151
|
-
/* @__PURE__ */ n(
|
|
1190
|
+
return /* @__PURE__ */ g(Y, { children: [
|
|
1191
|
+
/* @__PURE__ */ n(Ie, { isMulti: !0, options: l, onChange: i }),
|
|
1192
|
+
/* @__PURE__ */ g(Bt, { children: [
|
|
1193
|
+
/* @__PURE__ */ n($, { onClick: t, children: "Avbryt" }),
|
|
1152
1194
|
/* @__PURE__ */ n(
|
|
1153
|
-
|
|
1195
|
+
$,
|
|
1154
1196
|
{
|
|
1155
1197
|
variant: "primary",
|
|
1156
1198
|
onClick: () => {
|
|
@@ -1161,48 +1203,48 @@ const Rr = ({ onClose: t }) => {
|
|
|
1161
1203
|
)
|
|
1162
1204
|
] })
|
|
1163
1205
|
] });
|
|
1164
|
-
},
|
|
1206
|
+
}, zr = ({
|
|
1165
1207
|
open: t,
|
|
1166
|
-
onOpenChange:
|
|
1167
|
-
getDocs:
|
|
1208
|
+
onOpenChange: e,
|
|
1209
|
+
getDocs: r
|
|
1168
1210
|
}) => {
|
|
1169
1211
|
const [o, i] = b("url"), l = () => {
|
|
1170
|
-
|
|
1212
|
+
e(!1);
|
|
1171
1213
|
};
|
|
1172
|
-
return /* @__PURE__ */ g(Ee, { open: t, onOpenChange:
|
|
1173
|
-
/* @__PURE__ */ g(
|
|
1174
|
-
/* @__PURE__ */ n(
|
|
1175
|
-
/* @__PURE__ */ n(
|
|
1214
|
+
return /* @__PURE__ */ g(Ee, { open: t, onOpenChange: e, css: { width: "600px" }, children: [
|
|
1215
|
+
/* @__PURE__ */ g(_e, { css: { marginBottom: "$8" }, children: [
|
|
1216
|
+
/* @__PURE__ */ n(pt, { active: o === "url", onClick: () => i("url"), children: "URL" }),
|
|
1217
|
+
/* @__PURE__ */ n(pt, { active: o === "rutine", onClick: () => i("rutine"), children: "Rutine" })
|
|
1176
1218
|
] }),
|
|
1177
1219
|
o === "url" && /* @__PURE__ */ n(Rr, { onClose: l }),
|
|
1178
|
-
o === "rutine" && /* @__PURE__ */ n(
|
|
1220
|
+
o === "rutine" && /* @__PURE__ */ n(Ir, { onClose: l, getDocs: r })
|
|
1179
1221
|
] });
|
|
1180
|
-
},
|
|
1181
|
-
const [
|
|
1222
|
+
}, kn = ({ getDocs: t }) => {
|
|
1223
|
+
const [e] = y(), [r, o] = b(!1), [i, l] = b(!1), a = v(() => {
|
|
1182
1224
|
const s = T();
|
|
1183
1225
|
if (L(s)) {
|
|
1184
|
-
const d =
|
|
1185
|
-
o(
|
|
1226
|
+
const d = qt(s), c = d.getParent();
|
|
1227
|
+
o(U(c) || U(d));
|
|
1186
1228
|
}
|
|
1187
1229
|
}, []);
|
|
1188
|
-
return x(() =>
|
|
1189
|
-
|
|
1230
|
+
return x(() => e.registerCommand(
|
|
1231
|
+
F,
|
|
1190
1232
|
() => (a(), !1),
|
|
1191
|
-
|
|
1192
|
-
), [
|
|
1233
|
+
Q
|
|
1234
|
+
), [e, a]), /* @__PURE__ */ g(Rt, { type: "single", value: r ? "link" : "", children: [
|
|
1193
1235
|
/* @__PURE__ */ n(
|
|
1194
1236
|
I,
|
|
1195
1237
|
{
|
|
1196
1238
|
onClick: () => {
|
|
1197
|
-
|
|
1239
|
+
r ? e.dispatchCommand(Z, null) : l(!0);
|
|
1198
1240
|
},
|
|
1199
1241
|
title: "Lenke",
|
|
1200
1242
|
value: "link",
|
|
1201
|
-
children: /* @__PURE__ */ n(
|
|
1243
|
+
children: /* @__PURE__ */ n(ar, { size: "1.25rem" })
|
|
1202
1244
|
}
|
|
1203
1245
|
),
|
|
1204
1246
|
/* @__PURE__ */ n(
|
|
1205
|
-
|
|
1247
|
+
zr,
|
|
1206
1248
|
{
|
|
1207
1249
|
open: i,
|
|
1208
1250
|
onOpenChange: l,
|
|
@@ -1210,67 +1252,67 @@ const Rr = ({ onClose: t }) => {
|
|
|
1210
1252
|
}
|
|
1211
1253
|
)
|
|
1212
1254
|
] });
|
|
1213
|
-
},
|
|
1214
|
-
const [t] = y(),
|
|
1255
|
+
}, bn = () => {
|
|
1256
|
+
const [t] = y(), e = rt(null), [r, o] = b(null), [i, l] = b(""), { hasFocus: a } = at();
|
|
1215
1257
|
x(() => {
|
|
1216
|
-
|
|
1217
|
-
l(
|
|
1258
|
+
r ? t.update(() => {
|
|
1259
|
+
l(r.getURL());
|
|
1218
1260
|
}) : l("");
|
|
1219
|
-
}, [t,
|
|
1220
|
-
const s = !!(
|
|
1261
|
+
}, [t, r]);
|
|
1262
|
+
const s = !!(r && i && a), { refs: d, floatingStyles: c, context: f } = ot({
|
|
1221
1263
|
placement: "top",
|
|
1222
1264
|
strategy: "fixed",
|
|
1223
1265
|
open: s,
|
|
1224
|
-
whileElementsMounted:
|
|
1266
|
+
whileElementsMounted: It,
|
|
1225
1267
|
elements: {
|
|
1226
|
-
reference:
|
|
1268
|
+
reference: e.current
|
|
1227
1269
|
},
|
|
1228
|
-
middleware: [
|
|
1229
|
-
}), { getFloatingProps: u } =
|
|
1230
|
-
|
|
1231
|
-
|
|
1270
|
+
middleware: [ze()]
|
|
1271
|
+
}), { getFloatingProps: u } = Ot([
|
|
1272
|
+
$t(f),
|
|
1273
|
+
Oe(f)
|
|
1232
1274
|
]), m = v(() => {
|
|
1233
1275
|
var S;
|
|
1234
1276
|
const k = T();
|
|
1235
1277
|
if (L(k)) {
|
|
1236
|
-
const
|
|
1237
|
-
let
|
|
1238
|
-
if (
|
|
1239
|
-
const
|
|
1240
|
-
k !== null &&
|
|
1278
|
+
const A = qt(k), p = A.getParent();
|
|
1279
|
+
let H = null;
|
|
1280
|
+
if (U(p) ? H = p : U(A) && (H = A), H) {
|
|
1281
|
+
const G = window.getSelection(), lt = t.getRootElement();
|
|
1282
|
+
k !== null && G !== null && lt !== null && lt.contains(G.anchorNode) && t.isEditable() && (e.current = ((S = G.focusNode) == null ? void 0 : S.parentElement) ?? null);
|
|
1241
1283
|
}
|
|
1242
|
-
o(
|
|
1284
|
+
o(H);
|
|
1243
1285
|
}
|
|
1244
|
-
}, [t]),
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
}), t.dispatchCommand(
|
|
1248
|
-
}, [t,
|
|
1286
|
+
}, [t]), w = v(() => {
|
|
1287
|
+
r && _r(r) && t.update(() => {
|
|
1288
|
+
r.remove();
|
|
1289
|
+
}), t.dispatchCommand(Z, null);
|
|
1290
|
+
}, [t, r]);
|
|
1249
1291
|
if (x(() => {
|
|
1250
1292
|
t.getEditorState().read(() => {
|
|
1251
1293
|
m();
|
|
1252
1294
|
});
|
|
1253
|
-
}, [t, m]), x(() =>
|
|
1295
|
+
}, [t, m]), x(() => it(
|
|
1254
1296
|
t.registerUpdateListener(({ editorState: k }) => {
|
|
1255
1297
|
k.read(() => {
|
|
1256
1298
|
m();
|
|
1257
1299
|
});
|
|
1258
1300
|
}),
|
|
1259
1301
|
t.registerCommand(
|
|
1260
|
-
|
|
1302
|
+
F,
|
|
1261
1303
|
() => (m(), !0),
|
|
1262
|
-
|
|
1304
|
+
E
|
|
1263
1305
|
),
|
|
1264
1306
|
t.registerCommand(
|
|
1265
|
-
|
|
1266
|
-
() =>
|
|
1267
|
-
|
|
1307
|
+
vt,
|
|
1308
|
+
() => r ? (o(null), !0) : !1,
|
|
1309
|
+
le
|
|
1268
1310
|
)
|
|
1269
|
-
), [t, m,
|
|
1311
|
+
), [t, m, r]), !s)
|
|
1270
1312
|
return null;
|
|
1271
|
-
const N =
|
|
1272
|
-
return /* @__PURE__ */ n(
|
|
1273
|
-
|
|
1313
|
+
const N = Kt(i);
|
|
1314
|
+
return /* @__PURE__ */ n(At, { children: /* @__PURE__ */ g(
|
|
1315
|
+
Dt,
|
|
1274
1316
|
{
|
|
1275
1317
|
ref: d.setFloating,
|
|
1276
1318
|
css: {
|
|
@@ -1284,7 +1326,7 @@ const Rr = ({ onClose: t }) => {
|
|
|
1284
1326
|
...u(),
|
|
1285
1327
|
children: [
|
|
1286
1328
|
/* @__PURE__ */ n(
|
|
1287
|
-
|
|
1329
|
+
P,
|
|
1288
1330
|
{
|
|
1289
1331
|
as: "a",
|
|
1290
1332
|
css: {
|
|
@@ -1301,32 +1343,33 @@ const Rr = ({ onClose: t }) => {
|
|
|
1301
1343
|
children: i
|
|
1302
1344
|
}
|
|
1303
1345
|
),
|
|
1304
|
-
/* @__PURE__ */ n(
|
|
1346
|
+
/* @__PURE__ */ n($, { color: "danger", icon: !0, size: "sm", onClick: w, children: /* @__PURE__ */ n(Pe, { size: 24 }) })
|
|
1305
1347
|
]
|
|
1306
1348
|
}
|
|
1307
1349
|
) });
|
|
1308
1350
|
};
|
|
1309
1351
|
export {
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1352
|
+
Yt as $createRutineLinkNode,
|
|
1353
|
+
_r as $isRutineLinkNode,
|
|
1354
|
+
vr as FloatingToolbar,
|
|
1355
|
+
gn as InsertSelector,
|
|
1356
|
+
bn as LinkEditPlugin,
|
|
1357
|
+
kn as LinkToolbarButton,
|
|
1358
|
+
hn as RichTextEditor,
|
|
1359
|
+
Mr as RichTextToolbar,
|
|
1360
|
+
_ as RutineLinkNode,
|
|
1361
|
+
mn as RutineLinkNodeInit,
|
|
1362
|
+
fn as TableEditPlugin,
|
|
1363
|
+
Ye as clearEditorState,
|
|
1364
|
+
dn as defaultNodes,
|
|
1365
|
+
un as defaultViewNodes,
|
|
1366
|
+
qe as isEditorState,
|
|
1367
|
+
Ht as isJSON,
|
|
1368
|
+
Ut as richTextContext,
|
|
1369
|
+
pn as richTextCss,
|
|
1370
|
+
wr as richTextStyleObj,
|
|
1371
|
+
Ge as setStateFromPlainText,
|
|
1372
|
+
cn as stateToHTML,
|
|
1373
|
+
Je as useHasFocusWithin,
|
|
1374
|
+
at as useRichTextContext
|
|
1332
1375
|
};
|