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