@arkitektbedriftene/fe-lib 0.4.18 → 0.4.19
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 +169 -0
- package/dist/rich-text.es.js +92 -94
- package/package.json +1 -1
|
@@ -1,3 +1,172 @@
|
|
|
1
|
+
export declare const richTextStyleObj: {
|
|
2
|
+
fontSize: string;
|
|
3
|
+
lineHeight: string;
|
|
4
|
+
"h1, h2, h3, h4, h5, h6": {
|
|
5
|
+
fontWeight: string;
|
|
6
|
+
lineHeight: string;
|
|
7
|
+
margin: string;
|
|
8
|
+
"&:first-child": {
|
|
9
|
+
marginTop: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
h1: {
|
|
13
|
+
fontSize: string;
|
|
14
|
+
};
|
|
15
|
+
h2: {
|
|
16
|
+
fontSize: string;
|
|
17
|
+
};
|
|
18
|
+
h3: {
|
|
19
|
+
fontSize: string;
|
|
20
|
+
};
|
|
21
|
+
h4: {
|
|
22
|
+
fontSize: string;
|
|
23
|
+
};
|
|
24
|
+
h5: {
|
|
25
|
+
fontSize: string;
|
|
26
|
+
};
|
|
27
|
+
h6: {
|
|
28
|
+
fontSize: string;
|
|
29
|
+
};
|
|
30
|
+
"p, ul, ol": {
|
|
31
|
+
margin: string;
|
|
32
|
+
"&:first-child": {
|
|
33
|
+
marginTop: string;
|
|
34
|
+
};
|
|
35
|
+
"&:last-child": {
|
|
36
|
+
marginBottom: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
strong: {
|
|
40
|
+
fontWeight: string;
|
|
41
|
+
};
|
|
42
|
+
"ul, ol": {
|
|
43
|
+
paddingLeft: string;
|
|
44
|
+
listStylePosition: string;
|
|
45
|
+
listStyleImage: string;
|
|
46
|
+
};
|
|
47
|
+
ul: {
|
|
48
|
+
listStyleType: string;
|
|
49
|
+
};
|
|
50
|
+
ol: {
|
|
51
|
+
listStyleType: string;
|
|
52
|
+
};
|
|
53
|
+
th: {
|
|
54
|
+
fontWeight: string;
|
|
55
|
+
backgroundColor: string;
|
|
56
|
+
};
|
|
57
|
+
"th, td": {
|
|
58
|
+
padding: string;
|
|
59
|
+
border: string;
|
|
60
|
+
};
|
|
61
|
+
kbd: {
|
|
62
|
+
backgroundColor: string;
|
|
63
|
+
color: string;
|
|
64
|
+
padding: string;
|
|
65
|
+
borderRadius: string;
|
|
66
|
+
fontSize: string;
|
|
67
|
+
fontWeight: string;
|
|
68
|
+
};
|
|
69
|
+
"li[role=checkbox]": {
|
|
70
|
+
listStyle: string;
|
|
71
|
+
position: string;
|
|
72
|
+
paddingLeft: number;
|
|
73
|
+
"&::before": {
|
|
74
|
+
content: string;
|
|
75
|
+
width: number;
|
|
76
|
+
height: number;
|
|
77
|
+
top: number;
|
|
78
|
+
left: number;
|
|
79
|
+
cursor: string;
|
|
80
|
+
display: string;
|
|
81
|
+
backgroundSize: string;
|
|
82
|
+
position: string;
|
|
83
|
+
border: string;
|
|
84
|
+
borderRadius: number;
|
|
85
|
+
};
|
|
86
|
+
"&::after": {
|
|
87
|
+
content: string;
|
|
88
|
+
width: number;
|
|
89
|
+
height: number;
|
|
90
|
+
top: number;
|
|
91
|
+
left: number;
|
|
92
|
+
display: string;
|
|
93
|
+
position: string;
|
|
94
|
+
borderLeft: string;
|
|
95
|
+
borderBottom: string;
|
|
96
|
+
transform: string;
|
|
97
|
+
};
|
|
98
|
+
"&[aria-checked=true]": {
|
|
99
|
+
"&::before": {
|
|
100
|
+
backgroundColor: string;
|
|
101
|
+
borderColor: string;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
"&:focus": {
|
|
105
|
+
outline: string;
|
|
106
|
+
"&::before": {
|
|
107
|
+
outline: string;
|
|
108
|
+
outlineOffset: number;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
table: {
|
|
113
|
+
width: string;
|
|
114
|
+
borderCollapse: string;
|
|
115
|
+
border: string;
|
|
116
|
+
td: {
|
|
117
|
+
border: string;
|
|
118
|
+
verticalAlign: string;
|
|
119
|
+
padding: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
a: {
|
|
123
|
+
color: string;
|
|
124
|
+
textDecoration: string;
|
|
125
|
+
"&.rutine-link": {
|
|
126
|
+
background: string;
|
|
127
|
+
color: string;
|
|
128
|
+
padding: string;
|
|
129
|
+
borderRadius: string;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
variants: {
|
|
133
|
+
size: {
|
|
134
|
+
xs: {
|
|
135
|
+
fontSize: string;
|
|
136
|
+
"@print": {
|
|
137
|
+
fontSize: string;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
sm: {
|
|
141
|
+
fontSize: string;
|
|
142
|
+
"@print": {
|
|
143
|
+
fontSize: string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
md: {
|
|
147
|
+
fontSize: string;
|
|
148
|
+
"@print": {
|
|
149
|
+
fontSize: string;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
lg: {
|
|
153
|
+
fontSize: string;
|
|
154
|
+
"@print": {
|
|
155
|
+
fontSize: string;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
xl: {
|
|
159
|
+
fontSize: string;
|
|
160
|
+
"@print": {
|
|
161
|
+
fontSize: string;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
defaultVariants: {
|
|
167
|
+
size: string;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
1
170
|
export declare const richTextCss: import("@stitches/react/types/styled-component").CssComponent<never, {
|
|
2
171
|
size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
|
|
3
172
|
}, {
|
package/dist/rich-text.es.js
CHANGED
|
@@ -3,15 +3,15 @@ var Wt = (t, e, r) => e in t ? Ht(t, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var lt = (t, e, r) => (Wt(t, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
4
|
import { createHeadlessEditor as Ut } from "@lexical/headless";
|
|
5
5
|
import { $generateHtmlFromNodes as jt } from "@lexical/html";
|
|
6
|
-
import { $getRoot as j, ParagraphNode as Kt, $createParagraphNode as K, $createTextNode as A, $setSelection as kt, SELECTION_CHANGE_COMMAND as F, $getSelection as
|
|
6
|
+
import { $getRoot as j, ParagraphNode as Kt, $createParagraphNode as K, $createTextNode as A, $setSelection as kt, SELECTION_CHANGE_COMMAND as F, $getSelection as T, COMMAND_PRIORITY_CRITICAL as J, $isRangeSelection as L, $isRootOrShadowRoot as Yt, DEPRECATED_$isGridSelection as G, FORMAT_TEXT_COMMAND as B, COMMAND_PRIORITY_LOW as w, KEY_ARROW_DOWN_COMMAND as qt, KEY_ARROW_UP_COMMAND as Gt, KEY_ESCAPE_COMMAND as bt, KEY_SPACE_COMMAND as Xt, $getNearestNodeFromDOMNode as V, 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
7
|
import { trimTextContentFromAnchor as ee, $setBlocksType as X, $isAtNodeEnd as st } from "@lexical/selection";
|
|
8
8
|
import { AutoLinkNode as re, LinkNode as vt, $isLinkNode as W, TOGGLE_LINK_COMMAND as Z } from "@lexical/link";
|
|
9
9
|
import { ListNode as Ct, 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 _ } from "@lexical/list";
|
|
10
10
|
import { HeadingNode as le, QuoteNode as se, $isHeadingNode as ce, $createHeadingNode as de, $createQuoteNode as ue } from "@lexical/rich-text";
|
|
11
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
12
|
import { jsx as n, jsxs as f, Fragment as Y } from "react/jsx-runtime";
|
|
13
|
-
import { createContext as ve, useState as b, useRef as et, useCallback as v, useContext as Ce, useEffect as N, useMemo as
|
|
14
|
-
import { c as O, s as
|
|
13
|
+
import { createContext as ve, useState as b, useRef as et, useCallback as v, useContext as Ce, useEffect as N, useMemo as Tt, useLayoutEffect as Me } from "react";
|
|
14
|
+
import { c as O, s as Lt, D as rt, T as Nt, a as M, B as P, b as yt, d as z, u as nt, e as xt, f as Te, g as Le, o as St, h as Ne, i as Et, j as wt, F as Rt, O as It, k as ye, l as xe, S as Se, m as $, n as I, p as ut, q as Ee, N as we, r as ht, t as Re, v as zt, C as Ie, w as ze, x as _e } from "./Checkbox-a342242a.js";
|
|
15
15
|
import "react-select";
|
|
16
16
|
import { LexicalComposer as $e } from "@lexical/react/LexicalComposer.js";
|
|
17
17
|
import { RichTextPlugin as Oe } from "@lexical/react/LexicalRichTextPlugin.js";
|
|
@@ -76,7 +76,7 @@ const Ue = ({
|
|
|
76
76
|
tag: r
|
|
77
77
|
}
|
|
78
78
|
), e.blur();
|
|
79
|
-
},
|
|
79
|
+
}, gn = (t, e, r) => {
|
|
80
80
|
let o = 0;
|
|
81
81
|
const i = Ut({
|
|
82
82
|
nodes: e,
|
|
@@ -105,7 +105,7 @@ const Ue = ({
|
|
|
105
105
|
return i.update(() => {
|
|
106
106
|
l = jt(i);
|
|
107
107
|
}), { html: l, trimCount: o };
|
|
108
|
-
},
|
|
108
|
+
}, fn = [
|
|
109
109
|
le,
|
|
110
110
|
se,
|
|
111
111
|
Ct,
|
|
@@ -211,7 +211,7 @@ function kr(t) {
|
|
|
211
211
|
function br(t) {
|
|
212
212
|
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);
|
|
213
213
|
}
|
|
214
|
-
const vr =
|
|
214
|
+
const vr = Lt("div", {
|
|
215
215
|
width: "10rem",
|
|
216
216
|
display: "flex"
|
|
217
217
|
}), Dt = {
|
|
@@ -255,7 +255,7 @@ const vr = Tt("div", {
|
|
|
255
255
|
}
|
|
256
256
|
)
|
|
257
257
|
] }), Mr = (t) => {
|
|
258
|
-
if (!
|
|
258
|
+
if (!L(t))
|
|
259
259
|
return null;
|
|
260
260
|
const e = t.anchor.getNode();
|
|
261
261
|
let r = e.getKey() === "root" ? e : _t(e, (o) => {
|
|
@@ -266,22 +266,22 @@ const vr = Tt("div", {
|
|
|
266
266
|
anchorNode: e,
|
|
267
267
|
element: r
|
|
268
268
|
};
|
|
269
|
-
},
|
|
269
|
+
}, Tr = () => {
|
|
270
270
|
const [t] = y(), [e, r] = b("paragraph");
|
|
271
271
|
N(() => t.registerCommand(
|
|
272
272
|
F,
|
|
273
273
|
() => {
|
|
274
|
-
const c =
|
|
274
|
+
const c = T(), g = Mr(c);
|
|
275
275
|
if (!g)
|
|
276
276
|
return !1;
|
|
277
|
-
const { element: u, anchorNode: m } = g,
|
|
278
|
-
if (t.getElementByKey(
|
|
277
|
+
const { element: u, anchorNode: m } = g, E = u.getKey();
|
|
278
|
+
if (t.getElementByKey(E) !== null)
|
|
279
279
|
if (tt(u)) {
|
|
280
280
|
const k = Be(
|
|
281
281
|
m,
|
|
282
282
|
Ct
|
|
283
|
-
),
|
|
284
|
-
r(
|
|
283
|
+
), S = k ? k.getListType() : u.getListType();
|
|
284
|
+
r(S);
|
|
285
285
|
} else {
|
|
286
286
|
const k = ce(u) ? u.getTag() : u.getType();
|
|
287
287
|
k in Dt && r(k);
|
|
@@ -292,8 +292,8 @@ const vr = Tt("div", {
|
|
|
292
292
|
), [t]);
|
|
293
293
|
const o = (c) => {
|
|
294
294
|
e !== c && t.update(() => {
|
|
295
|
-
const g =
|
|
296
|
-
(
|
|
295
|
+
const g = T();
|
|
296
|
+
(L(g) || G(g)) && (X(g, () => de(c)), r(c));
|
|
297
297
|
});
|
|
298
298
|
};
|
|
299
299
|
return /* @__PURE__ */ n(vr, { children: /* @__PURE__ */ f(
|
|
@@ -312,8 +312,8 @@ const vr = Tt("div", {
|
|
|
312
312
|
children: [
|
|
313
313
|
/* @__PURE__ */ n(M, { onClick: () => {
|
|
314
314
|
e !== "paragraph" && t.update(() => {
|
|
315
|
-
const c =
|
|
316
|
-
(
|
|
315
|
+
const c = T();
|
|
316
|
+
(L(c) || G(c)) && (X(c, () => K()), r("paragraph"));
|
|
317
317
|
});
|
|
318
318
|
}, children: /* @__PURE__ */ n(C, { blockType: "paragraph" }) }),
|
|
319
319
|
/* @__PURE__ */ n(M, { onClick: () => o("h1"), children: /* @__PURE__ */ n(C, { blockType: "h1" }) }),
|
|
@@ -333,17 +333,17 @@ const vr = Tt("div", {
|
|
|
333
333
|
}, children: /* @__PURE__ */ n(C, { blockType: "check" }) }),
|
|
334
334
|
/* @__PURE__ */ n(M, { onClick: () => {
|
|
335
335
|
e !== "quote" && t.update(() => {
|
|
336
|
-
const c =
|
|
337
|
-
(
|
|
336
|
+
const c = T();
|
|
337
|
+
(L(c) || G(c)) && (X(c, () => ue()), r("quote"));
|
|
338
338
|
});
|
|
339
339
|
}, children: /* @__PURE__ */ n(C, { blockType: "quote" }) })
|
|
340
340
|
]
|
|
341
341
|
}
|
|
342
342
|
) });
|
|
343
|
-
},
|
|
343
|
+
}, Lr = () => {
|
|
344
344
|
const [t] = y(), [e, r] = b(!1), [o, i] = b(!1), [l, a] = b(!1), [s, d] = b(!1), [c, g] = b(!1), u = v(() => {
|
|
345
|
-
const p =
|
|
346
|
-
|
|
345
|
+
const p = T();
|
|
346
|
+
L(p) && (r(p.hasFormat("bold")), i(p.hasFormat("italic")), a(p.hasFormat("underline")), d(p.hasFormat("code")), g(p.hasFormat("superscript")));
|
|
347
347
|
}, []);
|
|
348
348
|
N(() => ot(
|
|
349
349
|
t.registerCommand(
|
|
@@ -360,7 +360,7 @@ const vr = Tt("div", {
|
|
|
360
360
|
const m = v(
|
|
361
361
|
() => t.dispatchCommand(B, "bold"),
|
|
362
362
|
[t]
|
|
363
|
-
),
|
|
363
|
+
), E = v(
|
|
364
364
|
() => t.dispatchCommand(B, "italic"),
|
|
365
365
|
[t]
|
|
366
366
|
), x = v(
|
|
@@ -369,10 +369,10 @@ const vr = Tt("div", {
|
|
|
369
369
|
), k = v(
|
|
370
370
|
() => t.dispatchCommand(B, "code"),
|
|
371
371
|
[t]
|
|
372
|
-
),
|
|
372
|
+
), S = v(
|
|
373
373
|
() => t.dispatchCommand(B, "superscript"),
|
|
374
374
|
[t]
|
|
375
|
-
), D =
|
|
375
|
+
), D = Tt(() => {
|
|
376
376
|
const p = [];
|
|
377
377
|
return e && p.push("bold"), o && p.push("italic"), l && p.push("underline"), s && p.push("code"), c && p.push("superscript"), p;
|
|
378
378
|
}, [e, o, l, s, c]);
|
|
@@ -395,7 +395,7 @@ const vr = Tt("div", {
|
|
|
395
395
|
/* @__PURE__ */ n(
|
|
396
396
|
z,
|
|
397
397
|
{
|
|
398
|
-
onClick:
|
|
398
|
+
onClick: E,
|
|
399
399
|
title: "Kursiv tekst",
|
|
400
400
|
value: "italic",
|
|
401
401
|
children: /* @__PURE__ */ n(cr, { size: "1.25rem" })
|
|
@@ -422,7 +422,7 @@ const vr = Tt("div", {
|
|
|
422
422
|
/* @__PURE__ */ n(
|
|
423
423
|
z,
|
|
424
424
|
{
|
|
425
|
-
onClick:
|
|
425
|
+
onClick: S,
|
|
426
426
|
title: "Superscript",
|
|
427
427
|
value: "superscript",
|
|
428
428
|
children: /* @__PURE__ */ n(mr, { size: "1.25rem" })
|
|
@@ -440,13 +440,13 @@ const vr = Tt("div", {
|
|
|
440
440
|
placement: "top",
|
|
441
441
|
whileElementsMounted: xt,
|
|
442
442
|
middleware: [
|
|
443
|
-
|
|
443
|
+
Te({
|
|
444
444
|
apply: ({ rects: g, elements: u }) => {
|
|
445
445
|
u.floating.style.minWidth = `${g.reference.width}px`;
|
|
446
446
|
}
|
|
447
447
|
}),
|
|
448
|
-
|
|
449
|
-
|
|
448
|
+
Le(),
|
|
449
|
+
St({
|
|
450
450
|
mainAxis: 8
|
|
451
451
|
}),
|
|
452
452
|
Ne({
|
|
@@ -458,7 +458,7 @@ const vr = Tt("div", {
|
|
|
458
458
|
elements: {
|
|
459
459
|
reference: r.current
|
|
460
460
|
}
|
|
461
|
-
}), { getFloatingProps: c } =
|
|
461
|
+
}), { getFloatingProps: c } = Et([
|
|
462
462
|
wt(a, {
|
|
463
463
|
role: "dialog"
|
|
464
464
|
})
|
|
@@ -482,9 +482,9 @@ const vr = Tt("div", {
|
|
|
482
482
|
children: t,
|
|
483
483
|
...e
|
|
484
484
|
}) => /* @__PURE__ */ f(ye, { "aria-label": "Formattering", ...e, children: [
|
|
485
|
-
/* @__PURE__ */ n(Lr, {}),
|
|
486
|
-
/* @__PURE__ */ n(xe, {}),
|
|
487
485
|
/* @__PURE__ */ n(Tr, {}),
|
|
486
|
+
/* @__PURE__ */ n(xe, {}),
|
|
487
|
+
/* @__PURE__ */ n(Lr, {}),
|
|
488
488
|
t
|
|
489
489
|
] });
|
|
490
490
|
function xr() {
|
|
@@ -530,8 +530,8 @@ function xr() {
|
|
|
530
530
|
t.registerCommand(
|
|
531
531
|
Qt,
|
|
532
532
|
(e) => t.getEditorState().read(() => {
|
|
533
|
-
const r =
|
|
534
|
-
if (
|
|
533
|
+
const r = T();
|
|
534
|
+
if (L(r) && r.isCollapsed()) {
|
|
535
535
|
const { anchor: o } = r, i = o.type === "element";
|
|
536
536
|
if (i || o.offset === 0) {
|
|
537
537
|
const l = o.getNode(), a = _t(
|
|
@@ -572,7 +572,7 @@ function Bt(t, e) {
|
|
|
572
572
|
}
|
|
573
573
|
function gt(t) {
|
|
574
574
|
Bt(t, () => {
|
|
575
|
-
const e = t.target, r =
|
|
575
|
+
const e = t.target, r = Sr(e);
|
|
576
576
|
r != null && r.isEditable() && r.update(() => {
|
|
577
577
|
if (t.target) {
|
|
578
578
|
const o = V(e);
|
|
@@ -586,7 +586,7 @@ function ft(t) {
|
|
|
586
586
|
t.preventDefault();
|
|
587
587
|
});
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function Sr(t) {
|
|
590
590
|
let e = t;
|
|
591
591
|
for (; e; ) {
|
|
592
592
|
if (e.__lexicalEditor)
|
|
@@ -600,7 +600,7 @@ function Q() {
|
|
|
600
600
|
return t != null && t.tagName === "LI" && t.parentNode != null && // @ts-ignore internal field
|
|
601
601
|
t.parentNode.__lexicalListType === "check" ? t : null;
|
|
602
602
|
}
|
|
603
|
-
function
|
|
603
|
+
function Er(t, e) {
|
|
604
604
|
let r = e ? t.getPreviousSibling() : t.getNextSibling(), o = t;
|
|
605
605
|
for (; r == null && _(o); )
|
|
606
606
|
o = o.getParentOrThrow().getParent(), o != null && (r = e ? o.getPreviousSibling() : o.getNextSibling());
|
|
@@ -618,7 +618,7 @@ function mt(t, e, r) {
|
|
|
618
618
|
const i = V(o);
|
|
619
619
|
if (!_(i))
|
|
620
620
|
return;
|
|
621
|
-
const l =
|
|
621
|
+
const l = Er(i, r);
|
|
622
622
|
if (l != null) {
|
|
623
623
|
l.selectStart();
|
|
624
624
|
const a = e.getElementByKey(l.__key);
|
|
@@ -655,7 +655,7 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
|
|
|
655
655
|
console.error("Could not parse"), console.error(r);
|
|
656
656
|
}
|
|
657
657
|
}, []), null;
|
|
658
|
-
}, Ir =
|
|
658
|
+
}, Ir = Lt("div", {
|
|
659
659
|
border: "1px solid $borderDarker",
|
|
660
660
|
borderRadius: "$md",
|
|
661
661
|
position: "relative",
|
|
@@ -704,9 +704,9 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
|
|
|
704
704
|
right: "1rem",
|
|
705
705
|
display: "flex"
|
|
706
706
|
},
|
|
707
|
-
children: /* @__PURE__ */ n(
|
|
707
|
+
children: /* @__PURE__ */ n(Se, {})
|
|
708
708
|
}
|
|
709
|
-
),
|
|
709
|
+
), mn = ({
|
|
710
710
|
isLoading: t,
|
|
711
711
|
children: e,
|
|
712
712
|
placeholderText: r,
|
|
@@ -720,14 +720,14 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
|
|
|
720
720
|
defaultState: g,
|
|
721
721
|
css: u
|
|
722
722
|
}) => {
|
|
723
|
-
const { hasFocus: m, attributes:
|
|
723
|
+
const { hasFocus: m, attributes: E } = tr({ onBlur: c }), x = et(null), k = Tt(() => ({ hasFocus: m, editorRef: x }), [m]);
|
|
724
724
|
return /* @__PURE__ */ n(Ot.Provider, { value: k, children: /* @__PURE__ */ f(
|
|
725
725
|
$e,
|
|
726
726
|
{
|
|
727
727
|
initialConfig: {
|
|
728
728
|
namespace: "CommentEditor",
|
|
729
|
-
onError: (
|
|
730
|
-
console.error(
|
|
729
|
+
onError: (S) => {
|
|
730
|
+
console.error(S);
|
|
731
731
|
},
|
|
732
732
|
theme: Ze,
|
|
733
733
|
nodes: o,
|
|
@@ -741,7 +741,7 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
|
|
|
741
741
|
hasFocus: m,
|
|
742
742
|
hideBorder: d,
|
|
743
743
|
css: u,
|
|
744
|
-
...
|
|
744
|
+
...E,
|
|
745
745
|
children: [
|
|
746
746
|
l,
|
|
747
747
|
/* @__PURE__ */ n(
|
|
@@ -777,7 +777,7 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
|
|
|
777
777
|
]
|
|
778
778
|
}
|
|
779
779
|
) });
|
|
780
|
-
},
|
|
780
|
+
}, _r = {
|
|
781
781
|
fontSize: "1rem",
|
|
782
782
|
lineHeight: "1.5",
|
|
783
783
|
"h1, h2, h3, h4, h5, h6": {
|
|
@@ -891,12 +891,9 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
|
|
|
891
891
|
table: {
|
|
892
892
|
width: "100%",
|
|
893
893
|
borderCollapse: "collapse",
|
|
894
|
-
border: 0,
|
|
895
|
-
tr: {
|
|
896
|
-
border: 0
|
|
897
|
-
},
|
|
894
|
+
border: "0",
|
|
898
895
|
td: {
|
|
899
|
-
border: "1px solid
|
|
896
|
+
border: "1px solid black",
|
|
900
897
|
verticalAlign: "top",
|
|
901
898
|
padding: "$2"
|
|
902
899
|
}
|
|
@@ -948,7 +945,7 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
|
|
|
948
945
|
defaultVariants: {
|
|
949
946
|
size: "md"
|
|
950
947
|
}
|
|
951
|
-
}
|
|
948
|
+
}, kn = O(_r), bn = () => {
|
|
952
949
|
const [t] = y(), e = v(() => {
|
|
953
950
|
t.dispatchCommand(fe, {
|
|
954
951
|
rows: "3",
|
|
@@ -969,10 +966,10 @@ const wr = () => /* @__PURE__ */ f(Y, { children: [
|
|
|
969
966
|
}
|
|
970
967
|
);
|
|
971
968
|
};
|
|
972
|
-
function
|
|
969
|
+
function $r(t) {
|
|
973
970
|
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);
|
|
974
971
|
}
|
|
975
|
-
const
|
|
972
|
+
const vn = () => {
|
|
976
973
|
const [t] = y(), [e, r] = b(null), { hasFocus: o } = it();
|
|
977
974
|
N(() => {
|
|
978
975
|
!o && e && r(null);
|
|
@@ -983,13 +980,13 @@ const bn = () => {
|
|
|
983
980
|
elements: {
|
|
984
981
|
reference: e
|
|
985
982
|
},
|
|
986
|
-
middleware: [
|
|
983
|
+
middleware: [St({ mainAxis: -20, crossAxis: -2 })]
|
|
987
984
|
});
|
|
988
985
|
N(() => t.registerCommand(
|
|
989
986
|
F,
|
|
990
987
|
() => {
|
|
991
|
-
const s =
|
|
992
|
-
if (
|
|
988
|
+
const s = T();
|
|
989
|
+
if (L(s)) {
|
|
993
990
|
const d = s.anchor.getNode(), c = me(d);
|
|
994
991
|
r(c ? t.getElementByKey(c.getKey()) : null);
|
|
995
992
|
}
|
|
@@ -1033,7 +1030,7 @@ const bn = () => {
|
|
|
1033
1030
|
ref: i.setFloating,
|
|
1034
1031
|
style: l,
|
|
1035
1032
|
css: { padding: "2px", width: "18px", height: "18px" },
|
|
1036
|
-
children: /* @__PURE__ */ n(
|
|
1033
|
+
children: /* @__PURE__ */ n($r, {})
|
|
1037
1034
|
}
|
|
1038
1035
|
),
|
|
1039
1036
|
children: [
|
|
@@ -1058,7 +1055,7 @@ function Pt(t) {
|
|
|
1058
1055
|
const e = t.anchor, r = t.focus, o = t.anchor.getNode(), i = t.focus.getNode();
|
|
1059
1056
|
return o === i ? o : t.isBackward() ? st(r) ? o : i : st(e) ? o : i;
|
|
1060
1057
|
}
|
|
1061
|
-
const
|
|
1058
|
+
const Cn = (t) => (R.baseURL = t, R), U = class extends vt {
|
|
1062
1059
|
static getType() {
|
|
1063
1060
|
return "rutine_link";
|
|
1064
1061
|
}
|
|
@@ -1093,15 +1090,15 @@ lt(R, "baseURL", "");
|
|
|
1093
1090
|
function Ft(t) {
|
|
1094
1091
|
return new R(t);
|
|
1095
1092
|
}
|
|
1096
|
-
function
|
|
1093
|
+
function Or(t) {
|
|
1097
1094
|
return t instanceof R;
|
|
1098
1095
|
}
|
|
1099
|
-
const
|
|
1096
|
+
const Dr = ({ onClose: t }) => {
|
|
1100
1097
|
const [e] = y(), r = v(
|
|
1101
1098
|
(i) => {
|
|
1102
1099
|
e.update(() => {
|
|
1103
|
-
const l =
|
|
1104
|
-
if (
|
|
1100
|
+
const l = T();
|
|
1101
|
+
if (L(l) && l.isCollapsed()) {
|
|
1105
1102
|
const a = l.getNodes();
|
|
1106
1103
|
if (a.length === 1) {
|
|
1107
1104
|
const s = a[0];
|
|
@@ -1121,12 +1118,12 @@ const Or = ({ onClose: t }) => {
|
|
|
1121
1118
|
/* @__PURE__ */ n($, { type: "submit", variant: "primary", children: "Lagre" })
|
|
1122
1119
|
] })
|
|
1123
1120
|
] });
|
|
1124
|
-
},
|
|
1121
|
+
}, Br = ({ onClose: t, getDocs: e }) => {
|
|
1125
1122
|
const [r] = y(), [o, i] = b([]), l = e(), a = v(
|
|
1126
1123
|
(s) => {
|
|
1127
1124
|
r.update(() => {
|
|
1128
|
-
const d =
|
|
1129
|
-
if (
|
|
1125
|
+
const d = T();
|
|
1126
|
+
if (L(d)) {
|
|
1130
1127
|
const c = [];
|
|
1131
1128
|
for (const [g, u] of s.entries()) {
|
|
1132
1129
|
const m = Ft(u.value);
|
|
@@ -1154,7 +1151,7 @@ const Or = ({ onClose: t }) => {
|
|
|
1154
1151
|
)
|
|
1155
1152
|
] })
|
|
1156
1153
|
] });
|
|
1157
|
-
},
|
|
1154
|
+
}, Ar = ({
|
|
1158
1155
|
open: t,
|
|
1159
1156
|
onOpenChange: e,
|
|
1160
1157
|
getDocs: r
|
|
@@ -1162,18 +1159,18 @@ const Or = ({ onClose: t }) => {
|
|
|
1162
1159
|
const [o, i] = b("url"), l = () => {
|
|
1163
1160
|
e(!1);
|
|
1164
1161
|
};
|
|
1165
|
-
return /* @__PURE__ */ f(
|
|
1162
|
+
return /* @__PURE__ */ f(Ee, { open: t, onOpenChange: e, css: { width: "600px" }, children: [
|
|
1166
1163
|
/* @__PURE__ */ f(we, { css: { marginBottom: "$8" }, children: [
|
|
1167
1164
|
/* @__PURE__ */ n(ht, { active: o === "url", onClick: () => i("url"), children: "URL" }),
|
|
1168
1165
|
/* @__PURE__ */ n(ht, { active: o === "rutine", onClick: () => i("rutine"), children: "Rutine" })
|
|
1169
1166
|
] }),
|
|
1170
|
-
o === "url" && /* @__PURE__ */ n(
|
|
1171
|
-
o === "rutine" && /* @__PURE__ */ n(
|
|
1167
|
+
o === "url" && /* @__PURE__ */ n(Dr, { onClose: l }),
|
|
1168
|
+
o === "rutine" && /* @__PURE__ */ n(Br, { onClose: l, getDocs: r })
|
|
1172
1169
|
] });
|
|
1173
|
-
},
|
|
1170
|
+
}, Mn = ({ getDocs: t }) => {
|
|
1174
1171
|
const [e] = y(), [r, o] = b(!1), [i, l] = b(!1), a = v(() => {
|
|
1175
|
-
const s =
|
|
1176
|
-
if (
|
|
1172
|
+
const s = T();
|
|
1173
|
+
if (L(s)) {
|
|
1177
1174
|
const d = Pt(s), c = d.getParent();
|
|
1178
1175
|
o(W(c) || W(d));
|
|
1179
1176
|
}
|
|
@@ -1195,7 +1192,7 @@ const Or = ({ onClose: t }) => {
|
|
|
1195
1192
|
}
|
|
1196
1193
|
),
|
|
1197
1194
|
/* @__PURE__ */ n(
|
|
1198
|
-
|
|
1195
|
+
Ar,
|
|
1199
1196
|
{
|
|
1200
1197
|
open: i,
|
|
1201
1198
|
onOpenChange: l,
|
|
@@ -1203,7 +1200,7 @@ const Or = ({ onClose: t }) => {
|
|
|
1203
1200
|
}
|
|
1204
1201
|
)
|
|
1205
1202
|
] });
|
|
1206
|
-
},
|
|
1203
|
+
}, Tn = () => {
|
|
1207
1204
|
const [t] = y(), e = et(null), [r, o] = b(null), [i, l] = b(""), { hasFocus: a } = it();
|
|
1208
1205
|
N(() => {
|
|
1209
1206
|
r ? t.update(() => {
|
|
@@ -1219,23 +1216,23 @@ const Or = ({ onClose: t }) => {
|
|
|
1219
1216
|
reference: e.current
|
|
1220
1217
|
},
|
|
1221
1218
|
middleware: [ze()]
|
|
1222
|
-
}), { getFloatingProps: u } =
|
|
1219
|
+
}), { getFloatingProps: u } = Et([
|
|
1223
1220
|
wt(g),
|
|
1224
1221
|
_e(g)
|
|
1225
1222
|
]), m = v(() => {
|
|
1226
|
-
var
|
|
1227
|
-
const k =
|
|
1228
|
-
if (
|
|
1223
|
+
var S;
|
|
1224
|
+
const k = T();
|
|
1225
|
+
if (L(k)) {
|
|
1229
1226
|
const D = Pt(k), p = D.getParent();
|
|
1230
1227
|
let H = null;
|
|
1231
1228
|
if (W(p) ? H = p : W(D) && (H = D), H) {
|
|
1232
1229
|
const q = window.getSelection(), at = t.getRootElement();
|
|
1233
|
-
k !== null && q !== null && at !== null && at.contains(q.anchorNode) && t.isEditable() && (e.current = ((
|
|
1230
|
+
k !== null && q !== null && at !== null && at.contains(q.anchorNode) && t.isEditable() && (e.current = ((S = q.focusNode) == null ? void 0 : S.parentElement) ?? null);
|
|
1234
1231
|
}
|
|
1235
1232
|
o(H);
|
|
1236
1233
|
}
|
|
1237
|
-
}, [t]),
|
|
1238
|
-
r &&
|
|
1234
|
+
}, [t]), E = v(() => {
|
|
1235
|
+
r && Or(r) && t.update(() => {
|
|
1239
1236
|
r.remove();
|
|
1240
1237
|
}), t.dispatchCommand(Z, null);
|
|
1241
1238
|
}, [t, r]);
|
|
@@ -1294,31 +1291,32 @@ const Or = ({ onClose: t }) => {
|
|
|
1294
1291
|
children: i
|
|
1295
1292
|
}
|
|
1296
1293
|
),
|
|
1297
|
-
/* @__PURE__ */ n($, { color: "danger", icon: !0, size: "sm", onClick:
|
|
1294
|
+
/* @__PURE__ */ n($, { color: "danger", icon: !0, size: "sm", onClick: E, children: /* @__PURE__ */ n(Ae, { size: 24 }) })
|
|
1298
1295
|
]
|
|
1299
1296
|
}
|
|
1300
1297
|
) });
|
|
1301
1298
|
};
|
|
1302
1299
|
export {
|
|
1303
1300
|
Ft as $createRutineLinkNode,
|
|
1304
|
-
|
|
1301
|
+
Or as $isRutineLinkNode,
|
|
1305
1302
|
Nr as FloatingToolbar,
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1303
|
+
bn as InsertSelector,
|
|
1304
|
+
Tn as LinkEditPlugin,
|
|
1305
|
+
Mn as LinkToolbarButton,
|
|
1306
|
+
mn as RichTextEditor,
|
|
1310
1307
|
yr as RichTextToolbar,
|
|
1311
1308
|
R as RutineLinkNode,
|
|
1312
|
-
|
|
1313
|
-
|
|
1309
|
+
Cn as RutineLinkNodeInit,
|
|
1310
|
+
vn as TableEditPlugin,
|
|
1314
1311
|
Ye as clearEditorState,
|
|
1315
|
-
|
|
1312
|
+
fn as defaultNodes,
|
|
1316
1313
|
Ke as isEditorState,
|
|
1317
1314
|
$t as isJSON,
|
|
1318
1315
|
Ot as richTextContext,
|
|
1319
|
-
|
|
1316
|
+
kn as richTextCss,
|
|
1317
|
+
_r as richTextStyleObj,
|
|
1320
1318
|
qe as setStateFromPlainText,
|
|
1321
|
-
|
|
1319
|
+
gn as stateToHTML,
|
|
1322
1320
|
tr as useHasFocusWithin,
|
|
1323
1321
|
it as useRichTextContext
|
|
1324
1322
|
};
|