@arkitektbedriftene/fe-lib 2.0.0 → 2.0.1
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.
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare function ImageComponent({ src, altText, width, height,
|
|
2
|
+
export declare function ImageComponent({ src, altText, width, height, }: {
|
|
3
3
|
src: string;
|
|
4
4
|
altText: string;
|
|
5
5
|
width: "inherit" | number;
|
|
6
6
|
height: "inherit" | number;
|
|
7
|
-
maxWidth: number;
|
|
8
7
|
}): JSX.Element;
|
|
@@ -6,28 +6,40 @@ export interface ImagePayload {
|
|
|
6
6
|
altText: string;
|
|
7
7
|
width?: number;
|
|
8
8
|
height?: number;
|
|
9
|
-
maxWidth?: number;
|
|
10
9
|
key?: NodeKey;
|
|
10
|
+
meta?: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
11
14
|
}
|
|
12
15
|
export type SerializedImageNode = Spread<{
|
|
13
16
|
src: string;
|
|
14
17
|
altText: string;
|
|
15
18
|
width?: number;
|
|
16
19
|
height?: number;
|
|
17
|
-
|
|
20
|
+
meta?: {
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
};
|
|
18
24
|
}, SerializedLexicalNode>;
|
|
19
25
|
export declare class ImageNode extends DecoratorNode<JSX.Element> {
|
|
20
26
|
__src: string;
|
|
21
27
|
__altText: string;
|
|
22
28
|
__width: "inherit" | number;
|
|
23
29
|
__height: "inherit" | number;
|
|
24
|
-
|
|
30
|
+
__meta: {
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
} | undefined;
|
|
25
34
|
static getType(): string;
|
|
26
35
|
static clone(node: ImageNode): ImageNode;
|
|
27
36
|
static importJSON(serializedNode: SerializedImageNode): ImageNode;
|
|
28
37
|
exportDOM(): DOMExportOutput;
|
|
29
38
|
static importDOM(): DOMConversionMap | null;
|
|
30
|
-
constructor(src: string, altText: string,
|
|
39
|
+
constructor(src: string, altText: string, width?: "inherit" | number, height?: "inherit" | number, meta?: {
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
}, key?: NodeKey);
|
|
31
43
|
exportJSON(): SerializedImageNode;
|
|
32
44
|
setSrc(src: string): void;
|
|
33
45
|
setWidthAndHeight(width: "inherit" | number, height: "inherit" | number): void;
|
|
@@ -37,5 +49,5 @@ export declare class ImageNode extends DecoratorNode<JSX.Element> {
|
|
|
37
49
|
getAltText(): string;
|
|
38
50
|
decorate(): JSX.Element;
|
|
39
51
|
}
|
|
40
|
-
export declare function $createImageNode({ altText, height,
|
|
52
|
+
export declare function $createImageNode({ altText, height, src, width, meta, key, }: ImagePayload): ImageNode;
|
|
41
53
|
export declare function $isImageNode(node: LexicalNode | null | undefined): node is ImageNode;
|
package/dist/rich-text.es.js
CHANGED
|
@@ -3,19 +3,19 @@ var re = (t, r, e) => r in t ? ee(t, r, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var I = (t, r, e) => (re(t, typeof r != "symbol" ? r + "" : r, e), e);
|
|
4
4
|
import { createHeadlessEditor as ne } from "@lexical/headless";
|
|
5
5
|
import { $generateHtmlFromNodes as oe } from "@lexical/html";
|
|
6
|
-
import { $getRoot as X, ParagraphNode as ie, $createParagraphNode as
|
|
6
|
+
import { $getRoot as X, ParagraphNode as ie, $createParagraphNode as W, $createTextNode as $, $setSelection as Q, DecoratorNode as ae, $applyNodeReplacement as le, SELECTION_CHANGE_COMMAND as j, $getSelection as _, COMMAND_PRIORITY_CRITICAL as at, $isRangeSelection as T, $isRootOrShadowRoot as xt, FORMAT_TEXT_COMMAND as F, COMMAND_PRIORITY_LOW as R, KEY_ARROW_DOWN_COMMAND as se, KEY_ARROW_UP_COMMAND as ce, KEY_ESCAPE_COMMAND as Lt, KEY_SPACE_COMMAND as de, $getNearestNodeFromDOMNode as lt, KEY_ARROW_LEFT_COMMAND as he, $isElementNode as ue, createCommand as ge, $insertNodes as pe, COMMAND_PRIORITY_EDITOR as me, COMMAND_PRIORITY_NORMAL as fe, $createRangeSelection as wt, COMMAND_PRIORITY_HIGH as ke } from "lexical";
|
|
7
7
|
import { trimTextContentFromAnchor as be, $setBlocksType as nt, $isAtNodeEnd as ft } from "@lexical/selection";
|
|
8
|
-
import { LinkNode as B, AutoLinkNode as
|
|
9
|
-
import { ListNode as st, ListItemNode as
|
|
8
|
+
import { LinkNode as B, AutoLinkNode as yt, $isLinkNode as Y, TOGGLE_LINK_COMMAND as V } from "@lexical/link";
|
|
9
|
+
import { ListNode as st, ListItemNode as Nt, $isListNode as ct, INSERT_UNORDERED_LIST_COMMAND as Ce, INSERT_ORDERED_LIST_COMMAND as ve, INSERT_CHECK_LIST_COMMAND as St, insertList as Me, $isListItemNode as P } from "@lexical/list";
|
|
10
10
|
import { HeadingNode as Et, QuoteNode as It, $isHeadingNode as _e, $createHeadingNode as Te, $createQuoteNode as xe } from "@lexical/rich-text";
|
|
11
|
-
import { TableNode as Rt, TableRowNode as Ot, TableCellNode as $t, INSERT_TABLE_COMMAND as Le, $getTableCellNodeFromLexicalNode as
|
|
12
|
-
import { jsx as o, jsxs as
|
|
11
|
+
import { TableNode as Rt, TableRowNode as Ot, TableCellNode as $t, INSERT_TABLE_COMMAND as Le, $getTableCellNodeFromLexicalNode as we, $deleteTableColumn__EXPERIMENTAL as ye, $deleteTableRow__EXPERIMENTAL as Ne, $insertTableColumn__EXPERIMENTAL as kt, $insertTableRow__EXPERIMENTAL as bt } from "@lexical/table";
|
|
12
|
+
import { jsx as o, jsxs as u, Fragment as H } from "react/jsx-runtime";
|
|
13
13
|
import { createContext as Se, useState as p, useRef as K, useCallback as C, useContext as Ee, useEffect as x, useMemo as zt, useLayoutEffect as Ie } from "react";
|
|
14
|
-
import { DropdownMenu as dt, ToolbarButton as At, DropdownMenuIconItem as v, Box as
|
|
14
|
+
import { DropdownMenu as dt, ToolbarButton as At, DropdownMenuIconItem as v, Box as U, ToolbarToggleGroup as Dt, ToolbarToggleItem as D, OverlayCard as Bt, Toolbar as Re, ToolbarSeparator as Oe, styled as $e, Spinner as ht, Dialog as Pt, DialogHeader as ze, TextInput as Ht, DialogActions as Z, Button as w, DropdownMenuItem as A, DropdownMenuSeparator as Ct, NavBar as Ae, NavBarItem as ot, Combobox as De } from "./ui.es.js";
|
|
15
15
|
import { LexicalComposer as Be } from "@lexical/react/LexicalComposer.js";
|
|
16
16
|
import { RichTextPlugin as Pe } from "@lexical/react/LexicalRichTextPlugin.js";
|
|
17
17
|
import He from "@lexical/react/LexicalErrorBoundary.js";
|
|
18
|
-
import { useFloating as ut, autoUpdate as Ft, size as Fe, flip as
|
|
18
|
+
import { useFloating as ut, autoUpdate as Ft, size as Fe, flip as Ue, offset as Ut, shift as We, useInteractions as Wt, useRole as jt, FloatingPortal as Kt, inline as je, useDismiss as Ke } from "@floating-ui/react";
|
|
19
19
|
import { useLexicalComposerContext as L } from "@lexical/react/LexicalComposerContext.js";
|
|
20
20
|
import { $getNearestNodeOfType as qe, $findMatchingParent as qt, mergeRegister as tt, isHTMLElement as vt, $wrapNodeInElement as Ye } from "@lexical/utils";
|
|
21
21
|
import { G as m, f as Ge, g as Je } from "./index.esm-297793f7.js";
|
|
@@ -67,7 +67,7 @@ const nr = ({
|
|
|
67
67
|
() => {
|
|
68
68
|
const e = X();
|
|
69
69
|
e.clear();
|
|
70
|
-
const n =
|
|
70
|
+
const n = W();
|
|
71
71
|
n.append($("")), e.append(n), Q(null);
|
|
72
72
|
},
|
|
73
73
|
{
|
|
@@ -79,14 +79,14 @@ const nr = ({
|
|
|
79
79
|
() => {
|
|
80
80
|
const n = X();
|
|
81
81
|
n.clear();
|
|
82
|
-
const i =
|
|
82
|
+
const i = W();
|
|
83
83
|
i.append($(t.trim())), n.append(i), Q(null);
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
tag: e
|
|
87
87
|
}
|
|
88
88
|
), r.blur();
|
|
89
|
-
},
|
|
89
|
+
}, wn = async (t, r, e) => {
|
|
90
90
|
var l;
|
|
91
91
|
let n = 0;
|
|
92
92
|
const i = ne({
|
|
@@ -98,7 +98,7 @@ const nr = ({
|
|
|
98
98
|
try {
|
|
99
99
|
if (typeof t == "string" && !Gt(t))
|
|
100
100
|
i.update(() => {
|
|
101
|
-
const s = X(), d =
|
|
101
|
+
const s = X(), d = W();
|
|
102
102
|
d.append($(t.trim())), s.append(d);
|
|
103
103
|
});
|
|
104
104
|
else {
|
|
@@ -167,25 +167,24 @@ function dr({
|
|
|
167
167
|
src: t,
|
|
168
168
|
altText: r,
|
|
169
169
|
width: e,
|
|
170
|
-
height: n
|
|
171
|
-
maxWidth: i
|
|
170
|
+
height: n
|
|
172
171
|
}) {
|
|
173
|
-
const { signUrl:
|
|
172
|
+
const { signUrl: i } = et(), [a, l] = p(cr(t) ? "" : t), s = K(!1);
|
|
174
173
|
return x(() => {
|
|
175
|
-
const
|
|
176
|
-
|
|
174
|
+
const d = async () => {
|
|
175
|
+
l(await (i == null ? void 0 : i(t)) ?? t);
|
|
177
176
|
};
|
|
178
|
-
!
|
|
179
|
-
}, []),
|
|
177
|
+
!a && !s.current && (s.current = !0, d());
|
|
178
|
+
}, []), a ? /* @__PURE__ */ o(
|
|
180
179
|
"img",
|
|
181
180
|
{
|
|
182
|
-
src:
|
|
181
|
+
src: a,
|
|
183
182
|
alt: r,
|
|
184
183
|
style: {
|
|
185
184
|
height: n,
|
|
186
|
-
maxWidth: i,
|
|
187
185
|
width: e
|
|
188
|
-
}
|
|
186
|
+
},
|
|
187
|
+
className: "ain-rich-text-image"
|
|
189
188
|
}
|
|
190
189
|
) : /* @__PURE__ */ o("span", {});
|
|
191
190
|
}
|
|
@@ -200,8 +199,8 @@ class z extends ae {
|
|
|
200
199
|
I(this, "__altText");
|
|
201
200
|
I(this, "__width");
|
|
202
201
|
I(this, "__height");
|
|
203
|
-
I(this, "
|
|
204
|
-
this.__src = e, this.__altText = n, this.
|
|
202
|
+
I(this, "__meta");
|
|
203
|
+
this.__src = e, this.__altText = n, this.__width = i || "inherit", this.__height = a || "inherit", this.__meta = l;
|
|
205
204
|
}
|
|
206
205
|
static getType() {
|
|
207
206
|
return "image";
|
|
@@ -210,25 +209,25 @@ class z extends ae {
|
|
|
210
209
|
return new z(
|
|
211
210
|
e.__src,
|
|
212
211
|
e.__altText,
|
|
213
|
-
e.__maxWidth,
|
|
214
212
|
e.__width,
|
|
215
213
|
e.__height,
|
|
214
|
+
e.__meta,
|
|
216
215
|
e.__key
|
|
217
216
|
);
|
|
218
217
|
}
|
|
219
218
|
static importJSON(e) {
|
|
220
|
-
const { altText: n, height: i, width: a,
|
|
219
|
+
const { altText: n, height: i, width: a, src: l, meta: s } = e;
|
|
221
220
|
return gt({
|
|
222
221
|
altText: n,
|
|
223
222
|
height: i,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
223
|
+
src: l,
|
|
224
|
+
width: a,
|
|
225
|
+
meta: s
|
|
227
226
|
});
|
|
228
227
|
}
|
|
229
228
|
exportDOM() {
|
|
230
229
|
const e = document.createElement("img");
|
|
231
|
-
return e.setAttribute("src", this.__src), e.setAttribute("alt", this.__altText), e.setAttribute("width", this.__width.toString()), e.setAttribute("height", this.__height.toString()), { element: e };
|
|
230
|
+
return e.setAttribute("src", this.__src), e.setAttribute("alt", this.__altText), this.__width !== "inherit" && e.setAttribute("width", this.__width.toString()), this.__height !== "inherit" && e.setAttribute("height", this.__height.toString()), { element: e };
|
|
232
231
|
}
|
|
233
232
|
static importDOM() {
|
|
234
233
|
return {
|
|
@@ -242,11 +241,11 @@ class z extends ae {
|
|
|
242
241
|
return {
|
|
243
242
|
altText: this.getAltText(),
|
|
244
243
|
height: this.__height === "inherit" ? 0 : this.__height,
|
|
245
|
-
maxWidth: this.__maxWidth,
|
|
246
244
|
src: this.getSrc(),
|
|
247
245
|
type: "image",
|
|
248
246
|
version: 1,
|
|
249
|
-
width: this.__width === "inherit" ? 0 : this.__width
|
|
247
|
+
width: this.__width === "inherit" ? 0 : this.__width,
|
|
248
|
+
meta: this.__meta
|
|
250
249
|
};
|
|
251
250
|
}
|
|
252
251
|
setSrc(e) {
|
|
@@ -259,8 +258,7 @@ class z extends ae {
|
|
|
259
258
|
}
|
|
260
259
|
// View
|
|
261
260
|
createDOM(e) {
|
|
262
|
-
|
|
263
|
-
return a !== void 0 && (n.className = a), n;
|
|
261
|
+
return document.createElement("div");
|
|
264
262
|
}
|
|
265
263
|
updateDOM() {
|
|
266
264
|
return !1;
|
|
@@ -278,8 +276,7 @@ class z extends ae {
|
|
|
278
276
|
src: this.__src,
|
|
279
277
|
altText: this.__altText,
|
|
280
278
|
width: this.__width,
|
|
281
|
-
height: this.__height
|
|
282
|
-
maxWidth: this.__maxWidth
|
|
279
|
+
height: this.__height
|
|
283
280
|
}
|
|
284
281
|
);
|
|
285
282
|
}
|
|
@@ -287,24 +284,24 @@ class z extends ae {
|
|
|
287
284
|
function gt({
|
|
288
285
|
altText: t,
|
|
289
286
|
height: r,
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
287
|
+
src: e,
|
|
288
|
+
width: n,
|
|
289
|
+
meta: i,
|
|
293
290
|
key: a
|
|
294
291
|
}) {
|
|
295
292
|
return le(
|
|
296
|
-
new z(
|
|
293
|
+
new z(e, t, n, r, i, a)
|
|
297
294
|
);
|
|
298
295
|
}
|
|
299
|
-
function
|
|
296
|
+
function yn(t) {
|
|
300
297
|
return t instanceof z;
|
|
301
298
|
}
|
|
302
|
-
const
|
|
299
|
+
const Nn = [
|
|
303
300
|
Et,
|
|
304
301
|
It,
|
|
305
302
|
st,
|
|
306
|
-
wt,
|
|
307
303
|
Nt,
|
|
304
|
+
yt,
|
|
308
305
|
B,
|
|
309
306
|
Rt,
|
|
310
307
|
Ot,
|
|
@@ -314,8 +311,8 @@ const wn = [
|
|
|
314
311
|
Et,
|
|
315
312
|
It,
|
|
316
313
|
st,
|
|
317
|
-
wt,
|
|
318
314
|
Nt,
|
|
315
|
+
yt,
|
|
319
316
|
B,
|
|
320
317
|
Rt,
|
|
321
318
|
Ot,
|
|
@@ -372,13 +369,13 @@ function xr(t) {
|
|
|
372
369
|
function Lr(t) {
|
|
373
370
|
return m({ 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);
|
|
374
371
|
}
|
|
375
|
-
function
|
|
372
|
+
function wr(t) {
|
|
376
373
|
return m({ 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);
|
|
377
374
|
}
|
|
378
|
-
function
|
|
375
|
+
function yr(t) {
|
|
379
376
|
return m({ 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);
|
|
380
377
|
}
|
|
381
|
-
function
|
|
378
|
+
function Nr(t) {
|
|
382
379
|
return m({ 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);
|
|
383
380
|
}
|
|
384
381
|
function Sr(t) {
|
|
@@ -410,13 +407,13 @@ const Er = Xe("div", {
|
|
|
410
407
|
number: /* @__PURE__ */ o(xr, { size: "1.25rem" }),
|
|
411
408
|
check: /* @__PURE__ */ o(Tr, { size: "1.25rem" }),
|
|
412
409
|
paragraph: /* @__PURE__ */ o(Mr, { size: "1.25rem" }),
|
|
413
|
-
quote: /* @__PURE__ */ o(
|
|
410
|
+
quote: /* @__PURE__ */ o(wr, { size: "1.25rem" })
|
|
414
411
|
}, M = ({
|
|
415
412
|
blockType: t
|
|
416
|
-
}) => /* @__PURE__ */
|
|
417
|
-
/* @__PURE__ */ o(
|
|
413
|
+
}) => /* @__PURE__ */ u(H, { children: [
|
|
414
|
+
/* @__PURE__ */ o(U, { css: { display: "flex", flex: "0 0 auto" }, children: Ir[t] }),
|
|
418
415
|
/* @__PURE__ */ o(
|
|
419
|
-
|
|
416
|
+
U,
|
|
420
417
|
{
|
|
421
418
|
css: {
|
|
422
419
|
flex: "1 1 auto",
|
|
@@ -444,20 +441,20 @@ const Er = Xe("div", {
|
|
|
444
441
|
x(() => t.registerCommand(
|
|
445
442
|
j,
|
|
446
443
|
() => {
|
|
447
|
-
const c = _(),
|
|
448
|
-
if (!
|
|
444
|
+
const c = _(), h = Rr(c);
|
|
445
|
+
if (!h)
|
|
449
446
|
return !1;
|
|
450
|
-
const { element: g, anchorNode:
|
|
451
|
-
if (t.getElementByKey(
|
|
447
|
+
const { element: g, anchorNode: k } = h, y = g.getKey();
|
|
448
|
+
if (t.getElementByKey(y) !== null)
|
|
452
449
|
if (ct(g)) {
|
|
453
|
-
const
|
|
454
|
-
|
|
450
|
+
const b = qe(
|
|
451
|
+
k,
|
|
455
452
|
st
|
|
456
|
-
),
|
|
457
|
-
e(
|
|
453
|
+
), N = b ? b.getListType() : g.getListType();
|
|
454
|
+
e(N);
|
|
458
455
|
} else {
|
|
459
|
-
const
|
|
460
|
-
|
|
456
|
+
const b = _e(g) ? g.getTag() : g.getType();
|
|
457
|
+
b in Xt && e(b);
|
|
461
458
|
}
|
|
462
459
|
return !1;
|
|
463
460
|
},
|
|
@@ -465,11 +462,11 @@ const Er = Xe("div", {
|
|
|
465
462
|
), [t]);
|
|
466
463
|
const n = (c) => {
|
|
467
464
|
r !== c && t.update(() => {
|
|
468
|
-
const
|
|
469
|
-
T(
|
|
465
|
+
const h = _();
|
|
466
|
+
T(h) && (nt(h, () => Te(c)), e(c));
|
|
470
467
|
});
|
|
471
468
|
};
|
|
472
|
-
return /* @__PURE__ */ o(Er, { children: /* @__PURE__ */
|
|
469
|
+
return /* @__PURE__ */ o(Er, { children: /* @__PURE__ */ u(
|
|
473
470
|
dt,
|
|
474
471
|
{
|
|
475
472
|
trigger: /* @__PURE__ */ o(
|
|
@@ -486,7 +483,7 @@ const Er = Xe("div", {
|
|
|
486
483
|
/* @__PURE__ */ o(v, { onClick: () => {
|
|
487
484
|
r !== "paragraph" && t.update(() => {
|
|
488
485
|
const c = _();
|
|
489
|
-
T(c) && (nt(c, () =>
|
|
486
|
+
T(c) && (nt(c, () => W()), e("paragraph"));
|
|
490
487
|
});
|
|
491
488
|
}, children: /* @__PURE__ */ o(M, { blockType: "paragraph" }) }),
|
|
492
489
|
/* @__PURE__ */ o(v, { onClick: () => n("h1"), children: /* @__PURE__ */ o(M, { blockType: "h1" }) }),
|
|
@@ -514,9 +511,9 @@ const Er = Xe("div", {
|
|
|
514
511
|
}
|
|
515
512
|
) });
|
|
516
513
|
}, $r = () => {
|
|
517
|
-
const [t] = L(), [r, e] = p(!1), [n, i] = p(!1), [a, l] = p(!1), [s, d] = p(!1), [c,
|
|
514
|
+
const [t] = L(), [r, e] = p(!1), [n, i] = p(!1), [a, l] = p(!1), [s, d] = p(!1), [c, h] = p(!1), g = C(() => {
|
|
518
515
|
const f = _();
|
|
519
|
-
T(f) && (e(f.hasFormat("bold")), i(f.hasFormat("italic")), l(f.hasFormat("underline")), d(f.hasFormat("code")),
|
|
516
|
+
T(f) && (e(f.hasFormat("bold")), i(f.hasFormat("italic")), l(f.hasFormat("underline")), d(f.hasFormat("code")), h(f.hasFormat("superscript")));
|
|
520
517
|
}, []);
|
|
521
518
|
x(() => tt(
|
|
522
519
|
t.registerCommand(
|
|
@@ -530,37 +527,37 @@ const Er = Xe("div", {
|
|
|
530
527
|
});
|
|
531
528
|
})
|
|
532
529
|
), [t, g]);
|
|
533
|
-
const
|
|
530
|
+
const k = C(
|
|
534
531
|
() => t.dispatchCommand(F, "bold"),
|
|
535
532
|
[t]
|
|
536
|
-
),
|
|
533
|
+
), y = C(
|
|
537
534
|
() => t.dispatchCommand(F, "italic"),
|
|
538
535
|
[t]
|
|
539
536
|
), S = C(
|
|
540
537
|
() => t.dispatchCommand(F, "underline"),
|
|
541
538
|
[t]
|
|
542
|
-
),
|
|
539
|
+
), b = C(
|
|
543
540
|
() => t.dispatchCommand(F, "code"),
|
|
544
541
|
[t]
|
|
545
|
-
),
|
|
542
|
+
), N = C(
|
|
546
543
|
() => t.dispatchCommand(F, "superscript"),
|
|
547
544
|
[t]
|
|
548
545
|
), E = zt(() => {
|
|
549
546
|
const f = [];
|
|
550
547
|
return r && f.push("bold"), n && f.push("italic"), a && f.push("underline"), s && f.push("code"), c && f.push("superscript"), f;
|
|
551
548
|
}, [r, n, a, s, c]);
|
|
552
|
-
return /* @__PURE__ */
|
|
549
|
+
return /* @__PURE__ */ u(
|
|
553
550
|
Dt,
|
|
554
551
|
{
|
|
555
552
|
type: "multiple",
|
|
556
553
|
"aria-label": "Tekstformattering",
|
|
557
554
|
value: E,
|
|
558
555
|
children: [
|
|
559
|
-
/* @__PURE__ */ o(D, { onClick:
|
|
556
|
+
/* @__PURE__ */ o(D, { onClick: k, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ o(ur, { size: "1.25rem" }) }),
|
|
560
557
|
/* @__PURE__ */ o(
|
|
561
558
|
D,
|
|
562
559
|
{
|
|
563
|
-
onClick:
|
|
560
|
+
onClick: y,
|
|
564
561
|
title: "Kursiv tekst",
|
|
565
562
|
value: "italic",
|
|
566
563
|
children: /* @__PURE__ */ o(vr, { size: "1.25rem" })
|
|
@@ -575,14 +572,14 @@ const Er = Xe("div", {
|
|
|
575
572
|
children: /* @__PURE__ */ o(Sr, { size: "1.25rem" })
|
|
576
573
|
}
|
|
577
574
|
),
|
|
578
|
-
/* @__PURE__ */ o(D, { onClick:
|
|
575
|
+
/* @__PURE__ */ o(D, { onClick: b, title: "Kode", value: "code", children: /* @__PURE__ */ o(gr, { size: "1.25rem" }) }),
|
|
579
576
|
/* @__PURE__ */ o(
|
|
580
577
|
D,
|
|
581
578
|
{
|
|
582
|
-
onClick:
|
|
579
|
+
onClick: N,
|
|
583
580
|
title: "Superscript",
|
|
584
581
|
value: "superscript",
|
|
585
|
-
children: /* @__PURE__ */ o(
|
|
582
|
+
children: /* @__PURE__ */ o(yr, { size: "1.25rem" })
|
|
586
583
|
}
|
|
587
584
|
)
|
|
588
585
|
]
|
|
@@ -598,15 +595,15 @@ const Er = Xe("div", {
|
|
|
598
595
|
whileElementsMounted: Ft,
|
|
599
596
|
middleware: [
|
|
600
597
|
Fe({
|
|
601
|
-
apply: ({ rects:
|
|
602
|
-
g.floating.style.minWidth = `${
|
|
598
|
+
apply: ({ rects: h, elements: g }) => {
|
|
599
|
+
g.floating.style.minWidth = `${h.reference.width}px`;
|
|
603
600
|
}
|
|
604
601
|
}),
|
|
605
|
-
|
|
606
|
-
|
|
602
|
+
Ue(),
|
|
603
|
+
Ut({
|
|
607
604
|
mainAxis: 8
|
|
608
605
|
}),
|
|
609
|
-
|
|
606
|
+
We({
|
|
610
607
|
padding: 8
|
|
611
608
|
})
|
|
612
609
|
],
|
|
@@ -615,7 +612,7 @@ const Er = Xe("div", {
|
|
|
615
612
|
elements: {
|
|
616
613
|
reference: e.current
|
|
617
614
|
}
|
|
618
|
-
}), { getFloatingProps: c } =
|
|
615
|
+
}), { getFloatingProps: c } = Wt([
|
|
619
616
|
jt(l, {
|
|
620
617
|
role: "dialog"
|
|
621
618
|
})
|
|
@@ -638,7 +635,7 @@ const Er = Xe("div", {
|
|
|
638
635
|
}, Ar = ({
|
|
639
636
|
children: t,
|
|
640
637
|
...r
|
|
641
|
-
}) => /* @__PURE__ */
|
|
638
|
+
}) => /* @__PURE__ */ u(Re, { "aria-label": "Formattering", ...r, children: [
|
|
642
639
|
/* @__PURE__ */ o(Or, {}),
|
|
643
640
|
/* @__PURE__ */ o(Oe, {}),
|
|
644
641
|
/* @__PURE__ */ o($r, {}),
|
|
@@ -796,21 +793,21 @@ function Hr() {
|
|
|
796
793
|
Vt,
|
|
797
794
|
(r) => {
|
|
798
795
|
const e = gt(r);
|
|
799
|
-
return pe([e]), xt(e.getParentOrThrow()) && Ye(e,
|
|
796
|
+
return pe([e]), xt(e.getParentOrThrow()) && Ye(e, W).selectEnd(), !0;
|
|
800
797
|
},
|
|
801
798
|
me
|
|
802
799
|
)
|
|
803
800
|
);
|
|
804
801
|
}, [t]), null;
|
|
805
802
|
}
|
|
806
|
-
const Fr = () => /* @__PURE__ */
|
|
803
|
+
const Fr = () => /* @__PURE__ */ u(H, { children: [
|
|
807
804
|
/* @__PURE__ */ o(Ve, {}),
|
|
808
805
|
/* @__PURE__ */ o(tr, {}),
|
|
809
806
|
/* @__PURE__ */ o(Ze, {}),
|
|
810
807
|
/* @__PURE__ */ o(Dr, {}),
|
|
811
808
|
/* @__PURE__ */ o(er, {}),
|
|
812
809
|
/* @__PURE__ */ o(Hr, {})
|
|
813
|
-
] }),
|
|
810
|
+
] }), Ur = ({
|
|
814
811
|
state: t
|
|
815
812
|
}) => {
|
|
816
813
|
const [r] = L(), e = K(!1);
|
|
@@ -832,7 +829,7 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
832
829
|
}
|
|
833
830
|
}));
|
|
834
831
|
}, []), null;
|
|
835
|
-
},
|
|
832
|
+
}, Wr = $e("div", {
|
|
836
833
|
border: "1px solid $borderDarker",
|
|
837
834
|
borderRadius: "$md",
|
|
838
835
|
position: "relative",
|
|
@@ -872,7 +869,7 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
872
869
|
}), jr = ({
|
|
873
870
|
isLoading: t
|
|
874
871
|
}) => /* @__PURE__ */ o(
|
|
875
|
-
|
|
872
|
+
U,
|
|
876
873
|
{
|
|
877
874
|
css: {
|
|
878
875
|
visibility: t ? "visible" : "hidden",
|
|
@@ -894,15 +891,15 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
894
891
|
content: s,
|
|
895
892
|
hideBorder: d,
|
|
896
893
|
onBlur: c,
|
|
897
|
-
defaultState:
|
|
894
|
+
defaultState: h,
|
|
898
895
|
css: g,
|
|
899
|
-
signUrl:
|
|
896
|
+
signUrl: k
|
|
900
897
|
}) => {
|
|
901
|
-
const { hasFocus:
|
|
902
|
-
() => ({ hasFocus:
|
|
903
|
-
[
|
|
898
|
+
const { hasFocus: y, attributes: S } = sr({ onBlur: c }), b = K(null), N = zt(
|
|
899
|
+
() => ({ hasFocus: y, editorRef: b, signUrl: k }),
|
|
900
|
+
[y, k]
|
|
904
901
|
);
|
|
905
|
-
return /* @__PURE__ */ o(Jt.Provider, { value:
|
|
902
|
+
return /* @__PURE__ */ o(Jt.Provider, { value: N, children: /* @__PURE__ */ u(
|
|
906
903
|
Be,
|
|
907
904
|
{
|
|
908
905
|
initialConfig: {
|
|
@@ -915,11 +912,11 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
915
912
|
editable: !0
|
|
916
913
|
},
|
|
917
914
|
children: [
|
|
918
|
-
/* @__PURE__ */
|
|
919
|
-
|
|
915
|
+
/* @__PURE__ */ u(
|
|
916
|
+
Wr,
|
|
920
917
|
{
|
|
921
|
-
ref:
|
|
922
|
-
hasFocus:
|
|
918
|
+
ref: b,
|
|
919
|
+
hasFocus: y,
|
|
923
920
|
hideBorder: d,
|
|
924
921
|
css: g,
|
|
925
922
|
...S,
|
|
@@ -930,7 +927,7 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
930
927
|
{
|
|
931
928
|
contentEditable: s,
|
|
932
929
|
placeholder: e ? /* @__PURE__ */ o(
|
|
933
|
-
|
|
930
|
+
U,
|
|
934
931
|
{
|
|
935
932
|
css: {
|
|
936
933
|
position: "absolute",
|
|
@@ -953,7 +950,7 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
953
950
|
]
|
|
954
951
|
}
|
|
955
952
|
),
|
|
956
|
-
/* @__PURE__ */ o(
|
|
953
|
+
/* @__PURE__ */ o(Ur, { state: h }),
|
|
957
954
|
/* @__PURE__ */ o(H, { children: r })
|
|
958
955
|
]
|
|
959
956
|
}
|
|
@@ -1111,6 +1108,11 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
1111
1108
|
margin: "1.5em 10px",
|
|
1112
1109
|
padding: "0.5em 10px"
|
|
1113
1110
|
},
|
|
1111
|
+
".ain-rich-text-image": {
|
|
1112
|
+
display: "block",
|
|
1113
|
+
maxWidth: "100%",
|
|
1114
|
+
height: "auto"
|
|
1115
|
+
},
|
|
1114
1116
|
variants: {
|
|
1115
1117
|
size: {
|
|
1116
1118
|
xs: {
|
|
@@ -1152,20 +1154,24 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
1152
1154
|
uploadFile: t,
|
|
1153
1155
|
...r
|
|
1154
1156
|
}) => {
|
|
1155
|
-
const [e] = L(), [n, i] = p(null), a =
|
|
1157
|
+
const [e] = L(), [n, i] = p(null), a = (s) => {
|
|
1156
1158
|
var c;
|
|
1157
1159
|
const d = (c = s.target.files) == null ? void 0 : c[0];
|
|
1158
1160
|
if (d) {
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1161
|
+
const h = new Image(), g = window.URL.createObjectURL(d);
|
|
1162
|
+
h.onload = async () => {
|
|
1163
|
+
const k = await t.uploadFile({ file: d });
|
|
1164
|
+
i({ url: k, width: h.naturalWidth, height: h.naturalHeight }), window.URL.revokeObjectURL(g);
|
|
1165
|
+
}, h.src = g;
|
|
1161
1166
|
}
|
|
1162
1167
|
}, l = () => {
|
|
1163
1168
|
n && !t.isLoading && (e.dispatchCommand(Vt, {
|
|
1164
|
-
src: n,
|
|
1165
|
-
altText: `Image: ${n}
|
|
1169
|
+
src: n.url,
|
|
1170
|
+
altText: `Image: ${n.url}`,
|
|
1171
|
+
meta: { width: n.width, height: n.height }
|
|
1166
1172
|
}), r.onOpenChange(!1));
|
|
1167
1173
|
};
|
|
1168
|
-
return /* @__PURE__ */
|
|
1174
|
+
return /* @__PURE__ */ u(Pt, { ...r, children: [
|
|
1169
1175
|
/* @__PURE__ */ o(ze, { children: "Sett inn bilde" }),
|
|
1170
1176
|
t.isLoading && /* @__PURE__ */ o(ht, {}),
|
|
1171
1177
|
/* @__PURE__ */ o(
|
|
@@ -1177,10 +1183,10 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
1177
1183
|
disabled: t.isLoading
|
|
1178
1184
|
}
|
|
1179
1185
|
),
|
|
1180
|
-
/* @__PURE__ */
|
|
1181
|
-
/* @__PURE__ */ o(
|
|
1186
|
+
/* @__PURE__ */ u(Z, { children: [
|
|
1187
|
+
/* @__PURE__ */ o(w, { onClick: () => r.onOpenChange(!1), children: "Avbryt" }),
|
|
1182
1188
|
/* @__PURE__ */ o(
|
|
1183
|
-
|
|
1189
|
+
w,
|
|
1184
1190
|
{
|
|
1185
1191
|
variant: "primary",
|
|
1186
1192
|
disabled: !n || t.isLoading,
|
|
@@ -1198,19 +1204,19 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
1198
1204
|
includeHeaders: !1
|
|
1199
1205
|
});
|
|
1200
1206
|
}, [r]);
|
|
1201
|
-
return /* @__PURE__ */
|
|
1202
|
-
/* @__PURE__ */
|
|
1207
|
+
return /* @__PURE__ */ u(H, { children: [
|
|
1208
|
+
/* @__PURE__ */ u(
|
|
1203
1209
|
dt,
|
|
1204
1210
|
{
|
|
1205
1211
|
trigger: /* @__PURE__ */ o(At, { dropdown: !0, children: "Sett inn" }),
|
|
1206
1212
|
side: "bottom",
|
|
1207
1213
|
align: "end",
|
|
1208
1214
|
children: [
|
|
1209
|
-
/* @__PURE__ */
|
|
1210
|
-
/* @__PURE__ */ o(
|
|
1215
|
+
/* @__PURE__ */ u(v, { onClick: i, children: [
|
|
1216
|
+
/* @__PURE__ */ o(Nr, { size: "1.25rem" }),
|
|
1211
1217
|
" Tabell"
|
|
1212
1218
|
] }),
|
|
1213
|
-
t && /* @__PURE__ */
|
|
1219
|
+
t && /* @__PURE__ */ u(v, { onClick: () => n(!0), children: [
|
|
1214
1220
|
/* @__PURE__ */ o(Ge, { size: "1.25rem" }),
|
|
1215
1221
|
" Bilde"
|
|
1216
1222
|
] })
|
|
@@ -1241,14 +1247,14 @@ const On = () => {
|
|
|
1241
1247
|
elements: {
|
|
1242
1248
|
reference: r
|
|
1243
1249
|
},
|
|
1244
|
-
middleware: [
|
|
1250
|
+
middleware: [Ut({ mainAxis: -20, crossAxis: -2 })]
|
|
1245
1251
|
});
|
|
1246
1252
|
x(() => t.registerCommand(
|
|
1247
1253
|
j,
|
|
1248
1254
|
() => {
|
|
1249
1255
|
const s = _();
|
|
1250
1256
|
if (T(s)) {
|
|
1251
|
-
const d = s.anchor.getNode(), c =
|
|
1257
|
+
const d = s.anchor.getNode(), c = we(d);
|
|
1252
1258
|
e(c ? t.getElementByKey(c.getKey()) : null);
|
|
1253
1259
|
}
|
|
1254
1260
|
return !1;
|
|
@@ -1271,19 +1277,19 @@ const On = () => {
|
|
|
1271
1277
|
kt(!0);
|
|
1272
1278
|
break;
|
|
1273
1279
|
case "delete-row":
|
|
1274
|
-
|
|
1280
|
+
Ne();
|
|
1275
1281
|
break;
|
|
1276
1282
|
case "delete-column":
|
|
1277
|
-
|
|
1283
|
+
ye();
|
|
1278
1284
|
break;
|
|
1279
1285
|
}
|
|
1280
1286
|
});
|
|
1281
1287
|
};
|
|
1282
|
-
return r ? /* @__PURE__ */
|
|
1288
|
+
return r ? /* @__PURE__ */ u(
|
|
1283
1289
|
dt,
|
|
1284
1290
|
{
|
|
1285
1291
|
trigger: /* @__PURE__ */ o(
|
|
1286
|
-
|
|
1292
|
+
w,
|
|
1287
1293
|
{
|
|
1288
1294
|
icon: !0,
|
|
1289
1295
|
variant: "primary",
|
|
@@ -1362,7 +1368,7 @@ const Jr = ({ onClose: t }) => {
|
|
|
1362
1368
|
if (T(a) && a.isCollapsed()) {
|
|
1363
1369
|
const l = $(i);
|
|
1364
1370
|
a.insertNodes([l]);
|
|
1365
|
-
const s =
|
|
1371
|
+
const s = wt();
|
|
1366
1372
|
s.setTextNodeRange(l, 0, l, i.length), Q(s);
|
|
1367
1373
|
}
|
|
1368
1374
|
r.dispatchCommand(V, pt(i));
|
|
@@ -1370,13 +1376,13 @@ const Jr = ({ onClose: t }) => {
|
|
|
1370
1376
|
},
|
|
1371
1377
|
[r]
|
|
1372
1378
|
);
|
|
1373
|
-
return /* @__PURE__ */
|
|
1379
|
+
return /* @__PURE__ */ u("form", { onSubmit: (i) => {
|
|
1374
1380
|
e(i.currentTarget.url.value), t();
|
|
1375
1381
|
}, children: [
|
|
1376
1382
|
/* @__PURE__ */ o(Ht, { name: "url", label: "URL", type: "url", required: !0 }),
|
|
1377
|
-
/* @__PURE__ */
|
|
1378
|
-
/* @__PURE__ */ o(
|
|
1379
|
-
/* @__PURE__ */ o(
|
|
1383
|
+
/* @__PURE__ */ u(Z, { children: [
|
|
1384
|
+
/* @__PURE__ */ o(w, { onClick: t, children: "Avbryt" }),
|
|
1385
|
+
/* @__PURE__ */ o(w, { type: "submit", variant: "primary", children: "Sett inn" })
|
|
1380
1386
|
] })
|
|
1381
1387
|
] });
|
|
1382
1388
|
}, Xr = ({
|
|
@@ -1389,9 +1395,9 @@ const Jr = ({ onClose: t }) => {
|
|
|
1389
1395
|
const d = _();
|
|
1390
1396
|
if (T(d)) {
|
|
1391
1397
|
const c = [];
|
|
1392
|
-
for (const [
|
|
1393
|
-
const
|
|
1394
|
-
|
|
1398
|
+
for (const [h, g] of s.entries()) {
|
|
1399
|
+
const k = te(g.value);
|
|
1400
|
+
k.append($(g.label)), c.push(k), h !== s.length - 1 && c.push($(" "));
|
|
1395
1401
|
}
|
|
1396
1402
|
d.insertNodes(c);
|
|
1397
1403
|
}
|
|
@@ -1399,7 +1405,7 @@ const Jr = ({ onClose: t }) => {
|
|
|
1399
1405
|
},
|
|
1400
1406
|
[e]
|
|
1401
1407
|
);
|
|
1402
|
-
return /* @__PURE__ */
|
|
1408
|
+
return /* @__PURE__ */ u(H, { children: [
|
|
1403
1409
|
/* @__PURE__ */ o(
|
|
1404
1410
|
De,
|
|
1405
1411
|
{
|
|
@@ -1408,10 +1414,10 @@ const Jr = ({ onClose: t }) => {
|
|
|
1408
1414
|
onChange: (s) => i(s)
|
|
1409
1415
|
}
|
|
1410
1416
|
),
|
|
1411
|
-
/* @__PURE__ */
|
|
1412
|
-
/* @__PURE__ */ o(
|
|
1417
|
+
/* @__PURE__ */ u(Z, { children: [
|
|
1418
|
+
/* @__PURE__ */ o(w, { onClick: t, children: "Avbryt" }),
|
|
1413
1419
|
/* @__PURE__ */ o(
|
|
1414
|
-
|
|
1420
|
+
w,
|
|
1415
1421
|
{
|
|
1416
1422
|
variant: "primary",
|
|
1417
1423
|
onClick: () => {
|
|
@@ -1430,10 +1436,10 @@ const Jr = ({ onClose: t }) => {
|
|
|
1430
1436
|
var c;
|
|
1431
1437
|
const d = (c = s.target.files) == null ? void 0 : c[0];
|
|
1432
1438
|
if (d) {
|
|
1433
|
-
const
|
|
1439
|
+
const h = await r.uploadFile({ file: d });
|
|
1434
1440
|
i({
|
|
1435
1441
|
name: d.name,
|
|
1436
|
-
url:
|
|
1442
|
+
url: h
|
|
1437
1443
|
});
|
|
1438
1444
|
}
|
|
1439
1445
|
}, l = C(() => {
|
|
@@ -1444,13 +1450,13 @@ const Jr = ({ onClose: t }) => {
|
|
|
1444
1450
|
if (T(s) && s.isCollapsed()) {
|
|
1445
1451
|
const d = $(n.name);
|
|
1446
1452
|
s.insertNodes([d]);
|
|
1447
|
-
const c =
|
|
1453
|
+
const c = wt();
|
|
1448
1454
|
c.setTextNodeRange(d, 0, d, n.name.length), Q(c);
|
|
1449
1455
|
}
|
|
1450
1456
|
e.dispatchCommand(V, pt(n.url));
|
|
1451
1457
|
});
|
|
1452
1458
|
}, [e, n]);
|
|
1453
|
-
return /* @__PURE__ */
|
|
1459
|
+
return /* @__PURE__ */ u(H, { children: [
|
|
1454
1460
|
r.isLoading && /* @__PURE__ */ o(ht, {}),
|
|
1455
1461
|
/* @__PURE__ */ o(
|
|
1456
1462
|
"input",
|
|
@@ -1460,10 +1466,10 @@ const Jr = ({ onClose: t }) => {
|
|
|
1460
1466
|
disabled: r.isLoading
|
|
1461
1467
|
}
|
|
1462
1468
|
),
|
|
1463
|
-
/* @__PURE__ */
|
|
1464
|
-
/* @__PURE__ */ o(
|
|
1469
|
+
/* @__PURE__ */ u(Z, { children: [
|
|
1470
|
+
/* @__PURE__ */ o(w, { onClick: t, children: "Avbryt" }),
|
|
1465
1471
|
/* @__PURE__ */ o(
|
|
1466
|
-
|
|
1472
|
+
w,
|
|
1467
1473
|
{
|
|
1468
1474
|
variant: "primary",
|
|
1469
1475
|
onClick: () => {
|
|
@@ -1484,8 +1490,8 @@ const Jr = ({ onClose: t }) => {
|
|
|
1484
1490
|
const [i, a] = p("url"), l = () => {
|
|
1485
1491
|
r(!1);
|
|
1486
1492
|
};
|
|
1487
|
-
return /* @__PURE__ */
|
|
1488
|
-
/* @__PURE__ */
|
|
1493
|
+
return /* @__PURE__ */ u(Pt, { open: t, onOpenChange: r, css: { width: "600px" }, children: [
|
|
1494
|
+
/* @__PURE__ */ u(Ae, { css: { marginBottom: "$8" }, children: [
|
|
1489
1495
|
/* @__PURE__ */ o(ot, { active: i === "url", onClick: () => a("url"), children: "URL" }),
|
|
1490
1496
|
e && /* @__PURE__ */ o(
|
|
1491
1497
|
ot,
|
|
@@ -1508,15 +1514,15 @@ const Jr = ({ onClose: t }) => {
|
|
|
1508
1514
|
const [e] = L(), [n, i] = p(!1), [a, l] = p(!1), s = C(() => {
|
|
1509
1515
|
const d = _();
|
|
1510
1516
|
if (T(d)) {
|
|
1511
|
-
const c = Zt(d),
|
|
1512
|
-
i(Y(
|
|
1517
|
+
const c = Zt(d), h = c.getParent();
|
|
1518
|
+
i(Y(h) || Y(c));
|
|
1513
1519
|
}
|
|
1514
1520
|
}, []);
|
|
1515
1521
|
return x(() => e.registerCommand(
|
|
1516
1522
|
j,
|
|
1517
1523
|
() => (s(), !1),
|
|
1518
1524
|
at
|
|
1519
|
-
), [e, s]), /* @__PURE__ */
|
|
1525
|
+
), [e, s]), /* @__PURE__ */ u(Dt, { type: "single", value: n ? "link" : "", children: [
|
|
1520
1526
|
/* @__PURE__ */ o(
|
|
1521
1527
|
D,
|
|
1522
1528
|
{
|
|
@@ -1545,7 +1551,7 @@ const Jr = ({ onClose: t }) => {
|
|
|
1545
1551
|
a(e.getURL());
|
|
1546
1552
|
}) : a("");
|
|
1547
1553
|
}, [t, e]);
|
|
1548
|
-
const s = !!(e && i && l), { refs: d, floatingStyles: c, context:
|
|
1554
|
+
const s = !!(e && i && l), { refs: d, floatingStyles: c, context: h } = ut({
|
|
1549
1555
|
placement: "top",
|
|
1550
1556
|
strategy: "fixed",
|
|
1551
1557
|
open: s,
|
|
@@ -1554,39 +1560,39 @@ const Jr = ({ onClose: t }) => {
|
|
|
1554
1560
|
reference: r.current
|
|
1555
1561
|
},
|
|
1556
1562
|
middleware: [je()]
|
|
1557
|
-
}), { getFloatingProps: g } =
|
|
1558
|
-
jt(
|
|
1559
|
-
Ke(
|
|
1560
|
-
]),
|
|
1561
|
-
var
|
|
1562
|
-
const
|
|
1563
|
-
if (T(
|
|
1564
|
-
const E = Zt(
|
|
1563
|
+
}), { getFloatingProps: g } = Wt([
|
|
1564
|
+
jt(h),
|
|
1565
|
+
Ke(h)
|
|
1566
|
+
]), k = C(() => {
|
|
1567
|
+
var N;
|
|
1568
|
+
const b = _();
|
|
1569
|
+
if (T(b)) {
|
|
1570
|
+
const E = Zt(b), f = E.getParent();
|
|
1565
1571
|
let q = null;
|
|
1566
1572
|
if (Y(f) ? q = f : Y(E) && (q = E), q) {
|
|
1567
1573
|
const rt = window.getSelection(), mt = t.getRootElement();
|
|
1568
|
-
|
|
1574
|
+
b !== null && rt !== null && mt !== null && mt.contains(rt.anchorNode) && t.isEditable() && (r.current = ((N = rt.focusNode) == null ? void 0 : N.parentElement) ?? null);
|
|
1569
1575
|
}
|
|
1570
1576
|
n(q);
|
|
1571
1577
|
}
|
|
1572
|
-
}, [t]),
|
|
1578
|
+
}, [t]), y = C(() => {
|
|
1573
1579
|
e && Gr(e) && t.update(() => {
|
|
1574
1580
|
e.remove();
|
|
1575
1581
|
}), t.dispatchCommand(V, null);
|
|
1576
1582
|
}, [t, e]);
|
|
1577
1583
|
if (x(() => {
|
|
1578
1584
|
t.getEditorState().read(() => {
|
|
1579
|
-
|
|
1585
|
+
k();
|
|
1580
1586
|
});
|
|
1581
|
-
}, [t,
|
|
1582
|
-
t.registerUpdateListener(({ editorState:
|
|
1583
|
-
|
|
1584
|
-
|
|
1587
|
+
}, [t, k]), x(() => tt(
|
|
1588
|
+
t.registerUpdateListener(({ editorState: b }) => {
|
|
1589
|
+
b.read(() => {
|
|
1590
|
+
k();
|
|
1585
1591
|
});
|
|
1586
1592
|
}),
|
|
1587
1593
|
t.registerCommand(
|
|
1588
1594
|
j,
|
|
1589
|
-
() => (
|
|
1595
|
+
() => (k(), !0),
|
|
1590
1596
|
R
|
|
1591
1597
|
),
|
|
1592
1598
|
t.registerCommand(
|
|
@@ -1594,10 +1600,10 @@ const Jr = ({ onClose: t }) => {
|
|
|
1594
1600
|
() => e ? (n(null), !0) : !1,
|
|
1595
1601
|
ke
|
|
1596
1602
|
)
|
|
1597
|
-
), [t,
|
|
1603
|
+
), [t, k, e]), !s)
|
|
1598
1604
|
return null;
|
|
1599
1605
|
const S = pt(i);
|
|
1600
|
-
return /* @__PURE__ */ o(Kt, { children: /* @__PURE__ */
|
|
1606
|
+
return /* @__PURE__ */ o(Kt, { children: /* @__PURE__ */ u(
|
|
1601
1607
|
Bt,
|
|
1602
1608
|
{
|
|
1603
1609
|
ref: d.setFloating,
|
|
@@ -1612,7 +1618,7 @@ const Jr = ({ onClose: t }) => {
|
|
|
1612
1618
|
...g(),
|
|
1613
1619
|
children: [
|
|
1614
1620
|
/* @__PURE__ */ o(
|
|
1615
|
-
|
|
1621
|
+
U,
|
|
1616
1622
|
{
|
|
1617
1623
|
as: "a",
|
|
1618
1624
|
css: {
|
|
@@ -1629,7 +1635,7 @@ const Jr = ({ onClose: t }) => {
|
|
|
1629
1635
|
children: i
|
|
1630
1636
|
}
|
|
1631
1637
|
),
|
|
1632
|
-
/* @__PURE__ */ o(
|
|
1638
|
+
/* @__PURE__ */ o(w, { color: "danger", icon: !0, size: "sm", onClick: y, children: /* @__PURE__ */ o(Je, { size: 24 }) })
|
|
1633
1639
|
]
|
|
1634
1640
|
}
|
|
1635
1641
|
) });
|
|
@@ -1637,7 +1643,7 @@ const Jr = ({ onClose: t }) => {
|
|
|
1637
1643
|
export {
|
|
1638
1644
|
gt as $createImageNode,
|
|
1639
1645
|
te as $createRutineLinkNode,
|
|
1640
|
-
|
|
1646
|
+
yn as $isImageNode,
|
|
1641
1647
|
Gr as $isRutineLinkNode,
|
|
1642
1648
|
zr as FloatingToolbar,
|
|
1643
1649
|
z as ImageNode,
|
|
@@ -1651,7 +1657,7 @@ export {
|
|
|
1651
1657
|
$n as RutineLinkNodeInit,
|
|
1652
1658
|
On as TableEditPlugin,
|
|
1653
1659
|
ar as clearEditorState,
|
|
1654
|
-
|
|
1660
|
+
Nn as defaultNodes,
|
|
1655
1661
|
Sn as defaultViewNodes,
|
|
1656
1662
|
ir as isEditorState,
|
|
1657
1663
|
Gt as isJSON,
|
|
@@ -1659,7 +1665,7 @@ export {
|
|
|
1659
1665
|
In as richTextCss,
|
|
1660
1666
|
Kr as richTextStyleObj,
|
|
1661
1667
|
lr as setStateFromPlainText,
|
|
1662
|
-
|
|
1668
|
+
wn as stateToHTML,
|
|
1663
1669
|
sr as useHasFocusWithin,
|
|
1664
1670
|
et as useRichTextContext
|
|
1665
1671
|
};
|