@arkitektbedriftene/fe-lib 1.5.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.
- package/dist/rich-text/Plugins/Image/ImageComponent.d.ts +1 -2
- package/dist/rich-text/Plugins/Image/ImageNode.d.ts +18 -5
- package/dist/rich-text/rich-text.d.ts +1 -0
- package/dist/rich-text/state.d.ts +5 -5
- package/dist/rich-text/styles.d.ts +5 -0
- package/dist/rich-text.es.js +341 -324
- package/package.json +1 -1
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
|
|
9
|
-
import { ListNode as st, ListItemNode as
|
|
10
|
-
import { HeadingNode as Et, QuoteNode as It, $isHeadingNode as
|
|
11
|
-
import { TableNode as Rt, TableRowNode as Ot, TableCellNode as
|
|
12
|
-
import { jsx as o, jsxs as
|
|
13
|
-
import { createContext as Se, useState as p, useRef as K, useCallback as C, useContext as Ee, useEffect as x, useMemo as
|
|
14
|
-
import { DropdownMenu as dt, ToolbarButton as At, DropdownMenuIconItem as v, Box 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
|
+
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 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
|
+
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 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";
|
|
@@ -36,20 +36,20 @@ const nr = ({
|
|
|
36
36
|
const n = typeof e == "number", i = typeof r == "number";
|
|
37
37
|
if (!n && !i)
|
|
38
38
|
return t.length;
|
|
39
|
-
let
|
|
40
|
-
for (;
|
|
41
|
-
t[
|
|
42
|
-
` &&
|
|
43
|
-
return t.slice(0,
|
|
39
|
+
let a = 0, l = 0;
|
|
40
|
+
for (; l < t.length && (!n || a < e) && (!i || l < r); )
|
|
41
|
+
t[l] === `
|
|
42
|
+
` && a++, l++;
|
|
43
|
+
return t.slice(0, l).length;
|
|
44
44
|
}, or = ({
|
|
45
45
|
editor: t,
|
|
46
46
|
maxChars: r,
|
|
47
47
|
maxLines: e
|
|
48
48
|
}) => {
|
|
49
|
-
const n = X(), i = n.getTextContent(),
|
|
50
|
-
be(t, d,
|
|
49
|
+
const n = X(), i = n.getTextContent(), a = nr({ text: i, maxChars: r, maxLines: e }), l = i.length - a, d = n.select().anchor;
|
|
50
|
+
be(t, d, l);
|
|
51
51
|
const c = n.getLastChild();
|
|
52
|
-
return c instanceof ie && c.getChildrenSize() === 0 && c.remove(),
|
|
52
|
+
return c instanceof ie && c.getChildrenSize() === 0 && c.remove(), l;
|
|
53
53
|
}, Yt = {
|
|
54
54
|
quote: "ain-rich-text-quote",
|
|
55
55
|
text: {
|
|
@@ -67,8 +67,8 @@ const nr = ({
|
|
|
67
67
|
() => {
|
|
68
68
|
const e = X();
|
|
69
69
|
e.clear();
|
|
70
|
-
const n =
|
|
71
|
-
n.append(
|
|
70
|
+
const n = W();
|
|
71
|
+
n.append($("")), e.append(n), Q(null);
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
tag: r
|
|
@@ -79,14 +79,15 @@ const nr = ({
|
|
|
79
79
|
() => {
|
|
80
80
|
const n = X();
|
|
81
81
|
n.clear();
|
|
82
|
-
const i =
|
|
83
|
-
i.append(
|
|
82
|
+
const i = W();
|
|
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
|
+
var l;
|
|
90
91
|
let n = 0;
|
|
91
92
|
const i = ne({
|
|
92
93
|
nodes: r,
|
|
@@ -97,40 +98,40 @@ const nr = ({
|
|
|
97
98
|
try {
|
|
98
99
|
if (typeof t == "string" && !Gt(t))
|
|
99
100
|
i.update(() => {
|
|
100
|
-
const
|
|
101
|
-
|
|
101
|
+
const s = X(), d = W();
|
|
102
|
+
d.append($(t.trim())), s.append(d);
|
|
102
103
|
});
|
|
103
104
|
else {
|
|
104
|
-
const
|
|
105
|
+
const s = i.parseEditorState(t, () => {
|
|
105
106
|
(e == null ? void 0 : e.maxLines) !== void 0 && (n = or({
|
|
106
107
|
editor: i,
|
|
107
108
|
maxLines: e.maxLines
|
|
108
109
|
}));
|
|
109
110
|
});
|
|
110
|
-
|
|
111
|
+
s.isEmpty() || i.setEditorState(s);
|
|
111
112
|
}
|
|
112
|
-
} catch (
|
|
113
|
-
console.error(
|
|
113
|
+
} catch (s) {
|
|
114
|
+
console.error(s);
|
|
114
115
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}), { html:
|
|
116
|
+
await ((l = e == null ? void 0 : e.updateFn) == null ? void 0 : l.call(e, i));
|
|
117
|
+
let a = "";
|
|
118
|
+
return i.read(() => {
|
|
119
|
+
a = oe(i);
|
|
120
|
+
}), { html: a, trimCount: n };
|
|
120
121
|
};
|
|
121
|
-
class G extends
|
|
122
|
+
class G extends B {
|
|
122
123
|
static getType() {
|
|
123
124
|
return "target-link";
|
|
124
125
|
}
|
|
125
126
|
constructor(r, e, n) {
|
|
126
127
|
let i = !1;
|
|
127
|
-
const
|
|
128
|
+
const a = { ...e };
|
|
128
129
|
try {
|
|
129
|
-
const
|
|
130
|
-
window.location.hostname !==
|
|
130
|
+
const l = new URL(r);
|
|
131
|
+
window.location.hostname !== l.hostname && (i = !0);
|
|
131
132
|
} catch {
|
|
132
133
|
}
|
|
133
|
-
i && (
|
|
134
|
+
i && (a.target = "_blank", a.rel = "noopener noreferrer"), super(r, a, n);
|
|
134
135
|
}
|
|
135
136
|
static clone(r) {
|
|
136
137
|
return new G(
|
|
@@ -143,13 +144,13 @@ class G extends D {
|
|
|
143
144
|
return super.exportJSON();
|
|
144
145
|
}
|
|
145
146
|
static importJSON(r) {
|
|
146
|
-
return
|
|
147
|
+
return B.importJSON(r);
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
150
|
const Jt = Se({ hasFocus: !1, editorRef: { current: null }, signUrl: void 0 }), sr = ({ onBlur: t }) => {
|
|
150
151
|
const [r, e] = p(!1), n = K(null), i = C(() => {
|
|
151
152
|
e(!0), n.current && window.clearTimeout(n.current);
|
|
152
|
-
}, []),
|
|
153
|
+
}, []), a = C(() => {
|
|
153
154
|
n.current = window.setTimeout(() => {
|
|
154
155
|
e(!1), t == null || t();
|
|
155
156
|
}, 0);
|
|
@@ -158,7 +159,7 @@ const Jt = Se({ hasFocus: !1, editorRef: { current: null }, signUrl: void 0 }),
|
|
|
158
159
|
hasFocus: r,
|
|
159
160
|
attributes: {
|
|
160
161
|
onFocus: i,
|
|
161
|
-
onBlur:
|
|
162
|
+
onBlur: a
|
|
162
163
|
}
|
|
163
164
|
};
|
|
164
165
|
}, et = () => Ee(Jt), cr = (t) => t.startsWith("https://devfilesab.blob.core.windows.net") || t.startsWith("https://filesab.blob.core.windows.net");
|
|
@@ -166,15 +167,14 @@ function dr({
|
|
|
166
167
|
src: t,
|
|
167
168
|
altText: r,
|
|
168
169
|
width: e,
|
|
169
|
-
height: n
|
|
170
|
-
maxWidth: i
|
|
170
|
+
height: n
|
|
171
171
|
}) {
|
|
172
|
-
const { signUrl:
|
|
172
|
+
const { signUrl: i } = et(), [a, l] = p(cr(t) ? "" : t), s = K(!1);
|
|
173
173
|
return x(() => {
|
|
174
|
-
const
|
|
175
|
-
|
|
174
|
+
const d = async () => {
|
|
175
|
+
l(await (i == null ? void 0 : i(t)) ?? t);
|
|
176
176
|
};
|
|
177
|
-
!a && !
|
|
177
|
+
!a && !s.current && (s.current = !0, d());
|
|
178
178
|
}, []), a ? /* @__PURE__ */ o(
|
|
179
179
|
"img",
|
|
180
180
|
{
|
|
@@ -182,52 +182,52 @@ function dr({
|
|
|
182
182
|
alt: r,
|
|
183
183
|
style: {
|
|
184
184
|
height: n,
|
|
185
|
-
maxWidth: i,
|
|
186
185
|
width: e
|
|
187
|
-
}
|
|
186
|
+
},
|
|
187
|
+
className: "ain-rich-text-image"
|
|
188
188
|
}
|
|
189
189
|
) : /* @__PURE__ */ o("span", {});
|
|
190
190
|
}
|
|
191
191
|
function hr(t) {
|
|
192
|
-
const r = t, { alt: e, src: n, width: i, height:
|
|
193
|
-
return { node: gt({ altText: e, height:
|
|
192
|
+
const r = t, { alt: e, src: n, width: i, height: a } = r;
|
|
193
|
+
return { node: gt({ altText: e, height: a, src: n, width: i }) };
|
|
194
194
|
}
|
|
195
|
-
class
|
|
196
|
-
constructor(e, n, i,
|
|
195
|
+
class z extends ae {
|
|
196
|
+
constructor(e, n, i, a, l, s) {
|
|
197
197
|
super(s);
|
|
198
198
|
I(this, "__src");
|
|
199
199
|
I(this, "__altText");
|
|
200
200
|
I(this, "__width");
|
|
201
201
|
I(this, "__height");
|
|
202
|
-
I(this, "
|
|
203
|
-
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;
|
|
204
204
|
}
|
|
205
205
|
static getType() {
|
|
206
206
|
return "image";
|
|
207
207
|
}
|
|
208
208
|
static clone(e) {
|
|
209
|
-
return new
|
|
209
|
+
return new z(
|
|
210
210
|
e.__src,
|
|
211
211
|
e.__altText,
|
|
212
|
-
e.__maxWidth,
|
|
213
212
|
e.__width,
|
|
214
213
|
e.__height,
|
|
214
|
+
e.__meta,
|
|
215
215
|
e.__key
|
|
216
216
|
);
|
|
217
217
|
}
|
|
218
218
|
static importJSON(e) {
|
|
219
|
-
const { altText: n, height: i, width:
|
|
219
|
+
const { altText: n, height: i, width: a, src: l, meta: s } = e;
|
|
220
220
|
return gt({
|
|
221
221
|
altText: n,
|
|
222
222
|
height: i,
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
223
|
+
src: l,
|
|
224
|
+
width: a,
|
|
225
|
+
meta: s
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
228
|
exportDOM() {
|
|
229
229
|
const e = document.createElement("img");
|
|
230
|
-
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 };
|
|
231
231
|
}
|
|
232
232
|
static importDOM() {
|
|
233
233
|
return {
|
|
@@ -241,21 +241,24 @@ class H extends ae {
|
|
|
241
241
|
return {
|
|
242
242
|
altText: this.getAltText(),
|
|
243
243
|
height: this.__height === "inherit" ? 0 : this.__height,
|
|
244
|
-
maxWidth: this.__maxWidth,
|
|
245
244
|
src: this.getSrc(),
|
|
246
245
|
type: "image",
|
|
247
246
|
version: 1,
|
|
248
|
-
width: this.__width === "inherit" ? 0 : this.__width
|
|
247
|
+
width: this.__width === "inherit" ? 0 : this.__width,
|
|
248
|
+
meta: this.__meta
|
|
249
249
|
};
|
|
250
250
|
}
|
|
251
|
+
setSrc(e) {
|
|
252
|
+
const n = this.getWritable();
|
|
253
|
+
n.__src = e;
|
|
254
|
+
}
|
|
251
255
|
setWidthAndHeight(e, n) {
|
|
252
256
|
const i = this.getWritable();
|
|
253
257
|
i.__width = e, i.__height = n;
|
|
254
258
|
}
|
|
255
259
|
// View
|
|
256
260
|
createDOM(e) {
|
|
257
|
-
|
|
258
|
-
return l !== void 0 && (n.className = l), n;
|
|
261
|
+
return document.createElement("div");
|
|
259
262
|
}
|
|
260
263
|
updateDOM() {
|
|
261
264
|
return !1;
|
|
@@ -273,8 +276,7 @@ class H extends ae {
|
|
|
273
276
|
src: this.__src,
|
|
274
277
|
altText: this.__altText,
|
|
275
278
|
width: this.__width,
|
|
276
|
-
height: this.__height
|
|
277
|
-
maxWidth: this.__maxWidth
|
|
279
|
+
height: this.__height
|
|
278
280
|
}
|
|
279
281
|
);
|
|
280
282
|
}
|
|
@@ -282,40 +284,43 @@ class H extends ae {
|
|
|
282
284
|
function gt({
|
|
283
285
|
altText: t,
|
|
284
286
|
height: r,
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
key:
|
|
287
|
+
src: e,
|
|
288
|
+
width: n,
|
|
289
|
+
meta: i,
|
|
290
|
+
key: a
|
|
289
291
|
}) {
|
|
290
292
|
return le(
|
|
291
|
-
new
|
|
293
|
+
new z(e, t, n, r, i, a)
|
|
292
294
|
);
|
|
293
295
|
}
|
|
296
|
+
function yn(t) {
|
|
297
|
+
return t instanceof z;
|
|
298
|
+
}
|
|
294
299
|
const Nn = [
|
|
295
300
|
Et,
|
|
296
301
|
It,
|
|
297
302
|
st,
|
|
298
|
-
wt,
|
|
299
303
|
Nt,
|
|
300
|
-
|
|
304
|
+
yt,
|
|
305
|
+
B,
|
|
301
306
|
Rt,
|
|
302
307
|
Ot,
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
],
|
|
308
|
+
$t,
|
|
309
|
+
z
|
|
310
|
+
], Sn = [
|
|
306
311
|
Et,
|
|
307
312
|
It,
|
|
308
313
|
st,
|
|
309
|
-
wt,
|
|
310
314
|
Nt,
|
|
311
|
-
|
|
315
|
+
yt,
|
|
316
|
+
B,
|
|
312
317
|
Rt,
|
|
313
318
|
Ot,
|
|
314
|
-
|
|
315
|
-
|
|
319
|
+
$t,
|
|
320
|
+
z,
|
|
316
321
|
G,
|
|
317
322
|
{
|
|
318
|
-
replace:
|
|
323
|
+
replace: B,
|
|
319
324
|
with: (t) => new G(
|
|
320
325
|
t.getURL(),
|
|
321
326
|
{ rel: t.__rel, target: t.__target, title: t.__title }
|
|
@@ -352,10 +357,10 @@ function vr(t) {
|
|
|
352
357
|
function Mr(t) {
|
|
353
358
|
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: "M17.5 15.5m-3.5 0a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0" } }, { tag: "path", attr: { d: "M3 19v-10.5a3.5 3.5 0 0 1 7 0v10.5" } }, { tag: "path", attr: { d: "M3 13h7" } }, { tag: "path", attr: { d: "M21 12v7" } }] })(t);
|
|
354
359
|
}
|
|
355
|
-
function
|
|
360
|
+
function _r(t) {
|
|
356
361
|
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 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" } }, { tag: "path", attr: { d: "M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" } }] })(t);
|
|
357
362
|
}
|
|
358
|
-
function
|
|
363
|
+
function Tr(t) {
|
|
359
364
|
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: "M3.5 5.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 11.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 17.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M11 6l9 0" } }, { tag: "path", attr: { d: "M11 12l9 0" } }, { tag: "path", attr: { d: "M11 18l9 0" } }] })(t);
|
|
360
365
|
}
|
|
361
366
|
function xr(t) {
|
|
@@ -364,13 +369,13 @@ function xr(t) {
|
|
|
364
369
|
function Lr(t) {
|
|
365
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);
|
|
366
371
|
}
|
|
367
|
-
function
|
|
372
|
+
function wr(t) {
|
|
368
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);
|
|
369
374
|
}
|
|
370
|
-
function
|
|
375
|
+
function yr(t) {
|
|
371
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);
|
|
372
377
|
}
|
|
373
|
-
function
|
|
378
|
+
function Nr(t) {
|
|
374
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);
|
|
375
380
|
}
|
|
376
381
|
function Sr(t) {
|
|
@@ -400,15 +405,15 @@ const Er = Xe("div", {
|
|
|
400
405
|
h5: /* @__PURE__ */ o(br, { size: "1.25rem" }),
|
|
401
406
|
h6: /* @__PURE__ */ o(Cr, { size: "1.25rem" }),
|
|
402
407
|
number: /* @__PURE__ */ o(xr, { size: "1.25rem" }),
|
|
403
|
-
check: /* @__PURE__ */ o(
|
|
408
|
+
check: /* @__PURE__ */ o(Tr, { size: "1.25rem" }),
|
|
404
409
|
paragraph: /* @__PURE__ */ o(Mr, { size: "1.25rem" }),
|
|
405
|
-
quote: /* @__PURE__ */ o(
|
|
410
|
+
quote: /* @__PURE__ */ o(wr, { size: "1.25rem" })
|
|
406
411
|
}, M = ({
|
|
407
412
|
blockType: t
|
|
408
|
-
}) => /* @__PURE__ */
|
|
409
|
-
/* @__PURE__ */ o(
|
|
413
|
+
}) => /* @__PURE__ */ u(H, { children: [
|
|
414
|
+
/* @__PURE__ */ o(U, { css: { display: "flex", flex: "0 0 auto" }, children: Ir[t] }),
|
|
410
415
|
/* @__PURE__ */ o(
|
|
411
|
-
|
|
416
|
+
U,
|
|
412
417
|
{
|
|
413
418
|
css: {
|
|
414
419
|
flex: "1 1 auto",
|
|
@@ -420,7 +425,7 @@ const Er = Xe("div", {
|
|
|
420
425
|
}
|
|
421
426
|
)
|
|
422
427
|
] }), Rr = (t) => {
|
|
423
|
-
if (!
|
|
428
|
+
if (!T(t))
|
|
424
429
|
return null;
|
|
425
430
|
const r = t.anchor.getNode();
|
|
426
431
|
let e = r.getKey() === "root" ? r : qt(r, (n) => {
|
|
@@ -436,20 +441,20 @@ const Er = Xe("div", {
|
|
|
436
441
|
x(() => t.registerCommand(
|
|
437
442
|
j,
|
|
438
443
|
() => {
|
|
439
|
-
const c =
|
|
440
|
-
if (!
|
|
444
|
+
const c = _(), h = Rr(c);
|
|
445
|
+
if (!h)
|
|
441
446
|
return !1;
|
|
442
|
-
const { element: g, anchorNode:
|
|
443
|
-
if (t.getElementByKey(
|
|
447
|
+
const { element: g, anchorNode: k } = h, y = g.getKey();
|
|
448
|
+
if (t.getElementByKey(y) !== null)
|
|
444
449
|
if (ct(g)) {
|
|
445
|
-
const
|
|
446
|
-
|
|
450
|
+
const b = qe(
|
|
451
|
+
k,
|
|
447
452
|
st
|
|
448
|
-
),
|
|
449
|
-
e(
|
|
453
|
+
), N = b ? b.getListType() : g.getListType();
|
|
454
|
+
e(N);
|
|
450
455
|
} else {
|
|
451
|
-
const
|
|
452
|
-
|
|
456
|
+
const b = _e(g) ? g.getTag() : g.getType();
|
|
457
|
+
b in Xt && e(b);
|
|
453
458
|
}
|
|
454
459
|
return !1;
|
|
455
460
|
},
|
|
@@ -457,11 +462,11 @@ const Er = Xe("div", {
|
|
|
457
462
|
), [t]);
|
|
458
463
|
const n = (c) => {
|
|
459
464
|
r !== c && t.update(() => {
|
|
460
|
-
const
|
|
461
|
-
|
|
465
|
+
const h = _();
|
|
466
|
+
T(h) && (nt(h, () => Te(c)), e(c));
|
|
462
467
|
});
|
|
463
468
|
};
|
|
464
|
-
return /* @__PURE__ */ o(Er, { children: /* @__PURE__ */
|
|
469
|
+
return /* @__PURE__ */ o(Er, { children: /* @__PURE__ */ u(
|
|
465
470
|
dt,
|
|
466
471
|
{
|
|
467
472
|
trigger: /* @__PURE__ */ o(
|
|
@@ -477,8 +482,8 @@ const Er = Xe("div", {
|
|
|
477
482
|
children: [
|
|
478
483
|
/* @__PURE__ */ o(v, { onClick: () => {
|
|
479
484
|
r !== "paragraph" && t.update(() => {
|
|
480
|
-
const c =
|
|
481
|
-
|
|
485
|
+
const c = _();
|
|
486
|
+
T(c) && (nt(c, () => W()), e("paragraph"));
|
|
482
487
|
});
|
|
483
488
|
}, children: /* @__PURE__ */ o(M, { blockType: "paragraph" }) }),
|
|
484
489
|
/* @__PURE__ */ o(v, { onClick: () => n("h1"), children: /* @__PURE__ */ o(M, { blockType: "h1" }) }),
|
|
@@ -498,17 +503,17 @@ const Er = Xe("div", {
|
|
|
498
503
|
}, children: /* @__PURE__ */ o(M, { blockType: "check" }) }),
|
|
499
504
|
/* @__PURE__ */ o(v, { onClick: () => {
|
|
500
505
|
r !== "quote" && t.update(() => {
|
|
501
|
-
const c =
|
|
502
|
-
|
|
506
|
+
const c = _();
|
|
507
|
+
T(c) && (nt(c, () => xe()), e("quote"));
|
|
503
508
|
});
|
|
504
509
|
}, children: /* @__PURE__ */ o(M, { blockType: "quote" }) })
|
|
505
510
|
]
|
|
506
511
|
}
|
|
507
512
|
) });
|
|
508
|
-
},
|
|
509
|
-
const [t] = L(), [r, e] = p(!1), [n, i] = p(!1), [
|
|
510
|
-
const f =
|
|
511
|
-
|
|
513
|
+
}, $r = () => {
|
|
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(() => {
|
|
515
|
+
const f = _();
|
|
516
|
+
T(f) && (e(f.hasFormat("bold")), i(f.hasFormat("italic")), l(f.hasFormat("underline")), d(f.hasFormat("code")), h(f.hasFormat("superscript")));
|
|
512
517
|
}, []);
|
|
513
518
|
x(() => tt(
|
|
514
519
|
t.registerCommand(
|
|
@@ -522,44 +527,44 @@ const Er = Xe("div", {
|
|
|
522
527
|
});
|
|
523
528
|
})
|
|
524
529
|
), [t, g]);
|
|
525
|
-
const
|
|
530
|
+
const k = C(
|
|
526
531
|
() => t.dispatchCommand(F, "bold"),
|
|
527
532
|
[t]
|
|
528
|
-
),
|
|
533
|
+
), y = C(
|
|
529
534
|
() => t.dispatchCommand(F, "italic"),
|
|
530
535
|
[t]
|
|
531
536
|
), S = C(
|
|
532
537
|
() => t.dispatchCommand(F, "underline"),
|
|
533
538
|
[t]
|
|
534
|
-
),
|
|
539
|
+
), b = C(
|
|
535
540
|
() => t.dispatchCommand(F, "code"),
|
|
536
541
|
[t]
|
|
537
|
-
),
|
|
542
|
+
), N = C(
|
|
538
543
|
() => t.dispatchCommand(F, "superscript"),
|
|
539
544
|
[t]
|
|
540
|
-
), E =
|
|
545
|
+
), E = zt(() => {
|
|
541
546
|
const f = [];
|
|
542
|
-
return r && f.push("bold"), n && f.push("italic"),
|
|
543
|
-
}, [r, n,
|
|
544
|
-
return /* @__PURE__ */
|
|
547
|
+
return r && f.push("bold"), n && f.push("italic"), a && f.push("underline"), s && f.push("code"), c && f.push("superscript"), f;
|
|
548
|
+
}, [r, n, a, s, c]);
|
|
549
|
+
return /* @__PURE__ */ u(
|
|
545
550
|
Dt,
|
|
546
551
|
{
|
|
547
552
|
type: "multiple",
|
|
548
553
|
"aria-label": "Tekstformattering",
|
|
549
554
|
value: E,
|
|
550
555
|
children: [
|
|
551
|
-
/* @__PURE__ */ o(
|
|
556
|
+
/* @__PURE__ */ o(D, { onClick: k, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ o(ur, { size: "1.25rem" }) }),
|
|
552
557
|
/* @__PURE__ */ o(
|
|
553
|
-
|
|
558
|
+
D,
|
|
554
559
|
{
|
|
555
|
-
onClick:
|
|
560
|
+
onClick: y,
|
|
556
561
|
title: "Kursiv tekst",
|
|
557
562
|
value: "italic",
|
|
558
563
|
children: /* @__PURE__ */ o(vr, { size: "1.25rem" })
|
|
559
564
|
}
|
|
560
565
|
),
|
|
561
566
|
/* @__PURE__ */ o(
|
|
562
|
-
|
|
567
|
+
D,
|
|
563
568
|
{
|
|
564
569
|
onClick: S,
|
|
565
570
|
title: "Understreket tekst",
|
|
@@ -567,48 +572,48 @@ const Er = Xe("div", {
|
|
|
567
572
|
children: /* @__PURE__ */ o(Sr, { size: "1.25rem" })
|
|
568
573
|
}
|
|
569
574
|
),
|
|
570
|
-
/* @__PURE__ */ o(
|
|
575
|
+
/* @__PURE__ */ o(D, { onClick: b, title: "Kode", value: "code", children: /* @__PURE__ */ o(gr, { size: "1.25rem" }) }),
|
|
571
576
|
/* @__PURE__ */ o(
|
|
572
|
-
|
|
577
|
+
D,
|
|
573
578
|
{
|
|
574
|
-
onClick:
|
|
579
|
+
onClick: N,
|
|
575
580
|
title: "Superscript",
|
|
576
581
|
value: "superscript",
|
|
577
|
-
children: /* @__PURE__ */ o(
|
|
582
|
+
children: /* @__PURE__ */ o(yr, { size: "1.25rem" })
|
|
578
583
|
}
|
|
579
584
|
)
|
|
580
585
|
]
|
|
581
586
|
}
|
|
582
587
|
);
|
|
583
|
-
},
|
|
584
|
-
const { hasFocus: r, editorRef: e } = et(), n = r, [i,
|
|
588
|
+
}, zr = ({ children: t }) => {
|
|
589
|
+
const { hasFocus: r, editorRef: e } = et(), n = r, [i, a] = p(n);
|
|
585
590
|
Ie(() => {
|
|
586
|
-
|
|
591
|
+
a(n);
|
|
587
592
|
}, [n]);
|
|
588
|
-
const { context:
|
|
593
|
+
const { context: l, refs: s, floatingStyles: d } = ut({
|
|
589
594
|
placement: "top",
|
|
590
595
|
whileElementsMounted: Ft,
|
|
591
596
|
middleware: [
|
|
592
597
|
Fe({
|
|
593
|
-
apply: ({ rects:
|
|
594
|
-
g.floating.style.minWidth = `${
|
|
598
|
+
apply: ({ rects: h, elements: g }) => {
|
|
599
|
+
g.floating.style.minWidth = `${h.reference.width}px`;
|
|
595
600
|
}
|
|
596
601
|
}),
|
|
597
|
-
|
|
598
|
-
|
|
602
|
+
Ue(),
|
|
603
|
+
Ut({
|
|
599
604
|
mainAxis: 8
|
|
600
605
|
}),
|
|
601
|
-
|
|
606
|
+
We({
|
|
602
607
|
padding: 8
|
|
603
608
|
})
|
|
604
609
|
],
|
|
605
610
|
open: i,
|
|
606
|
-
onOpenChange:
|
|
611
|
+
onOpenChange: a,
|
|
607
612
|
elements: {
|
|
608
613
|
reference: e.current
|
|
609
614
|
}
|
|
610
|
-
}), { getFloatingProps: c } =
|
|
611
|
-
jt(
|
|
615
|
+
}), { getFloatingProps: c } = Wt([
|
|
616
|
+
jt(l, {
|
|
612
617
|
role: "dialog"
|
|
613
618
|
})
|
|
614
619
|
]);
|
|
@@ -630,10 +635,10 @@ const Er = Xe("div", {
|
|
|
630
635
|
}, Ar = ({
|
|
631
636
|
children: t,
|
|
632
637
|
...r
|
|
633
|
-
}) => /* @__PURE__ */
|
|
638
|
+
}) => /* @__PURE__ */ u(Re, { "aria-label": "Formattering", ...r, children: [
|
|
634
639
|
/* @__PURE__ */ o(Or, {}),
|
|
635
640
|
/* @__PURE__ */ o(Oe, {}),
|
|
636
|
-
/* @__PURE__ */ o(
|
|
641
|
+
/* @__PURE__ */ o($r, {}),
|
|
637
642
|
t
|
|
638
643
|
] });
|
|
639
644
|
function Dr() {
|
|
@@ -646,12 +651,12 @@ function Dr() {
|
|
|
646
651
|
),
|
|
647
652
|
t.registerCommand(
|
|
648
653
|
se,
|
|
649
|
-
(r) =>
|
|
654
|
+
(r) => Tt(r, t, !1),
|
|
650
655
|
R
|
|
651
656
|
),
|
|
652
657
|
t.registerCommand(
|
|
653
658
|
ce,
|
|
654
|
-
(r) =>
|
|
659
|
+
(r) => Tt(r, t, !0),
|
|
655
660
|
R
|
|
656
661
|
),
|
|
657
662
|
t.registerCommand(
|
|
@@ -671,7 +676,7 @@ function Dr() {
|
|
|
671
676
|
const e = it();
|
|
672
677
|
return e != null && t.isEditable() ? (t.update(() => {
|
|
673
678
|
const n = lt(e);
|
|
674
|
-
|
|
679
|
+
P(n) && (r.preventDefault(), n.toggleChecked());
|
|
675
680
|
}), !0) : !1;
|
|
676
681
|
},
|
|
677
682
|
R
|
|
@@ -679,18 +684,18 @@ function Dr() {
|
|
|
679
684
|
t.registerCommand(
|
|
680
685
|
he,
|
|
681
686
|
(r) => t.getEditorState().read(() => {
|
|
682
|
-
const e =
|
|
683
|
-
if (
|
|
687
|
+
const e = _();
|
|
688
|
+
if (T(e) && e.isCollapsed()) {
|
|
684
689
|
const { anchor: n } = e, i = n.type === "element";
|
|
685
690
|
if (i || n.offset === 0) {
|
|
686
|
-
const
|
|
687
|
-
|
|
691
|
+
const a = n.getNode(), l = qt(
|
|
692
|
+
a,
|
|
688
693
|
(s) => ue(s) && !s.isInline()
|
|
689
694
|
);
|
|
690
|
-
if (
|
|
691
|
-
const s =
|
|
692
|
-
if (ct(s) && s.getListType() === "check" && (i ||
|
|
693
|
-
const d = t.getElementByKey(
|
|
695
|
+
if (P(l)) {
|
|
696
|
+
const s = l.getParent();
|
|
697
|
+
if (ct(s) && s.getListType() === "check" && (i || l.getFirstDescendant() === a)) {
|
|
698
|
+
const d = t.getElementByKey(l.__key);
|
|
694
699
|
if (d != null && document.activeElement !== d)
|
|
695
700
|
return d.focus(), r.preventDefault(), !0;
|
|
696
701
|
}
|
|
@@ -702,7 +707,7 @@ function Dr() {
|
|
|
702
707
|
R
|
|
703
708
|
),
|
|
704
709
|
t.registerRootListener((r, e) => {
|
|
705
|
-
r !== null && (r.addEventListener("click", Mt), r.addEventListener("pointerdown",
|
|
710
|
+
r !== null && (r.addEventListener("click", Mt), r.addEventListener("pointerdown", _t)), e !== null && (e.removeEventListener("click", Mt), e.removeEventListener("pointerdown", _t));
|
|
706
711
|
})
|
|
707
712
|
), [t]), null;
|
|
708
713
|
}
|
|
@@ -716,8 +721,8 @@ function Qt(t, r) {
|
|
|
716
721
|
const i = e.parentNode;
|
|
717
722
|
if (!i || i.__lexicalListType !== "check")
|
|
718
723
|
return;
|
|
719
|
-
const
|
|
720
|
-
(e.dir === "rtl" ?
|
|
724
|
+
const a = t.pageX, l = e.getBoundingClientRect();
|
|
725
|
+
(e.dir === "rtl" ? a < l.right && a > l.right - 20 : a > l.left && a < l.left + 20) && r();
|
|
721
726
|
}
|
|
722
727
|
function Mt(t) {
|
|
723
728
|
Qt(t, () => {
|
|
@@ -725,12 +730,12 @@ function Mt(t) {
|
|
|
725
730
|
e != null && e.isEditable() && e.update(() => {
|
|
726
731
|
if (t.target) {
|
|
727
732
|
const n = lt(r);
|
|
728
|
-
|
|
733
|
+
P(n) && (r.focus(), n.toggleChecked());
|
|
729
734
|
}
|
|
730
735
|
});
|
|
731
736
|
});
|
|
732
737
|
}
|
|
733
|
-
function
|
|
738
|
+
function _t(t) {
|
|
734
739
|
Qt(t, () => {
|
|
735
740
|
t.preventDefault();
|
|
736
741
|
});
|
|
@@ -751,9 +756,9 @@ function it() {
|
|
|
751
756
|
}
|
|
752
757
|
function Pr(t, r) {
|
|
753
758
|
let e = r ? t.getPreviousSibling() : t.getNextSibling(), n = t;
|
|
754
|
-
for (; e == null &&
|
|
759
|
+
for (; e == null && P(n); )
|
|
755
760
|
n = n.getParentOrThrow().getParent(), n != null && (e = r ? n.getPreviousSibling() : n.getNextSibling());
|
|
756
|
-
for (;
|
|
761
|
+
for (; P(e); ) {
|
|
757
762
|
const i = r ? e.getLastChild() : e.getFirstChild();
|
|
758
763
|
if (!ct(i))
|
|
759
764
|
return e;
|
|
@@ -761,18 +766,18 @@ function Pr(t, r) {
|
|
|
761
766
|
}
|
|
762
767
|
return null;
|
|
763
768
|
}
|
|
764
|
-
function
|
|
769
|
+
function Tt(t, r, e) {
|
|
765
770
|
const n = it();
|
|
766
771
|
return n != null && r.update(() => {
|
|
767
772
|
const i = lt(n);
|
|
768
|
-
if (!
|
|
773
|
+
if (!P(i))
|
|
769
774
|
return;
|
|
770
|
-
const
|
|
771
|
-
if (
|
|
772
|
-
|
|
773
|
-
const
|
|
774
|
-
|
|
775
|
-
|
|
775
|
+
const a = Pr(i, e);
|
|
776
|
+
if (a != null) {
|
|
777
|
+
a.selectStart();
|
|
778
|
+
const l = r.getElementByKey(a.__key);
|
|
779
|
+
l != null && (t.preventDefault(), setTimeout(() => {
|
|
780
|
+
l.focus();
|
|
776
781
|
}, 0));
|
|
777
782
|
}
|
|
778
783
|
}), !1;
|
|
@@ -781,28 +786,28 @@ const Vt = ge("INSERT_IMAGE_COMMAND");
|
|
|
781
786
|
function Hr() {
|
|
782
787
|
const [t] = rr();
|
|
783
788
|
return x(() => {
|
|
784
|
-
if (!t.hasNodes([
|
|
789
|
+
if (!t.hasNodes([z]))
|
|
785
790
|
throw new Error("ImagePlugin: ImageNode not registered on editor");
|
|
786
791
|
return tt(
|
|
787
792
|
t.registerCommand(
|
|
788
793
|
Vt,
|
|
789
794
|
(r) => {
|
|
790
795
|
const e = gt(r);
|
|
791
|
-
return pe([e]), xt(e.getParentOrThrow()) && Ye(e,
|
|
796
|
+
return pe([e]), xt(e.getParentOrThrow()) && Ye(e, W).selectEnd(), !0;
|
|
792
797
|
},
|
|
793
798
|
me
|
|
794
799
|
)
|
|
795
800
|
);
|
|
796
801
|
}, [t]), null;
|
|
797
802
|
}
|
|
798
|
-
const Fr = () => /* @__PURE__ */
|
|
803
|
+
const Fr = () => /* @__PURE__ */ u(H, { children: [
|
|
799
804
|
/* @__PURE__ */ o(Ve, {}),
|
|
800
805
|
/* @__PURE__ */ o(tr, {}),
|
|
801
806
|
/* @__PURE__ */ o(Ze, {}),
|
|
802
807
|
/* @__PURE__ */ o(Dr, {}),
|
|
803
808
|
/* @__PURE__ */ o(er, {}),
|
|
804
809
|
/* @__PURE__ */ o(Hr, {})
|
|
805
|
-
] }),
|
|
810
|
+
] }), Ur = ({
|
|
806
811
|
state: t
|
|
807
812
|
}) => {
|
|
808
813
|
const [r] = L(), e = K(!1);
|
|
@@ -824,7 +829,7 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
824
829
|
}
|
|
825
830
|
}));
|
|
826
831
|
}, []), null;
|
|
827
|
-
},
|
|
832
|
+
}, Wr = $e("div", {
|
|
828
833
|
border: "1px solid $borderDarker",
|
|
829
834
|
borderRadius: "$md",
|
|
830
835
|
position: "relative",
|
|
@@ -864,7 +869,7 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
864
869
|
}), jr = ({
|
|
865
870
|
isLoading: t
|
|
866
871
|
}) => /* @__PURE__ */ o(
|
|
867
|
-
|
|
872
|
+
U,
|
|
868
873
|
{
|
|
869
874
|
css: {
|
|
870
875
|
visibility: t ? "visible" : "hidden",
|
|
@@ -875,26 +880,26 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
875
880
|
},
|
|
876
881
|
children: /* @__PURE__ */ o(ht, {})
|
|
877
882
|
}
|
|
878
|
-
),
|
|
883
|
+
), En = ({
|
|
879
884
|
isLoading: t,
|
|
880
885
|
children: r,
|
|
881
886
|
placeholderText: e,
|
|
882
887
|
nodes: n,
|
|
883
888
|
plugins: i,
|
|
884
|
-
toolbar:
|
|
885
|
-
toolbarContent:
|
|
889
|
+
toolbar: a,
|
|
890
|
+
toolbarContent: l,
|
|
886
891
|
content: s,
|
|
887
892
|
hideBorder: d,
|
|
888
893
|
onBlur: c,
|
|
889
|
-
defaultState:
|
|
894
|
+
defaultState: h,
|
|
890
895
|
css: g,
|
|
891
|
-
signUrl:
|
|
896
|
+
signUrl: k
|
|
892
897
|
}) => {
|
|
893
|
-
const { hasFocus:
|
|
894
|
-
() => ({ hasFocus:
|
|
895
|
-
[
|
|
898
|
+
const { hasFocus: y, attributes: S } = sr({ onBlur: c }), b = K(null), N = zt(
|
|
899
|
+
() => ({ hasFocus: y, editorRef: b, signUrl: k }),
|
|
900
|
+
[y, k]
|
|
896
901
|
);
|
|
897
|
-
return /* @__PURE__ */ o(Jt.Provider, { value:
|
|
902
|
+
return /* @__PURE__ */ o(Jt.Provider, { value: N, children: /* @__PURE__ */ u(
|
|
898
903
|
Be,
|
|
899
904
|
{
|
|
900
905
|
initialConfig: {
|
|
@@ -907,22 +912,22 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
907
912
|
editable: !0
|
|
908
913
|
},
|
|
909
914
|
children: [
|
|
910
|
-
/* @__PURE__ */
|
|
911
|
-
|
|
915
|
+
/* @__PURE__ */ u(
|
|
916
|
+
Wr,
|
|
912
917
|
{
|
|
913
|
-
ref:
|
|
914
|
-
hasFocus:
|
|
918
|
+
ref: b,
|
|
919
|
+
hasFocus: y,
|
|
915
920
|
hideBorder: d,
|
|
916
921
|
css: g,
|
|
917
922
|
...S,
|
|
918
923
|
children: [
|
|
919
|
-
|
|
924
|
+
a,
|
|
920
925
|
/* @__PURE__ */ o(
|
|
921
926
|
Pe,
|
|
922
927
|
{
|
|
923
928
|
contentEditable: s,
|
|
924
929
|
placeholder: e ? /* @__PURE__ */ o(
|
|
925
|
-
|
|
930
|
+
U,
|
|
926
931
|
{
|
|
927
932
|
css: {
|
|
928
933
|
position: "absolute",
|
|
@@ -941,12 +946,12 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
941
946
|
/* @__PURE__ */ o(Fr, {}),
|
|
942
947
|
i,
|
|
943
948
|
/* @__PURE__ */ o(jr, { isLoading: t }),
|
|
944
|
-
!
|
|
949
|
+
!a && /* @__PURE__ */ o(zr, { children: l })
|
|
945
950
|
]
|
|
946
951
|
}
|
|
947
952
|
),
|
|
948
|
-
/* @__PURE__ */ o(
|
|
949
|
-
/* @__PURE__ */ o(
|
|
953
|
+
/* @__PURE__ */ o(Ur, { state: h }),
|
|
954
|
+
/* @__PURE__ */ o(H, { children: r })
|
|
950
955
|
]
|
|
951
956
|
}
|
|
952
957
|
) });
|
|
@@ -1103,6 +1108,11 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1103
1108
|
margin: "1.5em 10px",
|
|
1104
1109
|
padding: "0.5em 10px"
|
|
1105
1110
|
},
|
|
1111
|
+
".ain-rich-text-image": {
|
|
1112
|
+
display: "block",
|
|
1113
|
+
maxWidth: "100%",
|
|
1114
|
+
height: "auto"
|
|
1115
|
+
},
|
|
1106
1116
|
variants: {
|
|
1107
1117
|
size: {
|
|
1108
1118
|
xs: {
|
|
@@ -1140,49 +1150,53 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1140
1150
|
defaultVariants: {
|
|
1141
1151
|
size: "md"
|
|
1142
1152
|
}
|
|
1143
|
-
},
|
|
1153
|
+
}, In = Qe(Kr), qr = ({
|
|
1144
1154
|
uploadFile: t,
|
|
1145
1155
|
...r
|
|
1146
1156
|
}) => {
|
|
1147
|
-
const [e] = L(), [n, i] = p(null),
|
|
1157
|
+
const [e] = L(), [n, i] = p(null), a = (s) => {
|
|
1148
1158
|
var c;
|
|
1149
1159
|
const d = (c = s.target.files) == null ? void 0 : c[0];
|
|
1150
1160
|
if (d) {
|
|
1151
|
-
const
|
|
1152
|
-
|
|
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;
|
|
1153
1166
|
}
|
|
1154
|
-
},
|
|
1167
|
+
}, l = () => {
|
|
1155
1168
|
n && !t.isLoading && (e.dispatchCommand(Vt, {
|
|
1156
|
-
src: n,
|
|
1157
|
-
altText: `Image: ${n}
|
|
1169
|
+
src: n.url,
|
|
1170
|
+
altText: `Image: ${n.url}`,
|
|
1171
|
+
meta: { width: n.width, height: n.height }
|
|
1158
1172
|
}), r.onOpenChange(!1));
|
|
1159
1173
|
};
|
|
1160
|
-
return /* @__PURE__ */
|
|
1161
|
-
/* @__PURE__ */ o(
|
|
1174
|
+
return /* @__PURE__ */ u(Pt, { ...r, children: [
|
|
1175
|
+
/* @__PURE__ */ o(ze, { children: "Sett inn bilde" }),
|
|
1162
1176
|
t.isLoading && /* @__PURE__ */ o(ht, {}),
|
|
1163
1177
|
/* @__PURE__ */ o(
|
|
1164
1178
|
Ht,
|
|
1165
1179
|
{
|
|
1166
1180
|
type: "file",
|
|
1167
1181
|
accept: "image/png, image/jpeg",
|
|
1168
|
-
onChange:
|
|
1182
|
+
onChange: a,
|
|
1169
1183
|
disabled: t.isLoading
|
|
1170
1184
|
}
|
|
1171
1185
|
),
|
|
1172
|
-
/* @__PURE__ */
|
|
1173
|
-
/* @__PURE__ */ o(
|
|
1186
|
+
/* @__PURE__ */ u(Z, { children: [
|
|
1187
|
+
/* @__PURE__ */ o(w, { onClick: () => r.onOpenChange(!1), children: "Avbryt" }),
|
|
1174
1188
|
/* @__PURE__ */ o(
|
|
1175
|
-
|
|
1189
|
+
w,
|
|
1176
1190
|
{
|
|
1177
1191
|
variant: "primary",
|
|
1178
1192
|
disabled: !n || t.isLoading,
|
|
1179
|
-
onClick:
|
|
1193
|
+
onClick: l,
|
|
1180
1194
|
children: "Sett inn"
|
|
1181
1195
|
}
|
|
1182
1196
|
)
|
|
1183
1197
|
] })
|
|
1184
1198
|
] });
|
|
1185
|
-
},
|
|
1199
|
+
}, Rn = ({ uploadFile: t }) => {
|
|
1186
1200
|
const [r] = L(), [e, n] = p(!1), i = C(() => {
|
|
1187
1201
|
r.dispatchCommand(Le, {
|
|
1188
1202
|
rows: "3",
|
|
@@ -1190,19 +1204,19 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1190
1204
|
includeHeaders: !1
|
|
1191
1205
|
});
|
|
1192
1206
|
}, [r]);
|
|
1193
|
-
return /* @__PURE__ */
|
|
1194
|
-
/* @__PURE__ */
|
|
1207
|
+
return /* @__PURE__ */ u(H, { children: [
|
|
1208
|
+
/* @__PURE__ */ u(
|
|
1195
1209
|
dt,
|
|
1196
1210
|
{
|
|
1197
1211
|
trigger: /* @__PURE__ */ o(At, { dropdown: !0, children: "Sett inn" }),
|
|
1198
1212
|
side: "bottom",
|
|
1199
1213
|
align: "end",
|
|
1200
1214
|
children: [
|
|
1201
|
-
/* @__PURE__ */
|
|
1202
|
-
/* @__PURE__ */ o(
|
|
1215
|
+
/* @__PURE__ */ u(v, { onClick: i, children: [
|
|
1216
|
+
/* @__PURE__ */ o(Nr, { size: "1.25rem" }),
|
|
1203
1217
|
" Tabell"
|
|
1204
1218
|
] }),
|
|
1205
|
-
t && /* @__PURE__ */
|
|
1219
|
+
t && /* @__PURE__ */ u(v, { onClick: () => n(!0), children: [
|
|
1206
1220
|
/* @__PURE__ */ o(Ge, { size: "1.25rem" }),
|
|
1207
1221
|
" Bilde"
|
|
1208
1222
|
] })
|
|
@@ -1222,32 +1236,32 @@ const Fr = () => /* @__PURE__ */ h(P, { children: [
|
|
|
1222
1236
|
function Yr(t) {
|
|
1223
1237
|
return m({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "circle", attr: { cx: "256", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "416", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "96", cy: "256", r: "48" } }] })(t);
|
|
1224
1238
|
}
|
|
1225
|
-
const
|
|
1239
|
+
const On = () => {
|
|
1226
1240
|
const [t] = L(), [r, e] = p(null), { hasFocus: n } = et();
|
|
1227
1241
|
x(() => {
|
|
1228
1242
|
!n && r && e(null);
|
|
1229
1243
|
}, [n, r]);
|
|
1230
|
-
const { refs: i, floatingStyles:
|
|
1244
|
+
const { refs: i, floatingStyles: a } = ut({
|
|
1231
1245
|
placement: "top-end",
|
|
1232
1246
|
open: !!r,
|
|
1233
1247
|
elements: {
|
|
1234
1248
|
reference: r
|
|
1235
1249
|
},
|
|
1236
|
-
middleware: [
|
|
1250
|
+
middleware: [Ut({ mainAxis: -20, crossAxis: -2 })]
|
|
1237
1251
|
});
|
|
1238
1252
|
x(() => t.registerCommand(
|
|
1239
1253
|
j,
|
|
1240
1254
|
() => {
|
|
1241
|
-
const s =
|
|
1242
|
-
if (
|
|
1243
|
-
const d = s.anchor.getNode(), c =
|
|
1255
|
+
const s = _();
|
|
1256
|
+
if (T(s)) {
|
|
1257
|
+
const d = s.anchor.getNode(), c = we(d);
|
|
1244
1258
|
e(c ? t.getElementByKey(c.getKey()) : null);
|
|
1245
1259
|
}
|
|
1246
1260
|
return !1;
|
|
1247
1261
|
},
|
|
1248
1262
|
fe
|
|
1249
1263
|
), [t]);
|
|
1250
|
-
const
|
|
1264
|
+
const l = (s) => () => {
|
|
1251
1265
|
t.update(() => {
|
|
1252
1266
|
switch (s) {
|
|
1253
1267
|
case "add-row-over":
|
|
@@ -1263,38 +1277,38 @@ const Rn = () => {
|
|
|
1263
1277
|
kt(!0);
|
|
1264
1278
|
break;
|
|
1265
1279
|
case "delete-row":
|
|
1266
|
-
|
|
1280
|
+
Ne();
|
|
1267
1281
|
break;
|
|
1268
1282
|
case "delete-column":
|
|
1269
|
-
|
|
1283
|
+
ye();
|
|
1270
1284
|
break;
|
|
1271
1285
|
}
|
|
1272
1286
|
});
|
|
1273
1287
|
};
|
|
1274
|
-
return r ? /* @__PURE__ */
|
|
1288
|
+
return r ? /* @__PURE__ */ u(
|
|
1275
1289
|
dt,
|
|
1276
1290
|
{
|
|
1277
1291
|
trigger: /* @__PURE__ */ o(
|
|
1278
|
-
|
|
1292
|
+
w,
|
|
1279
1293
|
{
|
|
1280
1294
|
icon: !0,
|
|
1281
1295
|
variant: "primary",
|
|
1282
1296
|
color: "secondary",
|
|
1283
1297
|
ref: i.setFloating,
|
|
1284
|
-
style:
|
|
1298
|
+
style: a,
|
|
1285
1299
|
css: { padding: "2px", width: "18px", height: "18px" },
|
|
1286
1300
|
children: /* @__PURE__ */ o(Yr, {})
|
|
1287
1301
|
}
|
|
1288
1302
|
),
|
|
1289
1303
|
children: [
|
|
1290
|
-
/* @__PURE__ */ o(
|
|
1291
|
-
/* @__PURE__ */ o(
|
|
1304
|
+
/* @__PURE__ */ o(A, { onClick: l("add-row-over"), children: "Legg til rad over" }),
|
|
1305
|
+
/* @__PURE__ */ o(A, { onClick: l("add-row-under"), children: "Legg til rad under" }),
|
|
1292
1306
|
/* @__PURE__ */ o(Ct, {}),
|
|
1293
|
-
/* @__PURE__ */ o(
|
|
1294
|
-
/* @__PURE__ */ o(
|
|
1307
|
+
/* @__PURE__ */ o(A, { onClick: l("add-column-left"), children: "Legg til kolonne venstre" }),
|
|
1308
|
+
/* @__PURE__ */ o(A, { onClick: l("add-column-right"), children: "Legg til kolonne høyre" }),
|
|
1295
1309
|
/* @__PURE__ */ o(Ct, {}),
|
|
1296
|
-
/* @__PURE__ */ o(
|
|
1297
|
-
/* @__PURE__ */ o(
|
|
1310
|
+
/* @__PURE__ */ o(A, { onClick: l("delete-row"), children: "Fjern rad" }),
|
|
1311
|
+
/* @__PURE__ */ o(A, { onClick: l("delete-column"), children: "Fjern kolonne" })
|
|
1298
1312
|
]
|
|
1299
1313
|
}
|
|
1300
1314
|
) : null;
|
|
@@ -1308,7 +1322,7 @@ function Zt(t) {
|
|
|
1308
1322
|
const r = t.anchor, e = t.focus, n = t.anchor.getNode(), i = t.focus.getNode();
|
|
1309
1323
|
return n === i ? n : t.isBackward() ? ft(e) ? n : i : ft(r) ? n : i;
|
|
1310
1324
|
}
|
|
1311
|
-
const
|
|
1325
|
+
const $n = (t) => (O.baseURL = t, O), J = class extends B {
|
|
1312
1326
|
static getType() {
|
|
1313
1327
|
return "rutine_link";
|
|
1314
1328
|
}
|
|
@@ -1350,40 +1364,40 @@ const Jr = ({ onClose: t }) => {
|
|
|
1350
1364
|
const [r] = L(), e = C(
|
|
1351
1365
|
(i) => {
|
|
1352
1366
|
r.update(() => {
|
|
1353
|
-
const
|
|
1354
|
-
if (
|
|
1355
|
-
const
|
|
1356
|
-
|
|
1357
|
-
const s =
|
|
1358
|
-
s.setTextNodeRange(
|
|
1367
|
+
const a = _();
|
|
1368
|
+
if (T(a) && a.isCollapsed()) {
|
|
1369
|
+
const l = $(i);
|
|
1370
|
+
a.insertNodes([l]);
|
|
1371
|
+
const s = wt();
|
|
1372
|
+
s.setTextNodeRange(l, 0, l, i.length), Q(s);
|
|
1359
1373
|
}
|
|
1360
1374
|
r.dispatchCommand(V, pt(i));
|
|
1361
1375
|
});
|
|
1362
1376
|
},
|
|
1363
1377
|
[r]
|
|
1364
1378
|
);
|
|
1365
|
-
return /* @__PURE__ */
|
|
1379
|
+
return /* @__PURE__ */ u("form", { onSubmit: (i) => {
|
|
1366
1380
|
e(i.currentTarget.url.value), t();
|
|
1367
1381
|
}, children: [
|
|
1368
1382
|
/* @__PURE__ */ o(Ht, { name: "url", label: "URL", type: "url", required: !0 }),
|
|
1369
|
-
/* @__PURE__ */
|
|
1370
|
-
/* @__PURE__ */ o(
|
|
1371
|
-
/* @__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" })
|
|
1372
1386
|
] })
|
|
1373
1387
|
] });
|
|
1374
1388
|
}, Xr = ({
|
|
1375
1389
|
onClose: t,
|
|
1376
1390
|
getDocs: r
|
|
1377
1391
|
}) => {
|
|
1378
|
-
const [e] = L(), [n, i] = p([]),
|
|
1392
|
+
const [e] = L(), [n, i] = p([]), a = r(), l = C(
|
|
1379
1393
|
(s) => {
|
|
1380
1394
|
e.update(() => {
|
|
1381
|
-
const d =
|
|
1382
|
-
if (
|
|
1395
|
+
const d = _();
|
|
1396
|
+
if (T(d)) {
|
|
1383
1397
|
const c = [];
|
|
1384
|
-
for (const [
|
|
1385
|
-
const
|
|
1386
|
-
|
|
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($(" "));
|
|
1387
1401
|
}
|
|
1388
1402
|
d.insertNodes(c);
|
|
1389
1403
|
}
|
|
@@ -1391,23 +1405,23 @@ const Jr = ({ onClose: t }) => {
|
|
|
1391
1405
|
},
|
|
1392
1406
|
[e]
|
|
1393
1407
|
);
|
|
1394
|
-
return /* @__PURE__ */
|
|
1408
|
+
return /* @__PURE__ */ u(H, { children: [
|
|
1395
1409
|
/* @__PURE__ */ o(
|
|
1396
1410
|
De,
|
|
1397
1411
|
{
|
|
1398
1412
|
isMulti: !0,
|
|
1399
|
-
options:
|
|
1413
|
+
options: a,
|
|
1400
1414
|
onChange: (s) => i(s)
|
|
1401
1415
|
}
|
|
1402
1416
|
),
|
|
1403
|
-
/* @__PURE__ */
|
|
1404
|
-
/* @__PURE__ */ o(
|
|
1417
|
+
/* @__PURE__ */ u(Z, { children: [
|
|
1418
|
+
/* @__PURE__ */ o(w, { onClick: t, children: "Avbryt" }),
|
|
1405
1419
|
/* @__PURE__ */ o(
|
|
1406
|
-
|
|
1420
|
+
w,
|
|
1407
1421
|
{
|
|
1408
1422
|
variant: "primary",
|
|
1409
1423
|
onClick: () => {
|
|
1410
|
-
|
|
1424
|
+
l(n), t();
|
|
1411
1425
|
},
|
|
1412
1426
|
children: "Sett inn"
|
|
1413
1427
|
}
|
|
@@ -1418,48 +1432,48 @@ const Jr = ({ onClose: t }) => {
|
|
|
1418
1432
|
onClose: t,
|
|
1419
1433
|
uploadFile: r
|
|
1420
1434
|
}) => {
|
|
1421
|
-
const [e] = L(), [n, i] = p(null),
|
|
1435
|
+
const [e] = L(), [n, i] = p(null), a = async (s) => {
|
|
1422
1436
|
var c;
|
|
1423
1437
|
const d = (c = s.target.files) == null ? void 0 : c[0];
|
|
1424
1438
|
if (d) {
|
|
1425
|
-
const
|
|
1439
|
+
const h = await r.uploadFile({ file: d });
|
|
1426
1440
|
i({
|
|
1427
1441
|
name: d.name,
|
|
1428
|
-
url:
|
|
1442
|
+
url: h
|
|
1429
1443
|
});
|
|
1430
1444
|
}
|
|
1431
|
-
},
|
|
1445
|
+
}, l = C(() => {
|
|
1432
1446
|
e.update(() => {
|
|
1433
1447
|
if (!n)
|
|
1434
1448
|
return;
|
|
1435
|
-
const s =
|
|
1436
|
-
if (
|
|
1437
|
-
const d =
|
|
1449
|
+
const s = _();
|
|
1450
|
+
if (T(s) && s.isCollapsed()) {
|
|
1451
|
+
const d = $(n.name);
|
|
1438
1452
|
s.insertNodes([d]);
|
|
1439
|
-
const c =
|
|
1453
|
+
const c = wt();
|
|
1440
1454
|
c.setTextNodeRange(d, 0, d, n.name.length), Q(c);
|
|
1441
1455
|
}
|
|
1442
1456
|
e.dispatchCommand(V, pt(n.url));
|
|
1443
1457
|
});
|
|
1444
1458
|
}, [e, n]);
|
|
1445
|
-
return /* @__PURE__ */
|
|
1459
|
+
return /* @__PURE__ */ u(H, { children: [
|
|
1446
1460
|
r.isLoading && /* @__PURE__ */ o(ht, {}),
|
|
1447
1461
|
/* @__PURE__ */ o(
|
|
1448
1462
|
"input",
|
|
1449
1463
|
{
|
|
1450
1464
|
type: "file",
|
|
1451
|
-
onChange:
|
|
1465
|
+
onChange: a,
|
|
1452
1466
|
disabled: r.isLoading
|
|
1453
1467
|
}
|
|
1454
1468
|
),
|
|
1455
|
-
/* @__PURE__ */
|
|
1456
|
-
/* @__PURE__ */ o(
|
|
1469
|
+
/* @__PURE__ */ u(Z, { children: [
|
|
1470
|
+
/* @__PURE__ */ o(w, { onClick: t, children: "Avbryt" }),
|
|
1457
1471
|
/* @__PURE__ */ o(
|
|
1458
|
-
|
|
1472
|
+
w,
|
|
1459
1473
|
{
|
|
1460
1474
|
variant: "primary",
|
|
1461
1475
|
onClick: () => {
|
|
1462
|
-
|
|
1476
|
+
l(), t();
|
|
1463
1477
|
},
|
|
1464
1478
|
disabled: !n,
|
|
1465
1479
|
children: "Sett inn"
|
|
@@ -1473,71 +1487,71 @@ const Jr = ({ onClose: t }) => {
|
|
|
1473
1487
|
getDocs: e,
|
|
1474
1488
|
uploadFile: n
|
|
1475
1489
|
}) => {
|
|
1476
|
-
const [i,
|
|
1490
|
+
const [i, a] = p("url"), l = () => {
|
|
1477
1491
|
r(!1);
|
|
1478
1492
|
};
|
|
1479
|
-
return /* @__PURE__ */
|
|
1480
|
-
/* @__PURE__ */
|
|
1481
|
-
/* @__PURE__ */ o(ot, { active: i === "url", onClick: () =>
|
|
1493
|
+
return /* @__PURE__ */ u(Pt, { open: t, onOpenChange: r, css: { width: "600px" }, children: [
|
|
1494
|
+
/* @__PURE__ */ u(Ae, { css: { marginBottom: "$8" }, children: [
|
|
1495
|
+
/* @__PURE__ */ o(ot, { active: i === "url", onClick: () => a("url"), children: "URL" }),
|
|
1482
1496
|
e && /* @__PURE__ */ o(
|
|
1483
1497
|
ot,
|
|
1484
1498
|
{
|
|
1485
1499
|
active: i === "rutine",
|
|
1486
|
-
onClick: () =>
|
|
1500
|
+
onClick: () => a("rutine"),
|
|
1487
1501
|
children: "Rutine"
|
|
1488
1502
|
}
|
|
1489
1503
|
),
|
|
1490
|
-
n && /* @__PURE__ */ o(ot, { active: i === "file", onClick: () =>
|
|
1504
|
+
n && /* @__PURE__ */ o(ot, { active: i === "file", onClick: () => a("file"), children: "Fil" })
|
|
1491
1505
|
] }),
|
|
1492
|
-
i === "url" && /* @__PURE__ */ o(Jr, { onClose:
|
|
1493
|
-
i === "rutine" && e && /* @__PURE__ */ o(Xr, { onClose:
|
|
1494
|
-
i === "file" && n && /* @__PURE__ */ o(Qr, { onClose:
|
|
1506
|
+
i === "url" && /* @__PURE__ */ o(Jr, { onClose: l }),
|
|
1507
|
+
i === "rutine" && e && /* @__PURE__ */ o(Xr, { onClose: l, getDocs: e }),
|
|
1508
|
+
i === "file" && n && /* @__PURE__ */ o(Qr, { onClose: l, uploadFile: n })
|
|
1495
1509
|
] });
|
|
1496
1510
|
}, zn = ({
|
|
1497
1511
|
getDocs: t,
|
|
1498
1512
|
uploadFile: r
|
|
1499
1513
|
}) => {
|
|
1500
|
-
const [e] = L(), [n, i] = p(!1), [
|
|
1501
|
-
const d =
|
|
1502
|
-
if (
|
|
1503
|
-
const c = Zt(d),
|
|
1504
|
-
i(Y(
|
|
1514
|
+
const [e] = L(), [n, i] = p(!1), [a, l] = p(!1), s = C(() => {
|
|
1515
|
+
const d = _();
|
|
1516
|
+
if (T(d)) {
|
|
1517
|
+
const c = Zt(d), h = c.getParent();
|
|
1518
|
+
i(Y(h) || Y(c));
|
|
1505
1519
|
}
|
|
1506
1520
|
}, []);
|
|
1507
1521
|
return x(() => e.registerCommand(
|
|
1508
1522
|
j,
|
|
1509
1523
|
() => (s(), !1),
|
|
1510
1524
|
at
|
|
1511
|
-
), [e, s]), /* @__PURE__ */
|
|
1525
|
+
), [e, s]), /* @__PURE__ */ u(Dt, { type: "single", value: n ? "link" : "", children: [
|
|
1512
1526
|
/* @__PURE__ */ o(
|
|
1513
|
-
|
|
1527
|
+
D,
|
|
1514
1528
|
{
|
|
1515
1529
|
onClick: () => {
|
|
1516
|
-
n ? e.dispatchCommand(V, null) :
|
|
1530
|
+
n ? e.dispatchCommand(V, null) : l(!0);
|
|
1517
1531
|
},
|
|
1518
1532
|
title: "Lenke",
|
|
1519
1533
|
value: "link",
|
|
1520
|
-
children: /* @__PURE__ */ o(
|
|
1534
|
+
children: /* @__PURE__ */ o(_r, { size: "1.25rem" })
|
|
1521
1535
|
}
|
|
1522
1536
|
),
|
|
1523
1537
|
/* @__PURE__ */ o(
|
|
1524
1538
|
Vr,
|
|
1525
1539
|
{
|
|
1526
|
-
open:
|
|
1527
|
-
onOpenChange:
|
|
1540
|
+
open: a,
|
|
1541
|
+
onOpenChange: l,
|
|
1528
1542
|
getDocs: t,
|
|
1529
1543
|
uploadFile: r
|
|
1530
1544
|
}
|
|
1531
1545
|
)
|
|
1532
1546
|
] });
|
|
1533
|
-
},
|
|
1534
|
-
const [t] = L(), r = K(null), [e, n] = p(null), [i,
|
|
1547
|
+
}, An = () => {
|
|
1548
|
+
const [t] = L(), r = K(null), [e, n] = p(null), [i, a] = p(""), { hasFocus: l } = et();
|
|
1535
1549
|
x(() => {
|
|
1536
1550
|
e ? t.update(() => {
|
|
1537
|
-
|
|
1538
|
-
}) :
|
|
1551
|
+
a(e.getURL());
|
|
1552
|
+
}) : a("");
|
|
1539
1553
|
}, [t, e]);
|
|
1540
|
-
const s = !!(e && i &&
|
|
1554
|
+
const s = !!(e && i && l), { refs: d, floatingStyles: c, context: h } = ut({
|
|
1541
1555
|
placement: "top",
|
|
1542
1556
|
strategy: "fixed",
|
|
1543
1557
|
open: s,
|
|
@@ -1546,39 +1560,39 @@ const Jr = ({ onClose: t }) => {
|
|
|
1546
1560
|
reference: r.current
|
|
1547
1561
|
},
|
|
1548
1562
|
middleware: [je()]
|
|
1549
|
-
}), { getFloatingProps: g } =
|
|
1550
|
-
jt(
|
|
1551
|
-
Ke(
|
|
1552
|
-
]),
|
|
1553
|
-
var
|
|
1554
|
-
const
|
|
1555
|
-
if (
|
|
1556
|
-
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();
|
|
1557
1571
|
let q = null;
|
|
1558
1572
|
if (Y(f) ? q = f : Y(E) && (q = E), q) {
|
|
1559
1573
|
const rt = window.getSelection(), mt = t.getRootElement();
|
|
1560
|
-
|
|
1574
|
+
b !== null && rt !== null && mt !== null && mt.contains(rt.anchorNode) && t.isEditable() && (r.current = ((N = rt.focusNode) == null ? void 0 : N.parentElement) ?? null);
|
|
1561
1575
|
}
|
|
1562
1576
|
n(q);
|
|
1563
1577
|
}
|
|
1564
|
-
}, [t]),
|
|
1578
|
+
}, [t]), y = C(() => {
|
|
1565
1579
|
e && Gr(e) && t.update(() => {
|
|
1566
1580
|
e.remove();
|
|
1567
1581
|
}), t.dispatchCommand(V, null);
|
|
1568
1582
|
}, [t, e]);
|
|
1569
1583
|
if (x(() => {
|
|
1570
1584
|
t.getEditorState().read(() => {
|
|
1571
|
-
|
|
1585
|
+
k();
|
|
1572
1586
|
});
|
|
1573
|
-
}, [t,
|
|
1574
|
-
t.registerUpdateListener(({ editorState:
|
|
1575
|
-
|
|
1576
|
-
|
|
1587
|
+
}, [t, k]), x(() => tt(
|
|
1588
|
+
t.registerUpdateListener(({ editorState: b }) => {
|
|
1589
|
+
b.read(() => {
|
|
1590
|
+
k();
|
|
1577
1591
|
});
|
|
1578
1592
|
}),
|
|
1579
1593
|
t.registerCommand(
|
|
1580
1594
|
j,
|
|
1581
|
-
() => (
|
|
1595
|
+
() => (k(), !0),
|
|
1582
1596
|
R
|
|
1583
1597
|
),
|
|
1584
1598
|
t.registerCommand(
|
|
@@ -1586,10 +1600,10 @@ const Jr = ({ onClose: t }) => {
|
|
|
1586
1600
|
() => e ? (n(null), !0) : !1,
|
|
1587
1601
|
ke
|
|
1588
1602
|
)
|
|
1589
|
-
), [t,
|
|
1603
|
+
), [t, k, e]), !s)
|
|
1590
1604
|
return null;
|
|
1591
1605
|
const S = pt(i);
|
|
1592
|
-
return /* @__PURE__ */ o(Kt, { children: /* @__PURE__ */
|
|
1606
|
+
return /* @__PURE__ */ o(Kt, { children: /* @__PURE__ */ u(
|
|
1593
1607
|
Bt,
|
|
1594
1608
|
{
|
|
1595
1609
|
ref: d.setFloating,
|
|
@@ -1604,7 +1618,7 @@ const Jr = ({ onClose: t }) => {
|
|
|
1604
1618
|
...g(),
|
|
1605
1619
|
children: [
|
|
1606
1620
|
/* @__PURE__ */ o(
|
|
1607
|
-
|
|
1621
|
+
U,
|
|
1608
1622
|
{
|
|
1609
1623
|
as: "a",
|
|
1610
1624
|
css: {
|
|
@@ -1621,34 +1635,37 @@ const Jr = ({ onClose: t }) => {
|
|
|
1621
1635
|
children: i
|
|
1622
1636
|
}
|
|
1623
1637
|
),
|
|
1624
|
-
/* @__PURE__ */ o(
|
|
1638
|
+
/* @__PURE__ */ o(w, { color: "danger", icon: !0, size: "sm", onClick: y, children: /* @__PURE__ */ o(Je, { size: 24 }) })
|
|
1625
1639
|
]
|
|
1626
1640
|
}
|
|
1627
1641
|
) });
|
|
1628
1642
|
};
|
|
1629
1643
|
export {
|
|
1644
|
+
gt as $createImageNode,
|
|
1630
1645
|
te as $createRutineLinkNode,
|
|
1646
|
+
yn as $isImageNode,
|
|
1631
1647
|
Gr as $isRutineLinkNode,
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1648
|
+
zr as FloatingToolbar,
|
|
1649
|
+
z as ImageNode,
|
|
1650
|
+
Rn as InsertSelector,
|
|
1651
|
+
An as LinkEditPlugin,
|
|
1635
1652
|
G as LinkTargetNode,
|
|
1636
1653
|
zn as LinkToolbarButton,
|
|
1637
|
-
|
|
1654
|
+
En as RichTextEditor,
|
|
1638
1655
|
Ar as RichTextToolbar,
|
|
1639
1656
|
O as RutineLinkNode,
|
|
1640
|
-
|
|
1641
|
-
|
|
1657
|
+
$n as RutineLinkNodeInit,
|
|
1658
|
+
On as TableEditPlugin,
|
|
1642
1659
|
ar as clearEditorState,
|
|
1643
1660
|
Nn as defaultNodes,
|
|
1644
|
-
|
|
1661
|
+
Sn as defaultViewNodes,
|
|
1645
1662
|
ir as isEditorState,
|
|
1646
1663
|
Gt as isJSON,
|
|
1647
1664
|
Jt as richTextContext,
|
|
1648
|
-
|
|
1665
|
+
In as richTextCss,
|
|
1649
1666
|
Kr as richTextStyleObj,
|
|
1650
1667
|
lr as setStateFromPlainText,
|
|
1651
|
-
|
|
1668
|
+
wn as stateToHTML,
|
|
1652
1669
|
sr as useHasFocusWithin,
|
|
1653
1670
|
et as useRichTextContext
|
|
1654
1671
|
};
|