@pstdio/ui 0.5.1 → 0.6.0
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/{MermaidComponent-x3aKzNXm.js → MermaidComponent-D7Baqkwx.js} +2 -2
- package/dist/{MermaidComponent-x3aKzNXm.js.map → MermaidComponent-D7Baqkwx.js.map} +1 -1
- package/dist/chat-ui.js +744 -726
- package/dist/chat-ui.js.map +1 -1
- package/dist/components/activity/activity-avatar.d.ts +9 -0
- package/dist/components/activity/activity-comment.d.ts +19 -0
- package/dist/components/activity/activity-composer.d.ts +18 -0
- package/dist/components/activity/activity-event.d.ts +12 -0
- package/dist/components/activity/activity-root.d.ts +15 -0
- package/dist/components/activity/activity-timeline.d.ts +6 -0
- package/dist/components/activity/activity.types.d.ts +5 -0
- package/dist/components/activity/index.d.ts +25 -0
- package/dist/components/app-shell/app-shell.d.ts +1 -0
- package/dist/components/app-shell/command-palette.d.ts +16 -0
- package/dist/components/app-shell/file-tree.d.ts +7 -0
- package/dist/components/app-shell/mock-chat.d.ts +2 -0
- package/dist/components/app-shell/mock-data.d.ts +37 -0
- package/dist/components/app-shell/pages/project-list-page.d.ts +7 -0
- package/dist/components/app-shell/pages/sessions-page.d.ts +6 -0
- package/dist/components/app-shell/pages/settings-page.d.ts +5 -0
- package/dist/components/app-shell/pages/ticket-details-page.d.ts +7 -0
- package/dist/components/app-shell/pages/tickets-page.d.ts +7 -0
- package/dist/components/app-shell/pages/workspace-page.d.ts +1 -0
- package/dist/components/app-shell/resizable-panel.d.ts +13 -0
- package/dist/components/chat-ui/components/ai-conversation.d.ts +4 -4
- package/dist/components/chat-ui/components/ai-message.d.ts +7 -5
- package/dist/components/chat-ui/components/chat-input.d.ts +1 -0
- package/dist/components/chat-ui/components/chat-panel.d.ts +1 -0
- package/dist/components/chat-ui/mocks/library/index.d.ts +10 -0
- package/dist/components/chat-ui/tool-rendering/build-timeline.d.ts +2 -2
- package/dist/components/chat-ui/tool-rendering/shared.d.ts +1 -1
- package/dist/components/content-placeholder.d.ts +1 -0
- package/dist/components/header.d.ts +7 -0
- package/dist/components/list-row/list-row-actions.d.ts +10 -0
- package/dist/components/list-row/list-row.d.ts +2 -0
- package/dist/components/list-row/list-row.types.d.ts +85 -0
- package/dist/components/{sidebar-tree → list-row}/searchable-action-menu.d.ts +2 -2
- package/dist/components/panel-header.constants.d.ts +1 -1
- package/dist/components/resource-context-menu.d.ts +1 -2
- package/dist/components/rich-text/shared/editor-config.d.ts +1 -0
- package/dist/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/floating-toolbar-buttons.d.ts +16 -0
- package/dist/components/rich-text/shared/plugins/LinkEditorPlugin/commands.d.ts +2 -0
- package/dist/components/rich-text/shared/plugins/LinkEditorPlugin/index.d.ts +3 -0
- package/dist/components/rich-text/shared/plugins/LinkEditorPlugin/link-editor-content.d.ts +18 -0
- package/dist/components/rich-text/shared/plugins/LinkEditorPlugin/utils/link-edit-state.d.ts +1 -0
- package/dist/components/rich-text/shared/plugins/LinkEditorPlugin/utils/selection-link-url.d.ts +2 -0
- package/dist/components/rich-text/shared/plugins/LinkEditorPlugin/utils/setFloatingElemPos.d.ts +1 -1
- package/dist/components/rich-text/shared/transformers/markdown-transformers-test-utils.d.ts +3 -0
- package/dist/components/rich-text/shared/transformers/markdown-transformers.d.ts +1 -0
- package/dist/components/sidebar/sidebar-project-menu.d.ts +0 -3
- package/dist/components/sidebar/sidebar.store.d.ts +2 -0
- package/dist/components/sidebar/sidebar.types.d.ts +10 -4
- package/dist/components/tickets/tickets-workspace.d.ts +1 -0
- package/dist/components/tree-list/tree-list.d.ts +18 -0
- package/dist/components/tree-list/tree-list.types.d.ts +29 -0
- package/dist/index.d.ts +10 -5
- package/dist/index.js +2697 -2343
- package/dist/index.js.map +1 -1
- package/dist/{rich-message-CoXTd5kw.js → rich-message-33DPxuWJ.js} +502 -464
- package/dist/rich-message-33DPxuWJ.js.map +1 -0
- package/dist/rich-text.js +738 -414
- package/dist/rich-text.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/theme/custom/index.d.ts +3 -0
- package/dist/theme/custom/monokai.json.d.ts +80 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/primitives/colors.d.ts +6 -0
- package/dist/theme/recipes/alert.d.ts +1 -1
- package/dist/theme/recipes/button.d.ts +28 -0
- package/dist/theme/recipes/dialog.d.ts +1 -1
- package/dist/theme/recipes/drawer.d.ts +1 -1
- package/dist/theme/recipes/kbd.d.ts +41 -0
- package/dist/theme/recipes/menu.d.ts +1 -1
- package/dist/theme/recipes/popover.d.ts +1 -1
- package/dist/theme/tokens/borders.d.ts +6 -24
- package/dist/theme/tokens/colors.d.ts +180 -168
- package/dist/theme/tokens/shadows.d.ts +5 -5
- package/dist/{theme-BLGUwVOD.js → theme-0SQvHr1t.js} +331 -243
- package/dist/theme-0SQvHr1t.js.map +1 -0
- package/dist/theme.js +4 -2
- package/dist/utils/apply-theme-preference.d.ts +20 -2
- package/dist/utils/theme-preference.d.ts +4 -2
- package/package.json +1 -2
- package/dist/components/drawer-inline.d.ts +0 -24
- package/dist/components/file-selector.d.ts +0 -12
- package/dist/components/menu-item.d.ts +0 -42
- package/dist/components/pstdio-logo.d.ts +0 -2
- package/dist/components/sidebar-tree/sidebar-node-content.d.ts +0 -9
- package/dist/components/sidebar-tree/sidebar-tree.d.ts +0 -13
- package/dist/components/sidebar-tree/sidebar-tree.types.d.ts +0 -68
- package/dist/rich-message-CoXTd5kw.js.map +0 -1
- package/dist/theme-BLGUwVOD.js.map +0 -1
package/dist/rich-text.js
CHANGED
|
@@ -1,146 +1,272 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import { e as
|
|
4
|
-
import { D as
|
|
5
|
-
import { IconButton as
|
|
6
|
-
import { LexicalCollaboration as
|
|
7
|
-
import { CollaborationPluginV2__EXPERIMENTAL as
|
|
8
|
-
import { LexicalComposer as
|
|
9
|
-
import { LexicalErrorBoundary as
|
|
10
|
-
import { HorizontalRulePlugin as
|
|
11
|
-
import { LinkPlugin as
|
|
12
|
-
import { ListPlugin as
|
|
13
|
-
import { RichTextPlugin as
|
|
14
|
-
import { TabIndentationPlugin as
|
|
15
|
-
import { useState as
|
|
16
|
-
import { WebsocketProvider as
|
|
17
|
-
import * as
|
|
18
|
-
import { $isCodeNode as
|
|
19
|
-
import { useLexicalComposerContext as
|
|
20
|
-
import { mergeRegister as
|
|
21
|
-
import { SELECTION_CHANGE_COMMAND as
|
|
22
|
-
import { Check as
|
|
23
|
-
import { createPortal as
|
|
24
|
-
import { T as
|
|
25
|
-
import { $
|
|
26
|
-
import { $
|
|
27
|
-
import { $
|
|
28
|
-
import { $
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
import { jsx as n, jsxs as ie, Fragment as ft } from "react/jsx-runtime";
|
|
2
|
+
import { c as te } from "react/compiler-runtime";
|
|
3
|
+
import { T as Ke, e as We, a as Ve, C as Ge, I as qe, E as Ye, b as Xe, s as mt, n as ut, c as He, d as pt, f as ht } from "./rich-message-33DPxuWJ.js";
|
|
4
|
+
import { D as co, g as fo, R as mo, P as uo, R as po, h as ho, i as go } from "./rich-message-33DPxuWJ.js";
|
|
5
|
+
import { IconButton as F, Text as me, Stack as Pe, Box as $e, Flex as Ae, Input as gt, Link as bt } from "@chakra-ui/react";
|
|
6
|
+
import { LexicalCollaboration as vt } from "@lexical/react/LexicalCollaborationContext";
|
|
7
|
+
import { CollaborationPluginV2__EXPERIMENTAL as Ct } from "@lexical/react/LexicalCollaborationPlugin";
|
|
8
|
+
import { LexicalComposer as Qe } from "@lexical/react/LexicalComposer";
|
|
9
|
+
import { LexicalErrorBoundary as Ze } from "@lexical/react/LexicalErrorBoundary";
|
|
10
|
+
import { HorizontalRulePlugin as Je } from "@lexical/react/LexicalHorizontalRulePlugin";
|
|
11
|
+
import { LinkPlugin as et } from "@lexical/react/LexicalLinkPlugin";
|
|
12
|
+
import { ListPlugin as tt } from "@lexical/react/LexicalListPlugin";
|
|
13
|
+
import { RichTextPlugin as nt } from "@lexical/react/LexicalRichTextPlugin";
|
|
14
|
+
import { TabIndentationPlugin as ot } from "@lexical/react/LexicalTabIndentationPlugin";
|
|
15
|
+
import { useState as B, useRef as oe, useEffect as q, useLayoutEffect as _t } from "react";
|
|
16
|
+
import { WebsocketProvider as Et } from "y-websocket";
|
|
17
|
+
import * as kt from "yjs";
|
|
18
|
+
import { $isCodeNode as Te, $createCodeNode as Lt } from "@lexical/code";
|
|
19
|
+
import { useLexicalComposerContext as De } from "@lexical/react/LexicalComposerContext";
|
|
20
|
+
import { mergeRegister as Le, $findMatchingParent as Z } from "@lexical/utils";
|
|
21
|
+
import { SELECTION_CHANGE_COMMAND as Se, COMMAND_PRIORITY_CRITICAL as Oe, $getSelection as ee, $isRangeSelection as Q, FORMAT_TEXT_COMMAND as Re, $isRootOrShadowRoot as St, CLICK_COMMAND as it, COMMAND_PRIORITY_HIGH as lt, $createParagraphNode as Fe, COMMAND_PRIORITY_LOW as Be, KEY_ESCAPE_COMMAND as yt, $isLineBreakNode as xt, $setSelection as Tt, $getRoot as Rt } from "lexical";
|
|
22
|
+
import { Check as rt, Copy as wt, Link as Nt, Code2 as It, List as Pt, ListOrdered as At, ListTodo as Bt, X as zt, Pencil as Mt, Trash2 as $t } from "lucide-react";
|
|
23
|
+
import { createPortal as Ue } from "react-dom";
|
|
24
|
+
import { T as j } from "./get-file-type-icon-Bwqf1WXA.js";
|
|
25
|
+
import { $isLinkNode as le, $isAutoLinkNode as pe, TOGGLE_LINK_COMMAND as ze, $createLinkNode as Dt } from "@lexical/link";
|
|
26
|
+
import { $isListNode as we, REMOVE_LIST_COMMAND as Ot, INSERT_CHECK_LIST_COMMAND as Ut, INSERT_ORDERED_LIST_COMMAND as Ht, INSERT_UNORDERED_LIST_COMMAND as Ft } from "@lexical/list";
|
|
27
|
+
import { $isHeadingNode as jt, $createHeadingNode as Kt } from "@lexical/rich-text";
|
|
28
|
+
import { $isAtNodeEnd as je, $setBlocksType as _e } from "@lexical/selection";
|
|
29
|
+
import { $convertFromMarkdownString as Wt, $convertToMarkdownString as Vt } from "@lexical/markdown";
|
|
30
|
+
import { AutoFocusPlugin as Gt } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
31
|
+
import { CheckListPlugin as qt } from "@lexical/react/LexicalCheckListPlugin";
|
|
32
|
+
import { HistoryPlugin as Yt } from "@lexical/react/LexicalHistoryPlugin";
|
|
33
|
+
import { OnChangePlugin as Xt } from "@lexical/react/LexicalOnChangePlugin";
|
|
34
|
+
function Ne(t) {
|
|
35
|
+
const e = ee();
|
|
36
|
+
if (!Q(e))
|
|
36
37
|
return null;
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
38
|
+
const r = e.anchor.getNode(), o = Te(r) ? r : Z(r, (m) => Te(m));
|
|
39
|
+
if (!Te(o))
|
|
39
40
|
return null;
|
|
40
|
-
const
|
|
41
|
-
return
|
|
41
|
+
const l = t.getElementByKey(o.getKey());
|
|
42
|
+
return l instanceof HTMLElement ? l : null;
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
-
return
|
|
44
|
+
function Qt(t) {
|
|
45
|
+
return t instanceof HTMLElement ? t.closest(".rich-text__code") : null;
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
-
const
|
|
47
|
+
function Zt(t, e) {
|
|
48
|
+
const r = t.getBoundingClientRect(), o = e.getBoundingClientRect();
|
|
48
49
|
return {
|
|
49
|
-
top:
|
|
50
|
-
left:
|
|
50
|
+
top: o.top - r.top + 6,
|
|
51
|
+
left: o.right - r.left - 30
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
-
const e =
|
|
55
|
-
anchorElem:
|
|
56
|
-
} =
|
|
57
|
-
let
|
|
58
|
-
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
let
|
|
62
|
-
e[2] !==
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
54
|
+
function st(t) {
|
|
55
|
+
const e = te(31), {
|
|
56
|
+
anchorElem: r
|
|
57
|
+
} = t, [o] = De(), [l, m] = B(null), [L, u] = B(!1), a = oe(null);
|
|
58
|
+
let p, E;
|
|
59
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = () => () => {
|
|
60
|
+
a.current !== null && window.clearTimeout(a.current);
|
|
61
|
+
}, E = [], e[0] = p, e[1] = E) : (p = e[0], E = e[1]), q(p, E);
|
|
62
|
+
let b, h;
|
|
63
|
+
e[2] !== o ? (b = () => {
|
|
64
|
+
const _ = o.getRootElement();
|
|
65
|
+
if (!_)
|
|
65
66
|
return;
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
67
|
+
const k = (I) => {
|
|
68
|
+
const z = Qt(I.target);
|
|
69
|
+
m(z instanceof HTMLElement ? z : null);
|
|
70
|
+
}, N = () => {
|
|
71
|
+
o.getEditorState().read(() => {
|
|
72
|
+
const I = Ne(o);
|
|
73
|
+
m(I);
|
|
73
74
|
});
|
|
74
75
|
};
|
|
75
|
-
return
|
|
76
|
-
|
|
76
|
+
return _.addEventListener("pointermove", k), _.addEventListener("pointerleave", N), () => {
|
|
77
|
+
_.removeEventListener("pointermove", k), _.removeEventListener("pointerleave", N);
|
|
77
78
|
};
|
|
78
|
-
},
|
|
79
|
-
let
|
|
80
|
-
if (e[5] !==
|
|
79
|
+
}, h = [o], e[2] = o, e[3] = b, e[4] = h) : (b = e[3], h = e[4]), q(b, h);
|
|
80
|
+
let C, R;
|
|
81
|
+
if (e[5] !== o ? (C = () => Le(o.registerUpdateListener((_) => {
|
|
81
82
|
const {
|
|
82
|
-
editorState:
|
|
83
|
-
} =
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
83
|
+
editorState: k
|
|
84
|
+
} = _;
|
|
85
|
+
k.read(() => {
|
|
86
|
+
const N = Ne(o);
|
|
87
|
+
N && m(N);
|
|
87
88
|
});
|
|
88
|
-
}),
|
|
89
|
-
const
|
|
90
|
-
if (!
|
|
91
|
-
|
|
89
|
+
}), o.registerCommand(Se, () => (o.getEditorState().read(() => {
|
|
90
|
+
const _ = Ne(o);
|
|
91
|
+
if (!_) {
|
|
92
|
+
m(Jt);
|
|
92
93
|
return;
|
|
93
94
|
}
|
|
94
|
-
|
|
95
|
-
}), !1),
|
|
95
|
+
m(_);
|
|
96
|
+
}), !1), Oe)), R = [o], e[5] = o, e[6] = C, e[7] = R) : (C = e[6], R = e[7]), q(C, R), !r || !l)
|
|
96
97
|
return null;
|
|
97
|
-
let
|
|
98
|
-
e[8] !==
|
|
99
|
-
const
|
|
100
|
-
let
|
|
101
|
-
e[11] !==
|
|
98
|
+
let c;
|
|
99
|
+
e[8] !== l || e[9] !== r ? (c = Zt(r, l), e[8] = l, e[9] = r, e[10] = c) : c = e[10];
|
|
100
|
+
const w = c;
|
|
101
|
+
let v;
|
|
102
|
+
e[11] !== w.left || e[12] !== w.top ? (v = {
|
|
102
103
|
position: "absolute",
|
|
103
|
-
top:
|
|
104
|
-
left:
|
|
105
|
-
}, e[11] =
|
|
106
|
-
const
|
|
107
|
-
let
|
|
108
|
-
e[14] !==
|
|
109
|
-
const
|
|
104
|
+
top: w.top,
|
|
105
|
+
left: w.left
|
|
106
|
+
}, e[11] = w.left, e[12] = w.top, e[13] = v) : v = e[13];
|
|
107
|
+
const S = v, g = L ? "Copied" : "Copy code", d = L ? "Copied" : "Copy code";
|
|
108
|
+
let i;
|
|
109
|
+
e[14] !== l.textContent ? (i = async () => {
|
|
110
|
+
const _ = l.textContent ?? "";
|
|
110
111
|
try {
|
|
111
|
-
await navigator.clipboard.writeText(
|
|
112
|
-
|
|
112
|
+
await navigator.clipboard.writeText(_), u(!0), a.current !== null && window.clearTimeout(a.current), a.current = window.setTimeout(() => {
|
|
113
|
+
u(!1);
|
|
113
114
|
}, 1200);
|
|
114
115
|
} catch {
|
|
115
|
-
|
|
116
|
+
u(!1);
|
|
116
117
|
}
|
|
117
|
-
}, e[14] =
|
|
118
|
-
let
|
|
119
|
-
e[16] !==
|
|
120
|
-
let
|
|
121
|
-
e[18] !==
|
|
118
|
+
}, e[14] = l.textContent, e[15] = i) : i = e[15];
|
|
119
|
+
let s;
|
|
120
|
+
e[16] !== L ? (s = L ? /* @__PURE__ */ n(rt, { size: 14 }) : /* @__PURE__ */ n(wt, { size: 14 }), e[16] = L, e[17] = s) : s = e[17];
|
|
121
|
+
let f;
|
|
122
|
+
e[18] !== d || e[19] !== i || e[20] !== s ? (f = /* @__PURE__ */ n(F, { "aria-label": d, variant: "surface", size: "xs", onClick: i, children: s }), e[18] = d, e[19] = i, e[20] = s, e[21] = f) : f = e[21];
|
|
123
|
+
let y;
|
|
124
|
+
e[22] !== f || e[23] !== g ? (y = /* @__PURE__ */ n(j, { content: g, children: f }), e[22] = f, e[23] = g, e[24] = y) : y = e[24];
|
|
122
125
|
let x;
|
|
123
|
-
e[
|
|
124
|
-
let
|
|
125
|
-
e[
|
|
126
|
-
let w;
|
|
127
|
-
return e[28] !== i || e[29] !== _ ? (w = Pe(_, i), e[28] = i, e[29] = _, e[30] = w) : w = e[30], w;
|
|
126
|
+
e[25] !== S || e[26] !== y ? (x = /* @__PURE__ */ n("div", { className: "code-block-actions", style: S, children: y }), e[25] = S, e[26] = y, e[27] = x) : x = e[27];
|
|
127
|
+
let T;
|
|
128
|
+
return e[28] !== r || e[29] !== x ? (T = Ue(x, r), e[28] = r, e[29] = x, e[30] = T) : T = e[30], T;
|
|
128
129
|
}
|
|
129
|
-
function
|
|
130
|
-
return
|
|
130
|
+
function Jt(t) {
|
|
131
|
+
return t?.matches(":hover") ? t : null;
|
|
131
132
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
function he(t) {
|
|
134
|
+
const e = t.anchor, r = t.focus, o = t.anchor.getNode(), l = t.focus.getNode();
|
|
135
|
+
return o === l ? o : t.isBackward() ? je(r) ? o : l : je(e) ? o : l;
|
|
136
|
+
}
|
|
137
|
+
const en = 10, tn = 5;
|
|
138
|
+
function ke(t, e, r, o = en, l = tn, m = "legacy") {
|
|
139
|
+
const L = r.parentElement;
|
|
140
|
+
if (t === null || !L) {
|
|
136
141
|
e.style.opacity = "0", e.style.transform = "translate(-10000px, -10000px)";
|
|
137
142
|
return;
|
|
138
143
|
}
|
|
139
|
-
const
|
|
140
|
-
let
|
|
141
|
-
|
|
144
|
+
const u = e.getBoundingClientRect(), a = r.getBoundingClientRect(), p = L.getBoundingClientRect();
|
|
145
|
+
let E = m === "above" ? t.top - u.height - o : t.top - o, b = t.left - l;
|
|
146
|
+
E < p.top && (E = m === "above" ? t.bottom + o : E + u.height + t.height + o * 2), b + u.width > p.right && (b = p.right - u.width - l), E -= a.top, b -= a.left, e.style.opacity = "1", e.style.transform = `translate(${b}px, ${E}px)`;
|
|
147
|
+
}
|
|
148
|
+
function Ie() {
|
|
149
|
+
const t = te(1);
|
|
150
|
+
let e;
|
|
151
|
+
return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n("span", { style: {
|
|
152
|
+
display: "inline-flex",
|
|
153
|
+
height: "1rem",
|
|
154
|
+
margin: "0 0.25rem",
|
|
155
|
+
borderLeft: "1px solid var(--chakra-colors-border-muted)"
|
|
156
|
+
} }), t[0] = e) : e = t[0], e;
|
|
157
|
+
}
|
|
158
|
+
function nn(t) {
|
|
159
|
+
const e = te(81), {
|
|
160
|
+
editor: r,
|
|
161
|
+
blockType: o,
|
|
162
|
+
isBold: l,
|
|
163
|
+
isItalic: m,
|
|
164
|
+
isUnderline: L,
|
|
165
|
+
isLink: u,
|
|
166
|
+
formatHeading: a,
|
|
167
|
+
formatList: p,
|
|
168
|
+
formatCodeBlock: E,
|
|
169
|
+
insertLink: b
|
|
170
|
+
} = t, h = l || void 0;
|
|
171
|
+
let C;
|
|
172
|
+
e[0] !== r ? (C = () => r.dispatchCommand(Re, "bold"), e[0] = r, e[1] = C) : C = e[1];
|
|
173
|
+
let R;
|
|
174
|
+
e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (R = /* @__PURE__ */ n(me, { fontWeight: "bold", fontSize: ".75rem", children: "B" }), e[2] = R) : R = e[2];
|
|
175
|
+
let c;
|
|
176
|
+
e[3] !== h || e[4] !== C ? (c = /* @__PURE__ */ n(j, { content: "Bold", children: /* @__PURE__ */ n(F, { "data-active": h, onClick: C, variant: "ghost", "aria-label": "Bold", size: "xs", children: R }) }), e[3] = h, e[4] = C, e[5] = c) : c = e[5];
|
|
177
|
+
const w = m || void 0;
|
|
178
|
+
let v;
|
|
179
|
+
e[6] !== r ? (v = () => r.dispatchCommand(Re, "italic"), e[6] = r, e[7] = v) : v = e[7];
|
|
180
|
+
let S;
|
|
181
|
+
e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ n(me, { fontStyle: "italic", fontSize: ".75rem", children: "I" }), e[8] = S) : S = e[8];
|
|
182
|
+
let g;
|
|
183
|
+
e[9] !== w || e[10] !== v ? (g = /* @__PURE__ */ n(j, { content: "Italic", children: /* @__PURE__ */ n(F, { "data-active": w, onClick: v, variant: "ghost", "aria-label": "Italic", size: "xs", children: S }) }), e[9] = w, e[10] = v, e[11] = g) : g = e[11];
|
|
184
|
+
const d = L || void 0;
|
|
185
|
+
let i;
|
|
186
|
+
e[12] !== r ? (i = () => r.dispatchCommand(Re, "underline"), e[12] = r, e[13] = i) : i = e[13];
|
|
187
|
+
let s;
|
|
188
|
+
e[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ n(me, { textDecoration: "underline", fontSize: ".75rem", children: "U" }), e[14] = s) : s = e[14];
|
|
189
|
+
let f;
|
|
190
|
+
e[15] !== d || e[16] !== i ? (f = /* @__PURE__ */ n(j, { content: "Underline", children: /* @__PURE__ */ n(F, { "data-active": d, onClick: i, variant: "ghost", "aria-label": "Underline", size: "xs", children: s }) }), e[15] = d, e[16] = i, e[17] = f) : f = e[17];
|
|
191
|
+
const y = u ? "Remove Link" : "Insert Link", x = u || void 0, T = u ? "Remove Link" : "Insert Link";
|
|
192
|
+
let _;
|
|
193
|
+
e[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ n(Nt, { size: 14 }), e[18] = _) : _ = e[18];
|
|
194
|
+
let k;
|
|
195
|
+
e[19] !== b || e[20] !== x || e[21] !== T ? (k = /* @__PURE__ */ n(F, { "data-active": x, variant: "ghost", "aria-label": T, size: "xs", onClick: b, children: _ }), e[19] = b, e[20] = x, e[21] = T, e[22] = k) : k = e[22];
|
|
196
|
+
let N;
|
|
197
|
+
e[23] !== y || e[24] !== k ? (N = /* @__PURE__ */ n(j, { content: y, children: k }), e[23] = y, e[24] = k, e[25] = N) : N = e[25];
|
|
198
|
+
let I;
|
|
199
|
+
e[26] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (I = /* @__PURE__ */ n(Ie, {}), e[26] = I) : I = e[26];
|
|
200
|
+
const z = o === "h1" || void 0;
|
|
201
|
+
let D;
|
|
202
|
+
e[27] !== a ? (D = () => a("h1"), e[27] = a, e[28] = D) : D = e[28];
|
|
203
|
+
let W;
|
|
204
|
+
e[29] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (W = /* @__PURE__ */ n(me, { fontWeight: "thin", fontSize: ".8rem", children: "H1" }), e[29] = W) : W = e[29];
|
|
205
|
+
let O;
|
|
206
|
+
e[30] !== z || e[31] !== D ? (O = /* @__PURE__ */ n(j, { content: "Heading 1", children: /* @__PURE__ */ n(F, { "data-active": z, variant: "ghost", "aria-label": "Heading 1", size: "xs", onClick: D, children: W }) }), e[30] = z, e[31] = D, e[32] = O) : O = e[32];
|
|
207
|
+
const K = o === "h2" || void 0;
|
|
208
|
+
let M;
|
|
209
|
+
e[33] !== a ? (M = () => a("h2"), e[33] = a, e[34] = M) : M = e[34];
|
|
210
|
+
let V;
|
|
211
|
+
e[35] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ n(me, { fontWeight: "thin", fontSize: ".8rem", children: "H2" }), e[35] = V) : V = e[35];
|
|
212
|
+
let P;
|
|
213
|
+
e[36] !== K || e[37] !== M ? (P = /* @__PURE__ */ n(j, { content: "Heading 2", children: /* @__PURE__ */ n(F, { "data-active": K, variant: "ghost", "aria-label": "Heading 2", size: "xs", onClick: M, children: V }) }), e[36] = K, e[37] = M, e[38] = P) : P = e[38];
|
|
214
|
+
const $ = o === "h3" || void 0;
|
|
215
|
+
let A;
|
|
216
|
+
e[39] !== a ? (A = () => a("h3"), e[39] = a, e[40] = A) : A = e[40];
|
|
217
|
+
let U;
|
|
218
|
+
e[41] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (U = /* @__PURE__ */ n(me, { fontWeight: "thin", fontSize: ".8rem", children: "H3" }), e[41] = U) : U = e[41];
|
|
219
|
+
let H;
|
|
220
|
+
e[42] !== $ || e[43] !== A ? (H = /* @__PURE__ */ n(j, { content: "Heading 3", children: /* @__PURE__ */ n(F, { "data-active": $, variant: "ghost", "aria-label": "Heading 3", size: "xs", onClick: A, children: U }) }), e[42] = $, e[43] = A, e[44] = H) : H = e[44];
|
|
221
|
+
let G;
|
|
222
|
+
e[45] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (G = /* @__PURE__ */ n(Ie, {}), e[45] = G) : G = e[45];
|
|
223
|
+
const J = o === "code" || void 0;
|
|
224
|
+
let Y;
|
|
225
|
+
e[46] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Y = /* @__PURE__ */ n(It, { size: 14 }), e[46] = Y) : Y = e[46];
|
|
226
|
+
let X;
|
|
227
|
+
e[47] !== E || e[48] !== J ? (X = /* @__PURE__ */ n(j, { content: "Code Block", children: /* @__PURE__ */ n(F, { "data-active": J, variant: "ghost", "aria-label": "Code Block", size: "xs", onClick: E, children: Y }) }), e[47] = E, e[48] = J, e[49] = X) : X = e[49];
|
|
228
|
+
let re;
|
|
229
|
+
e[50] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (re = /* @__PURE__ */ n(Ie, {}), e[50] = re) : re = e[50];
|
|
230
|
+
const ue = o === "bullet" || void 0;
|
|
231
|
+
let ne;
|
|
232
|
+
e[51] !== p ? (ne = () => p("bullet"), e[51] = p, e[52] = ne) : ne = e[52];
|
|
233
|
+
let ge;
|
|
234
|
+
e[53] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ge = /* @__PURE__ */ n(Pt, { size: 14 }), e[53] = ge) : ge = e[53];
|
|
235
|
+
let se;
|
|
236
|
+
e[54] !== ue || e[55] !== ne ? (se = /* @__PURE__ */ n(j, { content: "Bulleted List", children: /* @__PURE__ */ n(F, { "data-active": ue, variant: "ghost", "aria-label": "Bulleted List", size: "xs", onClick: ne, children: ge }) }), e[54] = ue, e[55] = ne, e[56] = se) : se = e[56];
|
|
237
|
+
const ye = o === "number" || void 0;
|
|
238
|
+
let ae;
|
|
239
|
+
e[57] !== p ? (ae = () => p("number"), e[57] = p, e[58] = ae) : ae = e[58];
|
|
240
|
+
let be;
|
|
241
|
+
e[59] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (be = /* @__PURE__ */ n(At, { size: 14 }), e[59] = be) : be = e[59];
|
|
242
|
+
let ce;
|
|
243
|
+
e[60] !== ye || e[61] !== ae ? (ce = /* @__PURE__ */ n(j, { content: "Numbered List", children: /* @__PURE__ */ n(F, { "data-active": ye, variant: "ghost", "aria-label": "Numbered List", size: "xs", onClick: ae, children: be }) }), e[60] = ye, e[61] = ae, e[62] = ce) : ce = e[62];
|
|
244
|
+
const xe = o === "check" || void 0;
|
|
245
|
+
let de;
|
|
246
|
+
e[63] !== p ? (de = () => p("check"), e[63] = p, e[64] = de) : de = e[64];
|
|
247
|
+
let ve;
|
|
248
|
+
e[65] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ve = /* @__PURE__ */ n(Bt, { size: 14 }), e[65] = ve) : ve = e[65];
|
|
249
|
+
let fe;
|
|
250
|
+
e[66] !== xe || e[67] !== de ? (fe = /* @__PURE__ */ n(j, { content: "Check List", children: /* @__PURE__ */ n(F, { "data-active": xe, variant: "ghost", "aria-label": "Check List", size: "xs", onClick: de, children: ve }) }), e[66] = xe, e[67] = de, e[68] = fe) : fe = e[68];
|
|
251
|
+
let Ce;
|
|
252
|
+
return e[69] !== f || e[70] !== N || e[71] !== O || e[72] !== P || e[73] !== c || e[74] !== H || e[75] !== X || e[76] !== se || e[77] !== ce || e[78] !== fe || e[79] !== g ? (Ce = /* @__PURE__ */ ie(Pe, { direction: "row", gap: "0.5", alignItems: "center", children: [
|
|
253
|
+
c,
|
|
254
|
+
g,
|
|
255
|
+
f,
|
|
256
|
+
N,
|
|
257
|
+
I,
|
|
258
|
+
O,
|
|
259
|
+
P,
|
|
260
|
+
H,
|
|
261
|
+
G,
|
|
262
|
+
X,
|
|
263
|
+
re,
|
|
264
|
+
se,
|
|
265
|
+
ce,
|
|
266
|
+
fe
|
|
267
|
+
] }), e[69] = f, e[70] = N, e[71] = O, e[72] = P, e[73] = c, e[74] = H, e[75] = X, e[76] = se, e[77] = ce, e[78] = fe, e[79] = g, e[80] = Ce) : Ce = e[80], Ce;
|
|
142
268
|
}
|
|
143
|
-
const
|
|
269
|
+
const on = {
|
|
144
270
|
bullet: "Bulleted List",
|
|
145
271
|
check: "Check List",
|
|
146
272
|
code: "Code Block",
|
|
@@ -153,171 +279,143 @@ const Tt = {
|
|
|
153
279
|
number: "Numbered List",
|
|
154
280
|
paragraph: "Normal",
|
|
155
281
|
quote: "Quote"
|
|
156
|
-
},
|
|
157
|
-
const
|
|
158
|
-
return
|
|
159
|
-
})) ??
|
|
160
|
-
const e =
|
|
161
|
-
if (
|
|
282
|
+
}, ln = (t) => t in on ? t : null, rn = (t) => (t.getKey() === "root" ? t : Z(t, (r) => {
|
|
283
|
+
const o = r.getParent();
|
|
284
|
+
return o !== null && St(o);
|
|
285
|
+
})) ?? t.getTopLevelElementOrThrow(), sn = (t) => {
|
|
286
|
+
const e = rn(t);
|
|
287
|
+
if (we(e))
|
|
162
288
|
return e.getListType();
|
|
163
|
-
const
|
|
164
|
-
if (
|
|
165
|
-
return
|
|
166
|
-
const
|
|
167
|
-
return
|
|
289
|
+
const r = Z(t, (l) => we(l));
|
|
290
|
+
if (r !== null && we(r))
|
|
291
|
+
return r.getListType();
|
|
292
|
+
const o = jt(e) ? e.getTag() : e.getType();
|
|
293
|
+
return ln(o);
|
|
168
294
|
};
|
|
169
|
-
function
|
|
295
|
+
function an(t) {
|
|
170
296
|
const {
|
|
171
297
|
hasSelection: e,
|
|
172
|
-
isRangeSelection:
|
|
173
|
-
isCollapsed:
|
|
174
|
-
hasNativeSelection:
|
|
175
|
-
hasNativeRange:
|
|
176
|
-
isAnchorInsideEditor:
|
|
177
|
-
isEditorEditable:
|
|
178
|
-
} =
|
|
179
|
-
return e &&
|
|
180
|
-
}
|
|
181
|
-
const wt = -4;
|
|
182
|
-
function ce() {
|
|
183
|
-
const o = ee(1);
|
|
184
|
-
let e;
|
|
185
|
-
return o[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ t("span", { style: {
|
|
186
|
-
display: "inline-flex",
|
|
187
|
-
height: "1rem",
|
|
188
|
-
margin: "0 0.25rem",
|
|
189
|
-
borderLeft: "1px solid var(--chakra-colors-border-muted)"
|
|
190
|
-
} }), o[0] = e) : e = o[0], e;
|
|
298
|
+
isRangeSelection: r,
|
|
299
|
+
isCollapsed: o,
|
|
300
|
+
hasNativeSelection: l,
|
|
301
|
+
hasNativeRange: m,
|
|
302
|
+
isAnchorInsideEditor: L,
|
|
303
|
+
isEditorEditable: u
|
|
304
|
+
} = t;
|
|
305
|
+
return e && r && !o && l && m && L && u;
|
|
191
306
|
}
|
|
192
|
-
|
|
193
|
-
|
|
307
|
+
const cn = -4;
|
|
308
|
+
function dn({
|
|
309
|
+
editor: t,
|
|
194
310
|
anchorElem: e,
|
|
195
|
-
isToolbarActive:
|
|
196
|
-
setIsToolbarActive:
|
|
311
|
+
isToolbarActive: r,
|
|
312
|
+
setIsToolbarActive: o
|
|
197
313
|
}) {
|
|
198
|
-
const
|
|
199
|
-
}),
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
if (
|
|
203
|
-
if (
|
|
204
|
-
|
|
314
|
+
const l = oe(null), [m, L] = B("paragraph"), [u, a] = B(!1), [p, E] = B(!1), [b, h] = B(!1), [C, R] = B(!1), c = oe(() => {
|
|
315
|
+
}), w = (i) => {
|
|
316
|
+
t.update(() => {
|
|
317
|
+
const s = ee();
|
|
318
|
+
if (Q(s)) {
|
|
319
|
+
if (m === i) {
|
|
320
|
+
_e(s, Fe);
|
|
205
321
|
return;
|
|
206
322
|
}
|
|
207
|
-
|
|
323
|
+
_e(s, () => Kt(i));
|
|
208
324
|
}
|
|
209
325
|
});
|
|
210
|
-
},
|
|
211
|
-
if (
|
|
212
|
-
|
|
326
|
+
}, v = (i) => {
|
|
327
|
+
if (m === i) {
|
|
328
|
+
t.dispatchCommand(Ot, void 0);
|
|
213
329
|
return;
|
|
214
330
|
}
|
|
215
|
-
const
|
|
216
|
-
bullet:
|
|
217
|
-
number:
|
|
218
|
-
check:
|
|
219
|
-
}[
|
|
220
|
-
|
|
221
|
-
},
|
|
222
|
-
|
|
223
|
-
const
|
|
224
|
-
if (
|
|
225
|
-
if (
|
|
226
|
-
|
|
331
|
+
const s = {
|
|
332
|
+
bullet: Ft,
|
|
333
|
+
number: Ht,
|
|
334
|
+
check: Ut
|
|
335
|
+
}[i];
|
|
336
|
+
t.dispatchCommand(s, void 0);
|
|
337
|
+
}, S = () => {
|
|
338
|
+
t.update(() => {
|
|
339
|
+
const i = ee();
|
|
340
|
+
if (Q(i)) {
|
|
341
|
+
if (m === "code") {
|
|
342
|
+
_e(i, Fe);
|
|
227
343
|
return;
|
|
228
344
|
}
|
|
229
|
-
|
|
345
|
+
_e(i, () => Lt());
|
|
230
346
|
}
|
|
231
347
|
});
|
|
232
|
-
},
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
348
|
+
}, g = () => {
|
|
349
|
+
if (C) {
|
|
350
|
+
t.dispatchCommand(ze, null);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
t.dispatchCommand(Ke, !0);
|
|
354
|
+
}, d = () => {
|
|
355
|
+
const i = ee();
|
|
356
|
+
if (!Q(i)) return;
|
|
357
|
+
a(i.hasFormat("bold")), E(i.hasFormat("italic")), h(i.hasFormat("underline"));
|
|
358
|
+
const s = he(i), f = Z(s, le), y = Z(s, pe);
|
|
359
|
+
R(f !== null || y !== null);
|
|
360
|
+
const x = sn(i.anchor.getNode());
|
|
361
|
+
x && L(x);
|
|
238
362
|
};
|
|
239
|
-
return
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
363
|
+
return c.current = () => {
|
|
364
|
+
const i = ee(), s = l.current, f = window.getSelection();
|
|
365
|
+
if (s === null)
|
|
242
366
|
return;
|
|
243
|
-
const
|
|
244
|
-
if (
|
|
245
|
-
hasSelection:
|
|
246
|
-
isRangeSelection:
|
|
247
|
-
isCollapsed:
|
|
248
|
-
hasNativeSelection:
|
|
249
|
-
hasNativeRange:
|
|
250
|
-
isAnchorInsideEditor:
|
|
251
|
-
isEditorEditable:
|
|
252
|
-
}) &&
|
|
253
|
-
const
|
|
254
|
-
if (
|
|
255
|
-
const
|
|
256
|
-
|
|
367
|
+
const y = t.getRootElement(), x = f !== null, T = x && f.rangeCount > 0, _ = !!y?.contains(x ? f.anchorNode : null);
|
|
368
|
+
if (an({
|
|
369
|
+
hasSelection: i !== null,
|
|
370
|
+
isRangeSelection: Q(i),
|
|
371
|
+
isCollapsed: Q(i) ? i.isCollapsed() : !1,
|
|
372
|
+
hasNativeSelection: x,
|
|
373
|
+
hasNativeRange: T,
|
|
374
|
+
isAnchorInsideEditor: _,
|
|
375
|
+
isEditorEditable: t.isEditable()
|
|
376
|
+
}) && f) {
|
|
377
|
+
const k = f.getRangeAt(0).getBoundingClientRect();
|
|
378
|
+
if (k) {
|
|
379
|
+
const N = new DOMRect(k.left, k.bottom, 0, 0);
|
|
380
|
+
ke(N, s, e, cn);
|
|
257
381
|
}
|
|
258
|
-
|
|
382
|
+
o(!0);
|
|
259
383
|
} else
|
|
260
|
-
|
|
261
|
-
return
|
|
262
|
-
},
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
|
|
384
|
+
y !== null && ke(null, s, e), o(!1);
|
|
385
|
+
return d(), !0;
|
|
386
|
+
}, q(() => {
|
|
387
|
+
const i = e.parentElement, s = () => {
|
|
388
|
+
t.getEditorState().read(() => {
|
|
389
|
+
c.current();
|
|
266
390
|
});
|
|
267
391
|
};
|
|
268
|
-
return window.addEventListener("resize",
|
|
269
|
-
window.removeEventListener("resize",
|
|
392
|
+
return window.addEventListener("resize", s), i && i.addEventListener("scroll", s), () => {
|
|
393
|
+
window.removeEventListener("resize", s), i && i.removeEventListener("scroll", s);
|
|
270
394
|
};
|
|
271
|
-
}, [e,
|
|
272
|
-
editorState:
|
|
395
|
+
}, [e, t]), q(() => Le(t.registerUpdateListener(({
|
|
396
|
+
editorState: i
|
|
273
397
|
}) => {
|
|
274
|
-
|
|
275
|
-
|
|
398
|
+
i.read(() => {
|
|
399
|
+
c.current();
|
|
276
400
|
});
|
|
277
|
-
}),
|
|
278
|
-
const
|
|
279
|
-
return
|
|
280
|
-
},
|
|
281
|
-
/* @__PURE__ */ t(D, { content: "Bold", children: /* @__PURE__ */ t($, { "data-active": d || void 0, onClick: () => {
|
|
282
|
-
o.dispatchCommand(re, "bold");
|
|
283
|
-
}, variant: "ghost", "aria-label": "Bold", size: "xs", children: /* @__PURE__ */ t(Z, { fontWeight: "bold", fontSize: ".75rem", children: "B" }) }) }),
|
|
284
|
-
/* @__PURE__ */ t(D, { content: "Italic", children: /* @__PURE__ */ t($, { "data-active": v || void 0, onClick: () => {
|
|
285
|
-
o.dispatchCommand(re, "italic");
|
|
286
|
-
}, variant: "ghost", "aria-label": "Italic", size: "xs", children: /* @__PURE__ */ t(Z, { fontStyle: "italic", fontSize: ".75rem", children: "I" }) }) }),
|
|
287
|
-
/* @__PURE__ */ t(D, { content: "Underline", children: /* @__PURE__ */ t($, { "data-active": L || void 0, onClick: () => {
|
|
288
|
-
o.dispatchCommand(re, "underline");
|
|
289
|
-
}, variant: "ghost", "aria-label": "Underline", size: "xs", children: /* @__PURE__ */ t(Z, { textDecoration: "underline", fontSize: ".75rem", children: "U" }) }) }),
|
|
290
|
-
/* @__PURE__ */ t(ce, {}),
|
|
291
|
-
/* @__PURE__ */ t(D, { content: "Heading 1", children: /* @__PURE__ */ t($, { "data-active": a === "h1" || void 0, variant: "ghost", "aria-label": "Heading 1", size: "xs", onClick: () => {
|
|
292
|
-
R("h1");
|
|
293
|
-
}, children: /* @__PURE__ */ t(Z, { fontWeight: "thin", fontSize: ".8rem", children: "H1" }) }) }),
|
|
294
|
-
/* @__PURE__ */ t(D, { content: "Heading 2", children: /* @__PURE__ */ t($, { "data-active": a === "h2" || void 0, variant: "ghost", "aria-label": "Heading 2", size: "xs", onClick: () => {
|
|
295
|
-
R("h2");
|
|
296
|
-
}, children: /* @__PURE__ */ t(Z, { fontWeight: "thin", fontSize: ".8rem", children: "H2" }) }) }),
|
|
297
|
-
/* @__PURE__ */ t(D, { content: "Heading 3", children: /* @__PURE__ */ t($, { "data-active": a === "h3" || void 0, variant: "ghost", "aria-label": "Heading 3", size: "xs", onClick: () => {
|
|
298
|
-
R("h3");
|
|
299
|
-
}, children: /* @__PURE__ */ t(Z, { fontWeight: "thin", fontSize: ".8rem", children: "H3" }) }) }),
|
|
300
|
-
/* @__PURE__ */ t(ce, {}),
|
|
301
|
-
/* @__PURE__ */ t(D, { content: "Code Block", children: /* @__PURE__ */ t($, { "data-active": a === "code" || void 0, variant: "ghost", "aria-label": "Code Block", size: "xs", onClick: I, children: /* @__PURE__ */ t(tt, { size: 14 }) }) }),
|
|
302
|
-
/* @__PURE__ */ t(ce, {}),
|
|
303
|
-
/* @__PURE__ */ t(D, { content: "Bulleted List", children: /* @__PURE__ */ t($, { "data-active": a === "bullet" || void 0, variant: "ghost", "aria-label": "Bulleted List", size: "xs", onClick: () => T("bullet"), children: /* @__PURE__ */ t(ot, { size: 14 }) }) }),
|
|
304
|
-
/* @__PURE__ */ t(D, { content: "Numbered List", children: /* @__PURE__ */ t($, { "data-active": a === "number" || void 0, variant: "ghost", "aria-label": "Numbered List", size: "xs", onClick: () => T("number"), children: /* @__PURE__ */ t(nt, { size: 14 }) }) }),
|
|
305
|
-
/* @__PURE__ */ t(D, { content: "Check List", children: /* @__PURE__ */ t($, { "data-active": a === "check" || void 0, variant: "ghost", "aria-label": "Check List", size: "xs", onClick: () => T("check"), children: /* @__PURE__ */ t(it, { size: 14 }) }) })
|
|
306
|
-
] }) });
|
|
307
|
-
}
|
|
308
|
-
function Ae(o) {
|
|
309
|
-
const e = ee(7), {
|
|
310
|
-
anchorElem: i
|
|
311
|
-
} = o, n = i === void 0 ? document.body : i, [s] = Le(), [a, m] = H(!1);
|
|
312
|
-
let d;
|
|
313
|
-
e[0] !== n || e[1] !== s || e[2] !== a ? (d = /* @__PURE__ */ t(kt, { editor: s, anchorElem: n, isToolbarActive: a, setIsToolbarActive: m }), e[0] = n, e[1] = s, e[2] = a, e[3] = d) : d = e[3];
|
|
314
|
-
let c;
|
|
315
|
-
return e[4] !== n || e[5] !== d ? (c = Pe(d, n), e[4] = n, e[5] = d, e[6] = c) : c = e[6], c;
|
|
401
|
+
}), t.registerCommand(Se, (i) => (c.current(), !1), Oe), t.registerCommand(it, (i) => {
|
|
402
|
+
const s = ee();
|
|
403
|
+
return Q(s) && c.current(), !1;
|
|
404
|
+
}, lt)), [t]), /* @__PURE__ */ n("div", { ref: l, className: `floating-text-format-toolbar ${r ? "active" : ""}`, children: /* @__PURE__ */ n(nn, { editor: t, blockType: m, isBold: u, isItalic: p, isUnderline: b, isLink: C, formatHeading: w, formatList: v, formatCodeBlock: S, insertLink: g }) });
|
|
316
405
|
}
|
|
317
|
-
function
|
|
318
|
-
const
|
|
406
|
+
function at(t) {
|
|
407
|
+
const e = te(7), {
|
|
408
|
+
anchorElem: r
|
|
409
|
+
} = t, o = r === void 0 ? document.body : r, [l] = De(), [m, L] = B(!1);
|
|
410
|
+
let u;
|
|
411
|
+
e[0] !== o || e[1] !== l || e[2] !== m ? (u = /* @__PURE__ */ n(dn, { editor: l, anchorElem: o, isToolbarActive: m, setIsToolbarActive: L }), e[0] = o, e[1] = l, e[2] = m, e[3] = u) : u = e[3];
|
|
412
|
+
let a;
|
|
413
|
+
return e[4] !== o || e[5] !== u ? (a = Ue(u, o), e[4] = o, e[5] = u, e[6] = a) : a = e[6], a;
|
|
414
|
+
}
|
|
415
|
+
function fn() {
|
|
416
|
+
const t = te(1);
|
|
319
417
|
let e;
|
|
320
|
-
return
|
|
418
|
+
return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n("style", { children: `
|
|
321
419
|
.collaboration-cursor-container {
|
|
322
420
|
position: relative;
|
|
323
421
|
display: inline;
|
|
@@ -351,185 +449,411 @@ function Lt() {
|
|
|
351
449
|
pointer-events: none;
|
|
352
450
|
opacity: 0.25;
|
|
353
451
|
}
|
|
354
|
-
` }),
|
|
355
|
-
}
|
|
356
|
-
function
|
|
357
|
-
const e =
|
|
358
|
-
roomId:
|
|
359
|
-
wsUrl:
|
|
360
|
-
wsParams:
|
|
361
|
-
userName:
|
|
362
|
-
userColor:
|
|
363
|
-
placeholder:
|
|
364
|
-
} =
|
|
365
|
-
let
|
|
366
|
-
e[0] !==
|
|
367
|
-
const
|
|
368
|
-
let
|
|
369
|
-
e[2] !==
|
|
370
|
-
const
|
|
371
|
-
params:
|
|
452
|
+
` }), t[0] = e) : e = t[0], e;
|
|
453
|
+
}
|
|
454
|
+
function oo(t) {
|
|
455
|
+
const e = te(42), {
|
|
456
|
+
roomId: r,
|
|
457
|
+
wsUrl: o,
|
|
458
|
+
wsParams: l,
|
|
459
|
+
userName: m,
|
|
460
|
+
userColor: L,
|
|
461
|
+
placeholder: u
|
|
462
|
+
} = t;
|
|
463
|
+
let a;
|
|
464
|
+
e[0] !== l ? (a = l === void 0 ? {} : l, e[0] = l, e[1] = a) : a = e[1];
|
|
465
|
+
const p = a, E = m === void 0 ? "Anonymous" : m, b = L === void 0 ? "#30bced" : L, h = oe(null), [C, R] = B(null), [c, w] = B(!1), [v] = B(un);
|
|
466
|
+
let S;
|
|
467
|
+
e[2] !== v || e[3] !== r || e[4] !== p || e[5] !== o ? (S = () => {
|
|
468
|
+
const H = new Et(o, r, v, {
|
|
469
|
+
params: p,
|
|
372
470
|
connect: !1
|
|
373
471
|
});
|
|
374
|
-
return
|
|
375
|
-
|
|
376
|
-
}),
|
|
377
|
-
}, e[2] =
|
|
378
|
-
const [
|
|
379
|
-
let
|
|
380
|
-
e[7] !==
|
|
381
|
-
|
|
382
|
-
}),
|
|
383
|
-
let
|
|
384
|
-
e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
385
|
-
R(
|
|
386
|
-
},
|
|
387
|
-
let
|
|
388
|
-
e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
472
|
+
return H.on("sync", (G) => {
|
|
473
|
+
G && w(!0);
|
|
474
|
+
}), H;
|
|
475
|
+
}, e[2] = v, e[3] = r, e[4] = p, e[5] = o, e[6] = S) : S = e[6];
|
|
476
|
+
const [g] = B(S);
|
|
477
|
+
let d, i;
|
|
478
|
+
e[7] !== g ? (d = () => (g.connect(), () => {
|
|
479
|
+
g.disconnect();
|
|
480
|
+
}), i = [g], e[7] = g, e[8] = d, e[9] = i) : (d = e[8], i = e[9]), q(d, i);
|
|
481
|
+
let s, f;
|
|
482
|
+
e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = () => {
|
|
483
|
+
R(h.current);
|
|
484
|
+
}, f = [], e[10] = s, e[11] = f) : (s = e[10], f = e[11]), q(s, f);
|
|
485
|
+
let y;
|
|
486
|
+
e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = {
|
|
389
487
|
namespace: "COLLABORATIVE_EDITOR",
|
|
390
|
-
nodes:
|
|
488
|
+
nodes: Ve,
|
|
391
489
|
editorState: null,
|
|
392
|
-
onError:
|
|
490
|
+
onError: mn,
|
|
393
491
|
editable: !0,
|
|
394
|
-
theme:
|
|
395
|
-
}, e[12] =
|
|
396
|
-
const
|
|
397
|
-
let
|
|
398
|
-
e[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
399
|
-
const
|
|
400
|
-
let
|
|
401
|
-
e[14] !==
|
|
402
|
-
let
|
|
403
|
-
e[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
404
|
-
let z;
|
|
405
|
-
e[26] !== u ? (z = /* @__PURE__ */ t(Be, { anchorElem: u }), e[26] = u, e[27] = z) : z = e[27];
|
|
406
|
-
let O;
|
|
407
|
-
e[28] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (O = /* @__PURE__ */ t(be, {}), e[28] = O) : O = e[28];
|
|
492
|
+
theme: We
|
|
493
|
+
}, e[12] = y) : y = e[12];
|
|
494
|
+
const x = y;
|
|
495
|
+
let T;
|
|
496
|
+
e[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ n(fn, {}), e[13] = T) : T = e[13];
|
|
497
|
+
const _ = g;
|
|
498
|
+
let k;
|
|
499
|
+
e[14] !== v || e[15] !== r || e[16] !== _ || e[17] !== b || e[18] !== E ? (k = /* @__PURE__ */ n(Ct, { id: r, doc: v, provider: _, __shouldBootstrapUnsafe: !1, username: E, cursorColor: b }), e[14] = v, e[15] = r, e[16] = _, e[17] = b, e[18] = E, e[19] = k) : k = e[19];
|
|
500
|
+
let N, I, z, D, W, O;
|
|
501
|
+
e[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ n(et, {}), I = /* @__PURE__ */ n(tt, {}), z = /* @__PURE__ */ n(ot, { maxIndent: 7 }), D = /* @__PURE__ */ n(Je, {}), W = /* @__PURE__ */ n(Ge, {}), O = /* @__PURE__ */ n(qe, {}), e[20] = N, e[21] = I, e[22] = z, e[23] = D, e[24] = W, e[25] = O) : (N = e[20], I = e[21], z = e[22], D = e[23], W = e[24], O = e[25]);
|
|
408
502
|
let K;
|
|
409
|
-
e[
|
|
503
|
+
e[26] !== C ? (K = /* @__PURE__ */ n(st, { anchorElem: C }), e[26] = C, e[27] = K) : K = e[27];
|
|
504
|
+
let M;
|
|
505
|
+
e[28] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (M = /* @__PURE__ */ n(Ye, {}), e[28] = M) : M = e[28];
|
|
506
|
+
let V;
|
|
507
|
+
e[29] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ n(Xe, { fullWidth: !1 }), e[29] = V) : V = e[29];
|
|
410
508
|
let P;
|
|
411
|
-
e[30] !==
|
|
412
|
-
let
|
|
413
|
-
e[33] !== P ? (
|
|
509
|
+
e[30] !== u || e[31] !== c ? (P = c && u ? /* @__PURE__ */ n($e, { position: "absolute", top: "0", color: "fg.muted", pointerEvents: "none", userSelect: "none", textStyle: "paragraph/M/regular", children: u }) : null, e[30] = u, e[31] = c, e[32] = P) : P = e[32];
|
|
510
|
+
let $;
|
|
511
|
+
e[33] !== P ? ($ = /* @__PURE__ */ n(nt, { contentEditable: V, placeholder: P, ErrorBoundary: Ze }), e[33] = P, e[34] = $) : $ = e[34];
|
|
414
512
|
let A;
|
|
415
|
-
e[35] !==
|
|
416
|
-
let
|
|
417
|
-
return e[37] !==
|
|
418
|
-
|
|
419
|
-
/* @__PURE__ */
|
|
420
|
-
S,
|
|
513
|
+
e[35] !== C ? (A = C ? /* @__PURE__ */ n(at, { anchorElem: C }) : null, e[35] = C, e[36] = A) : A = e[36];
|
|
514
|
+
let U;
|
|
515
|
+
return e[37] !== k || e[38] !== K || e[39] !== $ || e[40] !== A ? (U = /* @__PURE__ */ ie(Ae, { ref: h, className: "rich-text", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: "100%", position: "relative", direction: "column", overflow: "visible", children: [
|
|
516
|
+
T,
|
|
517
|
+
/* @__PURE__ */ n(Qe, { initialConfig: x, children: /* @__PURE__ */ ie(vt, { children: [
|
|
421
518
|
k,
|
|
422
519
|
N,
|
|
423
|
-
|
|
424
|
-
j,
|
|
425
|
-
W,
|
|
426
|
-
U,
|
|
520
|
+
I,
|
|
427
521
|
z,
|
|
522
|
+
D,
|
|
523
|
+
W,
|
|
428
524
|
O,
|
|
429
|
-
|
|
525
|
+
K,
|
|
526
|
+
M,
|
|
527
|
+
$,
|
|
430
528
|
A
|
|
431
529
|
] }) })
|
|
432
|
-
] }), e[37] =
|
|
433
|
-
}
|
|
434
|
-
function
|
|
435
|
-
return console.error(
|
|
436
|
-
}
|
|
437
|
-
function
|
|
438
|
-
return new
|
|
439
|
-
}
|
|
440
|
-
function
|
|
441
|
-
const e =
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
530
|
+
] }), e[37] = k, e[38] = K, e[39] = $, e[40] = A, e[41] = U) : U = e[41], U;
|
|
531
|
+
}
|
|
532
|
+
function mn(t) {
|
|
533
|
+
return console.error(t);
|
|
534
|
+
}
|
|
535
|
+
function un() {
|
|
536
|
+
return new kt.Doc();
|
|
537
|
+
}
|
|
538
|
+
function pn(t) {
|
|
539
|
+
const e = te(32), {
|
|
540
|
+
isActive: r,
|
|
541
|
+
isLinkEditMode: o,
|
|
542
|
+
editedLinkUrl: l,
|
|
543
|
+
editedLinkUrlIsValid: m,
|
|
544
|
+
linkUrl: L,
|
|
545
|
+
href: u,
|
|
546
|
+
inputRef: a,
|
|
547
|
+
onEditedLinkUrlChange: p,
|
|
548
|
+
onInputKeyDown: E,
|
|
549
|
+
onClose: b,
|
|
550
|
+
onSubmit: h,
|
|
551
|
+
onEdit: C,
|
|
552
|
+
onRemove: R
|
|
553
|
+
} = t;
|
|
554
|
+
if (!r)
|
|
555
|
+
return null;
|
|
556
|
+
if (o) {
|
|
557
|
+
const i = !m;
|
|
558
|
+
let s;
|
|
559
|
+
e[0] !== p ? (s = (I) => {
|
|
560
|
+
p(I.target.value);
|
|
561
|
+
}, e[0] = p, e[1] = s) : s = e[1];
|
|
562
|
+
let f;
|
|
563
|
+
e[2] !== l || e[3] !== a || e[4] !== E || e[5] !== i || e[6] !== s ? (f = /* @__PURE__ */ n(gt, { ref: a, className: "link-editor-url-field", size: "sm", fontSize: "sm", value: l, placeholder: "https://", "aria-label": "Link URL", "aria-invalid": i, onChange: s, onKeyDown: E }), e[2] = l, e[3] = a, e[4] = E, e[5] = i, e[6] = s, e[7] = f) : f = e[7];
|
|
564
|
+
let y;
|
|
565
|
+
e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ n(zt, { size: 14 }), e[8] = y) : y = e[8];
|
|
566
|
+
let x;
|
|
567
|
+
e[9] !== b ? (x = /* @__PURE__ */ n(j, { content: "Cancel", children: /* @__PURE__ */ n(F, { variant: "ghost", size: "xs", "aria-label": "Cancel link edit", onMouseDown: Ee, onClick: b, children: y }) }), e[9] = b, e[10] = x) : x = e[10];
|
|
568
|
+
const T = !m;
|
|
569
|
+
let _;
|
|
570
|
+
e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ n(rt, { size: 14 }), e[11] = _) : _ = e[11];
|
|
571
|
+
let k;
|
|
572
|
+
e[12] !== h || e[13] !== T ? (k = /* @__PURE__ */ n(j, { content: "Confirm", children: /* @__PURE__ */ n(F, { variant: "ghost", size: "xs", "aria-label": "Confirm link edit", disabled: T, onMouseDown: Ee, onClick: h, children: _ }) }), e[12] = h, e[13] = T, e[14] = k) : k = e[14];
|
|
573
|
+
let N;
|
|
574
|
+
return e[15] !== f || e[16] !== x || e[17] !== k ? (N = /* @__PURE__ */ ie(Pe, { className: "link-editor-content", direction: "row", gap: "1", alignItems: "center", p: "1", children: [
|
|
575
|
+
f,
|
|
576
|
+
x,
|
|
577
|
+
k
|
|
578
|
+
] }), e[15] = f, e[16] = x, e[17] = k, e[18] = N) : N = e[18], N;
|
|
579
|
+
}
|
|
580
|
+
let c;
|
|
581
|
+
e[19] !== u || e[20] !== L ? (c = /* @__PURE__ */ n(bt, { href: u, target: "_blank", rel: "noopener noreferrer", className: "link-editor-url-field", fontSize: "sm", textDecoration: "underline", px: "2", truncate: !0, children: L }), e[19] = u, e[20] = L, e[21] = c) : c = e[21];
|
|
582
|
+
let w;
|
|
583
|
+
e[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ n(Mt, { size: 14 }), e[22] = w) : w = e[22];
|
|
584
|
+
let v;
|
|
585
|
+
e[23] !== C ? (v = /* @__PURE__ */ n(j, { content: "Edit link", children: /* @__PURE__ */ n(F, { variant: "ghost", size: "xs", "aria-label": "Edit link", onMouseDown: Ee, onClick: C, children: w }) }), e[23] = C, e[24] = v) : v = e[24];
|
|
586
|
+
let S;
|
|
587
|
+
e[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ n($t, { size: 14 }), e[25] = S) : S = e[25];
|
|
588
|
+
let g;
|
|
589
|
+
e[26] !== R ? (g = /* @__PURE__ */ n(j, { content: "Remove link", children: /* @__PURE__ */ n(F, { variant: "ghost", size: "xs", "aria-label": "Remove link", onMouseDown: Ee, onClick: R, children: S }) }), e[26] = R, e[27] = g) : g = e[27];
|
|
590
|
+
let d;
|
|
591
|
+
return e[28] !== c || e[29] !== v || e[30] !== g ? (d = /* @__PURE__ */ ie(Pe, { className: "link-editor-content", direction: "row", gap: "1", alignItems: "center", p: "1", children: [
|
|
592
|
+
c,
|
|
593
|
+
v,
|
|
594
|
+
g
|
|
595
|
+
] }), e[28] = c, e[29] = v, e[30] = g, e[31] = d) : d = e[31], d;
|
|
596
|
+
}
|
|
597
|
+
function Ee(t) {
|
|
598
|
+
t.preventDefault();
|
|
599
|
+
}
|
|
600
|
+
function hn(t, e, r) {
|
|
601
|
+
return t && e && r === "";
|
|
602
|
+
}
|
|
603
|
+
function gn(t) {
|
|
604
|
+
const e = he(t), r = Z(e, le);
|
|
605
|
+
return r ? r.getURL() : le(e) ? e.getURL() : "";
|
|
606
|
+
}
|
|
607
|
+
const ct = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "sms:", "tel:"]);
|
|
608
|
+
function Me(t) {
|
|
609
|
+
try {
|
|
610
|
+
const e = new URL(t);
|
|
611
|
+
if (!ct.has(e.protocol))
|
|
612
|
+
return "about:blank";
|
|
613
|
+
} catch {
|
|
614
|
+
return t;
|
|
615
|
+
}
|
|
616
|
+
return t;
|
|
617
|
+
}
|
|
618
|
+
function dt(t) {
|
|
619
|
+
try {
|
|
620
|
+
const e = new URL(t);
|
|
621
|
+
return ct.has(e.protocol) ? e.protocol === "http:" || e.protocol === "https:" ? e.hostname !== "" : e.pathname.trim() !== "" : !1;
|
|
622
|
+
} catch {
|
|
623
|
+
return !1;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
const bn = 8;
|
|
627
|
+
function vn({
|
|
628
|
+
editor: t,
|
|
629
|
+
isLink: e,
|
|
630
|
+
setIsLink: r,
|
|
631
|
+
anchorElem: o,
|
|
632
|
+
isLinkEditMode: l,
|
|
633
|
+
setIsLinkEditMode: m
|
|
634
|
+
}) {
|
|
635
|
+
const L = oe(null), u = oe(null), a = oe(() => {
|
|
636
|
+
}), [p, E] = B(""), [b, h] = B("https://"), [C, R] = B(null), c = e || l, w = dt(b);
|
|
637
|
+
a.current = () => {
|
|
638
|
+
const d = ee();
|
|
639
|
+
if (Q(d)) {
|
|
640
|
+
const T = gn(d);
|
|
641
|
+
E(T), hn(l, e, T) && S(), l && T !== "" && h(T);
|
|
642
|
+
}
|
|
643
|
+
const i = L.current, s = window.getSelection(), f = document.activeElement;
|
|
644
|
+
if (i === null)
|
|
645
|
+
return;
|
|
646
|
+
const y = t.getRootElement(), x = s !== null && s.rangeCount > 0;
|
|
647
|
+
if (d !== null && s !== null && x && y?.contains(s.anchorNode) && t.isEditable()) {
|
|
648
|
+
const T = s.getRangeAt(0).getBoundingClientRect(), _ = new DOMRect(T.left, T.top, 0, T.height);
|
|
649
|
+
ke(_, i, o, bn, void 0, "above"), R(d);
|
|
650
|
+
} else i.contains(f) || (y !== null && ke(null, i, o), R(null), m(!1), E(""));
|
|
651
|
+
}, q(() => {
|
|
652
|
+
const d = o.parentElement, i = () => {
|
|
653
|
+
t.getEditorState().read(() => {
|
|
654
|
+
a.current();
|
|
655
|
+
});
|
|
656
|
+
};
|
|
657
|
+
return window.addEventListener("resize", i), d && d.addEventListener("scroll", i), () => {
|
|
658
|
+
window.removeEventListener("resize", i), d && d.removeEventListener("scroll", i);
|
|
659
|
+
};
|
|
660
|
+
}, [o.parentElement, t]), q(() => Le(t.registerUpdateListener(({
|
|
661
|
+
editorState: d
|
|
662
|
+
}) => {
|
|
663
|
+
d.read(() => {
|
|
664
|
+
a.current();
|
|
665
|
+
});
|
|
666
|
+
}), t.registerCommand(Se, () => (a.current(), !0), Be), t.registerCommand(yt, () => e ? (r(!1), !0) : !1, lt)), [t, r, e]), q(() => {
|
|
667
|
+
t.getEditorState().read(() => {
|
|
668
|
+
a.current();
|
|
669
|
+
});
|
|
670
|
+
}, [t]), _t(() => {
|
|
671
|
+
c && t.getEditorState().read(() => {
|
|
672
|
+
a.current();
|
|
673
|
+
});
|
|
674
|
+
}, [t, c]), q(() => {
|
|
675
|
+
l && u.current && u.current.focus();
|
|
676
|
+
}, [l]);
|
|
677
|
+
const v = (d) => {
|
|
678
|
+
d.key === "Enter" ? (d.preventDefault(), g()) : d.key === "Escape" && (d.preventDefault(), S());
|
|
679
|
+
}, S = () => {
|
|
680
|
+
h("https://"), m(!1);
|
|
681
|
+
}, g = () => {
|
|
682
|
+
C === null || !w || (t.update(() => {
|
|
683
|
+
Tt(C);
|
|
684
|
+
}), t.dispatchCommand(ze, Me(b)), t.update(() => {
|
|
685
|
+
const d = ee();
|
|
686
|
+
if (Q(d)) {
|
|
687
|
+
const i = he(d).getParent();
|
|
688
|
+
if (pe(i)) {
|
|
689
|
+
const s = Dt(i.getURL(), {
|
|
690
|
+
rel: i.__rel,
|
|
691
|
+
target: i.__target,
|
|
692
|
+
title: i.__title
|
|
693
|
+
});
|
|
694
|
+
i.replace(s, !0);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}), S());
|
|
698
|
+
};
|
|
699
|
+
return /* @__PURE__ */ n($e, { ref: L, className: `link-editor ${c ? "active" : ""}`, children: /* @__PURE__ */ n(pn, { isActive: c, isLinkEditMode: l, editedLinkUrl: b, editedLinkUrlIsValid: w, linkUrl: p, href: Me(p), inputRef: u, onEditedLinkUrlChange: h, onInputKeyDown: v, onClose: S, onSubmit: g, onEdit: () => {
|
|
700
|
+
h(p), m(!0);
|
|
701
|
+
}, onRemove: () => {
|
|
702
|
+
t.dispatchCommand(ze, null);
|
|
703
|
+
} }) });
|
|
704
|
+
}
|
|
705
|
+
function Cn(t, e, r, o) {
|
|
706
|
+
const l = te(13), [m, L] = B(t), [u, a] = B(!1);
|
|
707
|
+
let p, E;
|
|
708
|
+
l[0] !== t || l[1] !== o ? (p = () => {
|
|
709
|
+
const C = function() {
|
|
710
|
+
const c = ee();
|
|
711
|
+
if (Q(c)) {
|
|
712
|
+
const w = he(c), v = Z(w, le), S = Z(w, pe);
|
|
713
|
+
if (!(v || S)) {
|
|
714
|
+
a(!1);
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
const g = c.getNodes().filter(En).find((d) => {
|
|
718
|
+
const i = Z(d, le), s = Z(d, pe), f = pe(s) && s.getIsUnlinked();
|
|
719
|
+
return v && !v.is(i) || i && !i.is(v) || S && !S.is(s) || s && (!s.is(S) || f);
|
|
720
|
+
});
|
|
721
|
+
a(!g);
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
return Le(t.registerUpdateListener((R) => {
|
|
725
|
+
const {
|
|
726
|
+
editorState: c
|
|
727
|
+
} = R;
|
|
728
|
+
c.read(() => {
|
|
729
|
+
C();
|
|
730
|
+
});
|
|
731
|
+
}), t.registerCommand(Se, (R, c) => (C(), L(c), !1), Oe), t.registerCommand(it, _n, Be), t.registerCommand(Ke, (R) => (o(R), !0), Be));
|
|
732
|
+
}, E = [t, o], l[0] = t, l[1] = o, l[2] = p, l[3] = E) : (p = l[2], E = l[3]), q(p, E);
|
|
733
|
+
let b;
|
|
734
|
+
l[4] !== m || l[5] !== e || l[6] !== u || l[7] !== r || l[8] !== o ? (b = /* @__PURE__ */ n(vn, { editor: m, isLink: u, anchorElem: e, setIsLink: a, isLinkEditMode: r, setIsLinkEditMode: o }), l[4] = m, l[5] = e, l[6] = u, l[7] = r, l[8] = o, l[9] = b) : b = l[9];
|
|
735
|
+
let h;
|
|
736
|
+
return l[10] !== e || l[11] !== b ? (h = Ue(b, e), l[10] = e, l[11] = b, l[12] = h) : h = l[12], h;
|
|
737
|
+
}
|
|
738
|
+
function _n(t) {
|
|
739
|
+
const e = ee();
|
|
740
|
+
if (Q(e)) {
|
|
741
|
+
const r = he(e), o = Z(r, le);
|
|
742
|
+
if (le(o) && (t.metaKey || t.ctrlKey))
|
|
743
|
+
return window.open(Me(o.getURL()), "_blank", "noopener,noreferrer"), !0;
|
|
744
|
+
}
|
|
745
|
+
return !1;
|
|
746
|
+
}
|
|
747
|
+
function En(t) {
|
|
748
|
+
return !xt(t);
|
|
749
|
+
}
|
|
750
|
+
function kn(t) {
|
|
751
|
+
const {
|
|
752
|
+
anchorElem: e
|
|
753
|
+
} = t, r = e === void 0 ? document.body : e, [o, l] = B(!1), [m] = De();
|
|
754
|
+
return Cn(m, r, o, l);
|
|
755
|
+
}
|
|
756
|
+
function Ln() {
|
|
757
|
+
const t = te(1);
|
|
758
|
+
let e;
|
|
759
|
+
return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n(et, { validateUrl: dt }), t[0] = e) : e = t[0], e;
|
|
760
|
+
}
|
|
761
|
+
function io(t) {
|
|
762
|
+
const e = te(54), {
|
|
763
|
+
autoFocus: r,
|
|
764
|
+
debug: o,
|
|
765
|
+
defaultState: l,
|
|
766
|
+
isEditable: m,
|
|
767
|
+
placeholder: L,
|
|
768
|
+
scrollable: u,
|
|
769
|
+
onChange: a
|
|
770
|
+
} = t, p = r === void 0 ? !1 : r, E = o === void 0 ? !1 : o, b = l === void 0 ? "" : l, h = m === void 0 ? !1 : m, C = u === void 0 ? !0 : u;
|
|
450
771
|
let R;
|
|
451
|
-
e[0] !==
|
|
772
|
+
e[0] !== b ? (R = mt(b), e[0] = b, e[1] = R) : R = e[1];
|
|
452
773
|
const {
|
|
453
|
-
frontmatter:
|
|
454
|
-
body:
|
|
455
|
-
} = R,
|
|
456
|
-
let
|
|
457
|
-
e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
458
|
-
|
|
459
|
-
},
|
|
460
|
-
let
|
|
461
|
-
e[4] !==
|
|
462
|
-
let
|
|
463
|
-
e[6] !==
|
|
774
|
+
frontmatter: c,
|
|
775
|
+
body: w
|
|
776
|
+
} = R, v = h && !!a, S = oe(null), [g, d] = B(null);
|
|
777
|
+
let i, s;
|
|
778
|
+
e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = () => {
|
|
779
|
+
d(S.current);
|
|
780
|
+
}, s = [], e[2] = i, e[3] = s) : (i = e[2], s = e[3]), q(i, s);
|
|
781
|
+
let f;
|
|
782
|
+
e[4] !== w ? (f = () => Wt(ut(w), He, void 0, !1), e[4] = w, e[5] = f) : f = e[5];
|
|
783
|
+
let y;
|
|
784
|
+
e[6] !== h || e[7] !== f ? (y = {
|
|
464
785
|
namespace: "MARKDOWN_EDITOR",
|
|
465
|
-
nodes:
|
|
466
|
-
editorState:
|
|
467
|
-
onError:
|
|
468
|
-
editable:
|
|
469
|
-
theme:
|
|
470
|
-
}, e[6] =
|
|
471
|
-
const
|
|
472
|
-
let
|
|
473
|
-
e[9] !==
|
|
474
|
-
let
|
|
475
|
-
e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
786
|
+
nodes: Ve,
|
|
787
|
+
editorState: f,
|
|
788
|
+
onError: Sn,
|
|
789
|
+
editable: h,
|
|
790
|
+
theme: We
|
|
791
|
+
}, e[6] = h, e[7] = f, e[8] = y) : y = e[8];
|
|
792
|
+
const x = y, T = C ? "100%" : "auto";
|
|
793
|
+
let _;
|
|
794
|
+
e[9] !== p ? (_ = p ? /* @__PURE__ */ n(Gt, {}) : null, e[9] = p, e[10] = _) : _ = e[10];
|
|
795
|
+
let k, N, I;
|
|
796
|
+
e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ n(Yt, {}), N = /* @__PURE__ */ n(Ln, {}), I = /* @__PURE__ */ n(tt, {}), e[11] = k, e[12] = N, e[13] = I) : (k = e[11], N = e[12], I = e[13]);
|
|
797
|
+
let z;
|
|
798
|
+
e[14] !== h ? (z = h ? /* @__PURE__ */ n(ot, { maxIndent: 7 }) : null, e[14] = h, e[15] = z) : z = e[15];
|
|
799
|
+
let D, W, O, K;
|
|
800
|
+
e[16] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (D = /* @__PURE__ */ n(qt, {}), W = /* @__PURE__ */ n(Je, {}), O = /* @__PURE__ */ n(Ge, {}), K = /* @__PURE__ */ n(qe, {}), e[16] = D, e[17] = W, e[18] = O, e[19] = K) : (D = e[16], W = e[17], O = e[18], K = e[19]);
|
|
476
801
|
let M;
|
|
477
|
-
e[
|
|
478
|
-
let
|
|
479
|
-
e[
|
|
480
|
-
let O;
|
|
481
|
-
e[20] !== r ? (O = /* @__PURE__ */ t(Be, { anchorElem: r }), e[20] = r, e[21] = O) : O = e[21];
|
|
482
|
-
let K;
|
|
483
|
-
e[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (K = /* @__PURE__ */ t(be, {}), e[22] = K) : K = e[22];
|
|
802
|
+
e[20] !== g ? (M = /* @__PURE__ */ n(st, { anchorElem: g }), e[20] = g, e[21] = M) : M = e[21];
|
|
803
|
+
let V;
|
|
804
|
+
e[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ n(Ye, {}), e[22] = V) : V = e[22];
|
|
484
805
|
let P;
|
|
485
|
-
e[23] !==
|
|
486
|
-
let
|
|
487
|
-
e[25] !==
|
|
806
|
+
e[23] !== C ? (P = /* @__PURE__ */ n(Xe, { fullWidth: !1, padding: "sm", scrollable: C }), e[23] = C, e[24] = P) : P = e[24];
|
|
807
|
+
let $;
|
|
808
|
+
e[25] !== L ? ($ = L ? /* @__PURE__ */ n(Ae, { position: "absolute", padding: "sm", top: "0", left: "0", right: "0", pointerEvents: "none", userSelect: "none", justifyContent: "center", children: /* @__PURE__ */ n($e, { width: "100%", maxWidth: "720px", color: "fg.muted", textStyle: "paragraph/M/regular", children: L }) }) : null, e[25] = L, e[26] = $) : $ = e[26];
|
|
488
809
|
let A;
|
|
489
|
-
e[27] !== P || e[28] !==
|
|
490
|
-
let
|
|
491
|
-
e[30] !==
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
810
|
+
e[27] !== P || e[28] !== $ ? (A = /* @__PURE__ */ n(nt, { contentEditable: P, placeholder: $, ErrorBoundary: Ze }), e[27] = P, e[28] = $, e[29] = A) : A = e[29];
|
|
811
|
+
let U;
|
|
812
|
+
e[30] !== g || e[31] !== h ? (U = h && g ? /* @__PURE__ */ ie(ft, { children: [
|
|
813
|
+
/* @__PURE__ */ n(at, { anchorElem: g }),
|
|
814
|
+
/* @__PURE__ */ n(kn, { anchorElem: g })
|
|
815
|
+
] }) : null, e[30] = g, e[31] = h, e[32] = U) : U = e[32];
|
|
816
|
+
let H;
|
|
817
|
+
e[33] !== c || e[34] !== a || e[35] !== v ? (H = v ? /* @__PURE__ */ n(Xt, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (re) => {
|
|
818
|
+
re.read(() => {
|
|
819
|
+
const ue = Rt(), ne = Vt(He, ue);
|
|
820
|
+
a?.(c + ne);
|
|
497
821
|
});
|
|
498
|
-
} }) : null, e[33] =
|
|
499
|
-
let
|
|
500
|
-
e[37] !==
|
|
501
|
-
let
|
|
502
|
-
e[39] !==
|
|
503
|
-
let
|
|
504
|
-
e[41] !==
|
|
505
|
-
|
|
506
|
-
S,
|
|
822
|
+
} }) : null, e[33] = c, e[34] = a, e[35] = v, e[36] = H) : H = e[36];
|
|
823
|
+
let G;
|
|
824
|
+
e[37] !== h ? (G = /* @__PURE__ */ n(pt, { isEditable: h }), e[37] = h, e[38] = G) : G = e[38];
|
|
825
|
+
let J;
|
|
826
|
+
e[39] !== E ? (J = E && /* @__PURE__ */ n(ht, {}), e[39] = E, e[40] = J) : J = e[40];
|
|
827
|
+
let Y;
|
|
828
|
+
e[41] !== x || e[42] !== _ || e[43] !== z || e[44] !== M || e[45] !== A || e[46] !== U || e[47] !== H || e[48] !== G || e[49] !== J ? (Y = /* @__PURE__ */ ie(Qe, { initialConfig: x, children: [
|
|
829
|
+
_,
|
|
507
830
|
k,
|
|
508
831
|
N,
|
|
509
|
-
|
|
510
|
-
j,
|
|
511
|
-
W,
|
|
512
|
-
U,
|
|
832
|
+
I,
|
|
513
833
|
z,
|
|
834
|
+
D,
|
|
835
|
+
W,
|
|
514
836
|
O,
|
|
515
837
|
K,
|
|
516
|
-
|
|
517
|
-
F,
|
|
518
|
-
q,
|
|
838
|
+
M,
|
|
519
839
|
V,
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
840
|
+
A,
|
|
841
|
+
U,
|
|
842
|
+
H,
|
|
843
|
+
G,
|
|
844
|
+
J
|
|
845
|
+
] }), e[41] = x, e[42] = _, e[43] = z, e[44] = M, e[45] = A, e[46] = U, e[47] = H, e[48] = G, e[49] = J, e[50] = Y) : Y = e[50];
|
|
846
|
+
let X;
|
|
847
|
+
return e[51] !== T || e[52] !== Y ? (X = /* @__PURE__ */ n(Ae, { ref: S, className: "rich-text", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: T, position: "relative", direction: "column", overflow: "visible", children: Y }), e[51] = T, e[52] = Y, e[53] = X) : X = e[53], X;
|
|
524
848
|
}
|
|
525
|
-
function
|
|
526
|
-
return console.error(
|
|
849
|
+
function Sn(t) {
|
|
850
|
+
return console.error(t);
|
|
527
851
|
}
|
|
528
|
-
function
|
|
529
|
-
const e =
|
|
852
|
+
function lo(t) {
|
|
853
|
+
const e = t.toLowerCase().trim();
|
|
530
854
|
return e ? e.startsWith("image/") ? "image" : e === "application/pdf" ? "pdf" : e === "text/markdown" ? "markdown" : e === "text/csv" || e === "text/tab-separated-values" ? "table" : e === "application/json" ? "json" : (e.startsWith("text/") || e.startsWith("application/"), "text") : "text";
|
|
531
855
|
}
|
|
532
|
-
const
|
|
856
|
+
const yn = {
|
|
533
857
|
csv: "text/csv",
|
|
534
858
|
tsv: "text/tab-separated-values",
|
|
535
859
|
json: "application/json",
|
|
@@ -553,21 +877,21 @@ const Pt = {
|
|
|
553
877
|
yml: "text/yaml",
|
|
554
878
|
yaml: "text/yaml"
|
|
555
879
|
};
|
|
556
|
-
function
|
|
557
|
-
const
|
|
558
|
-
return
|
|
880
|
+
function ro(t) {
|
|
881
|
+
const r = (t.split("?")[0]?.split("#")[0] ?? "").split(".").pop()?.toLowerCase();
|
|
882
|
+
return r ? yn[r] ?? null : null;
|
|
559
883
|
}
|
|
560
884
|
export {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
885
|
+
oo as CollaborativeMarkdownEditor,
|
|
886
|
+
co as DefaultRichTextCodeEditor,
|
|
887
|
+
fo as DefaultRichTextDataTable,
|
|
888
|
+
io as MarkdownEditor,
|
|
889
|
+
mo as MarkdownPreview,
|
|
890
|
+
uo as PromptEditor,
|
|
891
|
+
po as RichMessage,
|
|
892
|
+
ho as generateEditorStateFromString,
|
|
893
|
+
go as getTextFromSerializedEditorState,
|
|
894
|
+
lo as inferResourceTypeFromMediaType,
|
|
895
|
+
ro as mediaTypeFromPath
|
|
572
896
|
};
|
|
573
897
|
//# sourceMappingURL=rich-text.js.map
|