@arkitektbedriftene/fe-lib 0.4.3 → 0.4.5
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/{DropdownMenu-3889bea2.js → TextInput-bedd6814.js} +829 -736
- package/dist/icons.es.js +1 -1
- package/dist/{index.esm-d078f232.js → index.esm-969855d2.js} +39 -35
- package/dist/rich-text/Plugins/TableEditPlugin.d.ts +2 -0
- package/dist/rich-text/rich-text.d.ts +1 -0
- package/dist/rich-text.es.js +449 -354
- package/dist/ui/components/{Modal.d.ts → Dialog.d.ts} +3 -3
- package/dist/ui/components/Form/ReactSelect.d.ts +1 -1
- package/dist/ui/components/Form/TextInput.d.ts +13 -0
- package/dist/ui/components/Form/text.d.ts +232 -0
- package/dist/ui/ui.d.ts +2 -1
- package/dist/ui.es.js +76 -61
- package/package.json +1 -1
package/dist/rich-text.es.js
CHANGED
|
@@ -1,94 +1,95 @@
|
|
|
1
|
-
import { createHeadlessEditor as
|
|
2
|
-
import { $generateHtmlFromNodes as
|
|
3
|
-
import { $getRoot as
|
|
4
|
-
import { trimTextContentFromAnchor as
|
|
5
|
-
import { AutoLinkNode as
|
|
6
|
-
import { ListNode as
|
|
7
|
-
import { HeadingNode as
|
|
8
|
-
import { TableNode as
|
|
9
|
-
import { jsx as
|
|
10
|
-
import { createContext as
|
|
11
|
-
import { c as
|
|
1
|
+
import { createHeadlessEditor as kt } from "@lexical/headless";
|
|
2
|
+
import { $generateHtmlFromNodes as Mt } from "@lexical/html";
|
|
3
|
+
import { $getRoot as O, ParagraphNode as bt, $createParagraphNode as B, $createTextNode as A, $setSelection as Z, SELECTION_CHANGE_COMMAND as W, $getSelection as L, COMMAND_PRIORITY_CRITICAL as tt, $isRangeSelection as x, $isRootOrShadowRoot as Ct, DEPRECATED_$isGridSelection as P, FORMAT_TEXT_COMMAND as $, COMMAND_PRIORITY_LOW as T, KEY_ARROW_DOWN_COMMAND as vt, KEY_ARROW_UP_COMMAND as Tt, KEY_ESCAPE_COMMAND as Lt, KEY_SPACE_COMMAND as xt, $getNearestNodeFromDOMNode as j, KEY_ARROW_LEFT_COMMAND as yt, $isElementNode as Et } from "lexical";
|
|
4
|
+
import { trimTextContentFromAnchor as Nt, $setBlocksType as H } from "@lexical/selection";
|
|
5
|
+
import { AutoLinkNode as St, LinkNode as wt } from "@lexical/link";
|
|
6
|
+
import { ListNode as et, ListItemNode as zt, $isListNode as K, INSERT_UNORDERED_LIST_COMMAND as It, INSERT_ORDERED_LIST_COMMAND as $t, INSERT_CHECK_LIST_COMMAND as rt, insertList as _t, $isListItemNode as E } from "@lexical/list";
|
|
7
|
+
import { HeadingNode as Rt, QuoteNode as Ot, $isHeadingNode as Bt, $createHeadingNode as Ft, $createQuoteNode as Pt } from "@lexical/rich-text";
|
|
8
|
+
import { TableNode as Ht, TableRowNode as Dt, TableCellNode as At, $getTableCellNodeFromLexicalNode as Wt, $deleteTableColumn__EXPERIMENTAL as jt, $deleteTableRow__EXPERIMENTAL as Kt, $insertTableColumn__EXPERIMENTAL as Y, $insertTableRow__EXPERIMENTAL as q } from "@lexical/table";
|
|
9
|
+
import { jsx as r, jsxs as C, Fragment as U } from "react/jsx-runtime";
|
|
10
|
+
import { createContext as Ut, useState as M, useRef as ot, useCallback as b, useContext as Yt, useEffect as N, useMemo as nt, useLayoutEffect as qt } from "react";
|
|
11
|
+
import { c as S, s as at, D as it, T as Xt, a as m, B as R, b as Gt, d as _, u as lt, e as Qt, f as Vt, g as Jt, o as st, h as Zt, i as te, j as ee, F as re, O as oe, k as ne, l as ae, S as ie, m as le, n as y, p as X } from "./TextInput-bedd6814.js";
|
|
12
12
|
import "react-select";
|
|
13
|
-
import { LexicalComposer as
|
|
14
|
-
import { RichTextPlugin as
|
|
15
|
-
import
|
|
16
|
-
import { useLexicalComposerContext as
|
|
17
|
-
import { $getNearestNodeOfType as
|
|
18
|
-
import { G as c } from "./index.esm-
|
|
19
|
-
import { ListPlugin as
|
|
20
|
-
import { HistoryPlugin as
|
|
21
|
-
import { TablePlugin as
|
|
22
|
-
import { TabIndentationPlugin as
|
|
13
|
+
import { LexicalComposer as se } from "@lexical/react/LexicalComposer.js";
|
|
14
|
+
import { RichTextPlugin as de } from "@lexical/react/LexicalRichTextPlugin.js";
|
|
15
|
+
import ce from "@lexical/react/LexicalErrorBoundary.js";
|
|
16
|
+
import { useLexicalComposerContext as F } from "@lexical/react/LexicalComposerContext.js";
|
|
17
|
+
import { $getNearestNodeOfType as he, $findMatchingParent as dt, mergeRegister as ct, isHTMLElement as G } from "@lexical/utils";
|
|
18
|
+
import { G as c } from "./index.esm-969855d2.js";
|
|
19
|
+
import { ListPlugin as ue } from "@lexical/react/LexicalListPlugin.js";
|
|
20
|
+
import { HistoryPlugin as pe } from "@lexical/react/LexicalHistoryPlugin.js";
|
|
21
|
+
import { TablePlugin as ge } from "@lexical/react/LexicalTablePlugin.js";
|
|
22
|
+
import { TabIndentationPlugin as fe } from "@lexical/react/LexicalTabIndentationPlugin.js";
|
|
23
|
+
import { useLexicalComposerContext as me } from "@lexical/react/LexicalComposerContext";
|
|
23
24
|
import "react-dom";
|
|
24
25
|
import "@radix-ui/react-toolbar";
|
|
25
26
|
import "@radix-ui/react-dropdown-menu";
|
|
26
|
-
const
|
|
27
|
+
const ke = ({
|
|
27
28
|
text: t,
|
|
28
29
|
maxChars: e,
|
|
29
|
-
maxLines:
|
|
30
|
+
maxLines: o
|
|
30
31
|
}) => {
|
|
31
32
|
if (t.length === 0)
|
|
32
33
|
return 0;
|
|
33
|
-
const n = typeof
|
|
34
|
+
const n = typeof o == "number", a = typeof e == "number";
|
|
34
35
|
if (!n && !a)
|
|
35
36
|
return t.length;
|
|
36
37
|
let l = 0, i = 0;
|
|
37
|
-
for (; i < t.length && (!n || l <
|
|
38
|
+
for (; i < t.length && (!n || l < o) && (!a || i < e); )
|
|
38
39
|
t[i] === `
|
|
39
40
|
` && l++, i++;
|
|
40
41
|
return t.slice(0, i).length;
|
|
41
|
-
},
|
|
42
|
+
}, Me = ({
|
|
42
43
|
editor: t,
|
|
43
44
|
maxChars: e,
|
|
44
|
-
maxLines:
|
|
45
|
+
maxLines: o
|
|
45
46
|
}) => {
|
|
46
|
-
const n =
|
|
47
|
-
|
|
47
|
+
const n = O(), a = n.getTextContent(), l = ke({ text: a, maxChars: e, maxLines: o }), i = a.length - l, h = n.select().anchor;
|
|
48
|
+
Nt(t, h, i);
|
|
48
49
|
const s = n.getLastChild();
|
|
49
|
-
return s instanceof
|
|
50
|
-
},
|
|
50
|
+
return s instanceof bt && s.getChildrenSize() === 0 && s.remove(), i;
|
|
51
|
+
}, ht = (t) => t[0] === "{", be = (t) => t !== null && typeof t == "object" && "isEmpty" in t, Ce = (t, e) => {
|
|
51
52
|
t.update(
|
|
52
53
|
() => {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
const n =
|
|
56
|
-
n.append(
|
|
54
|
+
const o = O();
|
|
55
|
+
o.clear();
|
|
56
|
+
const n = B();
|
|
57
|
+
n.append(A("")), o.append(n), Z(null);
|
|
57
58
|
},
|
|
58
59
|
{
|
|
59
60
|
tag: e
|
|
60
61
|
}
|
|
61
62
|
);
|
|
62
|
-
},
|
|
63
|
+
}, ve = (t, e, o) => {
|
|
63
64
|
e.update(
|
|
64
65
|
() => {
|
|
65
|
-
const n =
|
|
66
|
+
const n = O();
|
|
66
67
|
n.clear();
|
|
67
|
-
const a =
|
|
68
|
-
a.append(
|
|
68
|
+
const a = B();
|
|
69
|
+
a.append(A(t.trim())), n.append(a), Z(null);
|
|
69
70
|
},
|
|
70
71
|
{
|
|
71
|
-
tag:
|
|
72
|
+
tag: o
|
|
72
73
|
}
|
|
73
74
|
), e.blur();
|
|
74
|
-
},
|
|
75
|
+
}, $r = (t, e, o) => {
|
|
75
76
|
let n = 0;
|
|
76
|
-
const a =
|
|
77
|
+
const a = kt({
|
|
77
78
|
nodes: e,
|
|
78
79
|
editable: !1
|
|
79
80
|
});
|
|
80
81
|
if (t)
|
|
81
82
|
try {
|
|
82
|
-
if (typeof t == "string" && !
|
|
83
|
+
if (typeof t == "string" && !ht(t))
|
|
83
84
|
a.update(() => {
|
|
84
|
-
const i =
|
|
85
|
-
d.append(
|
|
85
|
+
const i = O(), d = B();
|
|
86
|
+
d.append(A(t.trim())), i.append(d);
|
|
86
87
|
});
|
|
87
88
|
else {
|
|
88
89
|
const i = a.parseEditorState(t, () => {
|
|
89
|
-
n =
|
|
90
|
+
n = Me({
|
|
90
91
|
editor: a,
|
|
91
|
-
maxLines:
|
|
92
|
+
maxLines: o == null ? void 0 : o.maxLines
|
|
92
93
|
});
|
|
93
94
|
});
|
|
94
95
|
i.isEmpty() || a.setEditorState(i);
|
|
@@ -98,50 +99,50 @@ const le = ({
|
|
|
98
99
|
}
|
|
99
100
|
let l = "";
|
|
100
101
|
return a.update(() => {
|
|
101
|
-
l =
|
|
102
|
+
l = Mt(a);
|
|
102
103
|
}), { html: l, trimCount: n };
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
St,
|
|
106
|
-
X,
|
|
107
|
-
Tt,
|
|
108
|
-
Ct,
|
|
109
|
-
bt,
|
|
110
|
-
It,
|
|
104
|
+
}, _r = [
|
|
105
|
+
Rt,
|
|
111
106
|
Ot,
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
et,
|
|
108
|
+
zt,
|
|
109
|
+
St,
|
|
110
|
+
wt,
|
|
111
|
+
Ht,
|
|
112
|
+
Dt,
|
|
113
|
+
At
|
|
114
|
+
], Te = S({
|
|
114
115
|
fontWeight: "bold"
|
|
115
|
-
}),
|
|
116
|
+
}), Le = S({
|
|
116
117
|
fontStyle: "italic"
|
|
117
|
-
}),
|
|
118
|
+
}), xe = S({
|
|
118
119
|
textDecoration: "underline"
|
|
119
|
-
}),
|
|
120
|
+
}), ye = S({
|
|
120
121
|
listStyleType: "none"
|
|
121
|
-
}),
|
|
122
|
+
}), Ee = S({
|
|
122
123
|
borderLeft: "4px solid #ccc",
|
|
123
124
|
color: "#666",
|
|
124
125
|
fontStyle: "italic",
|
|
125
126
|
margin: "1.5em 10px",
|
|
126
127
|
padding: "0.5em 10px"
|
|
127
|
-
}),
|
|
128
|
-
quote:
|
|
128
|
+
}), Ne = {
|
|
129
|
+
quote: Ee().className,
|
|
129
130
|
text: {
|
|
130
|
-
bold:
|
|
131
|
-
italic:
|
|
132
|
-
underline:
|
|
131
|
+
bold: Te().className,
|
|
132
|
+
italic: Le().className,
|
|
133
|
+
underline: xe().className
|
|
133
134
|
},
|
|
134
135
|
list: {
|
|
135
136
|
nested: {
|
|
136
|
-
listitem:
|
|
137
|
+
listitem: ye().className
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
|
-
},
|
|
140
|
-
const [e,
|
|
141
|
-
|
|
142
|
-
}, []), l =
|
|
140
|
+
}, ut = Ut({ hasFocus: !1, editorRef: { current: null } }), Se = ({ onBlur: t }) => {
|
|
141
|
+
const [e, o] = M(!1), n = ot(null), a = b(() => {
|
|
142
|
+
o(!0), n.current && window.clearTimeout(n.current);
|
|
143
|
+
}, []), l = b(() => {
|
|
143
144
|
n.current = window.setTimeout(() => {
|
|
144
|
-
|
|
145
|
+
o(!1), t == null || t();
|
|
145
146
|
}, 0);
|
|
146
147
|
}, [t]);
|
|
147
148
|
return {
|
|
@@ -151,59 +152,59 @@ const le = ({
|
|
|
151
152
|
onBlur: l
|
|
152
153
|
}
|
|
153
154
|
};
|
|
154
|
-
},
|
|
155
|
-
function
|
|
155
|
+
}, pt = () => Yt(ut);
|
|
156
|
+
function we(t) {
|
|
156
157
|
return c({ 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);
|
|
157
158
|
}
|
|
158
|
-
function
|
|
159
|
+
function ze(t) {
|
|
159
160
|
return c({ 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);
|
|
160
161
|
}
|
|
161
|
-
function
|
|
162
|
+
function Ie(t) {
|
|
162
163
|
return c({ 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);
|
|
163
164
|
}
|
|
164
|
-
function
|
|
165
|
+
function $e(t) {
|
|
165
166
|
return c({ 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);
|
|
166
167
|
}
|
|
167
|
-
function
|
|
168
|
+
function _e(t) {
|
|
168
169
|
return c({ 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);
|
|
169
170
|
}
|
|
170
|
-
function
|
|
171
|
+
function Re(t) {
|
|
171
172
|
return c({ 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);
|
|
172
173
|
}
|
|
173
|
-
function
|
|
174
|
+
function Oe(t) {
|
|
174
175
|
return c({ 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);
|
|
175
176
|
}
|
|
176
|
-
function
|
|
177
|
+
function Be(t) {
|
|
177
178
|
return c({ 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);
|
|
178
179
|
}
|
|
179
|
-
function
|
|
180
|
+
function Fe(t) {
|
|
180
181
|
return c({ 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);
|
|
181
182
|
}
|
|
182
|
-
function
|
|
183
|
+
function Pe(t) {
|
|
183
184
|
return c({ 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);
|
|
184
185
|
}
|
|
185
|
-
function
|
|
186
|
+
function He(t) {
|
|
186
187
|
return c({ 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);
|
|
187
188
|
}
|
|
188
|
-
function
|
|
189
|
+
function De(t) {
|
|
189
190
|
return c({ 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);
|
|
190
191
|
}
|
|
191
|
-
function
|
|
192
|
+
function Ae(t) {
|
|
192
193
|
return c({ 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);
|
|
193
194
|
}
|
|
194
|
-
function
|
|
195
|
+
function We(t) {
|
|
195
196
|
return c({ 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);
|
|
196
197
|
}
|
|
197
|
-
function
|
|
198
|
+
function je(t) {
|
|
198
199
|
return c({ 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);
|
|
199
200
|
}
|
|
200
|
-
function
|
|
201
|
+
function Ke(t) {
|
|
201
202
|
return c({ 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);
|
|
202
203
|
}
|
|
203
|
-
const
|
|
204
|
+
const Ue = at("div", {
|
|
204
205
|
width: "10rem",
|
|
205
206
|
display: "flex"
|
|
206
|
-
}),
|
|
207
|
+
}), gt = {
|
|
207
208
|
bullet: "Punktliste",
|
|
208
209
|
h1: "Overskrift 1",
|
|
209
210
|
h2: "Overskrift 2",
|
|
@@ -215,24 +216,24 @@ const Be = et("div", {
|
|
|
215
216
|
paragraph: "Normal",
|
|
216
217
|
quote: "Sitat",
|
|
217
218
|
check: "Avkrysningsliste"
|
|
218
|
-
},
|
|
219
|
-
bullet: /* @__PURE__ */
|
|
220
|
-
h1: /* @__PURE__ */
|
|
221
|
-
h2: /* @__PURE__ */
|
|
222
|
-
h3: /* @__PURE__ */
|
|
223
|
-
h4: /* @__PURE__ */
|
|
224
|
-
h5: /* @__PURE__ */
|
|
225
|
-
h6: /* @__PURE__ */
|
|
226
|
-
number: /* @__PURE__ */
|
|
227
|
-
check: /* @__PURE__ */
|
|
228
|
-
paragraph: /* @__PURE__ */
|
|
229
|
-
quote: /* @__PURE__ */
|
|
219
|
+
}, Ye = {
|
|
220
|
+
bullet: /* @__PURE__ */ r(Ae, { size: "1.25rem" }),
|
|
221
|
+
h1: /* @__PURE__ */ r(Ie, { size: "1.25rem" }),
|
|
222
|
+
h2: /* @__PURE__ */ r($e, { size: "1.25rem" }),
|
|
223
|
+
h3: /* @__PURE__ */ r(_e, { size: "1.25rem" }),
|
|
224
|
+
h4: /* @__PURE__ */ r(Re, { size: "1.25rem" }),
|
|
225
|
+
h5: /* @__PURE__ */ r(Oe, { size: "1.25rem" }),
|
|
226
|
+
h6: /* @__PURE__ */ r(Be, { size: "1.25rem" }),
|
|
227
|
+
number: /* @__PURE__ */ r(De, { size: "1.25rem" }),
|
|
228
|
+
check: /* @__PURE__ */ r(He, { size: "1.25rem" }),
|
|
229
|
+
paragraph: /* @__PURE__ */ r(Pe, { size: "1.25rem" }),
|
|
230
|
+
quote: /* @__PURE__ */ r(We, { size: "1.25rem" })
|
|
230
231
|
}, f = ({
|
|
231
232
|
blockType: t
|
|
232
|
-
}) => /* @__PURE__ */
|
|
233
|
-
/* @__PURE__ */
|
|
234
|
-
/* @__PURE__ */
|
|
235
|
-
|
|
233
|
+
}) => /* @__PURE__ */ C(U, { children: [
|
|
234
|
+
/* @__PURE__ */ r(R, { css: { display: "flex", flex: "0 0 auto" }, children: Ye[t] }),
|
|
235
|
+
/* @__PURE__ */ r(
|
|
236
|
+
R,
|
|
236
237
|
{
|
|
237
238
|
css: {
|
|
238
239
|
flex: "1 1 auto",
|
|
@@ -240,223 +241,223 @@ const Be = et("div", {
|
|
|
240
241
|
textOverflow: "ellipsis",
|
|
241
242
|
whiteSpace: "nowrap"
|
|
242
243
|
},
|
|
243
|
-
children:
|
|
244
|
+
children: gt[t]
|
|
244
245
|
}
|
|
245
246
|
)
|
|
246
|
-
] }),
|
|
247
|
-
if (!
|
|
247
|
+
] }), qe = (t) => {
|
|
248
|
+
if (!x(t))
|
|
248
249
|
return null;
|
|
249
250
|
const e = t.anchor.getNode();
|
|
250
|
-
let
|
|
251
|
+
let o = e.getKey() === "root" ? e : dt(e, (n) => {
|
|
251
252
|
const a = n.getParent();
|
|
252
|
-
return a !== null &&
|
|
253
|
+
return a !== null && Ct(a);
|
|
253
254
|
});
|
|
254
|
-
return
|
|
255
|
+
return o === null && (o = e.getTopLevelElementOrThrow()), {
|
|
255
256
|
anchorNode: e,
|
|
256
|
-
element:
|
|
257
|
+
element: o
|
|
257
258
|
};
|
|
258
|
-
},
|
|
259
|
-
const [t] =
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
}, Xe = () => {
|
|
260
|
+
const [t] = F(), [e, o] = M("paragraph");
|
|
261
|
+
N(() => t.registerCommand(
|
|
262
|
+
W,
|
|
262
263
|
() => {
|
|
263
|
-
const s = L(), g =
|
|
264
|
+
const s = L(), g = qe(s);
|
|
264
265
|
if (!g)
|
|
265
266
|
return !1;
|
|
266
|
-
const { element:
|
|
267
|
-
if (t.getElementByKey(
|
|
268
|
-
if (
|
|
269
|
-
const k =
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
),
|
|
273
|
-
|
|
267
|
+
const { element: p, anchorNode: v } = g, w = p.getKey();
|
|
268
|
+
if (t.getElementByKey(w) !== null)
|
|
269
|
+
if (K(p)) {
|
|
270
|
+
const k = he(
|
|
271
|
+
v,
|
|
272
|
+
et
|
|
273
|
+
), I = k ? k.getListType() : p.getListType();
|
|
274
|
+
o(I);
|
|
274
275
|
} else {
|
|
275
|
-
const k =
|
|
276
|
-
k in
|
|
276
|
+
const k = Bt(p) ? p.getTag() : p.getType();
|
|
277
|
+
k in gt && o(k);
|
|
277
278
|
}
|
|
278
279
|
return !1;
|
|
279
280
|
},
|
|
280
|
-
|
|
281
|
+
tt
|
|
281
282
|
), [t]);
|
|
282
283
|
const n = (s) => {
|
|
283
284
|
e !== s && t.update(() => {
|
|
284
285
|
const g = L();
|
|
285
|
-
(
|
|
286
|
+
(x(g) || P(g)) && (H(g, () => Ft(s)), o(s));
|
|
286
287
|
});
|
|
287
288
|
};
|
|
288
|
-
return /* @__PURE__ */
|
|
289
|
-
|
|
289
|
+
return /* @__PURE__ */ r(Ue, { children: /* @__PURE__ */ C(
|
|
290
|
+
it,
|
|
290
291
|
{
|
|
291
|
-
trigger: /* @__PURE__ */
|
|
292
|
-
|
|
292
|
+
trigger: /* @__PURE__ */ r(
|
|
293
|
+
Xt,
|
|
293
294
|
{
|
|
294
295
|
dropdown: !0,
|
|
295
296
|
css: { display: "flex", width: "100%", overflow: "hidden" },
|
|
296
|
-
children: /* @__PURE__ */
|
|
297
|
+
children: /* @__PURE__ */ r(f, { blockType: e })
|
|
297
298
|
}
|
|
298
299
|
),
|
|
299
300
|
side: "bottom",
|
|
300
301
|
align: "start",
|
|
301
302
|
children: [
|
|
302
|
-
/* @__PURE__ */
|
|
303
|
+
/* @__PURE__ */ r(m, { onClick: () => {
|
|
303
304
|
e !== "paragraph" && t.update(() => {
|
|
304
305
|
const s = L();
|
|
305
|
-
(
|
|
306
|
+
(x(s) || P(s)) && (H(s, () => B()), o("paragraph"));
|
|
306
307
|
});
|
|
307
|
-
}, children: /* @__PURE__ */
|
|
308
|
-
/* @__PURE__ */
|
|
309
|
-
/* @__PURE__ */
|
|
310
|
-
/* @__PURE__ */
|
|
311
|
-
/* @__PURE__ */
|
|
312
|
-
/* @__PURE__ */
|
|
313
|
-
/* @__PURE__ */
|
|
314
|
-
/* @__PURE__ */
|
|
315
|
-
e !== "bullet" && (t.dispatchCommand(
|
|
316
|
-
}, children: /* @__PURE__ */
|
|
317
|
-
/* @__PURE__ */
|
|
318
|
-
e !== "number" && (t.dispatchCommand(
|
|
319
|
-
}, children: /* @__PURE__ */
|
|
320
|
-
/* @__PURE__ */
|
|
321
|
-
e !== "check" && (t.dispatchCommand(
|
|
322
|
-
}, children: /* @__PURE__ */
|
|
323
|
-
/* @__PURE__ */
|
|
308
|
+
}, children: /* @__PURE__ */ r(f, { blockType: "paragraph" }) }),
|
|
309
|
+
/* @__PURE__ */ r(m, { onClick: () => n("h1"), children: /* @__PURE__ */ r(f, { blockType: "h1" }) }),
|
|
310
|
+
/* @__PURE__ */ r(m, { onClick: () => n("h2"), children: /* @__PURE__ */ r(f, { blockType: "h2" }) }),
|
|
311
|
+
/* @__PURE__ */ r(m, { onClick: () => n("h3"), children: /* @__PURE__ */ r(f, { blockType: "h3" }) }),
|
|
312
|
+
/* @__PURE__ */ r(m, { onClick: () => n("h4"), children: /* @__PURE__ */ r(f, { blockType: "h4" }) }),
|
|
313
|
+
/* @__PURE__ */ r(m, { onClick: () => n("h5"), children: /* @__PURE__ */ r(f, { blockType: "h5" }) }),
|
|
314
|
+
/* @__PURE__ */ r(m, { onClick: () => n("h6"), children: /* @__PURE__ */ r(f, { blockType: "h6" }) }),
|
|
315
|
+
/* @__PURE__ */ r(m, { onClick: () => {
|
|
316
|
+
e !== "bullet" && (t.dispatchCommand(It, void 0), o("bullet"));
|
|
317
|
+
}, children: /* @__PURE__ */ r(f, { blockType: "bullet" }) }),
|
|
318
|
+
/* @__PURE__ */ r(m, { onClick: () => {
|
|
319
|
+
e !== "number" && (t.dispatchCommand($t, void 0), o("number"));
|
|
320
|
+
}, children: /* @__PURE__ */ r(f, { blockType: "number" }) }),
|
|
321
|
+
/* @__PURE__ */ r(m, { onClick: () => {
|
|
322
|
+
e !== "check" && (t.dispatchCommand(rt, void 0), o("check"));
|
|
323
|
+
}, children: /* @__PURE__ */ r(f, { blockType: "check" }) }),
|
|
324
|
+
/* @__PURE__ */ r(m, { onClick: () => {
|
|
324
325
|
e !== "quote" && t.update(() => {
|
|
325
326
|
const s = L();
|
|
326
|
-
(
|
|
327
|
+
(x(s) || P(s)) && (H(s, () => Pt()), o("quote"));
|
|
327
328
|
});
|
|
328
|
-
}, children: /* @__PURE__ */
|
|
329
|
+
}, children: /* @__PURE__ */ r(f, { blockType: "quote" }) })
|
|
329
330
|
]
|
|
330
331
|
}
|
|
331
332
|
) });
|
|
332
|
-
},
|
|
333
|
-
const [t] =
|
|
334
|
-
const
|
|
335
|
-
|
|
333
|
+
}, Ge = () => {
|
|
334
|
+
const [t] = F(), [e, o] = M(!1), [n, a] = M(!1), [l, i] = M(!1), [d, h] = M(!1), [s, g] = M(!1), p = b(() => {
|
|
335
|
+
const u = L();
|
|
336
|
+
x(u) && (o(u.hasFormat("bold")), a(u.hasFormat("italic")), i(u.hasFormat("underline")), h(u.hasFormat("code")), g(u.hasFormat("superscript")));
|
|
336
337
|
}, []);
|
|
337
|
-
|
|
338
|
+
N(() => ct(
|
|
338
339
|
t.registerCommand(
|
|
339
|
-
|
|
340
|
-
() => (
|
|
341
|
-
|
|
340
|
+
W,
|
|
341
|
+
() => (p(), !1),
|
|
342
|
+
tt
|
|
342
343
|
),
|
|
343
|
-
t.registerUpdateListener(({ editorState:
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
t.registerUpdateListener(({ editorState: u }) => {
|
|
345
|
+
u.read(() => {
|
|
346
|
+
p();
|
|
346
347
|
});
|
|
347
348
|
})
|
|
348
|
-
), [t,
|
|
349
|
-
const
|
|
350
|
-
() => t.dispatchCommand(
|
|
349
|
+
), [t, p]);
|
|
350
|
+
const v = b(
|
|
351
|
+
() => t.dispatchCommand($, "bold"),
|
|
351
352
|
[t]
|
|
352
|
-
),
|
|
353
|
-
() => t.dispatchCommand(
|
|
353
|
+
), w = b(
|
|
354
|
+
() => t.dispatchCommand($, "italic"),
|
|
354
355
|
[t]
|
|
355
|
-
),
|
|
356
|
-
() => t.dispatchCommand(
|
|
356
|
+
), z = b(
|
|
357
|
+
() => t.dispatchCommand($, "underline"),
|
|
357
358
|
[t]
|
|
358
|
-
), k =
|
|
359
|
-
() => t.dispatchCommand(
|
|
359
|
+
), k = b(
|
|
360
|
+
() => t.dispatchCommand($, "code"),
|
|
360
361
|
[t]
|
|
361
|
-
),
|
|
362
|
-
() => t.dispatchCommand(
|
|
362
|
+
), I = b(
|
|
363
|
+
() => t.dispatchCommand($, "superscript"),
|
|
363
364
|
[t]
|
|
364
|
-
),
|
|
365
|
-
const
|
|
366
|
-
return e &&
|
|
365
|
+
), mt = nt(() => {
|
|
366
|
+
const u = [];
|
|
367
|
+
return e && u.push("bold"), n && u.push("italic"), l && u.push("underline"), d && u.push("code"), s && u.push("superscript"), u;
|
|
367
368
|
}, [e, n, l, d, s]);
|
|
368
|
-
return /* @__PURE__ */
|
|
369
|
-
|
|
369
|
+
return /* @__PURE__ */ C(
|
|
370
|
+
Gt,
|
|
370
371
|
{
|
|
371
372
|
type: "multiple",
|
|
372
373
|
"aria-label": "Tekstformattering",
|
|
373
|
-
value:
|
|
374
|
+
value: mt,
|
|
374
375
|
children: [
|
|
375
|
-
/* @__PURE__ */
|
|
376
|
-
|
|
376
|
+
/* @__PURE__ */ r(
|
|
377
|
+
_,
|
|
377
378
|
{
|
|
378
|
-
onClick:
|
|
379
|
+
onClick: v,
|
|
379
380
|
title: "Fet tekst",
|
|
380
381
|
value: "bold",
|
|
381
|
-
children: /* @__PURE__ */
|
|
382
|
+
children: /* @__PURE__ */ r(we, { size: "1.25rem" })
|
|
382
383
|
}
|
|
383
384
|
),
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
|
|
385
|
+
/* @__PURE__ */ r(
|
|
386
|
+
_,
|
|
386
387
|
{
|
|
387
|
-
onClick:
|
|
388
|
+
onClick: w,
|
|
388
389
|
title: "Kursiv tekst",
|
|
389
390
|
value: "italic",
|
|
390
|
-
children: /* @__PURE__ */
|
|
391
|
+
children: /* @__PURE__ */ r(Fe, { size: "1.25rem" })
|
|
391
392
|
}
|
|
392
393
|
),
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
|
|
394
|
+
/* @__PURE__ */ r(
|
|
395
|
+
_,
|
|
395
396
|
{
|
|
396
|
-
onClick:
|
|
397
|
+
onClick: z,
|
|
397
398
|
title: "Understreket tekst",
|
|
398
399
|
value: "underline",
|
|
399
|
-
children: /* @__PURE__ */
|
|
400
|
+
children: /* @__PURE__ */ r(Ke, { size: "1.25rem" })
|
|
400
401
|
}
|
|
401
402
|
),
|
|
402
|
-
/* @__PURE__ */
|
|
403
|
-
|
|
403
|
+
/* @__PURE__ */ r(
|
|
404
|
+
_,
|
|
404
405
|
{
|
|
405
406
|
onClick: k,
|
|
406
407
|
title: "Kode",
|
|
407
408
|
value: "code",
|
|
408
|
-
children: /* @__PURE__ */
|
|
409
|
+
children: /* @__PURE__ */ r(ze, { size: "1.25rem" })
|
|
409
410
|
}
|
|
410
411
|
),
|
|
411
|
-
/* @__PURE__ */
|
|
412
|
-
|
|
412
|
+
/* @__PURE__ */ r(
|
|
413
|
+
_,
|
|
413
414
|
{
|
|
414
|
-
onClick:
|
|
415
|
+
onClick: I,
|
|
415
416
|
title: "Superscript",
|
|
416
417
|
value: "superscript",
|
|
417
|
-
children: /* @__PURE__ */
|
|
418
|
+
children: /* @__PURE__ */ r(je, { size: "1.25rem" })
|
|
418
419
|
}
|
|
419
420
|
)
|
|
420
421
|
]
|
|
421
422
|
}
|
|
422
423
|
);
|
|
423
|
-
},
|
|
424
|
-
const { hasFocus: e, editorRef:
|
|
425
|
-
|
|
424
|
+
}, Qe = ({ children: t }) => {
|
|
425
|
+
const { hasFocus: e, editorRef: o } = pt(), n = e, [a, l] = M(n);
|
|
426
|
+
qt(() => {
|
|
426
427
|
l(n);
|
|
427
428
|
}, [n]);
|
|
428
|
-
const { context: i, refs: d, floatingStyles:
|
|
429
|
+
const { context: i, refs: d, floatingStyles: h } = lt({
|
|
429
430
|
placement: "top",
|
|
430
|
-
whileElementsMounted:
|
|
431
|
+
whileElementsMounted: Qt,
|
|
431
432
|
middleware: [
|
|
432
|
-
|
|
433
|
-
apply: ({ rects: g, elements:
|
|
434
|
-
|
|
433
|
+
Vt({
|
|
434
|
+
apply: ({ rects: g, elements: p }) => {
|
|
435
|
+
p.floating.style.minWidth = `${g.reference.width}px`;
|
|
435
436
|
}
|
|
436
437
|
}),
|
|
437
|
-
|
|
438
|
-
|
|
438
|
+
Jt(),
|
|
439
|
+
st({
|
|
439
440
|
mainAxis: 8
|
|
440
441
|
}),
|
|
441
|
-
|
|
442
|
+
Zt({
|
|
442
443
|
padding: 8
|
|
443
444
|
})
|
|
444
445
|
],
|
|
445
446
|
open: a,
|
|
446
447
|
onOpenChange: l,
|
|
447
448
|
elements: {
|
|
448
|
-
reference:
|
|
449
|
+
reference: o.current
|
|
449
450
|
}
|
|
450
|
-
}), { getFloatingProps: s } =
|
|
451
|
-
|
|
451
|
+
}), { getFloatingProps: s } = te([
|
|
452
|
+
ee(i, {
|
|
452
453
|
role: "dialog"
|
|
453
454
|
})
|
|
454
455
|
]);
|
|
455
|
-
return a ? /* @__PURE__ */
|
|
456
|
-
|
|
456
|
+
return a ? /* @__PURE__ */ r(re, { children: /* @__PURE__ */ r(
|
|
457
|
+
oe,
|
|
457
458
|
{
|
|
458
459
|
ref: d.setFloating,
|
|
459
|
-
style:
|
|
460
|
+
style: h,
|
|
460
461
|
...s,
|
|
461
462
|
css: {
|
|
462
463
|
border: "1px solid $border",
|
|
@@ -464,40 +465,40 @@ const Be = et("div", {
|
|
|
464
465
|
overflow: "hidden",
|
|
465
466
|
boxShadow: "$md"
|
|
466
467
|
},
|
|
467
|
-
children: /* @__PURE__ */
|
|
468
|
+
children: /* @__PURE__ */ r(Ve, { children: t })
|
|
468
469
|
}
|
|
469
470
|
) }) : null;
|
|
470
|
-
},
|
|
471
|
+
}, Ve = ({
|
|
471
472
|
children: t,
|
|
472
473
|
...e
|
|
473
|
-
}) => /* @__PURE__ */
|
|
474
|
-
/* @__PURE__ */
|
|
475
|
-
/* @__PURE__ */
|
|
476
|
-
/* @__PURE__ */
|
|
474
|
+
}) => /* @__PURE__ */ C(ne, { "aria-label": "Formattering", ...e, children: [
|
|
475
|
+
/* @__PURE__ */ r(Xe, {}),
|
|
476
|
+
/* @__PURE__ */ r(ae, {}),
|
|
477
|
+
/* @__PURE__ */ r(Ge, {}),
|
|
477
478
|
t
|
|
478
479
|
] });
|
|
479
|
-
function
|
|
480
|
-
const [t] =
|
|
481
|
-
return
|
|
480
|
+
function Je() {
|
|
481
|
+
const [t] = F();
|
|
482
|
+
return N(() => ct(
|
|
482
483
|
t.registerCommand(
|
|
483
|
-
|
|
484
|
-
() => (
|
|
484
|
+
rt,
|
|
485
|
+
() => (_t(t, "check"), !0),
|
|
485
486
|
T
|
|
486
487
|
),
|
|
487
488
|
t.registerCommand(
|
|
488
|
-
|
|
489
|
-
(e) =>
|
|
489
|
+
vt,
|
|
490
|
+
(e) => J(e, t, !1),
|
|
490
491
|
T
|
|
491
492
|
),
|
|
492
493
|
t.registerCommand(
|
|
493
|
-
|
|
494
|
-
(e) =>
|
|
494
|
+
Tt,
|
|
495
|
+
(e) => J(e, t, !0),
|
|
495
496
|
T
|
|
496
497
|
),
|
|
497
498
|
t.registerCommand(
|
|
498
|
-
|
|
499
|
+
Lt,
|
|
499
500
|
(e) => {
|
|
500
|
-
if (
|
|
501
|
+
if (D() != null) {
|
|
501
502
|
const n = t.getRootElement();
|
|
502
503
|
return n != null && n.focus(), !0;
|
|
503
504
|
}
|
|
@@ -506,33 +507,33 @@ function je() {
|
|
|
506
507
|
T
|
|
507
508
|
),
|
|
508
509
|
t.registerCommand(
|
|
509
|
-
|
|
510
|
+
xt,
|
|
510
511
|
(e) => {
|
|
511
|
-
const
|
|
512
|
-
return
|
|
513
|
-
const n =
|
|
514
|
-
|
|
512
|
+
const o = D();
|
|
513
|
+
return o != null && t.isEditable() ? (t.update(() => {
|
|
514
|
+
const n = j(o);
|
|
515
|
+
E(n) && (e.preventDefault(), n.toggleChecked());
|
|
515
516
|
}), !0) : !1;
|
|
516
517
|
},
|
|
517
518
|
T
|
|
518
519
|
),
|
|
519
520
|
t.registerCommand(
|
|
520
|
-
|
|
521
|
+
yt,
|
|
521
522
|
(e) => t.getEditorState().read(() => {
|
|
522
|
-
const
|
|
523
|
-
if (
|
|
524
|
-
const { anchor: n } =
|
|
523
|
+
const o = L();
|
|
524
|
+
if (x(o) && o.isCollapsed()) {
|
|
525
|
+
const { anchor: n } = o, a = n.type === "element";
|
|
525
526
|
if (a || n.offset === 0) {
|
|
526
|
-
const l = n.getNode(), i =
|
|
527
|
+
const l = n.getNode(), i = dt(
|
|
527
528
|
l,
|
|
528
|
-
(d) =>
|
|
529
|
+
(d) => Et(d) && !d.isInline()
|
|
529
530
|
);
|
|
530
|
-
if (
|
|
531
|
+
if (E(i)) {
|
|
531
532
|
const d = i.getParent();
|
|
532
|
-
if (
|
|
533
|
-
const
|
|
534
|
-
if (
|
|
535
|
-
return
|
|
533
|
+
if (K(d) && d.getListType() === "check" && (a || i.getFirstDescendant() === l)) {
|
|
534
|
+
const h = t.getElementByKey(i.__key);
|
|
535
|
+
if (h != null && document.activeElement !== h)
|
|
536
|
+
return h.focus(), e.preventDefault(), !0;
|
|
536
537
|
}
|
|
537
538
|
}
|
|
538
539
|
}
|
|
@@ -541,41 +542,41 @@ function je() {
|
|
|
541
542
|
}),
|
|
542
543
|
T
|
|
543
544
|
),
|
|
544
|
-
t.registerRootListener((e,
|
|
545
|
-
e !== null && (e.addEventListener("click",
|
|
545
|
+
t.registerRootListener((e, o) => {
|
|
546
|
+
e !== null && (e.addEventListener("click", Q), e.addEventListener("pointerdown", V)), o !== null && (o.removeEventListener("click", Q), o.removeEventListener("pointerdown", V));
|
|
546
547
|
})
|
|
547
548
|
), [t]), null;
|
|
548
549
|
}
|
|
549
|
-
function
|
|
550
|
-
const
|
|
551
|
-
if (
|
|
550
|
+
function ft(t, e) {
|
|
551
|
+
const o = t.target;
|
|
552
|
+
if (o === null || !G(o))
|
|
552
553
|
return;
|
|
553
|
-
const n =
|
|
554
|
-
if (n != null &&
|
|
554
|
+
const n = o.firstChild;
|
|
555
|
+
if (n != null && G(n) && (n.tagName === "UL" || n.tagName === "OL"))
|
|
555
556
|
return;
|
|
556
|
-
const a =
|
|
557
|
+
const a = o.parentNode;
|
|
557
558
|
if (!a || a.__lexicalListType !== "check")
|
|
558
559
|
return;
|
|
559
|
-
const l = t.pageX, i =
|
|
560
|
-
(
|
|
560
|
+
const l = t.pageX, i = o.getBoundingClientRect();
|
|
561
|
+
(o.dir === "rtl" ? l < i.right && l > i.right - 20 : l > i.left && l < i.left + 20) && e();
|
|
561
562
|
}
|
|
562
|
-
function
|
|
563
|
-
|
|
564
|
-
const e = t.target,
|
|
565
|
-
|
|
563
|
+
function Q(t) {
|
|
564
|
+
ft(t, () => {
|
|
565
|
+
const e = t.target, o = Ze(e);
|
|
566
|
+
o != null && o.isEditable() && o.update(() => {
|
|
566
567
|
if (t.target) {
|
|
567
|
-
const n =
|
|
568
|
-
|
|
568
|
+
const n = j(e);
|
|
569
|
+
E(n) && (e.focus(), n.toggleChecked());
|
|
569
570
|
}
|
|
570
571
|
});
|
|
571
572
|
});
|
|
572
573
|
}
|
|
573
|
-
function
|
|
574
|
-
|
|
574
|
+
function V(t) {
|
|
575
|
+
ft(t, () => {
|
|
575
576
|
t.preventDefault();
|
|
576
577
|
});
|
|
577
578
|
}
|
|
578
|
-
function
|
|
579
|
+
function Ze(t) {
|
|
579
580
|
let e = t;
|
|
580
581
|
for (; e; ) {
|
|
581
582
|
if (e.__lexicalEditor)
|
|
@@ -584,30 +585,30 @@ function Ke(t) {
|
|
|
584
585
|
}
|
|
585
586
|
return null;
|
|
586
587
|
}
|
|
587
|
-
function
|
|
588
|
+
function D() {
|
|
588
589
|
const t = document.activeElement;
|
|
589
590
|
return t != null && t.tagName === "LI" && t.parentNode != null && // @ts-ignore internal field
|
|
590
591
|
t.parentNode.__lexicalListType === "check" ? t : null;
|
|
591
592
|
}
|
|
592
|
-
function
|
|
593
|
-
let
|
|
594
|
-
for (;
|
|
595
|
-
n = n.getParentOrThrow().getParent(), n != null && (
|
|
596
|
-
for (;
|
|
597
|
-
const a = e ?
|
|
598
|
-
if (!
|
|
599
|
-
return
|
|
600
|
-
|
|
593
|
+
function tr(t, e) {
|
|
594
|
+
let o = e ? t.getPreviousSibling() : t.getNextSibling(), n = t;
|
|
595
|
+
for (; o == null && E(n); )
|
|
596
|
+
n = n.getParentOrThrow().getParent(), n != null && (o = e ? n.getPreviousSibling() : n.getNextSibling());
|
|
597
|
+
for (; E(o); ) {
|
|
598
|
+
const a = e ? o.getLastChild() : o.getFirstChild();
|
|
599
|
+
if (!K(a))
|
|
600
|
+
return o;
|
|
601
|
+
o = e ? a.getLastChild() : a.getFirstChild();
|
|
601
602
|
}
|
|
602
603
|
return null;
|
|
603
604
|
}
|
|
604
|
-
function
|
|
605
|
-
const n =
|
|
605
|
+
function J(t, e, o) {
|
|
606
|
+
const n = D();
|
|
606
607
|
return n != null && e.update(() => {
|
|
607
|
-
const a =
|
|
608
|
-
if (!
|
|
608
|
+
const a = j(n);
|
|
609
|
+
if (!E(a))
|
|
609
610
|
return;
|
|
610
|
-
const l =
|
|
611
|
+
const l = tr(a, o);
|
|
611
612
|
if (l != null) {
|
|
612
613
|
l.selectStart();
|
|
613
614
|
const i = e.getElementByKey(l.__key);
|
|
@@ -617,34 +618,34 @@ function q(t, e, r) {
|
|
|
617
618
|
}
|
|
618
619
|
}), !1;
|
|
619
620
|
}
|
|
620
|
-
const
|
|
621
|
-
/* @__PURE__ */
|
|
622
|
-
/* @__PURE__ */
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
] }),
|
|
621
|
+
const er = () => /* @__PURE__ */ C(U, { children: [
|
|
622
|
+
/* @__PURE__ */ r(ue, {}),
|
|
623
|
+
/* @__PURE__ */ r(ge, {}),
|
|
624
|
+
/* @__PURE__ */ r(pe, {}),
|
|
625
|
+
/* @__PURE__ */ r(Je, {}),
|
|
626
|
+
/* @__PURE__ */ r(fe, {})
|
|
627
|
+
] }), rr = ({
|
|
627
628
|
state: t
|
|
628
629
|
}) => {
|
|
629
|
-
const [e] =
|
|
630
|
-
return
|
|
630
|
+
const [e] = F();
|
|
631
|
+
return N(() => {
|
|
631
632
|
if (t)
|
|
632
633
|
try {
|
|
633
|
-
if (
|
|
634
|
-
t.isEmpty() ?
|
|
634
|
+
if (be(t)) {
|
|
635
|
+
t.isEmpty() ? Ce(e) : e.setEditorState(t);
|
|
635
636
|
return;
|
|
636
637
|
}
|
|
637
|
-
if (typeof t == "string" && !
|
|
638
|
-
|
|
638
|
+
if (typeof t == "string" && !ht(t)) {
|
|
639
|
+
ve(t, e);
|
|
639
640
|
return;
|
|
640
641
|
}
|
|
641
|
-
const
|
|
642
|
-
|
|
643
|
-
} catch (
|
|
644
|
-
console.error("Could not parse"), console.error(
|
|
642
|
+
const o = e.parseEditorState(t);
|
|
643
|
+
o.isEmpty() || e.setEditorState(o);
|
|
644
|
+
} catch (o) {
|
|
645
|
+
console.error("Could not parse"), console.error(o);
|
|
645
646
|
}
|
|
646
647
|
}, []), null;
|
|
647
|
-
},
|
|
648
|
+
}, or = at("div", {
|
|
648
649
|
border: "1px solid $borderDarker",
|
|
649
650
|
borderRadius: "$md",
|
|
650
651
|
position: "relative",
|
|
@@ -681,10 +682,10 @@ const Ye = () => /* @__PURE__ */ b(O, { children: [
|
|
|
681
682
|
}
|
|
682
683
|
}
|
|
683
684
|
]
|
|
684
|
-
}),
|
|
685
|
+
}), nr = ({
|
|
685
686
|
isLoading: t
|
|
686
|
-
}) => /* @__PURE__ */
|
|
687
|
-
|
|
687
|
+
}) => /* @__PURE__ */ r(
|
|
688
|
+
R,
|
|
688
689
|
{
|
|
689
690
|
css: {
|
|
690
691
|
visibility: t ? "visible" : "hidden",
|
|
@@ -693,52 +694,52 @@ const Ye = () => /* @__PURE__ */ b(O, { children: [
|
|
|
693
694
|
right: "1rem",
|
|
694
695
|
display: "flex"
|
|
695
696
|
},
|
|
696
|
-
children: /* @__PURE__ */
|
|
697
|
+
children: /* @__PURE__ */ r(ie, {})
|
|
697
698
|
}
|
|
698
|
-
),
|
|
699
|
+
), Rr = ({
|
|
699
700
|
isLoading: t,
|
|
700
701
|
children: e,
|
|
701
|
-
placeholderText:
|
|
702
|
+
placeholderText: o,
|
|
702
703
|
nodes: n,
|
|
703
704
|
plugins: a,
|
|
704
705
|
toolbar: l,
|
|
705
706
|
toolbarContent: i,
|
|
706
707
|
content: d,
|
|
707
|
-
hideBorder:
|
|
708
|
+
hideBorder: h,
|
|
708
709
|
onBlur: s,
|
|
709
710
|
defaultState: g,
|
|
710
|
-
css:
|
|
711
|
+
css: p
|
|
711
712
|
}) => {
|
|
712
|
-
const { hasFocus:
|
|
713
|
-
return /* @__PURE__ */
|
|
714
|
-
|
|
713
|
+
const { hasFocus: v, attributes: w } = Se({ onBlur: s }), z = ot(null), k = nt(() => ({ hasFocus: v, editorRef: z }), [v]);
|
|
714
|
+
return /* @__PURE__ */ r(ut.Provider, { value: k, children: /* @__PURE__ */ C(
|
|
715
|
+
se,
|
|
715
716
|
{
|
|
716
717
|
initialConfig: {
|
|
717
718
|
namespace: "CommentEditor",
|
|
718
|
-
onError: (
|
|
719
|
-
console.error(
|
|
719
|
+
onError: (I) => {
|
|
720
|
+
console.error(I);
|
|
720
721
|
},
|
|
721
|
-
theme:
|
|
722
|
+
theme: Ne,
|
|
722
723
|
nodes: n,
|
|
723
724
|
editable: !0
|
|
724
725
|
},
|
|
725
726
|
children: [
|
|
726
|
-
/* @__PURE__ */
|
|
727
|
-
|
|
728
|
-
Ge,
|
|
727
|
+
/* @__PURE__ */ C(
|
|
728
|
+
or,
|
|
729
729
|
{
|
|
730
|
-
ref:
|
|
731
|
-
hasFocus:
|
|
732
|
-
hideBorder:
|
|
733
|
-
css:
|
|
734
|
-
...
|
|
730
|
+
ref: z,
|
|
731
|
+
hasFocus: v,
|
|
732
|
+
hideBorder: h,
|
|
733
|
+
css: p,
|
|
734
|
+
...w,
|
|
735
735
|
children: [
|
|
736
|
-
|
|
737
|
-
|
|
736
|
+
l,
|
|
737
|
+
/* @__PURE__ */ r(
|
|
738
|
+
de,
|
|
738
739
|
{
|
|
739
740
|
contentEditable: d,
|
|
740
|
-
placeholder:
|
|
741
|
-
|
|
741
|
+
placeholder: o ? /* @__PURE__ */ r(
|
|
742
|
+
R,
|
|
742
743
|
{
|
|
743
744
|
css: {
|
|
744
745
|
position: "absolute",
|
|
@@ -748,25 +749,25 @@ const Ye = () => /* @__PURE__ */ b(O, { children: [
|
|
|
748
749
|
pointerEvents: "none",
|
|
749
750
|
fontSize: "$sm"
|
|
750
751
|
},
|
|
751
|
-
children:
|
|
752
|
+
children: o
|
|
752
753
|
}
|
|
753
754
|
) : null,
|
|
754
|
-
ErrorBoundary:
|
|
755
|
+
ErrorBoundary: ce
|
|
755
756
|
}
|
|
756
757
|
),
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
+
/* @__PURE__ */ r(er, {}),
|
|
758
759
|
a,
|
|
759
|
-
/* @__PURE__ */
|
|
760
|
-
!l && /* @__PURE__ */
|
|
760
|
+
/* @__PURE__ */ r(nr, { isLoading: t }),
|
|
761
|
+
!l && /* @__PURE__ */ r(Qe, { children: i })
|
|
761
762
|
]
|
|
762
763
|
}
|
|
763
764
|
),
|
|
764
|
-
/* @__PURE__ */
|
|
765
|
-
/* @__PURE__ */
|
|
765
|
+
/* @__PURE__ */ r(rr, { state: g }),
|
|
766
|
+
/* @__PURE__ */ r(U, { children: e })
|
|
766
767
|
]
|
|
767
768
|
}
|
|
768
769
|
) });
|
|
769
|
-
},
|
|
770
|
+
}, Or = S({
|
|
770
771
|
fontSize: "1rem",
|
|
771
772
|
lineHeight: "1.5",
|
|
772
773
|
"h1, h2, h3, h4, h5, h6": {
|
|
@@ -869,6 +870,19 @@ const Ye = () => /* @__PURE__ */ b(O, { children: [
|
|
|
869
870
|
}
|
|
870
871
|
}
|
|
871
872
|
},
|
|
873
|
+
table: {
|
|
874
|
+
width: "100%",
|
|
875
|
+
borderCollapse: "collapse",
|
|
876
|
+
border: 0,
|
|
877
|
+
tr: {
|
|
878
|
+
border: 0
|
|
879
|
+
},
|
|
880
|
+
td: {
|
|
881
|
+
border: "1px solid $gray800",
|
|
882
|
+
verticalAlign: "top",
|
|
883
|
+
padding: "$2"
|
|
884
|
+
}
|
|
885
|
+
},
|
|
872
886
|
variants: {
|
|
873
887
|
size: {
|
|
874
888
|
xs: {
|
|
@@ -907,18 +921,99 @@ const Ye = () => /* @__PURE__ */ b(O, { children: [
|
|
|
907
921
|
size: "md"
|
|
908
922
|
}
|
|
909
923
|
});
|
|
924
|
+
function ar(t) {
|
|
925
|
+
return c({ 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);
|
|
926
|
+
}
|
|
927
|
+
const Br = () => {
|
|
928
|
+
const [t] = me(), [e, o] = M(null), { hasFocus: n } = pt();
|
|
929
|
+
N(() => {
|
|
930
|
+
!n && e && o(null);
|
|
931
|
+
}, [n, e]);
|
|
932
|
+
const { refs: a, floatingStyles: l } = lt({
|
|
933
|
+
placement: "top-end",
|
|
934
|
+
open: !!e,
|
|
935
|
+
elements: {
|
|
936
|
+
reference: e
|
|
937
|
+
},
|
|
938
|
+
middleware: [st({ mainAxis: -20, crossAxis: -2 })]
|
|
939
|
+
});
|
|
940
|
+
N(() => t.registerCommand(
|
|
941
|
+
W,
|
|
942
|
+
() => {
|
|
943
|
+
const d = L();
|
|
944
|
+
if (x(d)) {
|
|
945
|
+
const h = d.anchor.getNode(), s = Wt(h);
|
|
946
|
+
o(s ? t.getElementByKey(s.getKey()) : null);
|
|
947
|
+
}
|
|
948
|
+
return !1;
|
|
949
|
+
},
|
|
950
|
+
T
|
|
951
|
+
), [t]);
|
|
952
|
+
const i = (d) => () => {
|
|
953
|
+
t.update(() => {
|
|
954
|
+
switch (d) {
|
|
955
|
+
case "add-row-over":
|
|
956
|
+
q(!1);
|
|
957
|
+
break;
|
|
958
|
+
case "add-row-under":
|
|
959
|
+
q(!0);
|
|
960
|
+
break;
|
|
961
|
+
case "add-column-left":
|
|
962
|
+
Y(!1);
|
|
963
|
+
break;
|
|
964
|
+
case "add-column-right":
|
|
965
|
+
Y(!0);
|
|
966
|
+
break;
|
|
967
|
+
case "delete-row":
|
|
968
|
+
Kt();
|
|
969
|
+
break;
|
|
970
|
+
case "delete-column":
|
|
971
|
+
jt();
|
|
972
|
+
break;
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
};
|
|
976
|
+
return e ? /* @__PURE__ */ C(
|
|
977
|
+
it,
|
|
978
|
+
{
|
|
979
|
+
trigger: /* @__PURE__ */ r(
|
|
980
|
+
le,
|
|
981
|
+
{
|
|
982
|
+
icon: !0,
|
|
983
|
+
variant: "primary",
|
|
984
|
+
color: "secondary",
|
|
985
|
+
ref: a.setFloating,
|
|
986
|
+
style: l,
|
|
987
|
+
css: { padding: "2px", width: "18px", height: "18px" },
|
|
988
|
+
children: /* @__PURE__ */ r(ar, {})
|
|
989
|
+
}
|
|
990
|
+
),
|
|
991
|
+
children: [
|
|
992
|
+
/* @__PURE__ */ r(y, { onClick: i("add-row-over"), children: "Legg til rad over" }),
|
|
993
|
+
/* @__PURE__ */ r(y, { onClick: i("add-row-under"), children: "Legg til rad under" }),
|
|
994
|
+
/* @__PURE__ */ r(X, {}),
|
|
995
|
+
/* @__PURE__ */ r(y, { onClick: i("add-column-left"), children: "Legg til kolumne venstre" }),
|
|
996
|
+
/* @__PURE__ */ r(y, { onClick: i("add-column-right"), children: "Legg til kolumne høyre" }),
|
|
997
|
+
/* @__PURE__ */ r(X, {}),
|
|
998
|
+
/* @__PURE__ */ r(y, { onClick: i("delete-row"), children: "Fjern rad" }),
|
|
999
|
+
/* @__PURE__ */ r(y, { onClick: i("delete-column"), children: "Fjern kolumne" })
|
|
1000
|
+
]
|
|
1001
|
+
}
|
|
1002
|
+
) : null;
|
|
1003
|
+
};
|
|
910
1004
|
export {
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
1005
|
+
Qe as FloatingToolbar,
|
|
1006
|
+
Rr as RichTextEditor,
|
|
1007
|
+
Ve as RichTextToolbar,
|
|
1008
|
+
Br as TableEditPlugin,
|
|
1009
|
+
Ce as clearEditorState,
|
|
1010
|
+
_r as defaultNodes,
|
|
1011
|
+
be as isEditorState,
|
|
1012
|
+
ht as isJSON,
|
|
1013
|
+
ut as richTextContext,
|
|
1014
|
+
Or as richTextCss,
|
|
1015
|
+
ve as setStateFromPlainText,
|
|
1016
|
+
$r as stateToHTML,
|
|
1017
|
+
Se as useHasFocusWithin,
|
|
1018
|
+
pt as useRichTextContext
|
|
924
1019
|
};
|