@devchitchat/chat 4.0.3 → 4.0.5
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devchitchat/chat",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"description": "A small chat app. p2p video and screenshare.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "bun --watch index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"styles.css"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@devchitchat/index97": "^3.
|
|
36
|
+
"@devchitchat/index97": "^3.2.0",
|
|
37
37
|
"@devchitchat/rdbljs": "^2.0.1"
|
|
38
38
|
},
|
|
39
39
|
"main": "index.js",
|
|
@@ -201,6 +201,15 @@ export default function CallIsland(root) {
|
|
|
201
201
|
// Date separator before this article if date changed
|
|
202
202
|
const ts = parseInt(article.querySelector('time')?.getAttribute('datetime') ?? '0', 10)
|
|
203
203
|
if (ts) {
|
|
204
|
+
// Re-format time in the browser's local timezone (SSR bakes UTC time)
|
|
205
|
+
const timeEl = article.querySelector('.message-time')
|
|
206
|
+
if (timeEl) {
|
|
207
|
+
const localTime = new Date(ts).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })
|
|
208
|
+
const editedSpan = timeEl.querySelector('.message-edited')
|
|
209
|
+
timeEl.textContent = localTime
|
|
210
|
+
if (editedSpan) timeEl.appendChild(editedSpan)
|
|
211
|
+
}
|
|
212
|
+
|
|
204
213
|
const dateKey = utcDateKey(ts)
|
|
205
214
|
if (prevDateKey && dateKey !== prevDateKey) {
|
|
206
215
|
article.before(makeDateSeparator(dateKey))
|
|
@@ -1690,7 +1699,15 @@ export default function CallIsland(root) {
|
|
|
1690
1699
|
// Re-initialise chat state for the new channel without touching RTC.
|
|
1691
1700
|
document.addEventListener('chatpanel:navigated', (e) => {
|
|
1692
1701
|
const { channelId: newId, name, topic, kind, seedSeq: newSeedSeq, seedFirstSeq: newFirstSeq, seedHasMore: newHasMore } = e.detail
|
|
1693
|
-
|
|
1702
|
+
|
|
1703
|
+
// Morph strips dynamically-added content (reactions, attachments, timestamps, etc.)
|
|
1704
|
+
// but may preserve data-hydrated="1". Always clear and re-hydrate.
|
|
1705
|
+
for (const a of messages.querySelectorAll('article.message[data-hydrated]')) {
|
|
1706
|
+
delete a.dataset.hydrated
|
|
1707
|
+
}
|
|
1708
|
+
hydrateSeedMessages()
|
|
1709
|
+
|
|
1710
|
+
if (newId === channelId) return // same channel — re-hydrate only, no WS channel change
|
|
1694
1711
|
|
|
1695
1712
|
// Leave old channel subscription on the server
|
|
1696
1713
|
ws.send({ t: 'channel.leave', body: { channel_id: channelId } })
|
|
@@ -1716,9 +1733,6 @@ export default function CallIsland(root) {
|
|
|
1716
1733
|
const textarea = root.querySelector('#message-input')
|
|
1717
1734
|
if (textarea) textarea.placeholder = `Message in ${name}`
|
|
1718
1735
|
|
|
1719
|
-
// Hydrate attachments + dm-trigger on the freshly morphed seed articles
|
|
1720
|
-
hydrateSeedMessages()
|
|
1721
|
-
|
|
1722
1736
|
closePicker()
|
|
1723
1737
|
|
|
1724
1738
|
// Join new channel — server responds with channel.joined + rtc.call_state.
|