fix: extract message text from p elements in private meeting chat
This commit is contained in:
parent
ccfe47aa35
commit
2fee448e0b
@ -53,8 +53,14 @@ _POLL_JS = """() => {
|
||||
const senderEl = msg.querySelector("[data-tid='message-author-name']");
|
||||
const sender = senderEl ? senderEl.innerText.trim() : '';
|
||||
if (!sender) return;
|
||||
const id = msg.getAttribute('id') || (idx + '_' + msg.innerText.substring(0, 40));
|
||||
msgs.push({ sender, text: msg.innerText.trim(), id });
|
||||
// Extract only the message text (p elements), not the full innerText
|
||||
// which includes sender name and timestamp
|
||||
const pEls = msg.querySelectorAll('p');
|
||||
const text = pEls.length > 0
|
||||
? Array.from(pEls).map(p => p.innerText.trim()).filter(t => t).join('\n')
|
||||
: msg.innerText.trim();
|
||||
const id = msg.getAttribute('id') || (sender + '_' + text.substring(0, 40));
|
||||
msgs.push({ sender, text, id });
|
||||
});
|
||||
return msgs;
|
||||
}"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user