@arkitektbedriftene/fe-lib 0.4.33 → 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
|
}
|
|
@@ -306,7 +312,7 @@ const gr = Et("div", {
|
|
|
306
312
|
const { element: u, anchorNode: m } = f, w = u.getKey();
|
|
307
313
|
if (t.getElementByKey(w) !== null)
|
|
308
314
|
if (et(u)) {
|
|
309
|
-
const k =
|
|
315
|
+
const k = De(
|
|
310
316
|
m,
|
|
311
317
|
tt
|
|
312
318
|
), S = k ? k.getListType() : u.getListType();
|
|
@@ -387,19 +393,19 @@ const gr = Et("div", {
|
|
|
387
393
|
})
|
|
388
394
|
), [t, u]);
|
|
389
395
|
const m = v(
|
|
390
|
-
() => t.dispatchCommand(
|
|
396
|
+
() => t.dispatchCommand(B, "bold"),
|
|
391
397
|
[t]
|
|
392
398
|
), w = v(
|
|
393
|
-
() => t.dispatchCommand(
|
|
399
|
+
() => t.dispatchCommand(B, "italic"),
|
|
394
400
|
[t]
|
|
395
401
|
), N = v(
|
|
396
|
-
() => t.dispatchCommand(
|
|
402
|
+
() => t.dispatchCommand(B, "underline"),
|
|
397
403
|
[t]
|
|
398
404
|
), k = v(
|
|
399
|
-
() => t.dispatchCommand(
|
|
405
|
+
() => t.dispatchCommand(B, "code"),
|
|
400
406
|
[t]
|
|
401
407
|
), S = v(
|
|
402
|
-
() => t.dispatchCommand(
|
|
408
|
+
() => t.dispatchCommand(B, "superscript"),
|
|
403
409
|
[t]
|
|
404
410
|
), A = wt(() => {
|
|
405
411
|
const p = [];
|
|
@@ -493,7 +499,7 @@ const gr = Et("div", {
|
|
|
493
499
|
})
|
|
494
500
|
]);
|
|
495
501
|
return i ? /* @__PURE__ */ n(At, { children: /* @__PURE__ */ n(
|
|
496
|
-
|
|
502
|
+
Bt,
|
|
497
503
|
{
|
|
498
504
|
ref: s.setFloating,
|
|
499
505
|
style: d,
|
|
@@ -791,7 +797,7 @@ const xr = () => /* @__PURE__ */ g(Y, { children: [
|
|
|
791
797
|
children: r
|
|
792
798
|
}
|
|
793
799
|
) : null,
|
|
794
|
-
ErrorBoundary:
|
|
800
|
+
ErrorBoundary: Be
|
|
795
801
|
}
|
|
796
802
|
),
|
|
797
803
|
/* @__PURE__ */ n(xr, {}),
|
|
@@ -1164,7 +1170,7 @@ const Rr = ({ onClose: t }) => {
|
|
|
1164
1170
|
r(i.target.url.value), t();
|
|
1165
1171
|
}, children: [
|
|
1166
1172
|
/* @__PURE__ */ n(Re, { name: "url", label: "URL", type: "url", required: !0 }),
|
|
1167
|
-
/* @__PURE__ */ g(
|
|
1173
|
+
/* @__PURE__ */ g(Dt, { children: [
|
|
1168
1174
|
/* @__PURE__ */ n($, { onClick: t, children: "Avbryt" }),
|
|
1169
1175
|
/* @__PURE__ */ n($, { type: "submit", variant: "primary", children: "Lagre" })
|
|
1170
1176
|
] })
|
|
@@ -1178,7 +1184,7 @@ const Rr = ({ onClose: t }) => {
|
|
|
1178
1184
|
const c = [];
|
|
1179
1185
|
for (const [f, u] of s.entries()) {
|
|
1180
1186
|
const m = Yt(u.value);
|
|
1181
|
-
m.append(
|
|
1187
|
+
m.append(D(u.label)), c.push(m), f !== s.length - 1 && c.push(D(" "));
|
|
1182
1188
|
}
|
|
1183
1189
|
d.insertNodes(c);
|
|
1184
1190
|
}
|
|
@@ -1188,7 +1194,7 @@ const Rr = ({ onClose: t }) => {
|
|
|
1188
1194
|
);
|
|
1189
1195
|
return /* @__PURE__ */ g(Y, { children: [
|
|
1190
1196
|
/* @__PURE__ */ n(Ie, { isMulti: !0, options: l, onChange: i }),
|
|
1191
|
-
/* @__PURE__ */ g(
|
|
1197
|
+
/* @__PURE__ */ g(Dt, { children: [
|
|
1192
1198
|
/* @__PURE__ */ n($, { onClick: t, children: "Avbryt" }),
|
|
1193
1199
|
/* @__PURE__ */ n(
|
|
1194
1200
|
$,
|
|
@@ -1311,7 +1317,7 @@ const Rr = ({ onClose: t }) => {
|
|
|
1311
1317
|
return null;
|
|
1312
1318
|
const N = Kt(i);
|
|
1313
1319
|
return /* @__PURE__ */ n(At, { children: /* @__PURE__ */ g(
|
|
1314
|
-
|
|
1320
|
+
Bt,
|
|
1315
1321
|
{
|
|
1316
1322
|
ref: d.setFloating,
|
|
1317
1323
|
css: {
|