@arkitektbedriftene/fe-lib 2.0.0 → 2.0.2
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,29 +6,45 @@ 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;
|
|
44
|
+
getMeta(): {
|
|
45
|
+
width: number;
|
|
46
|
+
height: number;
|
|
47
|
+
};
|
|
32
48
|
setSrc(src: string): void;
|
|
33
49
|
setWidthAndHeight(width: "inherit" | number, height: "inherit" | number): void;
|
|
34
50
|
createDOM(config: EditorConfig): HTMLElement;
|
|
@@ -37,5 +53,5 @@ export declare class ImageNode extends DecoratorNode<JSX.Element> {
|
|
|
37
53
|
getAltText(): string;
|
|
38
54
|
decorate(): JSX.Element;
|
|
39
55
|
}
|
|
40
|
-
export declare function $createImageNode({ altText, height,
|
|
56
|
+
export declare function $createImageNode({ altText, height, src, width, meta, key, }: ImagePayload): ImageNode;
|
|
41
57
|
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,13 +241,16 @@ 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
|
}
|
|
251
|
+
getMeta() {
|
|
252
|
+
return this.__meta ?? { width: 0, height: 0 };
|
|
253
|
+
}
|
|
252
254
|
setSrc(e) {
|
|
253
255
|
const n = this.getWritable();
|
|
254
256
|
n.__src = e;
|
|
@@ -259,8 +261,7 @@ class z extends ae {
|
|
|
259
261
|
}
|
|
260
262
|
// View
|
|
261
263
|
createDOM(e) {
|
|
262
|
-
|
|
263
|
-
return a !== void 0 && (n.className = a), n;
|
|
264
|
+
return document.createElement("div");
|
|
264
265
|
}
|
|
265
266
|
updateDOM() {
|
|
266
267
|
return !1;
|
|
@@ -278,8 +279,7 @@ class z extends ae {
|
|
|
278
279
|
src: this.__src,
|
|
279
280
|
altText: this.__altText,
|
|
280
281
|
width: this.__width,
|
|
281
|
-
height: this.__height
|
|
282
|
-
maxWidth: this.__maxWidth
|
|
282
|
+
height: this.__height
|
|
283
283
|
}
|
|
284
284
|
);
|
|
285
285
|
}
|
|
@@ -287,24 +287,24 @@ class z extends ae {
|
|
|
287
287
|
function gt({
|
|
288
288
|
altText: t,
|
|
289
289
|
height: r,
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
290
|
+
src: e,
|
|
291
|
+
width: n,
|
|
292
|
+
meta: i,
|
|
293
293
|
key: a
|
|
294
294
|
}) {
|
|
295
295
|
return le(
|
|
296
|
-
new z(
|
|
296
|
+
new z(e, t, n, r, i, a)
|
|
297
297
|
);
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function yn(t) {
|
|
300
300
|
return t instanceof z;
|
|
301
301
|
}
|
|
302
|
-
const
|
|
302
|
+
const Nn = [
|
|
303
303
|
Et,
|
|
304
304
|
It,
|
|
305
305
|
st,
|
|
306
|
-
wt,
|
|
307
306
|
Nt,
|
|
307
|
+
yt,
|
|
308
308
|
B,
|
|
309
309
|
Rt,
|
|
310
310
|
Ot,
|
|
@@ -314,8 +314,8 @@ const wn = [
|
|
|
314
314
|
Et,
|
|
315
315
|
It,
|
|
316
316
|
st,
|
|
317
|
-
wt,
|
|
318
317
|
Nt,
|
|
318
|
+
yt,
|
|
319
319
|
B,
|
|
320
320
|
Rt,
|
|
321
321
|
Ot,
|
|
@@ -372,13 +372,13 @@ function xr(t) {
|
|
|
372
372
|
function Lr(t) {
|
|
373
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: "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
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function wr(t) {
|
|
376
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: "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
377
|
}
|
|
378
|
-
function
|
|
378
|
+
function yr(t) {
|
|
379
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: "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
380
|
}
|
|
381
|
-
function
|
|
381
|
+
function Nr(t) {
|
|
382
382
|
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
383
|
}
|
|
384
384
|
function Sr(t) {
|
|
@@ -410,13 +410,13 @@ const Er = Xe("div", {
|
|
|
410
410
|
number: /* @__PURE__ */ o(xr, { size: "1.25rem" }),
|
|
411
411
|
check: /* @__PURE__ */ o(Tr, { size: "1.25rem" }),
|
|
412
412
|
paragraph: /* @__PURE__ */ o(Mr, { size: "1.25rem" }),
|
|
413
|
-
quote: /* @__PURE__ */ o(
|
|
413
|
+
quote: /* @__PURE__ */ o(wr, { size: "1.25rem" })
|
|
414
414
|
}, M = ({
|
|
415
415
|
blockType: t
|
|
416
|
-
}) => /* @__PURE__ */
|
|
417
|
-
/* @__PURE__ */ o(
|
|
416
|
+
}) => /* @__PURE__ */ u(H, { children: [
|
|
417
|
+
/* @__PURE__ */ o(U, { css: { display: "flex", flex: "0 0 auto" }, children: Ir[t] }),
|
|
418
418
|
/* @__PURE__ */ o(
|
|
419
|
-
|
|
419
|
+
U,
|
|
420
420
|
{
|
|
421
421
|
css: {
|
|
422
422
|
flex: "1 1 auto",
|
|
@@ -444,20 +444,20 @@ const Er = Xe("div", {
|
|
|
444
444
|
x(() => t.registerCommand(
|
|
445
445
|
j,
|
|
446
446
|
() => {
|
|
447
|
-
const c = _(),
|
|
448
|
-
if (!
|
|
447
|
+
const c = _(), h = Rr(c);
|
|
448
|
+
if (!h)
|
|
449
449
|
return !1;
|
|
450
|
-
const { element: g, anchorNode:
|
|
451
|
-
if (t.getElementByKey(
|
|
450
|
+
const { element: g, anchorNode: k } = h, y = g.getKey();
|
|
451
|
+
if (t.getElementByKey(y) !== null)
|
|
452
452
|
if (ct(g)) {
|
|
453
|
-
const
|
|
454
|
-
|
|
453
|
+
const b = qe(
|
|
454
|
+
k,
|
|
455
455
|
st
|
|
456
|
-
),
|
|
457
|
-
e(
|
|
456
|
+
), N = b ? b.getListType() : g.getListType();
|
|
457
|
+
e(N);
|
|
458
458
|
} else {
|
|
459
|
-
const
|
|
460
|
-
|
|
459
|
+
const b = _e(g) ? g.getTag() : g.getType();
|
|
460
|
+
b in Xt && e(b);
|
|
461
461
|
}
|
|
462
462
|
return !1;
|
|
463
463
|
},
|
|
@@ -465,11 +465,11 @@ const Er = Xe("div", {
|
|
|
465
465
|
), [t]);
|
|
466
466
|
const n = (c) => {
|
|
467
467
|
r !== c && t.update(() => {
|
|
468
|
-
const
|
|
469
|
-
T(
|
|
468
|
+
const h = _();
|
|
469
|
+
T(h) && (nt(h, () => Te(c)), e(c));
|
|
470
470
|
});
|
|
471
471
|
};
|
|
472
|
-
return /* @__PURE__ */ o(Er, { children: /* @__PURE__ */
|
|
472
|
+
return /* @__PURE__ */ o(Er, { children: /* @__PURE__ */ u(
|
|
473
473
|
dt,
|
|
474
474
|
{
|
|
475
475
|
trigger: /* @__PURE__ */ o(
|
|
@@ -486,7 +486,7 @@ const Er = Xe("div", {
|
|
|
486
486
|
/* @__PURE__ */ o(v, { onClick: () => {
|
|
487
487
|
r !== "paragraph" && t.update(() => {
|
|
488
488
|
const c = _();
|
|
489
|
-
T(c) && (nt(c, () =>
|
|
489
|
+
T(c) && (nt(c, () => W()), e("paragraph"));
|
|
490
490
|
});
|
|
491
491
|
}, children: /* @__PURE__ */ o(M, { blockType: "paragraph" }) }),
|
|
492
492
|
/* @__PURE__ */ o(v, { onClick: () => n("h1"), children: /* @__PURE__ */ o(M, { blockType: "h1" }) }),
|
|
@@ -514,9 +514,9 @@ const Er = Xe("div", {
|
|
|
514
514
|
}
|
|
515
515
|
) });
|
|
516
516
|
}, $r = () => {
|
|
517
|
-
const [t] = L(), [r, e] = p(!1), [n, i] = p(!1), [a, l] = p(!1), [s, d] = p(!1), [c,
|
|
517
|
+
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
518
|
const f = _();
|
|
519
|
-
T(f) && (e(f.hasFormat("bold")), i(f.hasFormat("italic")), l(f.hasFormat("underline")), d(f.hasFormat("code")),
|
|
519
|
+
T(f) && (e(f.hasFormat("bold")), i(f.hasFormat("italic")), l(f.hasFormat("underline")), d(f.hasFormat("code")), h(f.hasFormat("superscript")));
|
|
520
520
|
}, []);
|
|
521
521
|
x(() => tt(
|
|
522
522
|
t.registerCommand(
|
|
@@ -530,37 +530,37 @@ const Er = Xe("div", {
|
|
|
530
530
|
});
|
|
531
531
|
})
|
|
532
532
|
), [t, g]);
|
|
533
|
-
const
|
|
533
|
+
const k = C(
|
|
534
534
|
() => t.dispatchCommand(F, "bold"),
|
|
535
535
|
[t]
|
|
536
|
-
),
|
|
536
|
+
), y = C(
|
|
537
537
|
() => t.dispatchCommand(F, "italic"),
|
|
538
538
|
[t]
|
|
539
539
|
), S = C(
|
|
540
540
|
() => t.dispatchCommand(F, "underline"),
|
|
541
541
|
[t]
|
|
542
|
-
),
|
|
542
|
+
), b = C(
|
|
543
543
|
() => t.dispatchCommand(F, "code"),
|
|
544
544
|
[t]
|
|
545
|
-
),
|
|
545
|
+
), N = C(
|
|
546
546
|
() => t.dispatchCommand(F, "superscript"),
|
|
547
547
|
[t]
|
|
548
548
|
), E = zt(() => {
|
|
549
549
|
const f = [];
|
|
550
550
|
return r && f.push("bold"), n && f.push("italic"), a && f.push("underline"), s && f.push("code"), c && f.push("superscript"), f;
|
|
551
551
|
}, [r, n, a, s, c]);
|
|
552
|
-
return /* @__PURE__ */
|
|
552
|
+
return /* @__PURE__ */ u(
|
|
553
553
|
Dt,
|
|
554
554
|
{
|
|
555
555
|
type: "multiple",
|
|
556
556
|
"aria-label": "Tekstformattering",
|
|
557
557
|
value: E,
|
|
558
558
|
children: [
|
|
559
|
-
/* @__PURE__ */ o(D, { onClick:
|
|
559
|
+
/* @__PURE__ */ o(D, { onClick: k, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ o(ur, { size: "1.25rem" }) }),
|
|
560
560
|
/* @__PURE__ */ o(
|
|
561
561
|
D,
|
|
562
562
|
{
|
|
563
|
-
onClick:
|
|
563
|
+
onClick: y,
|
|
564
564
|
title: "Kursiv tekst",
|
|
565
565
|
value: "italic",
|
|
566
566
|
children: /* @__PURE__ */ o(vr, { size: "1.25rem" })
|
|
@@ -575,14 +575,14 @@ const Er = Xe("div", {
|
|
|
575
575
|
children: /* @__PURE__ */ o(Sr, { size: "1.25rem" })
|
|
576
576
|
}
|
|
577
577
|
),
|
|
578
|
-
/* @__PURE__ */ o(D, { onClick:
|
|
578
|
+
/* @__PURE__ */ o(D, { onClick: b, title: "Kode", value: "code", children: /* @__PURE__ */ o(gr, { size: "1.25rem" }) }),
|
|
579
579
|
/* @__PURE__ */ o(
|
|
580
580
|
D,
|
|
581
581
|
{
|
|
582
|
-
onClick:
|
|
582
|
+
onClick: N,
|
|
583
583
|
title: "Superscript",
|
|
584
584
|
value: "superscript",
|
|
585
|
-
children: /* @__PURE__ */ o(
|
|
585
|
+
children: /* @__PURE__ */ o(yr, { size: "1.25rem" })
|
|
586
586
|
}
|
|
587
587
|
)
|
|
588
588
|
]
|
|
@@ -598,15 +598,15 @@ const Er = Xe("div", {
|
|
|
598
598
|
whileElementsMounted: Ft,
|
|
599
599
|
middleware: [
|
|
600
600
|
Fe({
|
|
601
|
-
apply: ({ rects:
|
|
602
|
-
g.floating.style.minWidth = `${
|
|
601
|
+
apply: ({ rects: h, elements: g }) => {
|
|
602
|
+
g.floating.style.minWidth = `${h.reference.width}px`;
|
|
603
603
|
}
|
|
604
604
|
}),
|
|
605
|
-
|
|
606
|
-
|
|
605
|
+
Ue(),
|
|
606
|
+
Ut({
|
|
607
607
|
mainAxis: 8
|
|
608
608
|
}),
|
|
609
|
-
|
|
609
|
+
We({
|
|
610
610
|
padding: 8
|
|
611
611
|
})
|
|
612
612
|
],
|
|
@@ -615,7 +615,7 @@ const Er = Xe("div", {
|
|
|
615
615
|
elements: {
|
|
616
616
|
reference: e.current
|
|
617
617
|
}
|
|
618
|
-
}), { getFloatingProps: c } =
|
|
618
|
+
}), { getFloatingProps: c } = Wt([
|
|
619
619
|
jt(l, {
|
|
620
620
|
role: "dialog"
|
|
621
621
|
})
|
|
@@ -638,7 +638,7 @@ const Er = Xe("div", {
|
|
|
638
638
|
}, Ar = ({
|
|
639
639
|
children: t,
|
|
640
640
|
...r
|
|
641
|
-
}) => /* @__PURE__ */
|
|
641
|
+
}) => /* @__PURE__ */ u(Re, { "aria-label": "Formattering", ...r, children: [
|
|
642
642
|
/* @__PURE__ */ o(Or, {}),
|
|
643
643
|
/* @__PURE__ */ o(Oe, {}),
|
|
644
644
|
/* @__PURE__ */ o($r, {}),
|
|
@@ -796,21 +796,21 @@ function Hr() {
|
|
|
796
796
|
Vt,
|
|
797
797
|
(r) => {
|
|
798
798
|
const e = gt(r);
|
|
799
|
-
return pe([e]), xt(e.getParentOrThrow()) && Ye(e,
|
|
799
|
+
return pe([e]), xt(e.getParentOrThrow()) && Ye(e, W).selectEnd(), !0;
|
|
800
800
|
},
|
|
801
801
|
me
|
|
802
802
|
)
|
|
803
803
|
);
|
|
804
804
|
}, [t]), null;
|
|
805
805
|
}
|
|
806
|
-
const Fr = () => /* @__PURE__ */
|
|
806
|
+
const Fr = () => /* @__PURE__ */ u(H, { children: [
|
|
807
807
|
/* @__PURE__ */ o(Ve, {}),
|
|
808
808
|
/* @__PURE__ */ o(tr, {}),
|
|
809
809
|
/* @__PURE__ */ o(Ze, {}),
|
|
810
810
|
/* @__PURE__ */ o(Dr, {}),
|
|
811
811
|
/* @__PURE__ */ o(er, {}),
|
|
812
812
|
/* @__PURE__ */ o(Hr, {})
|
|
813
|
-
] }),
|
|
813
|
+
] }), Ur = ({
|
|
814
814
|
state: t
|
|
815
815
|
}) => {
|
|
816
816
|
const [r] = L(), e = K(!1);
|
|
@@ -832,7 +832,7 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
832
832
|
}
|
|
833
833
|
}));
|
|
834
834
|
}, []), null;
|
|
835
|
-
},
|
|
835
|
+
}, Wr = $e("div", {
|
|
836
836
|
border: "1px solid $borderDarker",
|
|
837
837
|
borderRadius: "$md",
|
|
838
838
|
position: "relative",
|
|
@@ -872,7 +872,7 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
872
872
|
}), jr = ({
|
|
873
873
|
isLoading: t
|
|
874
874
|
}) => /* @__PURE__ */ o(
|
|
875
|
-
|
|
875
|
+
U,
|
|
876
876
|
{
|
|
877
877
|
css: {
|
|
878
878
|
visibility: t ? "visible" : "hidden",
|
|
@@ -894,15 +894,15 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
894
894
|
content: s,
|
|
895
895
|
hideBorder: d,
|
|
896
896
|
onBlur: c,
|
|
897
|
-
defaultState:
|
|
897
|
+
defaultState: h,
|
|
898
898
|
css: g,
|
|
899
|
-
signUrl:
|
|
899
|
+
signUrl: k
|
|
900
900
|
}) => {
|
|
901
|
-
const { hasFocus:
|
|
902
|
-
() => ({ hasFocus:
|
|
903
|
-
[
|
|
901
|
+
const { hasFocus: y, attributes: S } = sr({ onBlur: c }), b = K(null), N = zt(
|
|
902
|
+
() => ({ hasFocus: y, editorRef: b, signUrl: k }),
|
|
903
|
+
[y, k]
|
|
904
904
|
);
|
|
905
|
-
return /* @__PURE__ */ o(Jt.Provider, { value:
|
|
905
|
+
return /* @__PURE__ */ o(Jt.Provider, { value: N, children: /* @__PURE__ */ u(
|
|
906
906
|
Be,
|
|
907
907
|
{
|
|
908
908
|
initialConfig: {
|
|
@@ -915,11 +915,11 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
915
915
|
editable: !0
|
|
916
916
|
},
|
|
917
917
|
children: [
|
|
918
|
-
/* @__PURE__ */
|
|
919
|
-
|
|
918
|
+
/* @__PURE__ */ u(
|
|
919
|
+
Wr,
|
|
920
920
|
{
|
|
921
|
-
ref:
|
|
922
|
-
hasFocus:
|
|
921
|
+
ref: b,
|
|
922
|
+
hasFocus: y,
|
|
923
923
|
hideBorder: d,
|
|
924
924
|
css: g,
|
|
925
925
|
...S,
|
|
@@ -930,7 +930,7 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
930
930
|
{
|
|
931
931
|
contentEditable: s,
|
|
932
932
|
placeholder: e ? /* @__PURE__ */ o(
|
|
933
|
-
|
|
933
|
+
U,
|
|
934
934
|
{
|
|
935
935
|
css: {
|
|
936
936
|
position: "absolute",
|
|
@@ -953,7 +953,7 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
953
953
|
]
|
|
954
954
|
}
|
|
955
955
|
),
|
|
956
|
-
/* @__PURE__ */ o(
|
|
956
|
+
/* @__PURE__ */ o(Ur, { state: h }),
|
|
957
957
|
/* @__PURE__ */ o(H, { children: r })
|
|
958
958
|
]
|
|
959
959
|
}
|
|
@@ -1111,6 +1111,11 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
1111
1111
|
margin: "1.5em 10px",
|
|
1112
1112
|
padding: "0.5em 10px"
|
|
1113
1113
|
},
|
|
1114
|
+
".ain-rich-text-image": {
|
|
1115
|
+
display: "block",
|
|
1116
|
+
maxWidth: "100%",
|
|
1117
|
+
height: "auto"
|
|
1118
|
+
},
|
|
1114
1119
|
variants: {
|
|
1115
1120
|
size: {
|
|
1116
1121
|
xs: {
|
|
@@ -1152,20 +1157,24 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
1152
1157
|
uploadFile: t,
|
|
1153
1158
|
...r
|
|
1154
1159
|
}) => {
|
|
1155
|
-
const [e] = L(), [n, i] = p(null), a =
|
|
1160
|
+
const [e] = L(), [n, i] = p(null), a = (s) => {
|
|
1156
1161
|
var c;
|
|
1157
1162
|
const d = (c = s.target.files) == null ? void 0 : c[0];
|
|
1158
1163
|
if (d) {
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1164
|
+
const h = new Image(), g = window.URL.createObjectURL(d);
|
|
1165
|
+
h.onload = async () => {
|
|
1166
|
+
const k = await t.uploadFile({ file: d });
|
|
1167
|
+
i({ url: k, width: h.naturalWidth, height: h.naturalHeight }), window.URL.revokeObjectURL(g);
|
|
1168
|
+
}, h.src = g;
|
|
1161
1169
|
}
|
|
1162
1170
|
}, l = () => {
|
|
1163
1171
|
n && !t.isLoading && (e.dispatchCommand(Vt, {
|
|
1164
|
-
src: n,
|
|
1165
|
-
altText: `Image: ${n}
|
|
1172
|
+
src: n.url,
|
|
1173
|
+
altText: `Image: ${n.url}`,
|
|
1174
|
+
meta: { width: n.width, height: n.height }
|
|
1166
1175
|
}), r.onOpenChange(!1));
|
|
1167
1176
|
};
|
|
1168
|
-
return /* @__PURE__ */
|
|
1177
|
+
return /* @__PURE__ */ u(Pt, { ...r, children: [
|
|
1169
1178
|
/* @__PURE__ */ o(ze, { children: "Sett inn bilde" }),
|
|
1170
1179
|
t.isLoading && /* @__PURE__ */ o(ht, {}),
|
|
1171
1180
|
/* @__PURE__ */ o(
|
|
@@ -1177,10 +1186,10 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
1177
1186
|
disabled: t.isLoading
|
|
1178
1187
|
}
|
|
1179
1188
|
),
|
|
1180
|
-
/* @__PURE__ */
|
|
1181
|
-
/* @__PURE__ */ o(
|
|
1189
|
+
/* @__PURE__ */ u(Z, { children: [
|
|
1190
|
+
/* @__PURE__ */ o(w, { onClick: () => r.onOpenChange(!1), children: "Avbryt" }),
|
|
1182
1191
|
/* @__PURE__ */ o(
|
|
1183
|
-
|
|
1192
|
+
w,
|
|
1184
1193
|
{
|
|
1185
1194
|
variant: "primary",
|
|
1186
1195
|
disabled: !n || t.isLoading,
|
|
@@ -1198,19 +1207,19 @@ const Fr = () => /* @__PURE__ */ h(H, { children: [
|
|
|
1198
1207
|
includeHeaders: !1
|
|
1199
1208
|
});
|
|
1200
1209
|
}, [r]);
|
|
1201
|
-
return /* @__PURE__ */
|
|
1202
|
-
/* @__PURE__ */
|
|
1210
|
+
return /* @__PURE__ */ u(H, { children: [
|
|
1211
|
+
/* @__PURE__ */ u(
|
|
1203
1212
|
dt,
|
|
1204
1213
|
{
|
|
1205
1214
|
trigger: /* @__PURE__ */ o(At, { dropdown: !0, children: "Sett inn" }),
|
|
1206
1215
|
side: "bottom",
|
|
1207
1216
|
align: "end",
|
|
1208
1217
|
children: [
|
|
1209
|
-
/* @__PURE__ */
|
|
1210
|
-
/* @__PURE__ */ o(
|
|
1218
|
+
/* @__PURE__ */ u(v, { onClick: i, children: [
|
|
1219
|
+
/* @__PURE__ */ o(Nr, { size: "1.25rem" }),
|
|
1211
1220
|
" Tabell"
|
|
1212
1221
|
] }),
|
|
1213
|
-
t && /* @__PURE__ */
|
|
1222
|
+
t && /* @__PURE__ */ u(v, { onClick: () => n(!0), children: [
|
|
1214
1223
|
/* @__PURE__ */ o(Ge, { size: "1.25rem" }),
|
|
1215
1224
|
" Bilde"
|
|
1216
1225
|
] })
|
|
@@ -1241,14 +1250,14 @@ const On = () => {
|
|
|
1241
1250
|
elements: {
|
|
1242
1251
|
reference: r
|
|
1243
1252
|
},
|
|
1244
|
-
middleware: [
|
|
1253
|
+
middleware: [Ut({ mainAxis: -20, crossAxis: -2 })]
|
|
1245
1254
|
});
|
|
1246
1255
|
x(() => t.registerCommand(
|
|
1247
1256
|
j,
|
|
1248
1257
|
() => {
|
|
1249
1258
|
const s = _();
|
|
1250
1259
|
if (T(s)) {
|
|
1251
|
-
const d = s.anchor.getNode(), c =
|
|
1260
|
+
const d = s.anchor.getNode(), c = we(d);
|
|
1252
1261
|
e(c ? t.getElementByKey(c.getKey()) : null);
|
|
1253
1262
|
}
|
|
1254
1263
|
return !1;
|
|
@@ -1271,19 +1280,19 @@ const On = () => {
|
|
|
1271
1280
|
kt(!0);
|
|
1272
1281
|
break;
|
|
1273
1282
|
case "delete-row":
|
|
1274
|
-
|
|
1283
|
+
Ne();
|
|
1275
1284
|
break;
|
|
1276
1285
|
case "delete-column":
|
|
1277
|
-
|
|
1286
|
+
ye();
|
|
1278
1287
|
break;
|
|
1279
1288
|
}
|
|
1280
1289
|
});
|
|
1281
1290
|
};
|
|
1282
|
-
return r ? /* @__PURE__ */
|
|
1291
|
+
return r ? /* @__PURE__ */ u(
|
|
1283
1292
|
dt,
|
|
1284
1293
|
{
|
|
1285
1294
|
trigger: /* @__PURE__ */ o(
|
|
1286
|
-
|
|
1295
|
+
w,
|
|
1287
1296
|
{
|
|
1288
1297
|
icon: !0,
|
|
1289
1298
|
variant: "primary",
|
|
@@ -1362,7 +1371,7 @@ const Jr = ({ onClose: t }) => {
|
|
|
1362
1371
|
if (T(a) && a.isCollapsed()) {
|
|
1363
1372
|
const l = $(i);
|
|
1364
1373
|
a.insertNodes([l]);
|
|
1365
|
-
const s =
|
|
1374
|
+
const s = wt();
|
|
1366
1375
|
s.setTextNodeRange(l, 0, l, i.length), Q(s);
|
|
1367
1376
|
}
|
|
1368
1377
|
r.dispatchCommand(V, pt(i));
|
|
@@ -1370,13 +1379,13 @@ const Jr = ({ onClose: t }) => {
|
|
|
1370
1379
|
},
|
|
1371
1380
|
[r]
|
|
1372
1381
|
);
|
|
1373
|
-
return /* @__PURE__ */
|
|
1382
|
+
return /* @__PURE__ */ u("form", { onSubmit: (i) => {
|
|
1374
1383
|
e(i.currentTarget.url.value), t();
|
|
1375
1384
|
}, children: [
|
|
1376
1385
|
/* @__PURE__ */ o(Ht, { name: "url", label: "URL", type: "url", required: !0 }),
|
|
1377
|
-
/* @__PURE__ */
|
|
1378
|
-
/* @__PURE__ */ o(
|
|
1379
|
-
/* @__PURE__ */ o(
|
|
1386
|
+
/* @__PURE__ */ u(Z, { children: [
|
|
1387
|
+
/* @__PURE__ */ o(w, { onClick: t, children: "Avbryt" }),
|
|
1388
|
+
/* @__PURE__ */ o(w, { type: "submit", variant: "primary", children: "Sett inn" })
|
|
1380
1389
|
] })
|
|
1381
1390
|
] });
|
|
1382
1391
|
}, Xr = ({
|
|
@@ -1389,9 +1398,9 @@ const Jr = ({ onClose: t }) => {
|
|
|
1389
1398
|
const d = _();
|
|
1390
1399
|
if (T(d)) {
|
|
1391
1400
|
const c = [];
|
|
1392
|
-
for (const [
|
|
1393
|
-
const
|
|
1394
|
-
|
|
1401
|
+
for (const [h, g] of s.entries()) {
|
|
1402
|
+
const k = te(g.value);
|
|
1403
|
+
k.append($(g.label)), c.push(k), h !== s.length - 1 && c.push($(" "));
|
|
1395
1404
|
}
|
|
1396
1405
|
d.insertNodes(c);
|
|
1397
1406
|
}
|
|
@@ -1399,7 +1408,7 @@ const Jr = ({ onClose: t }) => {
|
|
|
1399
1408
|
},
|
|
1400
1409
|
[e]
|
|
1401
1410
|
);
|
|
1402
|
-
return /* @__PURE__ */
|
|
1411
|
+
return /* @__PURE__ */ u(H, { children: [
|
|
1403
1412
|
/* @__PURE__ */ o(
|
|
1404
1413
|
De,
|
|
1405
1414
|
{
|
|
@@ -1408,10 +1417,10 @@ const Jr = ({ onClose: t }) => {
|
|
|
1408
1417
|
onChange: (s) => i(s)
|
|
1409
1418
|
}
|
|
1410
1419
|
),
|
|
1411
|
-
/* @__PURE__ */
|
|
1412
|
-
/* @__PURE__ */ o(
|
|
1420
|
+
/* @__PURE__ */ u(Z, { children: [
|
|
1421
|
+
/* @__PURE__ */ o(w, { onClick: t, children: "Avbryt" }),
|
|
1413
1422
|
/* @__PURE__ */ o(
|
|
1414
|
-
|
|
1423
|
+
w,
|
|
1415
1424
|
{
|
|
1416
1425
|
variant: "primary",
|
|
1417
1426
|
onClick: () => {
|
|
@@ -1430,10 +1439,10 @@ const Jr = ({ onClose: t }) => {
|
|
|
1430
1439
|
var c;
|
|
1431
1440
|
const d = (c = s.target.files) == null ? void 0 : c[0];
|
|
1432
1441
|
if (d) {
|
|
1433
|
-
const
|
|
1442
|
+
const h = await r.uploadFile({ file: d });
|
|
1434
1443
|
i({
|
|
1435
1444
|
name: d.name,
|
|
1436
|
-
url:
|
|
1445
|
+
url: h
|
|
1437
1446
|
});
|
|
1438
1447
|
}
|
|
1439
1448
|
}, l = C(() => {
|
|
@@ -1444,13 +1453,13 @@ const Jr = ({ onClose: t }) => {
|
|
|
1444
1453
|
if (T(s) && s.isCollapsed()) {
|
|
1445
1454
|
const d = $(n.name);
|
|
1446
1455
|
s.insertNodes([d]);
|
|
1447
|
-
const c =
|
|
1456
|
+
const c = wt();
|
|
1448
1457
|
c.setTextNodeRange(d, 0, d, n.name.length), Q(c);
|
|
1449
1458
|
}
|
|
1450
1459
|
e.dispatchCommand(V, pt(n.url));
|
|
1451
1460
|
});
|
|
1452
1461
|
}, [e, n]);
|
|
1453
|
-
return /* @__PURE__ */
|
|
1462
|
+
return /* @__PURE__ */ u(H, { children: [
|
|
1454
1463
|
r.isLoading && /* @__PURE__ */ o(ht, {}),
|
|
1455
1464
|
/* @__PURE__ */ o(
|
|
1456
1465
|
"input",
|
|
@@ -1460,10 +1469,10 @@ const Jr = ({ onClose: t }) => {
|
|
|
1460
1469
|
disabled: r.isLoading
|
|
1461
1470
|
}
|
|
1462
1471
|
),
|
|
1463
|
-
/* @__PURE__ */
|
|
1464
|
-
/* @__PURE__ */ o(
|
|
1472
|
+
/* @__PURE__ */ u(Z, { children: [
|
|
1473
|
+
/* @__PURE__ */ o(w, { onClick: t, children: "Avbryt" }),
|
|
1465
1474
|
/* @__PURE__ */ o(
|
|
1466
|
-
|
|
1475
|
+
w,
|
|
1467
1476
|
{
|
|
1468
1477
|
variant: "primary",
|
|
1469
1478
|
onClick: () => {
|
|
@@ -1484,8 +1493,8 @@ const Jr = ({ onClose: t }) => {
|
|
|
1484
1493
|
const [i, a] = p("url"), l = () => {
|
|
1485
1494
|
r(!1);
|
|
1486
1495
|
};
|
|
1487
|
-
return /* @__PURE__ */
|
|
1488
|
-
/* @__PURE__ */
|
|
1496
|
+
return /* @__PURE__ */ u(Pt, { open: t, onOpenChange: r, css: { width: "600px" }, children: [
|
|
1497
|
+
/* @__PURE__ */ u(Ae, { css: { marginBottom: "$8" }, children: [
|
|
1489
1498
|
/* @__PURE__ */ o(ot, { active: i === "url", onClick: () => a("url"), children: "URL" }),
|
|
1490
1499
|
e && /* @__PURE__ */ o(
|
|
1491
1500
|
ot,
|
|
@@ -1508,15 +1517,15 @@ const Jr = ({ onClose: t }) => {
|
|
|
1508
1517
|
const [e] = L(), [n, i] = p(!1), [a, l] = p(!1), s = C(() => {
|
|
1509
1518
|
const d = _();
|
|
1510
1519
|
if (T(d)) {
|
|
1511
|
-
const c = Zt(d),
|
|
1512
|
-
i(Y(
|
|
1520
|
+
const c = Zt(d), h = c.getParent();
|
|
1521
|
+
i(Y(h) || Y(c));
|
|
1513
1522
|
}
|
|
1514
1523
|
}, []);
|
|
1515
1524
|
return x(() => e.registerCommand(
|
|
1516
1525
|
j,
|
|
1517
1526
|
() => (s(), !1),
|
|
1518
1527
|
at
|
|
1519
|
-
), [e, s]), /* @__PURE__ */
|
|
1528
|
+
), [e, s]), /* @__PURE__ */ u(Dt, { type: "single", value: n ? "link" : "", children: [
|
|
1520
1529
|
/* @__PURE__ */ o(
|
|
1521
1530
|
D,
|
|
1522
1531
|
{
|
|
@@ -1545,7 +1554,7 @@ const Jr = ({ onClose: t }) => {
|
|
|
1545
1554
|
a(e.getURL());
|
|
1546
1555
|
}) : a("");
|
|
1547
1556
|
}, [t, e]);
|
|
1548
|
-
const s = !!(e && i && l), { refs: d, floatingStyles: c, context:
|
|
1557
|
+
const s = !!(e && i && l), { refs: d, floatingStyles: c, context: h } = ut({
|
|
1549
1558
|
placement: "top",
|
|
1550
1559
|
strategy: "fixed",
|
|
1551
1560
|
open: s,
|
|
@@ -1554,39 +1563,39 @@ const Jr = ({ onClose: t }) => {
|
|
|
1554
1563
|
reference: r.current
|
|
1555
1564
|
},
|
|
1556
1565
|
middleware: [je()]
|
|
1557
|
-
}), { getFloatingProps: g } =
|
|
1558
|
-
jt(
|
|
1559
|
-
Ke(
|
|
1560
|
-
]),
|
|
1561
|
-
var
|
|
1562
|
-
const
|
|
1563
|
-
if (T(
|
|
1564
|
-
const E = Zt(
|
|
1566
|
+
}), { getFloatingProps: g } = Wt([
|
|
1567
|
+
jt(h),
|
|
1568
|
+
Ke(h)
|
|
1569
|
+
]), k = C(() => {
|
|
1570
|
+
var N;
|
|
1571
|
+
const b = _();
|
|
1572
|
+
if (T(b)) {
|
|
1573
|
+
const E = Zt(b), f = E.getParent();
|
|
1565
1574
|
let q = null;
|
|
1566
1575
|
if (Y(f) ? q = f : Y(E) && (q = E), q) {
|
|
1567
1576
|
const rt = window.getSelection(), mt = t.getRootElement();
|
|
1568
|
-
|
|
1577
|
+
b !== null && rt !== null && mt !== null && mt.contains(rt.anchorNode) && t.isEditable() && (r.current = ((N = rt.focusNode) == null ? void 0 : N.parentElement) ?? null);
|
|
1569
1578
|
}
|
|
1570
1579
|
n(q);
|
|
1571
1580
|
}
|
|
1572
|
-
}, [t]),
|
|
1581
|
+
}, [t]), y = C(() => {
|
|
1573
1582
|
e && Gr(e) && t.update(() => {
|
|
1574
1583
|
e.remove();
|
|
1575
1584
|
}), t.dispatchCommand(V, null);
|
|
1576
1585
|
}, [t, e]);
|
|
1577
1586
|
if (x(() => {
|
|
1578
1587
|
t.getEditorState().read(() => {
|
|
1579
|
-
|
|
1588
|
+
k();
|
|
1580
1589
|
});
|
|
1581
|
-
}, [t,
|
|
1582
|
-
t.registerUpdateListener(({ editorState:
|
|
1583
|
-
|
|
1584
|
-
|
|
1590
|
+
}, [t, k]), x(() => tt(
|
|
1591
|
+
t.registerUpdateListener(({ editorState: b }) => {
|
|
1592
|
+
b.read(() => {
|
|
1593
|
+
k();
|
|
1585
1594
|
});
|
|
1586
1595
|
}),
|
|
1587
1596
|
t.registerCommand(
|
|
1588
1597
|
j,
|
|
1589
|
-
() => (
|
|
1598
|
+
() => (k(), !0),
|
|
1590
1599
|
R
|
|
1591
1600
|
),
|
|
1592
1601
|
t.registerCommand(
|
|
@@ -1594,10 +1603,10 @@ const Jr = ({ onClose: t }) => {
|
|
|
1594
1603
|
() => e ? (n(null), !0) : !1,
|
|
1595
1604
|
ke
|
|
1596
1605
|
)
|
|
1597
|
-
), [t,
|
|
1606
|
+
), [t, k, e]), !s)
|
|
1598
1607
|
return null;
|
|
1599
1608
|
const S = pt(i);
|
|
1600
|
-
return /* @__PURE__ */ o(Kt, { children: /* @__PURE__ */
|
|
1609
|
+
return /* @__PURE__ */ o(Kt, { children: /* @__PURE__ */ u(
|
|
1601
1610
|
Bt,
|
|
1602
1611
|
{
|
|
1603
1612
|
ref: d.setFloating,
|
|
@@ -1612,7 +1621,7 @@ const Jr = ({ onClose: t }) => {
|
|
|
1612
1621
|
...g(),
|
|
1613
1622
|
children: [
|
|
1614
1623
|
/* @__PURE__ */ o(
|
|
1615
|
-
|
|
1624
|
+
U,
|
|
1616
1625
|
{
|
|
1617
1626
|
as: "a",
|
|
1618
1627
|
css: {
|
|
@@ -1629,7 +1638,7 @@ const Jr = ({ onClose: t }) => {
|
|
|
1629
1638
|
children: i
|
|
1630
1639
|
}
|
|
1631
1640
|
),
|
|
1632
|
-
/* @__PURE__ */ o(
|
|
1641
|
+
/* @__PURE__ */ o(w, { color: "danger", icon: !0, size: "sm", onClick: y, children: /* @__PURE__ */ o(Je, { size: 24 }) })
|
|
1633
1642
|
]
|
|
1634
1643
|
}
|
|
1635
1644
|
) });
|
|
@@ -1637,7 +1646,7 @@ const Jr = ({ onClose: t }) => {
|
|
|
1637
1646
|
export {
|
|
1638
1647
|
gt as $createImageNode,
|
|
1639
1648
|
te as $createRutineLinkNode,
|
|
1640
|
-
|
|
1649
|
+
yn as $isImageNode,
|
|
1641
1650
|
Gr as $isRutineLinkNode,
|
|
1642
1651
|
zr as FloatingToolbar,
|
|
1643
1652
|
z as ImageNode,
|
|
@@ -1651,7 +1660,7 @@ export {
|
|
|
1651
1660
|
$n as RutineLinkNodeInit,
|
|
1652
1661
|
On as TableEditPlugin,
|
|
1653
1662
|
ar as clearEditorState,
|
|
1654
|
-
|
|
1663
|
+
Nn as defaultNodes,
|
|
1655
1664
|
Sn as defaultViewNodes,
|
|
1656
1665
|
ir as isEditorState,
|
|
1657
1666
|
Gt as isJSON,
|
|
@@ -1659,7 +1668,7 @@ export {
|
|
|
1659
1668
|
In as richTextCss,
|
|
1660
1669
|
Kr as richTextStyleObj,
|
|
1661
1670
|
lr as setStateFromPlainText,
|
|
1662
|
-
|
|
1671
|
+
wn as stateToHTML,
|
|
1663
1672
|
sr as useHasFocusWithin,
|
|
1664
1673
|
et as useRichTextContext
|
|
1665
1674
|
};
|