collabdocchat 2.0.5 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * 聊天增强功能模块
3
3
  * 包含消息撤回、@提及、已读状态等功能
4
4
  */
@@ -8,7 +8,7 @@ export class ChatEnhancements {
8
8
  this.apiService = apiService;
9
9
  this.wsService = wsService;
10
10
  this.currentUserId = currentUserId;
11
- this.messageTimestamps = new Map(); // 存储消息发送时�?
11
+ this.messageTimestamps = new Map(); // 存储消息发送时�?
12
12
  this.mentionSuggestions = [];
13
13
  }
14
14
 
@@ -26,7 +26,7 @@ export class ChatEnhancements {
26
26
  // 处理@提及高亮
27
27
  let content = this.highlightMentions(msg.content, groupMembers);
28
28
 
29
- // 检查是否@了当前用�?
29
+ // 检查是否@了当前用�?
30
30
  const mentionsMe = this.checkMentionsMe(msg.content, groupMembers);
31
31
  if (mentionsMe && !isOwn) {
32
32
  messageEl.classList.add('mentions-me');
@@ -59,7 +59,7 @@ export class ChatEnhancements {
59
59
  });
60
60
  });
61
61
 
62
- // 存储消息时间�?
62
+ // 存储消息时间�?
63
63
  this.messageTimestamps.set(msg._id, new Date(msg.timestamp));
64
64
 
65
65
  return messageEl;
@@ -95,7 +95,7 @@ export class ChatEnhancements {
95
95
  closeBtn.addEventListener('click', closeModal);
96
96
  backdrop.addEventListener('click', closeModal);
97
97
 
98
- // ESC键关�?
98
+ // ESC键关�?
99
99
  const handleEsc = (e) => {
100
100
  if (e.key === 'Escape') {
101
101
  closeModal();
@@ -165,13 +165,13 @@ export class ChatEnhancements {
165
165
 
166
166
  if (matches.length > 0) {
167
167
  this.showMentionSuggestions(inputEl, matches, (selected) => {
168
- // 替换@文本为完整的用户�?
168
+ // 替换@文本为完整的用户�?
169
169
  const beforeAt = textBeforeCursor.substring(0, atMatch.index);
170
170
  const afterCursor = value.substring(cursorPos);
171
171
  inputEl.value = `${beforeAt}@${selected.username} ${afterCursor}`;
172
172
  inputEl.focus();
173
173
 
174
- // 移动光标到用户名�?
174
+ // 移动光标到用户名�?
175
175
  const newPos = beforeAt.length + selected.username.length + 2;
176
176
  inputEl.setSelectionRange(newPos, newPos);
177
177
 
@@ -185,7 +185,7 @@ export class ChatEnhancements {
185
185
  }
186
186
  });
187
187
 
188
- // 点击外部关闭建议�?
188
+ // 点击外部关闭建议�?
189
189
  document.addEventListener('click', (e) => {
190
190
  if (!inputEl.contains(e.target) && suggestionBox && !suggestionBox.contains(e.target)) {
191
191
  this.hideMentionSuggestions();
@@ -194,7 +194,7 @@ export class ChatEnhancements {
194
194
  }
195
195
 
196
196
  /**
197
- * 显示@提及建议�?
197
+ * 显示@提及建议�?
198
198
  */
199
199
  showMentionSuggestions(inputEl, matches, onSelect) {
200
200
  this.hideMentionSuggestions();
@@ -216,7 +216,7 @@ export class ChatEnhancements {
216
216
  suggestionBox.appendChild(item);
217
217
  });
218
218
 
219
- // 定位建议�?
219
+ // 定位建议�?
220
220
  const rect = inputEl.getBoundingClientRect();
221
221
  suggestionBox.style.position = 'absolute';
222
222
  suggestionBox.style.bottom = (window.innerHeight - rect.top + 5) + 'px';
@@ -227,7 +227,7 @@ export class ChatEnhancements {
227
227
  }
228
228
 
229
229
  /**
230
- * 隐藏@提及建议�?
230
+ * 隐藏@提及建议�?
231
231
  */
232
232
  hideMentionSuggestions() {
233
233
  const suggestionBox = document.getElementById('mentionSuggestions');
@@ -251,7 +251,7 @@ export class ChatEnhancements {
251
251
  }
252
252
 
253
253
  /**
254
- * 检查消息是否@了当前用�?
254
+ * 检查消息是否@了当前用�?
255
255
  */
256
256
  checkMentionsMe(content, groupMembers) {
257
257
  const currentUser = groupMembers.find(m => m._id === this.currentUserId);
@@ -262,7 +262,7 @@ export class ChatEnhancements {
262
262
  }
263
263
 
264
264
  /**
265
- * 获取消息已读状�?
265
+ * 获取消息已读状�?
266
266
  */
267
267
  getReadStatus(msg) {
268
268
  if (!msg.readBy || msg.readBy.length === 0) {
@@ -274,7 +274,7 @@ export class ChatEnhancements {
274
274
  }
275
275
 
276
276
  /**
277
- * 标记消息为已�?
277
+ * 标记消息为已�?
278
278
  */
279
279
  async markAsRead(messageId) {
280
280
  try {
@@ -286,7 +286,7 @@ export class ChatEnhancements {
286
286
  }
287
287
 
288
288
  /**
289
- * 批量标记消息为已�?
289
+ * 批量标记消息为已�?
290
290
  */
291
291
  async markAllAsRead(messageIds) {
292
292
  try {
@@ -373,7 +373,7 @@ export class ChatEnhancements {
373
373
  }
374
374
 
375
375
  /**
376
- * 在线状态管�?
376
+ * 在线状态管�?
377
377
  */
378
378
  export class OnlineStatusManager {
379
379
  constructor(wsService) {
@@ -382,7 +382,7 @@ export class OnlineStatusManager {
382
382
  }
383
383
 
384
384
  /**
385
- * 更新用户在线状�?
385
+ * 更新用户在线状�?
386
386
  */
387
387
  updateUserStatus(userId, isOnline) {
388
388
  if (isOnline) {
@@ -407,14 +407,14 @@ export class OnlineStatusManager {
407
407
  }
408
408
 
409
409
  /**
410
- * 检查用户是否在�?
410
+ * 检查用户是否在�?
411
411
  */
412
412
  isUserOnline(userId) {
413
413
  return this.onlineUsers.has(userId);
414
414
  }
415
415
 
416
416
  /**
417
- * 监听在线状态变�?
417
+ * 监听在线状态变�?
418
418
  */
419
419
  setupListeners() {
420
420
  this.wsService.on('user_online', (data) => {
@@ -507,3 +507,4 @@ export class MessageNotificationManager {
507
507
  }
508
508
 
509
509
 
510
+