@object-ui/collaboration 2.0.0 → 3.0.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/CommentThread.js +11 -11
- package/dist/usePresence.d.ts.map +1 -1
- package/dist/usePresence.js +6 -2
- package/package.json +4 -4
package/dist/CommentThread.js
CHANGED
|
@@ -274,6 +274,16 @@ export function CommentThread({ threadId, comments, currentUser, mentionableUser
|
|
|
274
274
|
}
|
|
275
275
|
setMentionQuery(null);
|
|
276
276
|
}, [inputValue]);
|
|
277
|
+
const handleSubmit = useCallback(() => {
|
|
278
|
+
const trimmed = inputValue.trim();
|
|
279
|
+
if (!trimmed || !onAddComment)
|
|
280
|
+
return;
|
|
281
|
+
const mentions = parseMentions(trimmed, mentionableUsers);
|
|
282
|
+
onAddComment(trimmed, mentions, replyTo ?? undefined);
|
|
283
|
+
setInputValue('');
|
|
284
|
+
setReplyTo(null);
|
|
285
|
+
setMentionQuery(null);
|
|
286
|
+
}, [inputValue, onAddComment, mentionableUsers, replyTo]);
|
|
277
287
|
const handleKeyDown = useCallback((e) => {
|
|
278
288
|
if (mentionQuery !== null && filteredMentions.length > 0) {
|
|
279
289
|
if (e.key === 'ArrowDown') {
|
|
@@ -297,17 +307,7 @@ export function CommentThread({ threadId, comments, currentUser, mentionableUser
|
|
|
297
307
|
e.preventDefault();
|
|
298
308
|
handleSubmit();
|
|
299
309
|
}
|
|
300
|
-
}, [mentionQuery, filteredMentions, mentionIndex, insertMention]);
|
|
301
|
-
const handleSubmit = useCallback(() => {
|
|
302
|
-
const trimmed = inputValue.trim();
|
|
303
|
-
if (!trimmed || !onAddComment)
|
|
304
|
-
return;
|
|
305
|
-
const mentions = parseMentions(trimmed, mentionableUsers);
|
|
306
|
-
onAddComment(trimmed, mentions, replyTo ?? undefined);
|
|
307
|
-
setInputValue('');
|
|
308
|
-
setReplyTo(null);
|
|
309
|
-
setMentionQuery(null);
|
|
310
|
-
}, [inputValue, onAddComment, mentionableUsers, replyTo]);
|
|
310
|
+
}, [mentionQuery, filteredMentions, mentionIndex, insertMention, handleSubmit]);
|
|
311
311
|
const handleEdit = useCallback((commentId) => {
|
|
312
312
|
const comment = comments.find(c => c.id === commentId);
|
|
313
313
|
if (comment) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePresence.d.ts","sourceRoot":"","sources":["../src/usePresence.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtD,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,wBAAwB;IACxB,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,iDAAiD;IACjD,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,2CAA2C;IAC3C,SAAS,EAAE,MA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;CACrF,CAyBA"}
|
package/dist/usePresence.js
CHANGED
|
@@ -44,9 +44,13 @@ export function usePresence(sendPresence, config) {
|
|
|
44
44
|
const activityTimerRef = useRef(null);
|
|
45
45
|
const awayTimerRef = useRef(null);
|
|
46
46
|
const currentUserRef = useRef(currentUser);
|
|
47
|
-
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
currentUserRef.current = currentUser;
|
|
49
|
+
}, [currentUser]);
|
|
48
50
|
const sendPresenceRef = useRef(sendPresence);
|
|
49
|
-
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
sendPresenceRef.current = sendPresence;
|
|
53
|
+
}, [sendPresence]);
|
|
50
54
|
const throttledSend = useCallback((updated) => {
|
|
51
55
|
const now = Date.now();
|
|
52
56
|
if (now - lastSendRef.current >= throttleMs) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/collaboration",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Real-time collaboration for Object UI with presence tracking, live cursors, conflict resolution, and comment threads.",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"react": "^18.0.0 || ^19.0.0"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@object-ui/types": "
|
|
29
|
+
"@object-ui/types": "3.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/react": "
|
|
33
|
-
"react": "
|
|
32
|
+
"@types/react": "19.2.13",
|
|
33
|
+
"react": "19.2.4",
|
|
34
34
|
"typescript": "^5.9.3",
|
|
35
35
|
"vitest": "^4.0.18"
|
|
36
36
|
},
|