@arkitektbedriftene/fe-lib 0.4.6 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{TextInput-bedd6814.js → TextInput-986922b7.js} +1334 -1252
- package/dist/icons.es.js +1 -1
- package/dist/{index.esm-969855d2.js → index.esm-b848a615.js} +26 -22
- package/dist/oidc/firmAccess.d.ts +3 -0
- package/dist/oidc.es.js +75 -63
- package/dist/rich-text/Plugins/LinkEditPlugin.d.ts +2 -0
- package/dist/rich-text/Plugins/LinkInsertPlugin.d.ts +2 -0
- package/dist/rich-text/getSelectedNode.d.ts +2 -0
- package/dist/rich-text/rich-text.d.ts +2 -0
- package/dist/rich-text/sanitizeUrl.d.ts +1 -0
- package/dist/rich-text.es.js +517 -360
- package/dist/ui.es.js +13 -13
- package/package.json +1 -1
package/dist/rich-text.es.js
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
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 r, jsxs as
|
|
10
|
-
import { createContext as
|
|
11
|
-
import { c as
|
|
1
|
+
import { createHeadlessEditor as zt } from "@lexical/headless";
|
|
2
|
+
import { $generateHtmlFromNodes as Rt } from "@lexical/html";
|
|
3
|
+
import { $getRoot as H, ParagraphNode as _t, $createParagraphNode as W, $createTextNode as q, $setSelection as ct, SELECTION_CHANGE_COMMAND as A, $getSelection as T, COMMAND_PRIORITY_CRITICAL as X, $isRangeSelection as y, $isRootOrShadowRoot as $t, DEPRECATED_$isGridSelection as U, FORMAT_TEXT_COMMAND as O, COMMAND_PRIORITY_LOW as w, KEY_ARROW_DOWN_COMMAND as Ot, KEY_ARROW_UP_COMMAND as Pt, KEY_ESCAPE_COMMAND as ht, KEY_SPACE_COMMAND as At, $getNearestNodeFromDOMNode as Q, KEY_ARROW_LEFT_COMMAND as Bt, $isElementNode as Dt, COMMAND_PRIORITY_NORMAL as Ft, $isParagraphNode as Ht, COMMAND_PRIORITY_HIGH as Wt } from "lexical";
|
|
4
|
+
import { trimTextContentFromAnchor as jt, $setBlocksType as K, $isAtNodeEnd as rt } from "@lexical/selection";
|
|
5
|
+
import { AutoLinkNode as Ut, LinkNode as Kt, $isLinkNode as P, TOGGLE_LINK_COMMAND as Y, $isAutoLinkNode as Yt } from "@lexical/link";
|
|
6
|
+
import { ListNode as ut, ListItemNode as Gt, $isListNode as V, INSERT_UNORDERED_LIST_COMMAND as qt, INSERT_ORDERED_LIST_COMMAND as Xt, INSERT_CHECK_LIST_COMMAND as pt, insertList as Qt, $isListItemNode as _ } from "@lexical/list";
|
|
7
|
+
import { HeadingNode as Vt, QuoteNode as Jt, $isHeadingNode as Zt, $createHeadingNode as te, $createQuoteNode as ee } from "@lexical/rich-text";
|
|
8
|
+
import { TableNode as re, TableRowNode as oe, TableCellNode as ne, $getTableCellNodeFromLexicalNode as ae, $deleteTableColumn__EXPERIMENTAL as ie, $deleteTableRow__EXPERIMENTAL as le, $insertTableColumn__EXPERIMENTAL as ot, $insertTableRow__EXPERIMENTAL as nt } from "@lexical/table";
|
|
9
|
+
import { jsx as r, jsxs as C, Fragment as j } from "react/jsx-runtime";
|
|
10
|
+
import { createContext as se, useState as f, useRef as J, useCallback as L, useContext as de, useEffect as E, useMemo as gt, useLayoutEffect as ce } from "react";
|
|
11
|
+
import { c as $, s as ft, D as mt, T as he, a as b, B, b as ue, d as R, u as Z, e as kt, f as pe, g as ge, o as vt, h as fe, i as Ct, j as Mt, F as bt, O as Lt, k as me, l as ke, S as ve, m as D, n as z, p as at, q as Ce, r as Me, t as be, v as Le, w as Te, x as ye } from "./TextInput-986922b7.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
|
|
19
|
-
import { ListPlugin as
|
|
20
|
-
import { HistoryPlugin as
|
|
21
|
-
import { TablePlugin as
|
|
22
|
-
import { TabIndentationPlugin as
|
|
23
|
-
import { useLexicalComposerContext as ke } from "@lexical/react/LexicalComposerContext";
|
|
13
|
+
import { LexicalComposer as Ne } from "@lexical/react/LexicalComposer.js";
|
|
14
|
+
import { RichTextPlugin as Ee } from "@lexical/react/LexicalRichTextPlugin.js";
|
|
15
|
+
import xe from "@lexical/react/LexicalErrorBoundary.js";
|
|
16
|
+
import { useLexicalComposerContext as I } from "@lexical/react/LexicalComposerContext.js";
|
|
17
|
+
import { $getNearestNodeOfType as Se, $findMatchingParent as F, mergeRegister as tt, isHTMLElement as it } from "@lexical/utils";
|
|
18
|
+
import { G as p, f as we } from "./index.esm-b848a615.js";
|
|
19
|
+
import { ListPlugin as Ie } from "@lexical/react/LexicalListPlugin.js";
|
|
20
|
+
import { HistoryPlugin as ze } from "@lexical/react/LexicalHistoryPlugin.js";
|
|
21
|
+
import { TablePlugin as Re } from "@lexical/react/LexicalTablePlugin.js";
|
|
22
|
+
import { TabIndentationPlugin as _e } from "@lexical/react/LexicalTabIndentationPlugin.js";
|
|
24
23
|
import "react-dom";
|
|
25
24
|
import "@radix-ui/react-toolbar";
|
|
26
25
|
import "@radix-ui/react-dropdown-menu";
|
|
27
|
-
const
|
|
26
|
+
const $e = ({
|
|
28
27
|
text: t,
|
|
29
28
|
maxChars: e,
|
|
30
29
|
maxLines: o
|
|
@@ -39,55 +38,55 @@ const Me = ({
|
|
|
39
38
|
t[i] === `
|
|
40
39
|
` && l++, i++;
|
|
41
40
|
return t.slice(0, i).length;
|
|
42
|
-
},
|
|
41
|
+
}, Oe = ({
|
|
43
42
|
editor: t,
|
|
44
43
|
maxChars: e,
|
|
45
44
|
maxLines: o
|
|
46
45
|
}) => {
|
|
47
|
-
const n =
|
|
48
|
-
|
|
46
|
+
const n = H(), a = n.getTextContent(), l = $e({ text: a, maxChars: e, maxLines: o }), i = a.length - l, c = n.select().anchor;
|
|
47
|
+
jt(t, c, i);
|
|
49
48
|
const s = n.getLastChild();
|
|
50
|
-
return s instanceof
|
|
51
|
-
},
|
|
49
|
+
return s instanceof _t && s.getChildrenSize() === 0 && s.remove(), i;
|
|
50
|
+
}, Tt = (t) => t[0] === "{", Pe = (t) => t !== null && typeof t == "object" && "isEmpty" in t, Ae = (t, e) => {
|
|
52
51
|
t.update(
|
|
53
52
|
() => {
|
|
54
|
-
const o =
|
|
53
|
+
const o = H();
|
|
55
54
|
o.clear();
|
|
56
|
-
const n =
|
|
57
|
-
n.append(
|
|
55
|
+
const n = W();
|
|
56
|
+
n.append(q("")), o.append(n), ct(null);
|
|
58
57
|
},
|
|
59
58
|
{
|
|
60
59
|
tag: e
|
|
61
60
|
}
|
|
62
61
|
);
|
|
63
|
-
},
|
|
62
|
+
}, Be = (t, e, o) => {
|
|
64
63
|
e.update(
|
|
65
64
|
() => {
|
|
66
|
-
const n =
|
|
65
|
+
const n = H();
|
|
67
66
|
n.clear();
|
|
68
|
-
const a =
|
|
69
|
-
a.append(
|
|
67
|
+
const a = W();
|
|
68
|
+
a.append(q(t.trim())), n.append(a), ct(null);
|
|
70
69
|
},
|
|
71
70
|
{
|
|
72
71
|
tag: o
|
|
73
72
|
}
|
|
74
73
|
), e.blur();
|
|
75
|
-
},
|
|
74
|
+
}, Qr = (t, e, o) => {
|
|
76
75
|
let n = 0;
|
|
77
|
-
const a =
|
|
76
|
+
const a = zt({
|
|
78
77
|
nodes: e,
|
|
79
78
|
editable: !1
|
|
80
79
|
});
|
|
81
80
|
if (t)
|
|
82
81
|
try {
|
|
83
|
-
if (typeof t == "string" && !
|
|
82
|
+
if (typeof t == "string" && !Tt(t))
|
|
84
83
|
a.update(() => {
|
|
85
|
-
const i =
|
|
86
|
-
d.append(
|
|
84
|
+
const i = H(), d = W();
|
|
85
|
+
d.append(q(t.trim())), i.append(d);
|
|
87
86
|
});
|
|
88
87
|
else {
|
|
89
88
|
const i = a.parseEditorState(t, () => {
|
|
90
|
-
n =
|
|
89
|
+
n = Oe({
|
|
91
90
|
editor: a,
|
|
92
91
|
maxLines: o == null ? void 0 : o.maxLines
|
|
93
92
|
});
|
|
@@ -99,48 +98,48 @@ const Me = ({
|
|
|
99
98
|
}
|
|
100
99
|
let l = "";
|
|
101
100
|
return a.update(() => {
|
|
102
|
-
l =
|
|
101
|
+
l = Rt(a);
|
|
103
102
|
}), { html: l, trimCount: n };
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
],
|
|
103
|
+
}, Vr = [
|
|
104
|
+
Vt,
|
|
105
|
+
Jt,
|
|
106
|
+
ut,
|
|
107
|
+
Gt,
|
|
108
|
+
Ut,
|
|
109
|
+
Kt,
|
|
110
|
+
re,
|
|
111
|
+
oe,
|
|
112
|
+
ne
|
|
113
|
+
], De = $({
|
|
115
114
|
fontWeight: "bold"
|
|
116
|
-
}),
|
|
115
|
+
}), Fe = $({
|
|
117
116
|
fontStyle: "italic"
|
|
118
|
-
}),
|
|
117
|
+
}), He = $({
|
|
119
118
|
textDecoration: "underline"
|
|
120
|
-
}),
|
|
119
|
+
}), We = $({
|
|
121
120
|
listStyleType: "none"
|
|
122
|
-
}),
|
|
121
|
+
}), je = $({
|
|
123
122
|
borderLeft: "4px solid #ccc",
|
|
124
123
|
color: "#666",
|
|
125
124
|
fontStyle: "italic",
|
|
126
125
|
margin: "1.5em 10px",
|
|
127
126
|
padding: "0.5em 10px"
|
|
128
|
-
}),
|
|
129
|
-
quote:
|
|
127
|
+
}), Ue = {
|
|
128
|
+
quote: je().className,
|
|
130
129
|
text: {
|
|
131
|
-
bold:
|
|
132
|
-
italic:
|
|
133
|
-
underline:
|
|
130
|
+
bold: De().className,
|
|
131
|
+
italic: Fe().className,
|
|
132
|
+
underline: He().className
|
|
134
133
|
},
|
|
135
134
|
list: {
|
|
136
135
|
nested: {
|
|
137
|
-
listitem:
|
|
136
|
+
listitem: We().className
|
|
138
137
|
}
|
|
139
138
|
}
|
|
140
|
-
},
|
|
141
|
-
const [e, o] =
|
|
139
|
+
}, yt = se({ hasFocus: !1, editorRef: { current: null } }), Ke = ({ onBlur: t }) => {
|
|
140
|
+
const [e, o] = f(!1), n = J(null), a = L(() => {
|
|
142
141
|
o(!0), n.current && window.clearTimeout(n.current);
|
|
143
|
-
}, []), l =
|
|
142
|
+
}, []), l = L(() => {
|
|
144
143
|
n.current = window.setTimeout(() => {
|
|
145
144
|
o(!1), t == null || t();
|
|
146
145
|
}, 0);
|
|
@@ -152,59 +151,62 @@ const Me = ({
|
|
|
152
151
|
onBlur: l
|
|
153
152
|
}
|
|
154
153
|
};
|
|
155
|
-
},
|
|
156
|
-
function
|
|
157
|
-
return
|
|
154
|
+
}, et = () => de(yt);
|
|
155
|
+
function Ye(t) {
|
|
156
|
+
return p({ 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
157
|
}
|
|
159
|
-
function
|
|
160
|
-
return
|
|
158
|
+
function Ge(t) {
|
|
159
|
+
return p({ 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
160
|
}
|
|
162
|
-
function
|
|
163
|
-
return
|
|
161
|
+
function qe(t) {
|
|
162
|
+
return p({ 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
163
|
}
|
|
165
|
-
function
|
|
166
|
-
return
|
|
164
|
+
function Xe(t) {
|
|
165
|
+
return p({ 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
166
|
}
|
|
168
|
-
function
|
|
169
|
-
return
|
|
167
|
+
function Qe(t) {
|
|
168
|
+
return p({ 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
169
|
}
|
|
171
|
-
function
|
|
172
|
-
return
|
|
170
|
+
function Ve(t) {
|
|
171
|
+
return p({ 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
172
|
}
|
|
174
|
-
function
|
|
175
|
-
return
|
|
173
|
+
function Je(t) {
|
|
174
|
+
return p({ 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
175
|
}
|
|
177
|
-
function
|
|
178
|
-
return
|
|
176
|
+
function Ze(t) {
|
|
177
|
+
return p({ 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
178
|
}
|
|
180
|
-
function
|
|
181
|
-
return
|
|
179
|
+
function tr(t) {
|
|
180
|
+
return p({ 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
|
+
function er(t) {
|
|
183
|
+
return p({ 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);
|
|
182
184
|
}
|
|
183
|
-
function
|
|
184
|
-
return
|
|
185
|
+
function rr(t) {
|
|
186
|
+
return p({ 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);
|
|
185
187
|
}
|
|
186
|
-
function
|
|
187
|
-
return
|
|
188
|
+
function or(t) {
|
|
189
|
+
return p({ 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
190
|
}
|
|
189
|
-
function
|
|
190
|
-
return
|
|
191
|
+
function nr(t) {
|
|
192
|
+
return p({ 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
193
|
}
|
|
192
|
-
function
|
|
193
|
-
return
|
|
194
|
+
function ar(t) {
|
|
195
|
+
return p({ 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
196
|
}
|
|
195
|
-
function
|
|
196
|
-
return
|
|
197
|
+
function ir(t) {
|
|
198
|
+
return p({ 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
199
|
}
|
|
198
|
-
function
|
|
199
|
-
return
|
|
200
|
+
function lr(t) {
|
|
201
|
+
return p({ 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
202
|
}
|
|
201
|
-
function
|
|
202
|
-
return
|
|
203
|
+
function sr(t) {
|
|
204
|
+
return p({ 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
205
|
}
|
|
204
|
-
const
|
|
206
|
+
const dr = ft("div", {
|
|
205
207
|
width: "10rem",
|
|
206
208
|
display: "flex"
|
|
207
|
-
}),
|
|
209
|
+
}), Nt = {
|
|
208
210
|
bullet: "Punktliste",
|
|
209
211
|
h1: "Overskrift 1",
|
|
210
212
|
h2: "Overskrift 2",
|
|
@@ -216,24 +218,24 @@ const Ye = at("div", {
|
|
|
216
218
|
paragraph: "Normal",
|
|
217
219
|
quote: "Sitat",
|
|
218
220
|
check: "Avkrysningsliste"
|
|
219
|
-
},
|
|
220
|
-
bullet: /* @__PURE__ */ r(
|
|
221
|
-
h1: /* @__PURE__ */ r(
|
|
222
|
-
h2: /* @__PURE__ */ r(
|
|
223
|
-
h3: /* @__PURE__ */ r(
|
|
224
|
-
h4: /* @__PURE__ */ r(
|
|
225
|
-
h5: /* @__PURE__ */ r(
|
|
226
|
-
h6: /* @__PURE__ */ r(
|
|
227
|
-
number: /* @__PURE__ */ r(
|
|
228
|
-
check: /* @__PURE__ */ r(
|
|
229
|
-
paragraph: /* @__PURE__ */ r(
|
|
230
|
-
quote: /* @__PURE__ */ r(
|
|
231
|
-
},
|
|
221
|
+
}, cr = {
|
|
222
|
+
bullet: /* @__PURE__ */ r(ar, { size: "1.25rem" }),
|
|
223
|
+
h1: /* @__PURE__ */ r(qe, { size: "1.25rem" }),
|
|
224
|
+
h2: /* @__PURE__ */ r(Xe, { size: "1.25rem" }),
|
|
225
|
+
h3: /* @__PURE__ */ r(Qe, { size: "1.25rem" }),
|
|
226
|
+
h4: /* @__PURE__ */ r(Ve, { size: "1.25rem" }),
|
|
227
|
+
h5: /* @__PURE__ */ r(Je, { size: "1.25rem" }),
|
|
228
|
+
h6: /* @__PURE__ */ r(Ze, { size: "1.25rem" }),
|
|
229
|
+
number: /* @__PURE__ */ r(nr, { size: "1.25rem" }),
|
|
230
|
+
check: /* @__PURE__ */ r(or, { size: "1.25rem" }),
|
|
231
|
+
paragraph: /* @__PURE__ */ r(er, { size: "1.25rem" }),
|
|
232
|
+
quote: /* @__PURE__ */ r(ir, { size: "1.25rem" })
|
|
233
|
+
}, v = ({
|
|
232
234
|
blockType: t
|
|
233
|
-
}) => /* @__PURE__ */
|
|
234
|
-
/* @__PURE__ */ r(
|
|
235
|
+
}) => /* @__PURE__ */ C(j, { children: [
|
|
236
|
+
/* @__PURE__ */ r(B, { css: { display: "flex", flex: "0 0 auto" }, children: cr[t] }),
|
|
235
237
|
/* @__PURE__ */ r(
|
|
236
|
-
|
|
238
|
+
B,
|
|
237
239
|
{
|
|
238
240
|
css: {
|
|
239
241
|
flex: "1 1 auto",
|
|
@@ -241,205 +243,205 @@ const Ye = at("div", {
|
|
|
241
243
|
textOverflow: "ellipsis",
|
|
242
244
|
whiteSpace: "nowrap"
|
|
243
245
|
},
|
|
244
|
-
children:
|
|
246
|
+
children: Nt[t]
|
|
245
247
|
}
|
|
246
248
|
)
|
|
247
|
-
] }),
|
|
248
|
-
if (!
|
|
249
|
+
] }), hr = (t) => {
|
|
250
|
+
if (!y(t))
|
|
249
251
|
return null;
|
|
250
252
|
const e = t.anchor.getNode();
|
|
251
|
-
let o = e.getKey() === "root" ? e :
|
|
253
|
+
let o = e.getKey() === "root" ? e : F(e, (n) => {
|
|
252
254
|
const a = n.getParent();
|
|
253
|
-
return a !== null &&
|
|
255
|
+
return a !== null && $t(a);
|
|
254
256
|
});
|
|
255
257
|
return o === null && (o = e.getTopLevelElementOrThrow()), {
|
|
256
258
|
anchorNode: e,
|
|
257
259
|
element: o
|
|
258
260
|
};
|
|
259
|
-
},
|
|
260
|
-
const [t] =
|
|
261
|
+
}, ur = () => {
|
|
262
|
+
const [t] = I(), [e, o] = f("paragraph");
|
|
261
263
|
E(() => t.registerCommand(
|
|
262
|
-
|
|
264
|
+
A,
|
|
263
265
|
() => {
|
|
264
|
-
const s = T(),
|
|
265
|
-
if (!
|
|
266
|
+
const s = T(), h = hr(s);
|
|
267
|
+
if (!h)
|
|
266
268
|
return !1;
|
|
267
|
-
const { element:
|
|
268
|
-
if (t.getElementByKey(
|
|
269
|
-
if (
|
|
270
|
-
const k =
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
),
|
|
274
|
-
o(
|
|
269
|
+
const { element: g, anchorNode: m } = h, M = g.getKey();
|
|
270
|
+
if (t.getElementByKey(M) !== null)
|
|
271
|
+
if (V(g)) {
|
|
272
|
+
const k = Se(
|
|
273
|
+
m,
|
|
274
|
+
ut
|
|
275
|
+
), x = k ? k.getListType() : g.getListType();
|
|
276
|
+
o(x);
|
|
275
277
|
} else {
|
|
276
|
-
const k =
|
|
277
|
-
k in
|
|
278
|
+
const k = Zt(g) ? g.getTag() : g.getType();
|
|
279
|
+
k in Nt && o(k);
|
|
278
280
|
}
|
|
279
281
|
return !1;
|
|
280
282
|
},
|
|
281
|
-
|
|
283
|
+
X
|
|
282
284
|
), [t]);
|
|
283
285
|
const n = (s) => {
|
|
284
286
|
e !== s && t.update(() => {
|
|
285
|
-
const
|
|
286
|
-
(
|
|
287
|
+
const h = T();
|
|
288
|
+
(y(h) || U(h)) && (K(h, () => te(s)), o(s));
|
|
287
289
|
});
|
|
288
290
|
};
|
|
289
|
-
return /* @__PURE__ */ r(
|
|
290
|
-
|
|
291
|
+
return /* @__PURE__ */ r(dr, { children: /* @__PURE__ */ C(
|
|
292
|
+
mt,
|
|
291
293
|
{
|
|
292
294
|
trigger: /* @__PURE__ */ r(
|
|
293
|
-
|
|
295
|
+
he,
|
|
294
296
|
{
|
|
295
297
|
dropdown: !0,
|
|
296
298
|
css: { display: "flex", width: "100%", overflow: "hidden" },
|
|
297
|
-
children: /* @__PURE__ */ r(
|
|
299
|
+
children: /* @__PURE__ */ r(v, { blockType: e })
|
|
298
300
|
}
|
|
299
301
|
),
|
|
300
302
|
side: "bottom",
|
|
301
303
|
align: "start",
|
|
302
304
|
children: [
|
|
303
|
-
/* @__PURE__ */ r(
|
|
305
|
+
/* @__PURE__ */ r(b, { onClick: () => {
|
|
304
306
|
e !== "paragraph" && t.update(() => {
|
|
305
307
|
const s = T();
|
|
306
|
-
(
|
|
308
|
+
(y(s) || U(s)) && (K(s, () => W()), o("paragraph"));
|
|
307
309
|
});
|
|
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(
|
|
319
|
-
e !== "number" && (t.dispatchCommand(
|
|
320
|
-
}, children: /* @__PURE__ */ r(
|
|
321
|
-
/* @__PURE__ */ r(
|
|
322
|
-
e !== "check" && (t.dispatchCommand(
|
|
323
|
-
}, children: /* @__PURE__ */ r(
|
|
324
|
-
/* @__PURE__ */ r(
|
|
310
|
+
}, children: /* @__PURE__ */ r(v, { blockType: "paragraph" }) }),
|
|
311
|
+
/* @__PURE__ */ r(b, { onClick: () => n("h1"), children: /* @__PURE__ */ r(v, { blockType: "h1" }) }),
|
|
312
|
+
/* @__PURE__ */ r(b, { onClick: () => n("h2"), children: /* @__PURE__ */ r(v, { blockType: "h2" }) }),
|
|
313
|
+
/* @__PURE__ */ r(b, { onClick: () => n("h3"), children: /* @__PURE__ */ r(v, { blockType: "h3" }) }),
|
|
314
|
+
/* @__PURE__ */ r(b, { onClick: () => n("h4"), children: /* @__PURE__ */ r(v, { blockType: "h4" }) }),
|
|
315
|
+
/* @__PURE__ */ r(b, { onClick: () => n("h5"), children: /* @__PURE__ */ r(v, { blockType: "h5" }) }),
|
|
316
|
+
/* @__PURE__ */ r(b, { onClick: () => n("h6"), children: /* @__PURE__ */ r(v, { blockType: "h6" }) }),
|
|
317
|
+
/* @__PURE__ */ r(b, { onClick: () => {
|
|
318
|
+
e !== "bullet" && (t.dispatchCommand(qt, void 0), o("bullet"));
|
|
319
|
+
}, children: /* @__PURE__ */ r(v, { blockType: "bullet" }) }),
|
|
320
|
+
/* @__PURE__ */ r(b, { onClick: () => {
|
|
321
|
+
e !== "number" && (t.dispatchCommand(Xt, void 0), o("number"));
|
|
322
|
+
}, children: /* @__PURE__ */ r(v, { blockType: "number" }) }),
|
|
323
|
+
/* @__PURE__ */ r(b, { onClick: () => {
|
|
324
|
+
e !== "check" && (t.dispatchCommand(pt, void 0), o("check"));
|
|
325
|
+
}, children: /* @__PURE__ */ r(v, { blockType: "check" }) }),
|
|
326
|
+
/* @__PURE__ */ r(b, { onClick: () => {
|
|
325
327
|
e !== "quote" && t.update(() => {
|
|
326
328
|
const s = T();
|
|
327
|
-
(
|
|
329
|
+
(y(s) || U(s)) && (K(s, () => ee()), o("quote"));
|
|
328
330
|
});
|
|
329
|
-
}, children: /* @__PURE__ */ r(
|
|
331
|
+
}, children: /* @__PURE__ */ r(v, { blockType: "quote" }) })
|
|
330
332
|
]
|
|
331
333
|
}
|
|
332
334
|
) });
|
|
333
|
-
},
|
|
334
|
-
const [t] =
|
|
335
|
+
}, pr = () => {
|
|
336
|
+
const [t] = I(), [e, o] = f(!1), [n, a] = f(!1), [l, i] = f(!1), [d, c] = f(!1), [s, h] = f(!1), g = L(() => {
|
|
335
337
|
const u = T();
|
|
336
|
-
|
|
338
|
+
y(u) && (o(u.hasFormat("bold")), a(u.hasFormat("italic")), i(u.hasFormat("underline")), c(u.hasFormat("code")), h(u.hasFormat("superscript")));
|
|
337
339
|
}, []);
|
|
338
|
-
E(() =>
|
|
340
|
+
E(() => tt(
|
|
339
341
|
t.registerCommand(
|
|
340
|
-
|
|
341
|
-
() => (
|
|
342
|
-
|
|
342
|
+
A,
|
|
343
|
+
() => (g(), !1),
|
|
344
|
+
X
|
|
343
345
|
),
|
|
344
346
|
t.registerUpdateListener(({ editorState: u }) => {
|
|
345
347
|
u.read(() => {
|
|
346
|
-
|
|
348
|
+
g();
|
|
347
349
|
});
|
|
348
350
|
})
|
|
349
|
-
), [t,
|
|
350
|
-
const
|
|
351
|
-
() => t.dispatchCommand(
|
|
351
|
+
), [t, g]);
|
|
352
|
+
const m = L(
|
|
353
|
+
() => t.dispatchCommand(O, "bold"),
|
|
352
354
|
[t]
|
|
353
|
-
),
|
|
354
|
-
() => t.dispatchCommand(
|
|
355
|
+
), M = L(
|
|
356
|
+
() => t.dispatchCommand(O, "italic"),
|
|
355
357
|
[t]
|
|
356
|
-
),
|
|
357
|
-
() => t.dispatchCommand(
|
|
358
|
+
), N = L(
|
|
359
|
+
() => t.dispatchCommand(O, "underline"),
|
|
358
360
|
[t]
|
|
359
|
-
), k =
|
|
360
|
-
() => t.dispatchCommand(
|
|
361
|
+
), k = L(
|
|
362
|
+
() => t.dispatchCommand(O, "code"),
|
|
361
363
|
[t]
|
|
362
|
-
),
|
|
363
|
-
() => t.dispatchCommand(
|
|
364
|
+
), x = L(
|
|
365
|
+
() => t.dispatchCommand(O, "superscript"),
|
|
364
366
|
[t]
|
|
365
|
-
),
|
|
367
|
+
), S = gt(() => {
|
|
366
368
|
const u = [];
|
|
367
369
|
return e && u.push("bold"), n && u.push("italic"), l && u.push("underline"), d && u.push("code"), s && u.push("superscript"), u;
|
|
368
370
|
}, [e, n, l, d, s]);
|
|
369
|
-
return /* @__PURE__ */
|
|
370
|
-
|
|
371
|
+
return /* @__PURE__ */ C(
|
|
372
|
+
ue,
|
|
371
373
|
{
|
|
372
374
|
type: "multiple",
|
|
373
375
|
"aria-label": "Tekstformattering",
|
|
374
|
-
value:
|
|
376
|
+
value: S,
|
|
375
377
|
children: [
|
|
376
378
|
/* @__PURE__ */ r(
|
|
377
|
-
|
|
379
|
+
R,
|
|
378
380
|
{
|
|
379
|
-
onClick:
|
|
381
|
+
onClick: m,
|
|
380
382
|
title: "Fet tekst",
|
|
381
383
|
value: "bold",
|
|
382
|
-
children: /* @__PURE__ */ r(
|
|
384
|
+
children: /* @__PURE__ */ r(Ye, { size: "1.25rem" })
|
|
383
385
|
}
|
|
384
386
|
),
|
|
385
387
|
/* @__PURE__ */ r(
|
|
386
|
-
|
|
388
|
+
R,
|
|
387
389
|
{
|
|
388
|
-
onClick:
|
|
390
|
+
onClick: M,
|
|
389
391
|
title: "Kursiv tekst",
|
|
390
392
|
value: "italic",
|
|
391
|
-
children: /* @__PURE__ */ r(
|
|
393
|
+
children: /* @__PURE__ */ r(tr, { size: "1.25rem" })
|
|
392
394
|
}
|
|
393
395
|
),
|
|
394
396
|
/* @__PURE__ */ r(
|
|
395
|
-
|
|
397
|
+
R,
|
|
396
398
|
{
|
|
397
|
-
onClick:
|
|
399
|
+
onClick: N,
|
|
398
400
|
title: "Understreket tekst",
|
|
399
401
|
value: "underline",
|
|
400
|
-
children: /* @__PURE__ */ r(
|
|
402
|
+
children: /* @__PURE__ */ r(sr, { size: "1.25rem" })
|
|
401
403
|
}
|
|
402
404
|
),
|
|
403
405
|
/* @__PURE__ */ r(
|
|
404
|
-
|
|
406
|
+
R,
|
|
405
407
|
{
|
|
406
408
|
onClick: k,
|
|
407
409
|
title: "Kode",
|
|
408
410
|
value: "code",
|
|
409
|
-
children: /* @__PURE__ */ r(
|
|
411
|
+
children: /* @__PURE__ */ r(Ge, { size: "1.25rem" })
|
|
410
412
|
}
|
|
411
413
|
),
|
|
412
414
|
/* @__PURE__ */ r(
|
|
413
|
-
|
|
415
|
+
R,
|
|
414
416
|
{
|
|
415
|
-
onClick:
|
|
417
|
+
onClick: x,
|
|
416
418
|
title: "Superscript",
|
|
417
419
|
value: "superscript",
|
|
418
|
-
children: /* @__PURE__ */ r(
|
|
420
|
+
children: /* @__PURE__ */ r(lr, { size: "1.25rem" })
|
|
419
421
|
}
|
|
420
422
|
)
|
|
421
423
|
]
|
|
422
424
|
}
|
|
423
425
|
);
|
|
424
|
-
},
|
|
425
|
-
const { hasFocus: e, editorRef: o } =
|
|
426
|
-
|
|
426
|
+
}, gr = ({ children: t }) => {
|
|
427
|
+
const { hasFocus: e, editorRef: o } = et(), n = e, [a, l] = f(n);
|
|
428
|
+
ce(() => {
|
|
427
429
|
l(n);
|
|
428
430
|
}, [n]);
|
|
429
|
-
const { context: i, refs: d, floatingStyles:
|
|
431
|
+
const { context: i, refs: d, floatingStyles: c } = Z({
|
|
430
432
|
placement: "top",
|
|
431
|
-
whileElementsMounted:
|
|
433
|
+
whileElementsMounted: kt,
|
|
432
434
|
middleware: [
|
|
433
|
-
|
|
434
|
-
apply: ({ rects:
|
|
435
|
-
|
|
435
|
+
pe({
|
|
436
|
+
apply: ({ rects: h, elements: g }) => {
|
|
437
|
+
g.floating.style.minWidth = `${h.reference.width}px`;
|
|
436
438
|
}
|
|
437
439
|
}),
|
|
438
|
-
|
|
439
|
-
|
|
440
|
+
ge(),
|
|
441
|
+
vt({
|
|
440
442
|
mainAxis: 8
|
|
441
443
|
}),
|
|
442
|
-
|
|
444
|
+
fe({
|
|
443
445
|
padding: 8
|
|
444
446
|
})
|
|
445
447
|
],
|
|
@@ -448,16 +450,16 @@ const Ye = at("div", {
|
|
|
448
450
|
elements: {
|
|
449
451
|
reference: o.current
|
|
450
452
|
}
|
|
451
|
-
}), { getFloatingProps: s } =
|
|
452
|
-
|
|
453
|
+
}), { getFloatingProps: s } = Ct([
|
|
454
|
+
Mt(i, {
|
|
453
455
|
role: "dialog"
|
|
454
456
|
})
|
|
455
457
|
]);
|
|
456
|
-
return a ? /* @__PURE__ */ r(
|
|
457
|
-
|
|
458
|
+
return a ? /* @__PURE__ */ r(bt, { children: /* @__PURE__ */ r(
|
|
459
|
+
Lt,
|
|
458
460
|
{
|
|
459
461
|
ref: d.setFloating,
|
|
460
|
-
style:
|
|
462
|
+
style: c,
|
|
461
463
|
...s,
|
|
462
464
|
css: {
|
|
463
465
|
border: "1px solid $border",
|
|
@@ -465,94 +467,94 @@ const Ye = at("div", {
|
|
|
465
467
|
overflow: "hidden",
|
|
466
468
|
boxShadow: "$md"
|
|
467
469
|
},
|
|
468
|
-
children: /* @__PURE__ */ r(
|
|
470
|
+
children: /* @__PURE__ */ r(fr, { children: t })
|
|
469
471
|
}
|
|
470
472
|
) }) : null;
|
|
471
|
-
},
|
|
473
|
+
}, fr = ({
|
|
472
474
|
children: t,
|
|
473
475
|
...e
|
|
474
|
-
}) => /* @__PURE__ */
|
|
475
|
-
/* @__PURE__ */ r(
|
|
476
|
-
/* @__PURE__ */ r(
|
|
477
|
-
/* @__PURE__ */ r(
|
|
476
|
+
}) => /* @__PURE__ */ C(me, { "aria-label": "Formattering", ...e, children: [
|
|
477
|
+
/* @__PURE__ */ r(ur, {}),
|
|
478
|
+
/* @__PURE__ */ r(ke, {}),
|
|
479
|
+
/* @__PURE__ */ r(pr, {}),
|
|
478
480
|
t
|
|
479
481
|
] });
|
|
480
|
-
function
|
|
481
|
-
const [t] =
|
|
482
|
-
return E(() =>
|
|
482
|
+
function mr() {
|
|
483
|
+
const [t] = I();
|
|
484
|
+
return E(() => tt(
|
|
483
485
|
t.registerCommand(
|
|
484
|
-
|
|
485
|
-
() => (
|
|
486
|
-
|
|
486
|
+
pt,
|
|
487
|
+
() => (Qt(t, "check"), !0),
|
|
488
|
+
w
|
|
487
489
|
),
|
|
488
490
|
t.registerCommand(
|
|
489
|
-
|
|
490
|
-
(e) =>
|
|
491
|
-
|
|
491
|
+
Ot,
|
|
492
|
+
(e) => dt(e, t, !1),
|
|
493
|
+
w
|
|
492
494
|
),
|
|
493
495
|
t.registerCommand(
|
|
494
|
-
|
|
495
|
-
(e) =>
|
|
496
|
-
|
|
496
|
+
Pt,
|
|
497
|
+
(e) => dt(e, t, !0),
|
|
498
|
+
w
|
|
497
499
|
),
|
|
498
500
|
t.registerCommand(
|
|
499
|
-
|
|
501
|
+
ht,
|
|
500
502
|
(e) => {
|
|
501
|
-
if (
|
|
503
|
+
if (G() != null) {
|
|
502
504
|
const n = t.getRootElement();
|
|
503
505
|
return n != null && n.focus(), !0;
|
|
504
506
|
}
|
|
505
507
|
return !1;
|
|
506
508
|
},
|
|
507
|
-
|
|
509
|
+
w
|
|
508
510
|
),
|
|
509
511
|
t.registerCommand(
|
|
510
|
-
|
|
512
|
+
At,
|
|
511
513
|
(e) => {
|
|
512
|
-
const o =
|
|
514
|
+
const o = G();
|
|
513
515
|
return o != null && t.isEditable() ? (t.update(() => {
|
|
514
|
-
const n =
|
|
515
|
-
|
|
516
|
+
const n = Q(o);
|
|
517
|
+
_(n) && (e.preventDefault(), n.toggleChecked());
|
|
516
518
|
}), !0) : !1;
|
|
517
519
|
},
|
|
518
|
-
|
|
520
|
+
w
|
|
519
521
|
),
|
|
520
522
|
t.registerCommand(
|
|
521
|
-
|
|
523
|
+
Bt,
|
|
522
524
|
(e) => t.getEditorState().read(() => {
|
|
523
525
|
const o = T();
|
|
524
|
-
if (
|
|
526
|
+
if (y(o) && o.isCollapsed()) {
|
|
525
527
|
const { anchor: n } = o, a = n.type === "element";
|
|
526
528
|
if (a || n.offset === 0) {
|
|
527
|
-
const l = n.getNode(), i =
|
|
529
|
+
const l = n.getNode(), i = F(
|
|
528
530
|
l,
|
|
529
|
-
(d) =>
|
|
531
|
+
(d) => Dt(d) && !d.isInline()
|
|
530
532
|
);
|
|
531
|
-
if (
|
|
533
|
+
if (_(i)) {
|
|
532
534
|
const d = i.getParent();
|
|
533
|
-
if (
|
|
534
|
-
const
|
|
535
|
-
if (
|
|
536
|
-
return
|
|
535
|
+
if (V(d) && d.getListType() === "check" && (a || i.getFirstDescendant() === l)) {
|
|
536
|
+
const c = t.getElementByKey(i.__key);
|
|
537
|
+
if (c != null && document.activeElement !== c)
|
|
538
|
+
return c.focus(), e.preventDefault(), !0;
|
|
537
539
|
}
|
|
538
540
|
}
|
|
539
541
|
}
|
|
540
542
|
}
|
|
541
543
|
return !1;
|
|
542
544
|
}),
|
|
543
|
-
|
|
545
|
+
w
|
|
544
546
|
),
|
|
545
547
|
t.registerRootListener((e, o) => {
|
|
546
|
-
e !== null && (e.addEventListener("click",
|
|
548
|
+
e !== null && (e.addEventListener("click", lt), e.addEventListener("pointerdown", st)), o !== null && (o.removeEventListener("click", lt), o.removeEventListener("pointerdown", st));
|
|
547
549
|
})
|
|
548
550
|
), [t]), null;
|
|
549
551
|
}
|
|
550
|
-
function
|
|
552
|
+
function Et(t, e) {
|
|
551
553
|
const o = t.target;
|
|
552
|
-
if (o === null || !
|
|
554
|
+
if (o === null || !it(o))
|
|
553
555
|
return;
|
|
554
556
|
const n = o.firstChild;
|
|
555
|
-
if (n != null &&
|
|
557
|
+
if (n != null && it(n) && (n.tagName === "UL" || n.tagName === "OL"))
|
|
556
558
|
return;
|
|
557
559
|
const a = o.parentNode;
|
|
558
560
|
if (!a || a.__lexicalListType !== "check")
|
|
@@ -560,23 +562,23 @@ function mt(t, e) {
|
|
|
560
562
|
const l = t.pageX, i = o.getBoundingClientRect();
|
|
561
563
|
(o.dir === "rtl" ? l < i.right && l > i.right - 20 : l > i.left && l < i.left + 20) && e();
|
|
562
564
|
}
|
|
563
|
-
function
|
|
564
|
-
|
|
565
|
-
const e = t.target, o =
|
|
565
|
+
function lt(t) {
|
|
566
|
+
Et(t, () => {
|
|
567
|
+
const e = t.target, o = kr(e);
|
|
566
568
|
o != null && o.isEditable() && o.update(() => {
|
|
567
569
|
if (t.target) {
|
|
568
|
-
const n =
|
|
569
|
-
|
|
570
|
+
const n = Q(e);
|
|
571
|
+
_(n) && (e.focus(), n.toggleChecked());
|
|
570
572
|
}
|
|
571
573
|
});
|
|
572
574
|
});
|
|
573
575
|
}
|
|
574
|
-
function
|
|
575
|
-
|
|
576
|
+
function st(t) {
|
|
577
|
+
Et(t, () => {
|
|
576
578
|
t.preventDefault();
|
|
577
579
|
});
|
|
578
580
|
}
|
|
579
|
-
function
|
|
581
|
+
function kr(t) {
|
|
580
582
|
let e = t;
|
|
581
583
|
for (; e; ) {
|
|
582
584
|
if (e.__lexicalEditor)
|
|
@@ -585,30 +587,30 @@ function tr(t) {
|
|
|
585
587
|
}
|
|
586
588
|
return null;
|
|
587
589
|
}
|
|
588
|
-
function
|
|
590
|
+
function G() {
|
|
589
591
|
const t = document.activeElement;
|
|
590
592
|
return t != null && t.tagName === "LI" && t.parentNode != null && // @ts-ignore internal field
|
|
591
593
|
t.parentNode.__lexicalListType === "check" ? t : null;
|
|
592
594
|
}
|
|
593
|
-
function
|
|
595
|
+
function vr(t, e) {
|
|
594
596
|
let o = e ? t.getPreviousSibling() : t.getNextSibling(), n = t;
|
|
595
|
-
for (; o == null &&
|
|
597
|
+
for (; o == null && _(n); )
|
|
596
598
|
n = n.getParentOrThrow().getParent(), n != null && (o = e ? n.getPreviousSibling() : n.getNextSibling());
|
|
597
|
-
for (;
|
|
599
|
+
for (; _(o); ) {
|
|
598
600
|
const a = e ? o.getLastChild() : o.getFirstChild();
|
|
599
|
-
if (!
|
|
601
|
+
if (!V(a))
|
|
600
602
|
return o;
|
|
601
603
|
o = e ? a.getLastChild() : a.getFirstChild();
|
|
602
604
|
}
|
|
603
605
|
return null;
|
|
604
606
|
}
|
|
605
|
-
function
|
|
606
|
-
const n =
|
|
607
|
+
function dt(t, e, o) {
|
|
608
|
+
const n = G();
|
|
607
609
|
return n != null && e.update(() => {
|
|
608
|
-
const a =
|
|
609
|
-
if (!
|
|
610
|
+
const a = Q(n);
|
|
611
|
+
if (!_(a))
|
|
610
612
|
return;
|
|
611
|
-
const l =
|
|
613
|
+
const l = vr(a, o);
|
|
612
614
|
if (l != null) {
|
|
613
615
|
l.selectStart();
|
|
614
616
|
const i = e.getElementByKey(l.__key);
|
|
@@ -618,25 +620,25 @@ function J(t, e, o) {
|
|
|
618
620
|
}
|
|
619
621
|
}), !1;
|
|
620
622
|
}
|
|
621
|
-
const
|
|
622
|
-
/* @__PURE__ */ r(
|
|
623
|
-
/* @__PURE__ */ r(
|
|
624
|
-
/* @__PURE__ */ r(
|
|
625
|
-
/* @__PURE__ */ r(
|
|
626
|
-
/* @__PURE__ */ r(
|
|
627
|
-
] }),
|
|
623
|
+
const Cr = () => /* @__PURE__ */ C(j, { children: [
|
|
624
|
+
/* @__PURE__ */ r(Ie, {}),
|
|
625
|
+
/* @__PURE__ */ r(Re, {}),
|
|
626
|
+
/* @__PURE__ */ r(ze, {}),
|
|
627
|
+
/* @__PURE__ */ r(mr, {}),
|
|
628
|
+
/* @__PURE__ */ r(_e, {})
|
|
629
|
+
] }), Mr = ({
|
|
628
630
|
state: t
|
|
629
631
|
}) => {
|
|
630
|
-
const [e] =
|
|
632
|
+
const [e] = I();
|
|
631
633
|
return E(() => {
|
|
632
634
|
if (t)
|
|
633
635
|
try {
|
|
634
|
-
if (
|
|
635
|
-
t.isEmpty() ?
|
|
636
|
+
if (Pe(t)) {
|
|
637
|
+
t.isEmpty() ? Ae(e) : e.setEditorState(t);
|
|
636
638
|
return;
|
|
637
639
|
}
|
|
638
|
-
if (typeof t == "string" && !
|
|
639
|
-
|
|
640
|
+
if (typeof t == "string" && !Tt(t)) {
|
|
641
|
+
Be(t, e);
|
|
640
642
|
return;
|
|
641
643
|
}
|
|
642
644
|
const o = e.parseEditorState(t);
|
|
@@ -645,7 +647,7 @@ const rr = () => /* @__PURE__ */ b(U, { children: [
|
|
|
645
647
|
console.error("Could not parse"), console.error(o);
|
|
646
648
|
}
|
|
647
649
|
}, []), null;
|
|
648
|
-
},
|
|
650
|
+
}, br = ft("div", {
|
|
649
651
|
border: "1px solid $borderDarker",
|
|
650
652
|
borderRadius: "$md",
|
|
651
653
|
position: "relative",
|
|
@@ -682,10 +684,10 @@ const rr = () => /* @__PURE__ */ b(U, { children: [
|
|
|
682
684
|
}
|
|
683
685
|
}
|
|
684
686
|
]
|
|
685
|
-
}),
|
|
687
|
+
}), Lr = ({
|
|
686
688
|
isLoading: t
|
|
687
689
|
}) => /* @__PURE__ */ r(
|
|
688
|
-
|
|
690
|
+
B,
|
|
689
691
|
{
|
|
690
692
|
css: {
|
|
691
693
|
visibility: t ? "visible" : "hidden",
|
|
@@ -694,9 +696,9 @@ const rr = () => /* @__PURE__ */ b(U, { children: [
|
|
|
694
696
|
right: "1rem",
|
|
695
697
|
display: "flex"
|
|
696
698
|
},
|
|
697
|
-
children: /* @__PURE__ */ r(
|
|
699
|
+
children: /* @__PURE__ */ r(ve, {})
|
|
698
700
|
}
|
|
699
|
-
),
|
|
701
|
+
), Jr = ({
|
|
700
702
|
isLoading: t,
|
|
701
703
|
children: e,
|
|
702
704
|
placeholderText: o,
|
|
@@ -705,41 +707,41 @@ const rr = () => /* @__PURE__ */ b(U, { children: [
|
|
|
705
707
|
toolbar: l,
|
|
706
708
|
toolbarContent: i,
|
|
707
709
|
content: d,
|
|
708
|
-
hideBorder:
|
|
710
|
+
hideBorder: c,
|
|
709
711
|
onBlur: s,
|
|
710
|
-
defaultState:
|
|
711
|
-
css:
|
|
712
|
+
defaultState: h,
|
|
713
|
+
css: g
|
|
712
714
|
}) => {
|
|
713
|
-
const { hasFocus:
|
|
714
|
-
return /* @__PURE__ */ r(
|
|
715
|
-
|
|
715
|
+
const { hasFocus: m, attributes: M } = Ke({ onBlur: s }), N = J(null), k = gt(() => ({ hasFocus: m, editorRef: N }), [m]);
|
|
716
|
+
return /* @__PURE__ */ r(yt.Provider, { value: k, children: /* @__PURE__ */ C(
|
|
717
|
+
Ne,
|
|
716
718
|
{
|
|
717
719
|
initialConfig: {
|
|
718
720
|
namespace: "CommentEditor",
|
|
719
|
-
onError: (
|
|
720
|
-
console.error(
|
|
721
|
+
onError: (x) => {
|
|
722
|
+
console.error(x);
|
|
721
723
|
},
|
|
722
|
-
theme:
|
|
724
|
+
theme: Ue,
|
|
723
725
|
nodes: n,
|
|
724
726
|
editable: !0
|
|
725
727
|
},
|
|
726
728
|
children: [
|
|
727
|
-
/* @__PURE__ */
|
|
728
|
-
|
|
729
|
+
/* @__PURE__ */ C(
|
|
730
|
+
br,
|
|
729
731
|
{
|
|
730
|
-
ref:
|
|
731
|
-
hasFocus:
|
|
732
|
-
hideBorder:
|
|
733
|
-
css:
|
|
734
|
-
...
|
|
732
|
+
ref: N,
|
|
733
|
+
hasFocus: m,
|
|
734
|
+
hideBorder: c,
|
|
735
|
+
css: g,
|
|
736
|
+
...M,
|
|
735
737
|
children: [
|
|
736
738
|
l,
|
|
737
739
|
/* @__PURE__ */ r(
|
|
738
|
-
|
|
740
|
+
Ee,
|
|
739
741
|
{
|
|
740
742
|
contentEditable: d,
|
|
741
743
|
placeholder: o ? /* @__PURE__ */ r(
|
|
742
|
-
|
|
744
|
+
B,
|
|
743
745
|
{
|
|
744
746
|
css: {
|
|
745
747
|
position: "absolute",
|
|
@@ -752,22 +754,22 @@ const rr = () => /* @__PURE__ */ b(U, { children: [
|
|
|
752
754
|
children: o
|
|
753
755
|
}
|
|
754
756
|
) : null,
|
|
755
|
-
ErrorBoundary:
|
|
757
|
+
ErrorBoundary: xe
|
|
756
758
|
}
|
|
757
759
|
),
|
|
758
|
-
/* @__PURE__ */ r(
|
|
760
|
+
/* @__PURE__ */ r(Cr, {}),
|
|
759
761
|
a,
|
|
760
|
-
/* @__PURE__ */ r(
|
|
761
|
-
!l && /* @__PURE__ */ r(
|
|
762
|
+
/* @__PURE__ */ r(Lr, { isLoading: t }),
|
|
763
|
+
!l && /* @__PURE__ */ r(gr, { children: i })
|
|
762
764
|
]
|
|
763
765
|
}
|
|
764
766
|
),
|
|
765
|
-
/* @__PURE__ */ r(
|
|
766
|
-
/* @__PURE__ */ r(
|
|
767
|
+
/* @__PURE__ */ r(Mr, { state: h }),
|
|
768
|
+
/* @__PURE__ */ r(j, { children: e })
|
|
767
769
|
]
|
|
768
770
|
}
|
|
769
771
|
) });
|
|
770
|
-
},
|
|
772
|
+
}, Zr = $({
|
|
771
773
|
fontSize: "1rem",
|
|
772
774
|
lineHeight: "1.5",
|
|
773
775
|
"h1, h2, h3, h4, h5, h6": {
|
|
@@ -929,63 +931,63 @@ const rr = () => /* @__PURE__ */ b(U, { children: [
|
|
|
929
931
|
size: "md"
|
|
930
932
|
}
|
|
931
933
|
});
|
|
932
|
-
function
|
|
933
|
-
return
|
|
934
|
+
function Tr(t) {
|
|
935
|
+
return p({ 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);
|
|
934
936
|
}
|
|
935
|
-
const
|
|
936
|
-
const [t] =
|
|
937
|
+
const to = () => {
|
|
938
|
+
const [t] = I(), [e, o] = f(null), { hasFocus: n } = et();
|
|
937
939
|
E(() => {
|
|
938
940
|
!n && e && o(null);
|
|
939
941
|
}, [n, e]);
|
|
940
|
-
const { refs: a, floatingStyles: l } =
|
|
942
|
+
const { refs: a, floatingStyles: l } = Z({
|
|
941
943
|
placement: "top-end",
|
|
942
944
|
open: !!e,
|
|
943
945
|
elements: {
|
|
944
946
|
reference: e
|
|
945
947
|
},
|
|
946
|
-
middleware: [
|
|
948
|
+
middleware: [vt({ mainAxis: -20, crossAxis: -2 })]
|
|
947
949
|
});
|
|
948
950
|
E(() => t.registerCommand(
|
|
949
|
-
|
|
951
|
+
A,
|
|
950
952
|
() => {
|
|
951
953
|
const d = T();
|
|
952
|
-
if (
|
|
953
|
-
const
|
|
954
|
+
if (y(d)) {
|
|
955
|
+
const c = d.anchor.getNode(), s = ae(c);
|
|
954
956
|
o(s ? t.getElementByKey(s.getKey()) : null);
|
|
955
957
|
}
|
|
956
958
|
return !1;
|
|
957
959
|
},
|
|
958
|
-
|
|
960
|
+
Ft
|
|
959
961
|
), [t]);
|
|
960
962
|
const i = (d) => () => {
|
|
961
963
|
t.update(() => {
|
|
962
964
|
switch (d) {
|
|
963
965
|
case "add-row-over":
|
|
964
|
-
|
|
966
|
+
nt(!1);
|
|
965
967
|
break;
|
|
966
968
|
case "add-row-under":
|
|
967
|
-
|
|
969
|
+
nt(!0);
|
|
968
970
|
break;
|
|
969
971
|
case "add-column-left":
|
|
970
|
-
|
|
972
|
+
ot(!1);
|
|
971
973
|
break;
|
|
972
974
|
case "add-column-right":
|
|
973
|
-
|
|
975
|
+
ot(!0);
|
|
974
976
|
break;
|
|
975
977
|
case "delete-row":
|
|
976
|
-
|
|
978
|
+
le();
|
|
977
979
|
break;
|
|
978
980
|
case "delete-column":
|
|
979
|
-
|
|
981
|
+
ie();
|
|
980
982
|
break;
|
|
981
983
|
}
|
|
982
984
|
});
|
|
983
985
|
};
|
|
984
|
-
return e ? /* @__PURE__ */
|
|
985
|
-
|
|
986
|
+
return e ? /* @__PURE__ */ C(
|
|
987
|
+
mt,
|
|
986
988
|
{
|
|
987
989
|
trigger: /* @__PURE__ */ r(
|
|
988
|
-
|
|
990
|
+
D,
|
|
989
991
|
{
|
|
990
992
|
icon: !0,
|
|
991
993
|
variant: "primary",
|
|
@@ -993,35 +995,190 @@ const Pr = () => {
|
|
|
993
995
|
ref: a.setFloating,
|
|
994
996
|
style: l,
|
|
995
997
|
css: { padding: "2px", width: "18px", height: "18px" },
|
|
996
|
-
children: /* @__PURE__ */ r(
|
|
998
|
+
children: /* @__PURE__ */ r(Tr, {})
|
|
997
999
|
}
|
|
998
1000
|
),
|
|
999
1001
|
children: [
|
|
1000
|
-
/* @__PURE__ */ r(
|
|
1001
|
-
/* @__PURE__ */ r(
|
|
1002
|
-
/* @__PURE__ */ r(
|
|
1003
|
-
/* @__PURE__ */ r(
|
|
1004
|
-
/* @__PURE__ */ r(
|
|
1005
|
-
/* @__PURE__ */ r(
|
|
1006
|
-
/* @__PURE__ */ r(
|
|
1007
|
-
/* @__PURE__ */ r(
|
|
1002
|
+
/* @__PURE__ */ r(z, { onClick: i("add-row-over"), children: "Legg til rad over" }),
|
|
1003
|
+
/* @__PURE__ */ r(z, { onClick: i("add-row-under"), children: "Legg til rad under" }),
|
|
1004
|
+
/* @__PURE__ */ r(at, {}),
|
|
1005
|
+
/* @__PURE__ */ r(z, { onClick: i("add-column-left"), children: "Legg til kolumne venstre" }),
|
|
1006
|
+
/* @__PURE__ */ r(z, { onClick: i("add-column-right"), children: "Legg til kolumne høyre" }),
|
|
1007
|
+
/* @__PURE__ */ r(at, {}),
|
|
1008
|
+
/* @__PURE__ */ r(z, { onClick: i("delete-row"), children: "Fjern rad" }),
|
|
1009
|
+
/* @__PURE__ */ r(z, { onClick: i("delete-column"), children: "Fjern kolumne" })
|
|
1008
1010
|
]
|
|
1009
1011
|
}
|
|
1010
1012
|
) : null;
|
|
1011
1013
|
};
|
|
1014
|
+
function xt(t) {
|
|
1015
|
+
let e = t;
|
|
1016
|
+
const o = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi, n = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
|
|
1017
|
+
return e = String(e).trim(), e.match(o) || e.match(n) ? e : "https://";
|
|
1018
|
+
}
|
|
1019
|
+
function St(t) {
|
|
1020
|
+
const e = t.anchor, o = t.focus, n = t.anchor.getNode(), a = t.focus.getNode();
|
|
1021
|
+
return n === a ? n : t.isBackward() ? rt(o) ? n : a : rt(e) ? n : a;
|
|
1022
|
+
}
|
|
1023
|
+
const yr = ({
|
|
1024
|
+
isOpen: t,
|
|
1025
|
+
onSave: e,
|
|
1026
|
+
onCancel: o
|
|
1027
|
+
}) => {
|
|
1028
|
+
const n = J(null);
|
|
1029
|
+
return /* @__PURE__ */ C(Ce, { open: t, onOpenChange: o, children: [
|
|
1030
|
+
/* @__PURE__ */ r(Me, { children: "Opprett lenke" }),
|
|
1031
|
+
/* @__PURE__ */ r(be, { label: "URL", ref: n }),
|
|
1032
|
+
/* @__PURE__ */ C(Le, { children: [
|
|
1033
|
+
/* @__PURE__ */ r(D, { onClick: o, children: "Avbryt" }),
|
|
1034
|
+
/* @__PURE__ */ r(
|
|
1035
|
+
D,
|
|
1036
|
+
{
|
|
1037
|
+
variant: "primary",
|
|
1038
|
+
onClick: () => {
|
|
1039
|
+
var a;
|
|
1040
|
+
e(((a = n.current) == null ? void 0 : a.value) || "");
|
|
1041
|
+
},
|
|
1042
|
+
children: "Lagre"
|
|
1043
|
+
}
|
|
1044
|
+
)
|
|
1045
|
+
] })
|
|
1046
|
+
] });
|
|
1047
|
+
}, eo = () => {
|
|
1048
|
+
const [t] = I(), [e, o] = f(!1), [n, a] = f(!1), l = L(() => {
|
|
1049
|
+
const d = T();
|
|
1050
|
+
if (y(d)) {
|
|
1051
|
+
const c = St(d), s = c.getParent();
|
|
1052
|
+
o(P(s) || P(c));
|
|
1053
|
+
}
|
|
1054
|
+
}, []);
|
|
1055
|
+
E(() => t.registerCommand(
|
|
1056
|
+
A,
|
|
1057
|
+
() => (l(), !1),
|
|
1058
|
+
X
|
|
1059
|
+
), [t, l]);
|
|
1060
|
+
const i = L(
|
|
1061
|
+
(d) => {
|
|
1062
|
+
t.update(() => {
|
|
1063
|
+
const c = T();
|
|
1064
|
+
if (y(c) && c.isCollapsed()) {
|
|
1065
|
+
const s = c.getNodes();
|
|
1066
|
+
if (s.length === 1) {
|
|
1067
|
+
const h = s[0];
|
|
1068
|
+
Ht(h) && h.getChildren().length === 0 && c.insertText(d);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
}), t.dispatchCommand(Y, xt(d));
|
|
1072
|
+
},
|
|
1073
|
+
[t]
|
|
1074
|
+
);
|
|
1075
|
+
return /* @__PURE__ */ C(j, { children: [
|
|
1076
|
+
/* @__PURE__ */ r(
|
|
1077
|
+
R,
|
|
1078
|
+
{
|
|
1079
|
+
onClick: () => {
|
|
1080
|
+
e ? t.dispatchCommand(Y, null) : a(!0);
|
|
1081
|
+
},
|
|
1082
|
+
title: "Lenke",
|
|
1083
|
+
value: "link",
|
|
1084
|
+
children: /* @__PURE__ */ r(rr, { size: "1.25rem" })
|
|
1085
|
+
}
|
|
1086
|
+
),
|
|
1087
|
+
/* @__PURE__ */ r(
|
|
1088
|
+
yr,
|
|
1089
|
+
{
|
|
1090
|
+
isOpen: n,
|
|
1091
|
+
onCancel: () => a(!1),
|
|
1092
|
+
onSave: (d) => {
|
|
1093
|
+
i(d), a(!1);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
)
|
|
1097
|
+
] });
|
|
1098
|
+
}, ro = () => {
|
|
1099
|
+
const [t] = I(), [e, o] = f(), [n, a] = f(!1), [l, i] = f(""), { hasFocus: d } = et(), { refs: c, floatingStyles: s, context: h } = Z({
|
|
1100
|
+
placement: "top",
|
|
1101
|
+
strategy: "fixed",
|
|
1102
|
+
open: !!e,
|
|
1103
|
+
whileElementsMounted: kt,
|
|
1104
|
+
elements: {
|
|
1105
|
+
reference: e
|
|
1106
|
+
},
|
|
1107
|
+
middleware: [ye()]
|
|
1108
|
+
}), { getFloatingProps: g } = Ct([
|
|
1109
|
+
Mt(h),
|
|
1110
|
+
Te(h)
|
|
1111
|
+
]), m = L(() => {
|
|
1112
|
+
var x;
|
|
1113
|
+
const M = T();
|
|
1114
|
+
if (y(M)) {
|
|
1115
|
+
const S = St(M), u = S.getParent(), wt = F(S, P), It = F(S, Yt);
|
|
1116
|
+
a(wt !== null && It === null), P(u) ? i(u.getURL()) : P(S) ? i(S.getURL()) : i("");
|
|
1117
|
+
}
|
|
1118
|
+
const N = window.getSelection(), k = t.getRootElement();
|
|
1119
|
+
M !== null && N !== null && k !== null && k.contains(N.anchorNode) && t.isEditable() && o(((x = N.focusNode) == null ? void 0 : x.parentElement) ?? void 0);
|
|
1120
|
+
}, [t]);
|
|
1121
|
+
return E(() => {
|
|
1122
|
+
t.getEditorState().read(() => {
|
|
1123
|
+
m();
|
|
1124
|
+
});
|
|
1125
|
+
}, [t, m]), E(() => tt(
|
|
1126
|
+
t.registerUpdateListener(({ editorState: M }) => {
|
|
1127
|
+
M.read(() => {
|
|
1128
|
+
m();
|
|
1129
|
+
});
|
|
1130
|
+
}),
|
|
1131
|
+
t.registerCommand(
|
|
1132
|
+
A,
|
|
1133
|
+
() => (m(), !0),
|
|
1134
|
+
w
|
|
1135
|
+
),
|
|
1136
|
+
t.registerCommand(
|
|
1137
|
+
ht,
|
|
1138
|
+
() => n ? (a(!1), !0) : !1,
|
|
1139
|
+
Wt
|
|
1140
|
+
)
|
|
1141
|
+
), [t, m, n]), n && d ? /* @__PURE__ */ r(bt, { children: /* @__PURE__ */ C(
|
|
1142
|
+
Lt,
|
|
1143
|
+
{
|
|
1144
|
+
ref: c.setFloating,
|
|
1145
|
+
css: {
|
|
1146
|
+
padding: "$2 $4",
|
|
1147
|
+
// Make sure this renders above the toolbar
|
|
1148
|
+
zIndex: "calc(var(--zIndices-overlayCard) + 1)"
|
|
1149
|
+
},
|
|
1150
|
+
style: s,
|
|
1151
|
+
...g(),
|
|
1152
|
+
children: [
|
|
1153
|
+
/* @__PURE__ */ r("a", { href: xt(l), target: "_blank", rel: "noreferrer", children: l }),
|
|
1154
|
+
/* @__PURE__ */ r(
|
|
1155
|
+
D,
|
|
1156
|
+
{
|
|
1157
|
+
onClick: () => {
|
|
1158
|
+
t.dispatchCommand(Y, null);
|
|
1159
|
+
},
|
|
1160
|
+
children: /* @__PURE__ */ r(we, {})
|
|
1161
|
+
}
|
|
1162
|
+
)
|
|
1163
|
+
]
|
|
1164
|
+
}
|
|
1165
|
+
) }) : null;
|
|
1166
|
+
};
|
|
1012
1167
|
export {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1168
|
+
gr as FloatingToolbar,
|
|
1169
|
+
ro as LinkEditPlugin,
|
|
1170
|
+
eo as LinkToolbarButton,
|
|
1171
|
+
Jr as RichTextEditor,
|
|
1172
|
+
fr as RichTextToolbar,
|
|
1173
|
+
to as TableEditPlugin,
|
|
1174
|
+
Ae as clearEditorState,
|
|
1175
|
+
Vr as defaultNodes,
|
|
1176
|
+
Pe as isEditorState,
|
|
1177
|
+
Tt as isJSON,
|
|
1178
|
+
yt as richTextContext,
|
|
1179
|
+
Zr as richTextCss,
|
|
1180
|
+
Be as setStateFromPlainText,
|
|
1181
|
+
Qr as stateToHTML,
|
|
1182
|
+
Ke as useHasFocusWithin,
|
|
1183
|
+
et as useRichTextContext
|
|
1027
1184
|
};
|