@arkitektbedriftene/fe-lib 0.4.32 → 0.4.34
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,9 +1,8 @@
|
|
|
1
|
-
import { LinkNode, type SerializedLinkNode } from "@lexical/link";
|
|
2
|
-
import type { EditorConfig } from "lexical";
|
|
1
|
+
import { type LinkAttributes, LinkNode, type SerializedLinkNode } from "@lexical/link";
|
|
3
2
|
export declare class LinkTargetNode extends LinkNode {
|
|
4
3
|
static getType(): string;
|
|
4
|
+
constructor(url: string, attrs?: LinkAttributes, key?: string);
|
|
5
5
|
static clone(node: LinkTargetNode): LinkTargetNode;
|
|
6
|
-
createDOM(config: EditorConfig): HTMLAnchorElement;
|
|
7
6
|
exportJSON(): SerializedLinkNode;
|
|
8
7
|
static importJSON(serializedNode: SerializedLinkNode): LinkNode;
|
|
9
8
|
}
|
package/dist/rich-text.es.js
CHANGED
|
@@ -3,7 +3,7 @@ var Jt = (t, e, r) => e in t ? Gt(t, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var st = (t, e, r) => (Jt(t, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
4
|
import { createHeadlessEditor as Xt } from "@lexical/headless";
|
|
5
5
|
import { $generateHtmlFromNodes as Qt } from "@lexical/html";
|
|
6
|
-
import { $getRoot as K, ParagraphNode as Vt, $createParagraphNode as q, $createTextNode as
|
|
6
|
+
import { $getRoot as K, ParagraphNode as Vt, $createParagraphNode as q, $createTextNode as D, $setSelection as bt, SELECTION_CHANGE_COMMAND as F, $getSelection as T, COMMAND_PRIORITY_CRITICAL as Q, $isRangeSelection as L, $isRootOrShadowRoot as Zt, FORMAT_TEXT_COMMAND as B, COMMAND_PRIORITY_LOW as E, KEY_ARROW_DOWN_COMMAND as te, KEY_ARROW_UP_COMMAND as ee, KEY_ESCAPE_COMMAND as vt, KEY_SPACE_COMMAND as re, $getNearestNodeFromDOMNode as V, KEY_ARROW_LEFT_COMMAND as ne, $isElementNode as oe, COMMAND_PRIORITY_NORMAL as ie, $isParagraphNode as ae, COMMAND_PRIORITY_HIGH as le } from "lexical";
|
|
7
7
|
import { trimTextContentFromAnchor as se, $setBlocksType as J, $isAtNodeEnd as ct } from "@lexical/selection";
|
|
8
8
|
import { LinkNode as z, AutoLinkNode as Mt, $isLinkNode as U, TOGGLE_LINK_COMMAND as Z } from "@lexical/link";
|
|
9
9
|
import { ListNode as tt, ListItemNode as Ct, $isListNode as et, INSERT_UNORDERED_LIST_COMMAND as ce, INSERT_ORDERED_LIST_COMMAND as de, INSERT_CHECK_LIST_COMMAND as Tt, insertList as ue, $isListItemNode as O } from "@lexical/list";
|
|
@@ -11,13 +11,13 @@ import { HeadingNode as Lt, QuoteNode as xt, $isHeadingNode as he, $createHeadin
|
|
|
11
11
|
import { TableNode as yt, TableRowNode as Nt, TableCellNode as St, INSERT_TABLE_COMMAND as fe, $getTableCellNodeFromLexicalNode as me, $deleteTableColumn__EXPERIMENTAL as ke, $deleteTableRow__EXPERIMENTAL as be, $insertTableColumn__EXPERIMENTAL as dt, $insertTableRow__EXPERIMENTAL as ut } from "@lexical/table";
|
|
12
12
|
import { jsx as n, jsxs as g, Fragment as Y } from "react/jsx-runtime";
|
|
13
13
|
import { createContext as ve, useState as b, useRef as rt, useCallback as v, useContext as Me, useEffect as x, useMemo as wt, useLayoutEffect as Ce } from "react";
|
|
14
|
-
import { s as Et, D as nt, T as _t, a as C, B as P, b as Rt, c as I, u as ot, d as It, e as Te, f as Le, o as zt, g as xe, h as Ot, i as $t, F as At, O as
|
|
14
|
+
import { s as Et, D as nt, T as _t, a as C, B as P, b as Rt, c as I, u as ot, d as It, e as Te, f as Le, o as zt, g as xe, h as Ot, i as $t, F as At, O as Bt, j as ye, k as Ne, S as Se, l as we, m as $, n as R, p as ht, q as Ee, N as _e, r as pt, t as Re, v as Dt, C as Ie, w as ze, x as Oe } from "./Checkbox-0c1030b1.js";
|
|
15
15
|
import "react-select";
|
|
16
16
|
import { LexicalComposer as $e } from "@lexical/react/LexicalComposer.js";
|
|
17
17
|
import { RichTextPlugin as Ae } from "@lexical/react/LexicalRichTextPlugin.js";
|
|
18
|
-
import
|
|
18
|
+
import Be from "@lexical/react/LexicalErrorBoundary.js";
|
|
19
19
|
import { useLexicalComposerContext as y } from "@lexical/react/LexicalComposerContext.js";
|
|
20
|
-
import { $getNearestNodeOfType as
|
|
20
|
+
import { $getNearestNodeOfType as De, $findMatchingParent as Pt, mergeRegister as it, isHTMLElement as gt } from "@lexical/utils";
|
|
21
21
|
import { G as h, f as Pe } from "./index.esm-3266b7f8.js";
|
|
22
22
|
import { ListPlugin as Fe } from "@lexical/react/LexicalListPlugin.js";
|
|
23
23
|
import { HistoryPlugin as He } from "@lexical/react/LexicalHistoryPlugin.js";
|
|
@@ -70,7 +70,7 @@ const je = ({
|
|
|
70
70
|
const r = K();
|
|
71
71
|
r.clear();
|
|
72
72
|
const o = q();
|
|
73
|
-
o.append(
|
|
73
|
+
o.append(D("")), r.append(o), bt(null);
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
76
|
tag: e
|
|
@@ -82,7 +82,7 @@ const je = ({
|
|
|
82
82
|
const o = K();
|
|
83
83
|
o.clear();
|
|
84
84
|
const i = q();
|
|
85
|
-
i.append(
|
|
85
|
+
i.append(D(t.trim())), o.append(i), bt(null);
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
tag: r
|
|
@@ -100,7 +100,7 @@ const je = ({
|
|
|
100
100
|
if (typeof t == "string" && !Ht(t))
|
|
101
101
|
i.update(() => {
|
|
102
102
|
const a = K(), s = q();
|
|
103
|
-
s.append(
|
|
103
|
+
s.append(D(t.trim())), a.append(s);
|
|
104
104
|
});
|
|
105
105
|
else {
|
|
106
106
|
const a = i.parseEditorState(t, () => {
|
|
@@ -124,6 +124,16 @@ class W extends z {
|
|
|
124
124
|
static getType() {
|
|
125
125
|
return "target-link";
|
|
126
126
|
}
|
|
127
|
+
constructor(e, r, o) {
|
|
128
|
+
let i = !1;
|
|
129
|
+
const l = { ...r };
|
|
130
|
+
try {
|
|
131
|
+
const a = new URL(e);
|
|
132
|
+
window.location.hostname !== a.hostname && (i = !0);
|
|
133
|
+
} catch {
|
|
134
|
+
}
|
|
135
|
+
i && (l.target = "_blank", l.rel = "noopener noreferrer"), super(e, l, o);
|
|
136
|
+
}
|
|
127
137
|
static clone(e) {
|
|
128
138
|
return new W(
|
|
129
139
|
e.__url,
|
|
@@ -131,10 +141,6 @@ class W extends z {
|
|
|
131
141
|
e.__key
|
|
132
142
|
);
|
|
133
143
|
}
|
|
134
|
-
createDOM(e) {
|
|
135
|
-
const r = super.createDOM(e);
|
|
136
|
-
return r.setAttribute("target", "_blank"), r.setAttribute("rel", "noopener noreferrer"), r;
|
|
137
|
-
}
|
|
138
144
|
exportJSON() {
|
|
139
145
|
return super.exportJSON();
|
|
140
146
|
}
|
|
@@ -167,8 +173,7 @@ const dn = [
|
|
|
167
173
|
replace: z,
|
|
168
174
|
with: (t) => new W(
|
|
169
175
|
t.getURL(),
|
|
170
|
-
{ rel: t.__rel, target: t.__target, title: t.__title }
|
|
171
|
-
t.getKey()
|
|
176
|
+
{ rel: t.__rel, target: t.__target, title: t.__title }
|
|
172
177
|
)
|
|
173
178
|
}
|
|
174
179
|
], Ut = ve({ hasFocus: !1, editorRef: { current: null } }), Je = ({ onBlur: t }) => {
|
|
@@ -307,7 +312,7 @@ const gr = Et("div", {
|
|
|
307
312
|
const { element: u, anchorNode: m } = f, w = u.getKey();
|
|
308
313
|
if (t.getElementByKey(w) !== null)
|
|
309
314
|
if (et(u)) {
|
|
310
|
-
const k =
|
|
315
|
+
const k = De(
|
|
311
316
|
m,
|
|
312
317
|
tt
|
|
313
318
|
), S = k ? k.getListType() : u.getListType();
|
|
@@ -388,19 +393,19 @@ const gr = Et("div", {
|
|
|
388
393
|
})
|
|
389
394
|
), [t, u]);
|
|
390
395
|
const m = v(
|
|
391
|
-
() => t.dispatchCommand(
|
|
396
|
+
() => t.dispatchCommand(B, "bold"),
|
|
392
397
|
[t]
|
|
393
398
|
), w = v(
|
|
394
|
-
() => t.dispatchCommand(
|
|
399
|
+
() => t.dispatchCommand(B, "italic"),
|
|
395
400
|
[t]
|
|
396
401
|
), N = v(
|
|
397
|
-
() => t.dispatchCommand(
|
|
402
|
+
() => t.dispatchCommand(B, "underline"),
|
|
398
403
|
[t]
|
|
399
404
|
), k = v(
|
|
400
|
-
() => t.dispatchCommand(
|
|
405
|
+
() => t.dispatchCommand(B, "code"),
|
|
401
406
|
[t]
|
|
402
407
|
), S = v(
|
|
403
|
-
() => t.dispatchCommand(
|
|
408
|
+
() => t.dispatchCommand(B, "superscript"),
|
|
404
409
|
[t]
|
|
405
410
|
), A = wt(() => {
|
|
406
411
|
const p = [];
|
|
@@ -494,7 +499,7 @@ const gr = Et("div", {
|
|
|
494
499
|
})
|
|
495
500
|
]);
|
|
496
501
|
return i ? /* @__PURE__ */ n(At, { children: /* @__PURE__ */ n(
|
|
497
|
-
|
|
502
|
+
Bt,
|
|
498
503
|
{
|
|
499
504
|
ref: s.setFloating,
|
|
500
505
|
style: d,
|
|
@@ -792,7 +797,7 @@ const xr = () => /* @__PURE__ */ g(Y, { children: [
|
|
|
792
797
|
children: r
|
|
793
798
|
}
|
|
794
799
|
) : null,
|
|
795
|
-
ErrorBoundary:
|
|
800
|
+
ErrorBoundary: Be
|
|
796
801
|
}
|
|
797
802
|
),
|
|
798
803
|
/* @__PURE__ */ n(xr, {}),
|
|
@@ -1165,7 +1170,7 @@ const Rr = ({ onClose: t }) => {
|
|
|
1165
1170
|
r(i.target.url.value), t();
|
|
1166
1171
|
}, children: [
|
|
1167
1172
|
/* @__PURE__ */ n(Re, { name: "url", label: "URL", type: "url", required: !0 }),
|
|
1168
|
-
/* @__PURE__ */ g(
|
|
1173
|
+
/* @__PURE__ */ g(Dt, { children: [
|
|
1169
1174
|
/* @__PURE__ */ n($, { onClick: t, children: "Avbryt" }),
|
|
1170
1175
|
/* @__PURE__ */ n($, { type: "submit", variant: "primary", children: "Lagre" })
|
|
1171
1176
|
] })
|
|
@@ -1179,7 +1184,7 @@ const Rr = ({ onClose: t }) => {
|
|
|
1179
1184
|
const c = [];
|
|
1180
1185
|
for (const [f, u] of s.entries()) {
|
|
1181
1186
|
const m = Yt(u.value);
|
|
1182
|
-
m.append(
|
|
1187
|
+
m.append(D(u.label)), c.push(m), f !== s.length - 1 && c.push(D(" "));
|
|
1183
1188
|
}
|
|
1184
1189
|
d.insertNodes(c);
|
|
1185
1190
|
}
|
|
@@ -1189,7 +1194,7 @@ const Rr = ({ onClose: t }) => {
|
|
|
1189
1194
|
);
|
|
1190
1195
|
return /* @__PURE__ */ g(Y, { children: [
|
|
1191
1196
|
/* @__PURE__ */ n(Ie, { isMulti: !0, options: l, onChange: i }),
|
|
1192
|
-
/* @__PURE__ */ g(
|
|
1197
|
+
/* @__PURE__ */ g(Dt, { children: [
|
|
1193
1198
|
/* @__PURE__ */ n($, { onClick: t, children: "Avbryt" }),
|
|
1194
1199
|
/* @__PURE__ */ n(
|
|
1195
1200
|
$,
|
|
@@ -1312,7 +1317,7 @@ const Rr = ({ onClose: t }) => {
|
|
|
1312
1317
|
return null;
|
|
1313
1318
|
const N = Kt(i);
|
|
1314
1319
|
return /* @__PURE__ */ n(At, { children: /* @__PURE__ */ g(
|
|
1315
|
-
|
|
1320
|
+
Bt,
|
|
1316
1321
|
{
|
|
1317
1322
|
ref: d.setFloating,
|
|
1318
1323
|
css: {
|