@tangle-network/sandbox-ui 0.14.0 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.d.ts +1 -74
- package/dist/auth.js +1 -4
- package/dist/chat.d.ts +1 -136
- package/dist/chat.js +2 -15
- package/dist/chunk-2BUPSB7O.js +0 -0
- package/dist/chunk-3J6FG3FJ.js +18 -0
- package/dist/chunk-76IQLPW2.js +206 -0
- package/dist/chunk-7ZA5SEK3.js +239 -0
- package/dist/chunk-AZ3AWMTM.js +8 -0
- package/dist/chunk-CMY7W45U.js +380 -0
- package/dist/chunk-EI44GEQ5.js +6 -0
- package/dist/chunk-ENMWGVDL.js +858 -0
- package/dist/{chunk-5OQ27N57.js → chunk-GPT7VKK6.js} +34 -38
- package/dist/chunk-HLZTKSGT.js +2652 -0
- package/dist/chunk-JBGKGLD7.js +16 -0
- package/dist/chunk-NJNME4J4.js +14 -0
- package/dist/chunk-QPAJR74X.js +20 -0
- package/dist/chunk-TK46XFLM.js +28 -0
- package/dist/chunk-WID73FPH.js +89 -0
- package/dist/chunk-YVXK4XRO.js +30 -0
- package/dist/dashboard.d.ts +450 -4
- package/dist/dashboard.js +20 -891
- package/dist/editor.d.ts +1 -120
- package/dist/editor.js +1 -5
- package/dist/files.d.ts +1 -129
- package/dist/files.js +2 -7
- package/dist/globals.css +2 -1265
- package/dist/hooks.d.ts +114 -11
- package/dist/hooks.js +17 -88
- package/dist/index.d.ts +24 -99
- package/dist/index.js +251 -256
- package/dist/markdown.d.ts +1 -29
- package/dist/markdown.js +2 -2
- package/dist/openui.d.ts +8 -115
- package/dist/openui.js +1 -6
- package/dist/pages.d.ts +13 -12
- package/dist/pages.js +91 -115
- package/dist/primitives.d.ts +14 -49
- package/dist/primitives.js +69 -77
- package/dist/run.d.ts +1 -14
- package/dist/run.js +2 -22
- package/dist/sdk-hooks.d.ts +3 -283
- package/dist/sdk-hooks.js +10 -14
- package/dist/stores.d.ts +2 -14
- package/dist/stores.js +11 -39
- package/dist/styles.css +2 -1265
- package/dist/template-card-DStb8boW.d.ts +183 -0
- package/dist/types.d.ts +11 -8
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +1 -44
- package/dist/utils.js +6 -12
- package/dist/workspace.d.ts +5 -10
- package/dist/workspace.js +3 -19
- package/package.json +19 -54
- package/dist/active-sessions-store-CeOmXgv5.d.ts +0 -85
- package/dist/artifact-pane-Bh45Ssco.d.ts +0 -24
- package/dist/branding-DCi5VEik.d.ts +0 -13
- package/dist/button-CMQuQEW_.d.ts +0 -17
- package/dist/chat-container-f4yEs6KN.d.ts +0 -106
- package/dist/chunk-34A66VBG.js +0 -214
- package/dist/chunk-34I7UFSX.js +0 -92
- package/dist/chunk-36QY2W5G.js +0 -802
- package/dist/chunk-4CLN43XT.js +0 -45
- package/dist/chunk-54SQQMMM.js +0 -156
- package/dist/chunk-66EZOYZR.js +0 -102
- package/dist/chunk-BX6AQMUS.js +0 -183
- package/dist/chunk-DI3NZ5ZX.js +0 -192
- package/dist/chunk-DPGIXDAI.js +0 -220
- package/dist/chunk-DXMIEK4K.js +0 -1426
- package/dist/chunk-GSZA3TSY.js +0 -79
- package/dist/chunk-HB5Y37YU.js +0 -54
- package/dist/chunk-LQNEZDRM.js +0 -109
- package/dist/chunk-MA7YKRUP.js +0 -131
- package/dist/chunk-MKTSMWVD.js +0 -109
- package/dist/chunk-MQXABZTB.js +0 -1348
- package/dist/chunk-MT5FJ3ZT.js +0 -186
- package/dist/chunk-NKUPJC34.js +0 -2070
- package/dist/chunk-OEX7NZE3.js +0 -321
- package/dist/chunk-OKLQVY3Y.js +0 -139
- package/dist/chunk-Q56BYXQF.js +0 -61
- package/dist/chunk-QD4QE5P5.js +0 -40
- package/dist/chunk-QDH5GEGY.js +0 -630
- package/dist/chunk-QID2OOMG.js +0 -133
- package/dist/chunk-QMU2PWOU.js +0 -493
- package/dist/chunk-RQHJBTEU.js +0 -10
- package/dist/chunk-T7HMZEVO.js +0 -216
- package/dist/chunk-U6QTHMY6.js +0 -1290
- package/dist/chunk-US6JKJKH.js +0 -124
- package/dist/chunk-VX3XOUEB.js +0 -63
- package/dist/chunk-XLG757B6.js +0 -933
- package/dist/chunk-ZMNSRDMH.js +0 -127
- package/dist/chunk-ZNCEM5CD.js +0 -316
- package/dist/document-editor-pane-A70-EhdQ.d.ts +0 -124
- package/dist/document-editor-pane-TLPVRBBU.js +0 -11
- package/dist/expanded-tool-detail-Dh99mcbY.d.ts +0 -63
- package/dist/file-tabs-BLfxfmAH.d.ts +0 -51
- package/dist/parts-CyGkM6Fp.d.ts +0 -50
- package/dist/run-CtFZ6s-D.d.ts +0 -41
- package/dist/sidebar-drop-zone-tDBsuOH5.d.ts +0 -301
- package/dist/sidecar-CFU2W9j1.d.ts +0 -8
- package/dist/template-card-BAtvcAkU.d.ts +0 -18
- package/dist/tool-call-feed-Bs3MyQMT.d.ts +0 -68
- package/dist/tool-display-Ct9nFAzJ.d.ts +0 -32
- package/dist/usage-chart-CPTcNlGs.d.ts +0 -73
- package/dist/use-sandbox-metrics-DWc0k9Xm.d.ts +0 -153
- package/dist/variant-list-BrHYcBCk.d.ts +0 -540
package/dist/chunk-U6QTHMY6.js
DELETED
|
@@ -1,1290 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Tabs,
|
|
3
|
-
TabsContent,
|
|
4
|
-
TabsList,
|
|
5
|
-
TabsTrigger
|
|
6
|
-
} from "./chunk-Q56BYXQF.js";
|
|
7
|
-
import {
|
|
8
|
-
ArtifactPane
|
|
9
|
-
} from "./chunk-HB5Y37YU.js";
|
|
10
|
-
import {
|
|
11
|
-
Markdown
|
|
12
|
-
} from "./chunk-T7HMZEVO.js";
|
|
13
|
-
import {
|
|
14
|
-
cn
|
|
15
|
-
} from "./chunk-RQHJBTEU.js";
|
|
16
|
-
|
|
17
|
-
// src/editor/document-editor-pane.tsx
|
|
18
|
-
import { useEffect as useEffect5, useMemo as useMemo4, useState as useState3 } from "react";
|
|
19
|
-
import { PencilLine, Save, Users, Wifi, WifiOff } from "lucide-react";
|
|
20
|
-
|
|
21
|
-
// src/editor/tiptap-editor.tsx
|
|
22
|
-
import Collaboration from "@tiptap/extension-collaboration";
|
|
23
|
-
|
|
24
|
-
// node_modules/.pnpm/@tiptap+extension-collaboration-caret@3.21.0_@tiptap+core@3.20.4_@tiptap+pm@3.20.4__@ti_795f003f8529614c8766f32d0d0747ee/node_modules/@tiptap/extension-collaboration-caret/dist/index.js
|
|
25
|
-
import { Extension } from "@tiptap/core";
|
|
26
|
-
import { defaultSelectionBuilder, yCursorPlugin } from "@tiptap/y-tiptap";
|
|
27
|
-
var awarenessStatesToArray = (states) => {
|
|
28
|
-
return Array.from(states.entries()).map(([key, value]) => {
|
|
29
|
-
return {
|
|
30
|
-
clientId: key,
|
|
31
|
-
...value.user
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
var defaultOnUpdate = () => null;
|
|
36
|
-
var CollaborationCaret = Extension.create({
|
|
37
|
-
name: "collaborationCaret",
|
|
38
|
-
priority: 999,
|
|
39
|
-
addOptions() {
|
|
40
|
-
return {
|
|
41
|
-
provider: null,
|
|
42
|
-
user: {
|
|
43
|
-
name: null,
|
|
44
|
-
color: null
|
|
45
|
-
},
|
|
46
|
-
render: (user) => {
|
|
47
|
-
const cursor = document.createElement("span");
|
|
48
|
-
cursor.classList.add("collaboration-carets__caret");
|
|
49
|
-
cursor.setAttribute("style", `border-color: ${user.color}`);
|
|
50
|
-
const label = document.createElement("div");
|
|
51
|
-
label.classList.add("collaboration-carets__label");
|
|
52
|
-
label.setAttribute("style", `background-color: ${user.color}`);
|
|
53
|
-
label.insertBefore(document.createTextNode(user.name), null);
|
|
54
|
-
cursor.insertBefore(label, null);
|
|
55
|
-
return cursor;
|
|
56
|
-
},
|
|
57
|
-
selectionRender: defaultSelectionBuilder,
|
|
58
|
-
onUpdate: defaultOnUpdate
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
onCreate() {
|
|
62
|
-
if (this.options.onUpdate !== defaultOnUpdate) {
|
|
63
|
-
console.warn(
|
|
64
|
-
'[tiptap warn]: DEPRECATED: The "onUpdate" option is deprecated. Please use `editor.storage.collaborationCaret.users` instead. Read more: https://tiptap.dev/api/extensions/collaboration-caret'
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
if (!this.options.provider) {
|
|
68
|
-
throw new Error('The "provider" option is required for the CollaborationCaret extension');
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
addStorage() {
|
|
72
|
-
return {
|
|
73
|
-
users: []
|
|
74
|
-
};
|
|
75
|
-
},
|
|
76
|
-
addCommands() {
|
|
77
|
-
return {
|
|
78
|
-
updateUser: (attributes) => () => {
|
|
79
|
-
this.options.provider.awareness.setLocalStateField("user", attributes);
|
|
80
|
-
return true;
|
|
81
|
-
},
|
|
82
|
-
user: (attributes) => ({ editor }) => {
|
|
83
|
-
console.warn(
|
|
84
|
-
'[tiptap warn]: DEPRECATED: The "user" command is deprecated. Please use "updateUser" instead. Read more: https://tiptap.dev/api/extensions/collaboration-caret'
|
|
85
|
-
);
|
|
86
|
-
return editor.commands.updateUser(attributes);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
},
|
|
90
|
-
addProseMirrorPlugins() {
|
|
91
|
-
return [
|
|
92
|
-
yCursorPlugin(
|
|
93
|
-
(() => {
|
|
94
|
-
this.options.provider.awareness.setLocalStateField("user", this.options.user);
|
|
95
|
-
this.storage.users = awarenessStatesToArray(this.options.provider.awareness.states);
|
|
96
|
-
this.options.provider.awareness.on("update", () => {
|
|
97
|
-
this.storage.users = awarenessStatesToArray(this.options.provider.awareness.states);
|
|
98
|
-
});
|
|
99
|
-
return this.options.provider.awareness;
|
|
100
|
-
})(),
|
|
101
|
-
{
|
|
102
|
-
cursorBuilder: this.options.render,
|
|
103
|
-
selectionBuilder: this.options.selectionRender
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
];
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
var index_default = CollaborationCaret;
|
|
110
|
-
|
|
111
|
-
// src/editor/tiptap-editor.tsx
|
|
112
|
-
import { EditorContent, useEditor } from "@tiptap/react";
|
|
113
|
-
import StarterKit from "@tiptap/starter-kit";
|
|
114
|
-
import { useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
115
|
-
|
|
116
|
-
// src/editor/editor-provider.tsx
|
|
117
|
-
import { HocuspocusProvider } from "@hocuspocus/provider";
|
|
118
|
-
import {
|
|
119
|
-
createContext,
|
|
120
|
-
useCallback,
|
|
121
|
-
useContext,
|
|
122
|
-
useEffect,
|
|
123
|
-
useMemo,
|
|
124
|
-
useRef,
|
|
125
|
-
useState
|
|
126
|
-
} from "react";
|
|
127
|
-
import * as Y from "yjs";
|
|
128
|
-
import { jsx } from "react/jsx-runtime";
|
|
129
|
-
var EditorContext = createContext(null);
|
|
130
|
-
function generateUserColor() {
|
|
131
|
-
const colors = [
|
|
132
|
-
"#FF6B6B",
|
|
133
|
-
// Red
|
|
134
|
-
"#4ECDC4",
|
|
135
|
-
// Teal
|
|
136
|
-
"#45B7D1",
|
|
137
|
-
// Blue
|
|
138
|
-
"#96CEB4",
|
|
139
|
-
// Green
|
|
140
|
-
"#FFEAA7",
|
|
141
|
-
// Yellow
|
|
142
|
-
"#DDA0DD",
|
|
143
|
-
// Plum
|
|
144
|
-
"#98D8C8",
|
|
145
|
-
// Mint
|
|
146
|
-
"#F7DC6F",
|
|
147
|
-
// Gold
|
|
148
|
-
"#BB8FCE",
|
|
149
|
-
// Purple
|
|
150
|
-
"#85C1E9"
|
|
151
|
-
// Sky
|
|
152
|
-
];
|
|
153
|
-
return colors[Math.floor(Math.random() * colors.length)];
|
|
154
|
-
}
|
|
155
|
-
function EditorProvider({
|
|
156
|
-
websocketUrl,
|
|
157
|
-
documentName,
|
|
158
|
-
token,
|
|
159
|
-
tokenExpiresAt,
|
|
160
|
-
user,
|
|
161
|
-
autoConnect = true,
|
|
162
|
-
autoReconnect = true,
|
|
163
|
-
maxReconnectAttempts = 5,
|
|
164
|
-
onConnectionChange,
|
|
165
|
-
onSync,
|
|
166
|
-
onAuthError,
|
|
167
|
-
onRefreshToken,
|
|
168
|
-
children
|
|
169
|
-
}) {
|
|
170
|
-
const [connectionState, setConnectionState] = useState("disconnected");
|
|
171
|
-
const [collaborators, setCollaborators] = useState([]);
|
|
172
|
-
const [isSynced, setIsSynced] = useState(false);
|
|
173
|
-
const docRef = useRef(null);
|
|
174
|
-
const providerRef = useRef(null);
|
|
175
|
-
const reconnectAttemptsRef = useRef(0);
|
|
176
|
-
const tokenRef = useRef(token);
|
|
177
|
-
const tokenExpiryRef = useRef(tokenExpiresAt);
|
|
178
|
-
const refreshPromiseRef = useRef(null);
|
|
179
|
-
const refreshTimerRef = useRef(null);
|
|
180
|
-
tokenRef.current = token;
|
|
181
|
-
tokenExpiryRef.current = tokenExpiresAt;
|
|
182
|
-
if (!docRef.current) {
|
|
183
|
-
docRef.current = new Y.Doc();
|
|
184
|
-
}
|
|
185
|
-
const doc = docRef.current;
|
|
186
|
-
const userColor = useMemo(
|
|
187
|
-
() => user.color ?? generateUserColor(),
|
|
188
|
-
[user.color]
|
|
189
|
-
);
|
|
190
|
-
const updateConnectionState = useCallback(
|
|
191
|
-
(state) => {
|
|
192
|
-
setConnectionState(state);
|
|
193
|
-
onConnectionChange?.(state);
|
|
194
|
-
},
|
|
195
|
-
[onConnectionChange]
|
|
196
|
-
);
|
|
197
|
-
const updateCollaborators = useCallback(
|
|
198
|
-
(awareness) => {
|
|
199
|
-
if (!awareness) return;
|
|
200
|
-
const states = awareness.getStates();
|
|
201
|
-
const collabs = [];
|
|
202
|
-
states.forEach((state, clientId) => {
|
|
203
|
-
if (clientId === awareness.clientID) return;
|
|
204
|
-
if (state.user) {
|
|
205
|
-
collabs.push({
|
|
206
|
-
clientId,
|
|
207
|
-
user: state.user
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
setCollaborators(collabs);
|
|
212
|
-
},
|
|
213
|
-
[]
|
|
214
|
-
);
|
|
215
|
-
const clearRefreshTimer = useCallback(() => {
|
|
216
|
-
if (refreshTimerRef.current != null) {
|
|
217
|
-
window.clearTimeout(refreshTimerRef.current);
|
|
218
|
-
refreshTimerRef.current = null;
|
|
219
|
-
}
|
|
220
|
-
}, []);
|
|
221
|
-
const refreshToken = useCallback(async () => {
|
|
222
|
-
if (!onRefreshToken) {
|
|
223
|
-
return null;
|
|
224
|
-
}
|
|
225
|
-
if (refreshPromiseRef.current) {
|
|
226
|
-
return refreshPromiseRef.current;
|
|
227
|
-
}
|
|
228
|
-
const refreshPromise = (async () => {
|
|
229
|
-
const next = await onRefreshToken();
|
|
230
|
-
const resolvedToken = typeof next === "string" ? next : next.token;
|
|
231
|
-
const resolvedExpiry = typeof next === "string" ? void 0 : next.expiresAt;
|
|
232
|
-
tokenRef.current = resolvedToken;
|
|
233
|
-
tokenExpiryRef.current = resolvedExpiry;
|
|
234
|
-
return resolvedToken;
|
|
235
|
-
})().catch((error) => {
|
|
236
|
-
onAuthError?.(
|
|
237
|
-
error instanceof Error ? error : new Error(String(error))
|
|
238
|
-
);
|
|
239
|
-
return null;
|
|
240
|
-
}).finally(() => {
|
|
241
|
-
refreshPromiseRef.current = null;
|
|
242
|
-
});
|
|
243
|
-
refreshPromiseRef.current = refreshPromise;
|
|
244
|
-
return refreshPromise;
|
|
245
|
-
}, [onAuthError, onRefreshToken]);
|
|
246
|
-
const scheduleTokenRefresh = useCallback(() => {
|
|
247
|
-
clearRefreshTimer();
|
|
248
|
-
if (!tokenExpiryRef.current || !onRefreshToken || typeof window === "undefined") {
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
const refreshAtMs = tokenExpiryRef.current * 1e3 - 6e4;
|
|
252
|
-
const delay = refreshAtMs - Date.now();
|
|
253
|
-
if (delay <= 0) {
|
|
254
|
-
void refreshToken();
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
refreshTimerRef.current = window.setTimeout(() => {
|
|
258
|
-
void refreshToken();
|
|
259
|
-
}, delay);
|
|
260
|
-
}, [clearRefreshTimer, onRefreshToken, refreshToken]);
|
|
261
|
-
const connect = useCallback(() => {
|
|
262
|
-
if (providerRef.current) {
|
|
263
|
-
providerRef.current.connect();
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
updateConnectionState("connecting");
|
|
267
|
-
const provider = new HocuspocusProvider({
|
|
268
|
-
url: websocketUrl,
|
|
269
|
-
name: documentName,
|
|
270
|
-
document: doc,
|
|
271
|
-
token: async () => tokenRef.current,
|
|
272
|
-
// @ts-expect-error -- connect is valid at runtime but missing from type defs
|
|
273
|
-
connect: true,
|
|
274
|
-
onConnect: () => {
|
|
275
|
-
reconnectAttemptsRef.current = 0;
|
|
276
|
-
updateConnectionState("connected");
|
|
277
|
-
scheduleTokenRefresh();
|
|
278
|
-
},
|
|
279
|
-
onSynced: () => {
|
|
280
|
-
setIsSynced(true);
|
|
281
|
-
updateConnectionState("synced");
|
|
282
|
-
onSync?.();
|
|
283
|
-
},
|
|
284
|
-
onDisconnect: () => {
|
|
285
|
-
updateConnectionState("disconnected");
|
|
286
|
-
setIsSynced(false);
|
|
287
|
-
clearRefreshTimer();
|
|
288
|
-
if (autoReconnect && reconnectAttemptsRef.current < maxReconnectAttempts) {
|
|
289
|
-
reconnectAttemptsRef.current += 1;
|
|
290
|
-
const delay = Math.min(
|
|
291
|
-
1e3 * 2 ** reconnectAttemptsRef.current,
|
|
292
|
-
3e4
|
|
293
|
-
);
|
|
294
|
-
setTimeout(() => {
|
|
295
|
-
if (providerRef.current && !providerRef.current.isConnected) {
|
|
296
|
-
providerRef.current.connect();
|
|
297
|
-
}
|
|
298
|
-
}, delay);
|
|
299
|
-
}
|
|
300
|
-
},
|
|
301
|
-
onAuthenticationFailed: ({ reason }) => {
|
|
302
|
-
const error = new Error(reason ?? "Authentication failed");
|
|
303
|
-
updateConnectionState("disconnected");
|
|
304
|
-
clearRefreshTimer();
|
|
305
|
-
if (onRefreshToken) {
|
|
306
|
-
void refreshToken().then((nextToken) => {
|
|
307
|
-
if (nextToken && providerRef.current) {
|
|
308
|
-
providerRef.current.connect();
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
onAuthError?.(error);
|
|
312
|
-
});
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
onAuthError?.(error);
|
|
316
|
-
},
|
|
317
|
-
onAwarenessUpdate: () => {
|
|
318
|
-
updateCollaborators(provider.awareness);
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
provider.awareness?.setLocalStateField("user", {
|
|
322
|
-
name: user.name,
|
|
323
|
-
color: userColor,
|
|
324
|
-
userId: user.userId
|
|
325
|
-
});
|
|
326
|
-
providerRef.current = provider;
|
|
327
|
-
}, [
|
|
328
|
-
websocketUrl,
|
|
329
|
-
documentName,
|
|
330
|
-
doc,
|
|
331
|
-
user.name,
|
|
332
|
-
user.userId,
|
|
333
|
-
userColor,
|
|
334
|
-
autoReconnect,
|
|
335
|
-
maxReconnectAttempts,
|
|
336
|
-
clearRefreshTimer,
|
|
337
|
-
updateConnectionState,
|
|
338
|
-
updateCollaborators,
|
|
339
|
-
onSync,
|
|
340
|
-
onAuthError,
|
|
341
|
-
onRefreshToken,
|
|
342
|
-
refreshToken,
|
|
343
|
-
scheduleTokenRefresh
|
|
344
|
-
]);
|
|
345
|
-
const disconnect = useCallback(() => {
|
|
346
|
-
if (providerRef.current) {
|
|
347
|
-
providerRef.current.disconnect();
|
|
348
|
-
updateConnectionState("disconnected");
|
|
349
|
-
}
|
|
350
|
-
}, [updateConnectionState]);
|
|
351
|
-
useEffect(() => {
|
|
352
|
-
if (autoConnect) {
|
|
353
|
-
connect();
|
|
354
|
-
}
|
|
355
|
-
return () => {
|
|
356
|
-
clearRefreshTimer();
|
|
357
|
-
if (providerRef.current) {
|
|
358
|
-
providerRef.current.destroy();
|
|
359
|
-
providerRef.current = null;
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
}, [autoConnect, clearRefreshTimer, connect]);
|
|
363
|
-
const contextValue = useMemo(
|
|
364
|
-
() => ({
|
|
365
|
-
doc,
|
|
366
|
-
provider: providerRef.current,
|
|
367
|
-
connectionState,
|
|
368
|
-
collaborators,
|
|
369
|
-
isSynced,
|
|
370
|
-
connect,
|
|
371
|
-
disconnect
|
|
372
|
-
}),
|
|
373
|
-
[doc, connectionState, collaborators, isSynced, connect, disconnect]
|
|
374
|
-
);
|
|
375
|
-
return /* @__PURE__ */ jsx(EditorContext.Provider, { value: contextValue, children });
|
|
376
|
-
}
|
|
377
|
-
function useEditorContext() {
|
|
378
|
-
const context = useContext(EditorContext);
|
|
379
|
-
if (!context) {
|
|
380
|
-
throw new Error("useEditorContext must be used within an EditorProvider");
|
|
381
|
-
}
|
|
382
|
-
return context;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
// src/editor/editor-toolbar.tsx
|
|
386
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
387
|
-
function EditorToolbar({
|
|
388
|
-
editor,
|
|
389
|
-
className
|
|
390
|
-
}) {
|
|
391
|
-
if (!editor) {
|
|
392
|
-
return null;
|
|
393
|
-
}
|
|
394
|
-
const buttons = [
|
|
395
|
-
{
|
|
396
|
-
id: "bold",
|
|
397
|
-
label: "Bold",
|
|
398
|
-
action: () => editor.chain().focus().toggleBold().run(),
|
|
399
|
-
isActive: editor.isActive("bold"),
|
|
400
|
-
shortcut: "Ctrl+B"
|
|
401
|
-
},
|
|
402
|
-
{
|
|
403
|
-
id: "italic",
|
|
404
|
-
label: "Italic",
|
|
405
|
-
action: () => editor.chain().focus().toggleItalic().run(),
|
|
406
|
-
isActive: editor.isActive("italic"),
|
|
407
|
-
shortcut: "Ctrl+I"
|
|
408
|
-
},
|
|
409
|
-
{
|
|
410
|
-
id: "strike",
|
|
411
|
-
label: "Strike",
|
|
412
|
-
action: () => editor.chain().focus().toggleStrike().run(),
|
|
413
|
-
isActive: editor.isActive("strike"),
|
|
414
|
-
shortcut: "Ctrl+Shift+X"
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
id: "code",
|
|
418
|
-
label: "Code",
|
|
419
|
-
action: () => editor.chain().focus().toggleCode().run(),
|
|
420
|
-
isActive: editor.isActive("code"),
|
|
421
|
-
shortcut: "Ctrl+E"
|
|
422
|
-
},
|
|
423
|
-
{ id: "sep-1", type: "separator" },
|
|
424
|
-
{
|
|
425
|
-
id: "h1",
|
|
426
|
-
label: "H1",
|
|
427
|
-
action: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
428
|
-
isActive: editor.isActive("heading", { level: 1 })
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
id: "h2",
|
|
432
|
-
label: "H2",
|
|
433
|
-
action: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
434
|
-
isActive: editor.isActive("heading", { level: 2 })
|
|
435
|
-
},
|
|
436
|
-
{
|
|
437
|
-
id: "h3",
|
|
438
|
-
label: "H3",
|
|
439
|
-
action: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
440
|
-
isActive: editor.isActive("heading", { level: 3 })
|
|
441
|
-
},
|
|
442
|
-
{ id: "sep-2", type: "separator" },
|
|
443
|
-
{
|
|
444
|
-
id: "bullet-list",
|
|
445
|
-
label: "Bullet List",
|
|
446
|
-
action: () => editor.chain().focus().toggleBulletList().run(),
|
|
447
|
-
isActive: editor.isActive("bulletList")
|
|
448
|
-
},
|
|
449
|
-
{
|
|
450
|
-
id: "ordered-list",
|
|
451
|
-
label: "Ordered List",
|
|
452
|
-
action: () => editor.chain().focus().toggleOrderedList().run(),
|
|
453
|
-
isActive: editor.isActive("orderedList")
|
|
454
|
-
},
|
|
455
|
-
{
|
|
456
|
-
id: "code-block",
|
|
457
|
-
label: "Code Block",
|
|
458
|
-
action: () => editor.chain().focus().toggleCodeBlock().run(),
|
|
459
|
-
isActive: editor.isActive("codeBlock")
|
|
460
|
-
},
|
|
461
|
-
{
|
|
462
|
-
id: "blockquote",
|
|
463
|
-
label: "Blockquote",
|
|
464
|
-
action: () => editor.chain().focus().toggleBlockquote().run(),
|
|
465
|
-
isActive: editor.isActive("blockquote")
|
|
466
|
-
}
|
|
467
|
-
];
|
|
468
|
-
return /* @__PURE__ */ jsx2(
|
|
469
|
-
"div",
|
|
470
|
-
{
|
|
471
|
-
className: cn(
|
|
472
|
-
"flex items-center gap-1 border-border border-b bg-card p-2",
|
|
473
|
-
className
|
|
474
|
-
),
|
|
475
|
-
children: buttons.map((button) => {
|
|
476
|
-
if ("type" in button && button.type === "separator") {
|
|
477
|
-
return /* @__PURE__ */ jsx2("div", { className: "mx-1 h-6 w-px bg-border" }, button.id);
|
|
478
|
-
}
|
|
479
|
-
return /* @__PURE__ */ jsx2(
|
|
480
|
-
"button",
|
|
481
|
-
{
|
|
482
|
-
onClick: button.action,
|
|
483
|
-
type: "button",
|
|
484
|
-
title: "shortcut" in button ? `${button.label} (${button.shortcut})` : button.label,
|
|
485
|
-
className: cn(
|
|
486
|
-
"rounded px-2 py-1 font-medium text-xs transition-colors",
|
|
487
|
-
"hover:bg-accent hover:text-accent-foreground",
|
|
488
|
-
button.isActive && "bg-accent text-accent-foreground"
|
|
489
|
-
),
|
|
490
|
-
children: button.label
|
|
491
|
-
},
|
|
492
|
-
button.id
|
|
493
|
-
);
|
|
494
|
-
})
|
|
495
|
-
}
|
|
496
|
-
);
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
// src/editor/tiptap-editor.tsx
|
|
500
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
501
|
-
var cursorColors = {
|
|
502
|
-
"#FF6B6B": { background: "#FF6B6B", text: "#FFFFFF" },
|
|
503
|
-
"#4ECDC4": { background: "#4ECDC4", text: "#000000" },
|
|
504
|
-
"#45B7D1": { background: "#45B7D1", text: "#000000" },
|
|
505
|
-
"#96CEB4": { background: "#96CEB4", text: "#000000" },
|
|
506
|
-
"#FFEAA7": { background: "#FFEAA7", text: "#000000" },
|
|
507
|
-
"#DDA0DD": { background: "#DDA0DD", text: "#000000" },
|
|
508
|
-
"#98D8C8": { background: "#98D8C8", text: "#000000" },
|
|
509
|
-
"#F7DC6F": { background: "#F7DC6F", text: "#000000" },
|
|
510
|
-
"#BB8FCE": { background: "#BB8FCE", text: "#000000" },
|
|
511
|
-
"#85C1E9": { background: "#85C1E9", text: "#000000" }
|
|
512
|
-
};
|
|
513
|
-
function getCursorColors(color) {
|
|
514
|
-
return cursorColors[color] ?? { background: color, text: "#FFFFFF" };
|
|
515
|
-
}
|
|
516
|
-
function TiptapEditor({
|
|
517
|
-
initialContent,
|
|
518
|
-
placeholder = "Start writing...",
|
|
519
|
-
readOnly = false,
|
|
520
|
-
autoFocus = false,
|
|
521
|
-
className,
|
|
522
|
-
contentClassName,
|
|
523
|
-
onUpdate,
|
|
524
|
-
onSelectionUpdate,
|
|
525
|
-
onReady
|
|
526
|
-
}) {
|
|
527
|
-
const { doc, provider, connectionState } = useEditorContext();
|
|
528
|
-
const fragment = useMemo2(() => doc.getXmlFragment("prosemirror"), [doc]);
|
|
529
|
-
const extensions = useMemo2(() => {
|
|
530
|
-
const baseExtensions = [
|
|
531
|
-
StarterKit.configure({
|
|
532
|
-
// Disable history - Y.js handles undo/redo
|
|
533
|
-
...{ history: false },
|
|
534
|
-
// Configure code block for syntax highlighting placeholder
|
|
535
|
-
codeBlock: {
|
|
536
|
-
HTMLAttributes: {
|
|
537
|
-
class: "hljs"
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}),
|
|
541
|
-
Collaboration.configure({
|
|
542
|
-
fragment
|
|
543
|
-
})
|
|
544
|
-
];
|
|
545
|
-
if (provider?.awareness) {
|
|
546
|
-
baseExtensions.push(
|
|
547
|
-
index_default.configure({
|
|
548
|
-
provider,
|
|
549
|
-
user: provider.awareness.getLocalState()?.user ?? {
|
|
550
|
-
name: "Anonymous",
|
|
551
|
-
color: "#808080"
|
|
552
|
-
},
|
|
553
|
-
render: (user) => {
|
|
554
|
-
const { background, text } = getCursorColors(user.color);
|
|
555
|
-
const cursor = document.createElement("span");
|
|
556
|
-
cursor.className = "collaboration-cursor";
|
|
557
|
-
cursor.style.borderColor = background;
|
|
558
|
-
const label = document.createElement("span");
|
|
559
|
-
label.className = "collaboration-cursor-label";
|
|
560
|
-
label.style.backgroundColor = background;
|
|
561
|
-
label.style.color = text;
|
|
562
|
-
label.textContent = user.name;
|
|
563
|
-
cursor.appendChild(label);
|
|
564
|
-
return cursor;
|
|
565
|
-
}
|
|
566
|
-
})
|
|
567
|
-
);
|
|
568
|
-
}
|
|
569
|
-
return baseExtensions;
|
|
570
|
-
}, [fragment, provider]);
|
|
571
|
-
const editor = useEditor({
|
|
572
|
-
extensions,
|
|
573
|
-
editable: !readOnly,
|
|
574
|
-
autofocus: autoFocus,
|
|
575
|
-
editorProps: {
|
|
576
|
-
attributes: {
|
|
577
|
-
class: cn(
|
|
578
|
-
"prose prose-sm sm:prose-base dark:prose-invert max-w-none",
|
|
579
|
-
"focus:outline-none",
|
|
580
|
-
contentClassName
|
|
581
|
-
),
|
|
582
|
-
"data-placeholder": placeholder
|
|
583
|
-
}
|
|
584
|
-
},
|
|
585
|
-
onUpdate: ({ editor: ed }) => {
|
|
586
|
-
onUpdate?.(ed);
|
|
587
|
-
},
|
|
588
|
-
onSelectionUpdate: ({ editor: ed }) => {
|
|
589
|
-
onSelectionUpdate?.(ed);
|
|
590
|
-
},
|
|
591
|
-
onCreate: ({ editor: ed }) => {
|
|
592
|
-
onReady?.(ed);
|
|
593
|
-
}
|
|
594
|
-
});
|
|
595
|
-
useEffect2(() => {
|
|
596
|
-
if (editor) {
|
|
597
|
-
editor.setEditable(!readOnly);
|
|
598
|
-
}
|
|
599
|
-
}, [editor, readOnly]);
|
|
600
|
-
useEffect2(() => {
|
|
601
|
-
if (editor && initialContent && connectionState === "synced" && editor.isEmpty) {
|
|
602
|
-
editor.commands.setContent(initialContent);
|
|
603
|
-
}
|
|
604
|
-
}, [editor, initialContent, connectionState]);
|
|
605
|
-
return /* @__PURE__ */ jsxs(
|
|
606
|
-
"div",
|
|
607
|
-
{
|
|
608
|
-
className: cn(
|
|
609
|
-
"relative min-h-[200px] w-full rounded-lg border border-border",
|
|
610
|
-
"bg-background",
|
|
611
|
-
className
|
|
612
|
-
),
|
|
613
|
-
children: [
|
|
614
|
-
/* @__PURE__ */ jsx3("div", { className: "absolute top-2 right-2 z-10", children: /* @__PURE__ */ jsx3(ConnectionIndicator, { state: connectionState }) }),
|
|
615
|
-
/* @__PURE__ */ jsx3("div", { className: "p-4 pt-10", children: /* @__PURE__ */ jsx3(EditorContent, { editor }) }),
|
|
616
|
-
/* @__PURE__ */ jsx3("style", { children: `
|
|
617
|
-
.ProseMirror p.is-editor-empty:first-child::before {
|
|
618
|
-
content: attr(data-placeholder);
|
|
619
|
-
float: left;
|
|
620
|
-
color: var(--muted-foreground, #999);
|
|
621
|
-
pointer-events: none;
|
|
622
|
-
height: 0;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
.collaboration-cursor {
|
|
626
|
-
position: relative;
|
|
627
|
-
border-left: 2px solid;
|
|
628
|
-
margin-left: -1px;
|
|
629
|
-
margin-right: -1px;
|
|
630
|
-
pointer-events: none;
|
|
631
|
-
word-break: normal;
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
.collaboration-cursor-label {
|
|
635
|
-
position: absolute;
|
|
636
|
-
top: -1.4em;
|
|
637
|
-
left: -1px;
|
|
638
|
-
font-size: 12px;
|
|
639
|
-
font-style: normal;
|
|
640
|
-
font-weight: 600;
|
|
641
|
-
line-height: normal;
|
|
642
|
-
padding: 2px 6px;
|
|
643
|
-
border-radius: 4px 4px 4px 0;
|
|
644
|
-
white-space: nowrap;
|
|
645
|
-
user-select: none;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
.ProseMirror pre {
|
|
649
|
-
background: var(--muted, #f4f4f5);
|
|
650
|
-
border-radius: 0.375rem;
|
|
651
|
-
padding: 0.75rem 1rem;
|
|
652
|
-
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
|
|
653
|
-
font-size: 0.875rem;
|
|
654
|
-
overflow-x: auto;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
.dark .ProseMirror pre {
|
|
658
|
-
background: var(--muted, #27272a);
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
.ProseMirror code {
|
|
662
|
-
background: var(--muted, #f4f4f5);
|
|
663
|
-
border-radius: 0.25rem;
|
|
664
|
-
padding: 0.125rem 0.25rem;
|
|
665
|
-
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
|
|
666
|
-
font-size: 0.875em;
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
.dark .ProseMirror code {
|
|
670
|
-
background: var(--muted, #27272a);
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
.ProseMirror pre code {
|
|
674
|
-
background: transparent;
|
|
675
|
-
padding: 0;
|
|
676
|
-
font-size: inherit;
|
|
677
|
-
}
|
|
678
|
-
` })
|
|
679
|
-
]
|
|
680
|
-
}
|
|
681
|
-
);
|
|
682
|
-
}
|
|
683
|
-
function ConnectionIndicator({
|
|
684
|
-
state
|
|
685
|
-
}) {
|
|
686
|
-
const config = {
|
|
687
|
-
disconnected: {
|
|
688
|
-
color: "bg-red-500",
|
|
689
|
-
label: "Disconnected"
|
|
690
|
-
},
|
|
691
|
-
connecting: {
|
|
692
|
-
color: "bg-yellow-500 animate-pulse",
|
|
693
|
-
label: "Connecting..."
|
|
694
|
-
},
|
|
695
|
-
connected: {
|
|
696
|
-
color: "bg-blue-500",
|
|
697
|
-
label: "Connected"
|
|
698
|
-
},
|
|
699
|
-
synced: {
|
|
700
|
-
color: "bg-green-500",
|
|
701
|
-
label: "Synced"
|
|
702
|
-
}
|
|
703
|
-
}[state];
|
|
704
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-muted-foreground text-xs", children: [
|
|
705
|
-
/* @__PURE__ */ jsx3("span", { className: cn("h-2 w-2 rounded-full", config.color) }),
|
|
706
|
-
/* @__PURE__ */ jsx3("span", { children: config.label })
|
|
707
|
-
] });
|
|
708
|
-
}
|
|
709
|
-
function CollaboratorsList({
|
|
710
|
-
collaborators,
|
|
711
|
-
className
|
|
712
|
-
}) {
|
|
713
|
-
if (collaborators.length === 0) {
|
|
714
|
-
return null;
|
|
715
|
-
}
|
|
716
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-1", className), children: [
|
|
717
|
-
collaborators.slice(0, 5).map((collab) => /* @__PURE__ */ jsx3(
|
|
718
|
-
"div",
|
|
719
|
-
{
|
|
720
|
-
className: "flex h-6 w-6 items-center justify-center rounded-full font-medium text-xs",
|
|
721
|
-
style: { backgroundColor: collab.user.color },
|
|
722
|
-
title: collab.user.name,
|
|
723
|
-
children: collab.user.name.charAt(0).toUpperCase()
|
|
724
|
-
},
|
|
725
|
-
collab.clientId
|
|
726
|
-
)),
|
|
727
|
-
collaborators.length > 5 && /* @__PURE__ */ jsxs("div", { className: "flex h-6 w-6 items-center justify-center rounded-full bg-muted font-medium text-xs", children: [
|
|
728
|
-
"+",
|
|
729
|
-
collaborators.length - 5
|
|
730
|
-
] })
|
|
731
|
-
] });
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
// src/editor/markdown-document-editor.tsx
|
|
735
|
-
import { EditorContent as EditorContent2, useEditor as useEditor2 } from "@tiptap/react";
|
|
736
|
-
import StarterKit2 from "@tiptap/starter-kit";
|
|
737
|
-
import { useEffect as useEffect3, useMemo as useMemo3, useRef as useRef2 } from "react";
|
|
738
|
-
|
|
739
|
-
// src/editor/markdown-conversion.ts
|
|
740
|
-
import { marked } from "marked";
|
|
741
|
-
import TurndownService from "turndown";
|
|
742
|
-
var turndown = new TurndownService({
|
|
743
|
-
bulletListMarker: "-",
|
|
744
|
-
codeBlockStyle: "fenced",
|
|
745
|
-
emDelimiter: "*",
|
|
746
|
-
headingStyle: "atx"
|
|
747
|
-
});
|
|
748
|
-
function markdownToHtml(markdown) {
|
|
749
|
-
return String(marked.parse(markdown, { async: false, gfm: true }));
|
|
750
|
-
}
|
|
751
|
-
function htmlToMarkdown(html) {
|
|
752
|
-
return turndown.turndown(html);
|
|
753
|
-
}
|
|
754
|
-
function normalizeMarkdown(markdown) {
|
|
755
|
-
return markdown.replace(/\r\n/g, "\n").trimEnd();
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
// src/editor/markdown-document-editor.tsx
|
|
759
|
-
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
760
|
-
function MarkdownDocumentEditor({
|
|
761
|
-
value = "",
|
|
762
|
-
placeholder = "Start writing...",
|
|
763
|
-
readOnly = false,
|
|
764
|
-
autoFocus = false,
|
|
765
|
-
className,
|
|
766
|
-
contentClassName,
|
|
767
|
-
onChange,
|
|
768
|
-
onReady
|
|
769
|
-
}) {
|
|
770
|
-
const initialHtml = useMemo3(() => markdownToHtml(value), []);
|
|
771
|
-
const lastAppliedMarkdownRef = useRef2(normalizeMarkdown(value));
|
|
772
|
-
const editor = useEditor2({
|
|
773
|
-
extensions: [
|
|
774
|
-
StarterKit2.configure({
|
|
775
|
-
codeBlock: {
|
|
776
|
-
HTMLAttributes: {
|
|
777
|
-
class: "hljs"
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
})
|
|
781
|
-
],
|
|
782
|
-
content: initialHtml,
|
|
783
|
-
editable: !readOnly,
|
|
784
|
-
autofocus: autoFocus,
|
|
785
|
-
editorProps: {
|
|
786
|
-
attributes: {
|
|
787
|
-
class: cn(
|
|
788
|
-
"prose prose-sm sm:prose-base max-w-none focus:outline-none",
|
|
789
|
-
"prose-headings:text-foreground prose-p:text-foreground prose-li:text-foreground",
|
|
790
|
-
"prose-strong:text-foreground prose-code:text-foreground prose-pre:text-foreground",
|
|
791
|
-
contentClassName
|
|
792
|
-
),
|
|
793
|
-
"data-placeholder": placeholder
|
|
794
|
-
}
|
|
795
|
-
},
|
|
796
|
-
onUpdate: ({ editor: currentEditor }) => {
|
|
797
|
-
const nextMarkdown = normalizeMarkdown(htmlToMarkdown(currentEditor.getHTML()));
|
|
798
|
-
lastAppliedMarkdownRef.current = nextMarkdown;
|
|
799
|
-
onChange?.(nextMarkdown, currentEditor);
|
|
800
|
-
},
|
|
801
|
-
onCreate: ({ editor: currentEditor }) => {
|
|
802
|
-
onReady?.(currentEditor);
|
|
803
|
-
}
|
|
804
|
-
});
|
|
805
|
-
useEffect3(() => {
|
|
806
|
-
if (editor) {
|
|
807
|
-
editor.setEditable(!readOnly);
|
|
808
|
-
}
|
|
809
|
-
}, [editor, readOnly]);
|
|
810
|
-
useEffect3(() => {
|
|
811
|
-
if (!editor) {
|
|
812
|
-
return;
|
|
813
|
-
}
|
|
814
|
-
const normalizedValue = normalizeMarkdown(value);
|
|
815
|
-
if (normalizedValue === lastAppliedMarkdownRef.current) {
|
|
816
|
-
return;
|
|
817
|
-
}
|
|
818
|
-
editor.commands.setContent(markdownToHtml(value), { emitUpdate: false });
|
|
819
|
-
lastAppliedMarkdownRef.current = normalizedValue;
|
|
820
|
-
}, [editor, value]);
|
|
821
|
-
return /* @__PURE__ */ jsxs2(
|
|
822
|
-
"div",
|
|
823
|
-
{
|
|
824
|
-
className: cn(
|
|
825
|
-
"flex min-h-[14rem] w-full flex-col overflow-hidden rounded-lg border border-border bg-background",
|
|
826
|
-
className
|
|
827
|
-
),
|
|
828
|
-
children: [
|
|
829
|
-
/* @__PURE__ */ jsx4(
|
|
830
|
-
EditorToolbar,
|
|
831
|
-
{
|
|
832
|
-
editor,
|
|
833
|
-
className: "border-border bg-card px-2 py-2"
|
|
834
|
-
}
|
|
835
|
-
),
|
|
836
|
-
/* @__PURE__ */ jsx4("div", { className: "min-h-0 flex-1 overflow-auto px-5 py-4", children: /* @__PURE__ */ jsx4(EditorContent2, { editor }) }),
|
|
837
|
-
/* @__PURE__ */ jsx4("style", { children: `
|
|
838
|
-
.ProseMirror p.is-editor-empty:first-child::before {
|
|
839
|
-
content: attr(data-placeholder);
|
|
840
|
-
float: left;
|
|
841
|
-
color: hsl(var(--muted-foreground));
|
|
842
|
-
pointer-events: none;
|
|
843
|
-
height: 0;
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
.ProseMirror pre {
|
|
847
|
-
background: hsl(var(--muted));
|
|
848
|
-
border: 1px solid hsl(var(--border));
|
|
849
|
-
border-radius: 0.75rem;
|
|
850
|
-
padding: 0.875rem 1rem;
|
|
851
|
-
overflow-x: auto;
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
.ProseMirror code {
|
|
855
|
-
background: hsl(var(--muted));
|
|
856
|
-
border-radius: 0.35rem;
|
|
857
|
-
padding: 0.12rem 0.3rem;
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
.ProseMirror pre code {
|
|
861
|
-
background: transparent;
|
|
862
|
-
padding: 0;
|
|
863
|
-
}
|
|
864
|
-
` })
|
|
865
|
-
]
|
|
866
|
-
}
|
|
867
|
-
);
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
// src/editor/use-editor.ts
|
|
871
|
-
import { useCallback as useCallback2, useEffect as useEffect4, useState as useState2 } from "react";
|
|
872
|
-
function useEditorConnection() {
|
|
873
|
-
const { connectionState, isSynced, connect, disconnect } = useEditorContext();
|
|
874
|
-
const isConnected = connectionState === "connected" || connectionState === "synced";
|
|
875
|
-
const isConnecting = connectionState === "connecting";
|
|
876
|
-
const isDisconnected = connectionState === "disconnected";
|
|
877
|
-
return {
|
|
878
|
-
/** Current connection state string */
|
|
879
|
-
state: connectionState,
|
|
880
|
-
/** Whether connected to the server (connected or synced) */
|
|
881
|
-
isConnected,
|
|
882
|
-
/** Whether currently attempting to connect */
|
|
883
|
-
isConnecting,
|
|
884
|
-
/** Whether disconnected from the server */
|
|
885
|
-
isDisconnected,
|
|
886
|
-
/** Whether the document is synced with the server */
|
|
887
|
-
isSynced,
|
|
888
|
-
/** Connect to the collaboration server */
|
|
889
|
-
connect,
|
|
890
|
-
/** Disconnect from the collaboration server */
|
|
891
|
-
disconnect
|
|
892
|
-
};
|
|
893
|
-
}
|
|
894
|
-
function useCollaborators() {
|
|
895
|
-
const { collaborators } = useEditorContext();
|
|
896
|
-
const count = collaborators.length;
|
|
897
|
-
const hasOthers = count > 0;
|
|
898
|
-
return {
|
|
899
|
-
/** List of active collaborators (excluding self) */
|
|
900
|
-
collaborators,
|
|
901
|
-
/** Number of other collaborators */
|
|
902
|
-
count,
|
|
903
|
-
/** Whether there are other collaborators present */
|
|
904
|
-
hasOthers
|
|
905
|
-
};
|
|
906
|
-
}
|
|
907
|
-
function useCollaboratorPresence(userId) {
|
|
908
|
-
const { collaborators } = useEditorContext();
|
|
909
|
-
return collaborators.find((c) => c.user.userId === userId) ?? null;
|
|
910
|
-
}
|
|
911
|
-
function useYjsState(key, initialValue) {
|
|
912
|
-
const { doc } = useEditorContext();
|
|
913
|
-
const [value, setLocalValue] = useState2(initialValue);
|
|
914
|
-
const metaMap = doc.getMap("metadata");
|
|
915
|
-
useEffect4(() => {
|
|
916
|
-
const updateValue = () => {
|
|
917
|
-
const stored = metaMap.get(key);
|
|
918
|
-
if (stored !== void 0) {
|
|
919
|
-
setLocalValue(stored);
|
|
920
|
-
}
|
|
921
|
-
};
|
|
922
|
-
updateValue();
|
|
923
|
-
metaMap.observe(updateValue);
|
|
924
|
-
return () => {
|
|
925
|
-
metaMap.unobserve(updateValue);
|
|
926
|
-
};
|
|
927
|
-
}, [metaMap, key]);
|
|
928
|
-
const setValue = useCallback2(
|
|
929
|
-
(newValue) => {
|
|
930
|
-
doc.transact(() => {
|
|
931
|
-
metaMap.set(key, newValue);
|
|
932
|
-
});
|
|
933
|
-
},
|
|
934
|
-
[doc, metaMap, key]
|
|
935
|
-
);
|
|
936
|
-
return [value, setValue];
|
|
937
|
-
}
|
|
938
|
-
function useDocumentChanges(onSave) {
|
|
939
|
-
const { doc } = useEditorContext();
|
|
940
|
-
const [isDirty, setIsDirty] = useState2(false);
|
|
941
|
-
const [isSaving, setIsSaving] = useState2(false);
|
|
942
|
-
const [lastSaved, setLastSaved] = useState2(null);
|
|
943
|
-
useEffect4(() => {
|
|
944
|
-
const handleUpdate = () => {
|
|
945
|
-
setIsDirty(true);
|
|
946
|
-
};
|
|
947
|
-
doc.on("update", handleUpdate);
|
|
948
|
-
return () => {
|
|
949
|
-
doc.off("update", handleUpdate);
|
|
950
|
-
};
|
|
951
|
-
}, [doc]);
|
|
952
|
-
const save = useCallback2(async () => {
|
|
953
|
-
if (!onSave || isSaving) return;
|
|
954
|
-
setIsSaving(true);
|
|
955
|
-
try {
|
|
956
|
-
await onSave();
|
|
957
|
-
setIsDirty(false);
|
|
958
|
-
setLastSaved(/* @__PURE__ */ new Date());
|
|
959
|
-
} finally {
|
|
960
|
-
setIsSaving(false);
|
|
961
|
-
}
|
|
962
|
-
}, [onSave, isSaving]);
|
|
963
|
-
return {
|
|
964
|
-
/** Whether there are unsaved changes */
|
|
965
|
-
isDirty,
|
|
966
|
-
/** Whether save is in progress */
|
|
967
|
-
isSaving,
|
|
968
|
-
/** When the document was last saved */
|
|
969
|
-
lastSaved,
|
|
970
|
-
/** Save the document */
|
|
971
|
-
save
|
|
972
|
-
};
|
|
973
|
-
}
|
|
974
|
-
function useAwareness() {
|
|
975
|
-
const { provider } = useEditorContext();
|
|
976
|
-
const [localState, setLocalStateValue] = useState2(
|
|
977
|
-
{}
|
|
978
|
-
);
|
|
979
|
-
const awareness = provider?.awareness;
|
|
980
|
-
useEffect4(() => {
|
|
981
|
-
if (!awareness) return;
|
|
982
|
-
const updateState = () => {
|
|
983
|
-
setLocalStateValue(awareness.getLocalState() ?? {});
|
|
984
|
-
};
|
|
985
|
-
updateState();
|
|
986
|
-
awareness.on("change", updateState);
|
|
987
|
-
return () => {
|
|
988
|
-
awareness.off("change", updateState);
|
|
989
|
-
};
|
|
990
|
-
}, [awareness]);
|
|
991
|
-
const setLocalState = useCallback2(
|
|
992
|
-
(state) => {
|
|
993
|
-
if (!awareness) return;
|
|
994
|
-
const current = awareness.getLocalState() ?? {};
|
|
995
|
-
awareness.setLocalState({ ...current, ...state });
|
|
996
|
-
},
|
|
997
|
-
[awareness]
|
|
998
|
-
);
|
|
999
|
-
const setLocalStateField = useCallback2(
|
|
1000
|
-
(field, value) => {
|
|
1001
|
-
if (!awareness) return;
|
|
1002
|
-
awareness.setLocalStateField(field, value);
|
|
1003
|
-
},
|
|
1004
|
-
[awareness]
|
|
1005
|
-
);
|
|
1006
|
-
return {
|
|
1007
|
-
/** Current local awareness state */
|
|
1008
|
-
localState,
|
|
1009
|
-
/** Set the entire local state (merges with existing) */
|
|
1010
|
-
setLocalState,
|
|
1011
|
-
/** Set a single field in the local state */
|
|
1012
|
-
setLocalStateField,
|
|
1013
|
-
/** The raw awareness instance */
|
|
1014
|
-
awareness
|
|
1015
|
-
};
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
// src/editor/document-editor-pane.tsx
|
|
1019
|
-
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1020
|
-
function connectionTone(state) {
|
|
1021
|
-
switch (state) {
|
|
1022
|
-
case "synced":
|
|
1023
|
-
return "text-[var(--surface-success-text)] border-[var(--surface-success-border)] bg-[var(--surface-success-bg)]";
|
|
1024
|
-
case "connected":
|
|
1025
|
-
case "connecting":
|
|
1026
|
-
return "text-[var(--surface-info-text)] border-[var(--surface-info-border)] bg-[var(--surface-info-bg)]";
|
|
1027
|
-
case "disconnected":
|
|
1028
|
-
default:
|
|
1029
|
-
return "text-[var(--surface-warning-text)] border-[var(--surface-warning-border)] bg-[var(--surface-warning-bg)]";
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
function connectionLabel(state) {
|
|
1033
|
-
switch (state) {
|
|
1034
|
-
case "synced":
|
|
1035
|
-
return "Live synced";
|
|
1036
|
-
case "connected":
|
|
1037
|
-
return "Connected";
|
|
1038
|
-
case "connecting":
|
|
1039
|
-
return "Connecting";
|
|
1040
|
-
case "disconnected":
|
|
1041
|
-
default:
|
|
1042
|
-
return "Offline";
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
function connectionDescription(state, collaborators, readOnly) {
|
|
1046
|
-
if (readOnly) {
|
|
1047
|
-
return state === "disconnected" ? "Live access is paused. You can keep reading while the editor reconnects." : "You are viewing the live document in read-only mode.";
|
|
1048
|
-
}
|
|
1049
|
-
switch (state) {
|
|
1050
|
-
case "synced":
|
|
1051
|
-
return collaborators > 0 ? `You and ${collaborators} collaborator${collaborators === 1 ? "" : "s"} are editing the same document.` : "You are editing the live document. Changes sync automatically.";
|
|
1052
|
-
case "connected":
|
|
1053
|
-
case "connecting":
|
|
1054
|
-
return "Connecting the live document. Local edits stay in place while sync catches up.";
|
|
1055
|
-
case "disconnected":
|
|
1056
|
-
default:
|
|
1057
|
-
return "Live updates are paused. You can keep editing and reconnect when the transport is healthy again.";
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
function CollaborativeDocumentSurface({
|
|
1061
|
-
markdown,
|
|
1062
|
-
placeholder,
|
|
1063
|
-
autoFocus,
|
|
1064
|
-
readOnly,
|
|
1065
|
-
className,
|
|
1066
|
-
onChange
|
|
1067
|
-
}) {
|
|
1068
|
-
const { state } = useEditorConnection();
|
|
1069
|
-
const { collaborators } = useCollaborators();
|
|
1070
|
-
const initialContent = useMemo4(() => markdownToHtml(markdown), [markdown]);
|
|
1071
|
-
const collaboratorCount = collaborators.length + 1;
|
|
1072
|
-
return /* @__PURE__ */ jsxs3("div", { className: cn("flex h-full min-h-0 flex-col gap-3", className), children: [
|
|
1073
|
-
/* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center justify-between gap-3 rounded-[var(--radius-lg)] border border-border bg-card px-3 py-2", children: [
|
|
1074
|
-
/* @__PURE__ */ jsxs3("div", { className: "min-w-0 space-y-2", children: [
|
|
1075
|
-
/* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [
|
|
1076
|
-
/* @__PURE__ */ jsxs3(
|
|
1077
|
-
"span",
|
|
1078
|
-
{
|
|
1079
|
-
className: cn(
|
|
1080
|
-
"inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 font-medium",
|
|
1081
|
-
connectionTone(state)
|
|
1082
|
-
),
|
|
1083
|
-
children: [
|
|
1084
|
-
state === "disconnected" ? /* @__PURE__ */ jsx5(WifiOff, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx5(Wifi, { className: "h-3.5 w-3.5" }),
|
|
1085
|
-
connectionLabel(state)
|
|
1086
|
-
]
|
|
1087
|
-
}
|
|
1088
|
-
),
|
|
1089
|
-
/* @__PURE__ */ jsxs3("span", { className: "inline-flex items-center gap-1.5 rounded-full border border-border bg-background px-2.5 py-1", children: [
|
|
1090
|
-
/* @__PURE__ */ jsx5(Users, { className: "h-3.5 w-3.5" }),
|
|
1091
|
-
collaborators.length === 0 ? "Solo editing" : `${collaboratorCount} active`
|
|
1092
|
-
] })
|
|
1093
|
-
] }),
|
|
1094
|
-
/* @__PURE__ */ jsx5("p", { className: "text-xs text-muted-foreground", children: connectionDescription(state, collaborators.length, readOnly) })
|
|
1095
|
-
] }),
|
|
1096
|
-
/* @__PURE__ */ jsx5(CollaboratorsList, { collaborators })
|
|
1097
|
-
] }),
|
|
1098
|
-
/* @__PURE__ */ jsx5(
|
|
1099
|
-
TiptapEditor,
|
|
1100
|
-
{
|
|
1101
|
-
initialContent,
|
|
1102
|
-
placeholder,
|
|
1103
|
-
autoFocus,
|
|
1104
|
-
readOnly,
|
|
1105
|
-
className: cn("h-full min-h-[16rem]", className),
|
|
1106
|
-
onUpdate: (editor) => {
|
|
1107
|
-
onChange?.(normalizeMarkdown(htmlToMarkdown(editor.getHTML())));
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
)
|
|
1111
|
-
] });
|
|
1112
|
-
}
|
|
1113
|
-
function DocumentEditorPane({
|
|
1114
|
-
eyebrow,
|
|
1115
|
-
title,
|
|
1116
|
-
subtitle,
|
|
1117
|
-
meta,
|
|
1118
|
-
headerActions,
|
|
1119
|
-
footer,
|
|
1120
|
-
className,
|
|
1121
|
-
contentClassName,
|
|
1122
|
-
tabs,
|
|
1123
|
-
toolbar,
|
|
1124
|
-
markdown = "",
|
|
1125
|
-
mode,
|
|
1126
|
-
defaultMode = "preview",
|
|
1127
|
-
onModeChange,
|
|
1128
|
-
backend = "local",
|
|
1129
|
-
placeholder = "Start writing...",
|
|
1130
|
-
autoFocus = false,
|
|
1131
|
-
readOnly = false,
|
|
1132
|
-
onChange,
|
|
1133
|
-
onSave,
|
|
1134
|
-
saving = false,
|
|
1135
|
-
saveLabel = "Save changes",
|
|
1136
|
-
previewClassName,
|
|
1137
|
-
editorClassName,
|
|
1138
|
-
collaboration
|
|
1139
|
-
}) {
|
|
1140
|
-
const [draft, setDraft] = useState3(markdown);
|
|
1141
|
-
const [uncontrolledMode, setUncontrolledMode] = useState3(defaultMode);
|
|
1142
|
-
const activeMode = mode ?? uncontrolledMode;
|
|
1143
|
-
const isCollaborative = backend === "collaborative" && Boolean(collaboration);
|
|
1144
|
-
const isDirty = normalizeMarkdown(draft) !== normalizeMarkdown(markdown);
|
|
1145
|
-
const saveStateLabel = readOnly ? "Read only" : isCollaborative ? isDirty ? "Snapshot pending" : "Live document current" : isDirty ? "Unsaved changes" : "Saved";
|
|
1146
|
-
useEffect5(() => {
|
|
1147
|
-
setDraft(markdown);
|
|
1148
|
-
}, [markdown]);
|
|
1149
|
-
useEffect5(() => {
|
|
1150
|
-
if (mode === void 0) {
|
|
1151
|
-
setUncontrolledMode(defaultMode);
|
|
1152
|
-
}
|
|
1153
|
-
}, [defaultMode, mode]);
|
|
1154
|
-
const setMode = (nextMode) => {
|
|
1155
|
-
if (mode === void 0) {
|
|
1156
|
-
setUncontrolledMode(nextMode);
|
|
1157
|
-
}
|
|
1158
|
-
onModeChange?.(nextMode);
|
|
1159
|
-
};
|
|
1160
|
-
const handleChange = (nextMarkdown) => {
|
|
1161
|
-
setDraft(nextMarkdown);
|
|
1162
|
-
onChange?.(nextMarkdown);
|
|
1163
|
-
};
|
|
1164
|
-
const editorToolbar = /* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
|
|
1165
|
-
/* @__PURE__ */ jsxs3(
|
|
1166
|
-
TabsList,
|
|
1167
|
-
{
|
|
1168
|
-
variant: "underline",
|
|
1169
|
-
className: "h-auto gap-4 border-0 bg-transparent p-0 text-muted-foreground",
|
|
1170
|
-
children: [
|
|
1171
|
-
/* @__PURE__ */ jsx5(
|
|
1172
|
-
TabsTrigger,
|
|
1173
|
-
{
|
|
1174
|
-
value: "preview",
|
|
1175
|
-
variant: "underline",
|
|
1176
|
-
className: "pb-2 data-[state=active]:border-primary data-[state=active]:text-foreground",
|
|
1177
|
-
children: "Preview"
|
|
1178
|
-
}
|
|
1179
|
-
),
|
|
1180
|
-
/* @__PURE__ */ jsxs3(
|
|
1181
|
-
TabsTrigger,
|
|
1182
|
-
{
|
|
1183
|
-
value: "edit",
|
|
1184
|
-
variant: "underline",
|
|
1185
|
-
className: "flex items-center gap-2 pb-2 data-[state=active]:border-primary data-[state=active]:text-foreground",
|
|
1186
|
-
children: [
|
|
1187
|
-
/* @__PURE__ */ jsx5(PencilLine, { className: "h-3.5 w-3.5" }),
|
|
1188
|
-
isCollaborative ? "Live edit" : "Edit"
|
|
1189
|
-
]
|
|
1190
|
-
}
|
|
1191
|
-
)
|
|
1192
|
-
]
|
|
1193
|
-
}
|
|
1194
|
-
),
|
|
1195
|
-
/* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [
|
|
1196
|
-
toolbar,
|
|
1197
|
-
/* @__PURE__ */ jsx5("span", { className: "rounded-full border border-border bg-card px-2.5 py-1 font-medium", children: isCollaborative ? "Live document" : "Local draft" }),
|
|
1198
|
-
/* @__PURE__ */ jsx5("span", { className: "rounded-full border border-border bg-background px-2.5 py-1", children: saveStateLabel }),
|
|
1199
|
-
onSave && !readOnly && /* @__PURE__ */ jsxs3(
|
|
1200
|
-
"button",
|
|
1201
|
-
{
|
|
1202
|
-
type: "button",
|
|
1203
|
-
onClick: () => void onSave(draft),
|
|
1204
|
-
disabled: saving || !isDirty,
|
|
1205
|
-
className: "inline-flex items-center gap-2 rounded-[var(--radius-full)] border border-border bg-card px-3 py-1.5 text-xs font-semibold text-foreground transition-colors hover:border-primary/40 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
1206
|
-
children: [
|
|
1207
|
-
/* @__PURE__ */ jsx5(Save, { className: "h-3.5 w-3.5" }),
|
|
1208
|
-
saving ? "Saving..." : saveLabel
|
|
1209
|
-
]
|
|
1210
|
-
}
|
|
1211
|
-
)
|
|
1212
|
-
] })
|
|
1213
|
-
] });
|
|
1214
|
-
const preview = /* @__PURE__ */ jsx5(
|
|
1215
|
-
"div",
|
|
1216
|
-
{
|
|
1217
|
-
className: cn(
|
|
1218
|
-
"rounded-[var(--radius-lg)] border border-border bg-background p-5",
|
|
1219
|
-
previewClassName
|
|
1220
|
-
),
|
|
1221
|
-
children: /* @__PURE__ */ jsx5(Markdown, { className: "prose-sm max-w-none", children: draft })
|
|
1222
|
-
}
|
|
1223
|
-
);
|
|
1224
|
-
const localEditor = /* @__PURE__ */ jsx5(
|
|
1225
|
-
MarkdownDocumentEditor,
|
|
1226
|
-
{
|
|
1227
|
-
value: draft,
|
|
1228
|
-
placeholder,
|
|
1229
|
-
autoFocus,
|
|
1230
|
-
readOnly,
|
|
1231
|
-
onChange: (nextMarkdown) => {
|
|
1232
|
-
handleChange(nextMarkdown);
|
|
1233
|
-
},
|
|
1234
|
-
className: editorClassName
|
|
1235
|
-
}
|
|
1236
|
-
);
|
|
1237
|
-
const collaborativeEditor = collaboration ? /* @__PURE__ */ jsx5(EditorProvider, { ...collaboration, children: /* @__PURE__ */ jsx5(
|
|
1238
|
-
CollaborativeDocumentSurface,
|
|
1239
|
-
{
|
|
1240
|
-
markdown: draft,
|
|
1241
|
-
placeholder,
|
|
1242
|
-
autoFocus,
|
|
1243
|
-
readOnly,
|
|
1244
|
-
className: editorClassName,
|
|
1245
|
-
onChange: handleChange
|
|
1246
|
-
}
|
|
1247
|
-
) }, collaboration.documentName) : localEditor;
|
|
1248
|
-
return /* @__PURE__ */ jsx5(
|
|
1249
|
-
Tabs,
|
|
1250
|
-
{
|
|
1251
|
-
value: activeMode,
|
|
1252
|
-
onValueChange: (nextValue) => setMode(nextValue),
|
|
1253
|
-
className: "h-full",
|
|
1254
|
-
children: /* @__PURE__ */ jsxs3(
|
|
1255
|
-
ArtifactPane,
|
|
1256
|
-
{
|
|
1257
|
-
eyebrow,
|
|
1258
|
-
title,
|
|
1259
|
-
subtitle,
|
|
1260
|
-
meta,
|
|
1261
|
-
headerActions,
|
|
1262
|
-
footer,
|
|
1263
|
-
tabs,
|
|
1264
|
-
className,
|
|
1265
|
-
contentClassName,
|
|
1266
|
-
toolbar: editorToolbar,
|
|
1267
|
-
children: [
|
|
1268
|
-
/* @__PURE__ */ jsx5(TabsContent, { value: "preview", className: "mt-0 h-full px-4 py-4", children: preview }),
|
|
1269
|
-
/* @__PURE__ */ jsx5(TabsContent, { value: "edit", className: "mt-0 h-full px-4 py-4", children: isCollaborative ? collaborativeEditor : localEditor })
|
|
1270
|
-
]
|
|
1271
|
-
}
|
|
1272
|
-
)
|
|
1273
|
-
}
|
|
1274
|
-
);
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
export {
|
|
1278
|
-
EditorProvider,
|
|
1279
|
-
useEditorContext,
|
|
1280
|
-
EditorToolbar,
|
|
1281
|
-
TiptapEditor,
|
|
1282
|
-
CollaboratorsList,
|
|
1283
|
-
useEditorConnection,
|
|
1284
|
-
useCollaborators,
|
|
1285
|
-
useCollaboratorPresence,
|
|
1286
|
-
useYjsState,
|
|
1287
|
-
useDocumentChanges,
|
|
1288
|
-
useAwareness,
|
|
1289
|
-
DocumentEditorPane
|
|
1290
|
-
};
|