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