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