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