Merge pull request #45 from joenunezb/fix/render-chat-message-properly
fix: Render chat messages using updateMessageBlock
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { getContext } from '../../../../../../extensions.js';
|
||||
import { chat, user_avatar, setExtensionPrompt, extension_prompt_types } from '../../../../../../../script.js';
|
||||
import { chat, user_avatar, setExtensionPrompt, extension_prompt_types, updateMessageBlock } from '../../../../../../../script.js';
|
||||
|
||||
// Core modules
|
||||
import {
|
||||
@@ -167,13 +167,9 @@ export async function onMessageReceived(data) {
|
||||
renderQuests();
|
||||
|
||||
// Then update the DOM to reflect the cleaned message
|
||||
const lastMessageElement = $('#chat').children('.mes').last();
|
||||
if (lastMessageElement.length) {
|
||||
const messageText = lastMessageElement.find('.mes_text');
|
||||
if (messageText.length) {
|
||||
messageText.html(substituteParams(cleanedMessage.trim()));
|
||||
}
|
||||
}
|
||||
// Using updateMessageBlock to perform macro substitutions + regex formatting
|
||||
const messageId = chat.length - 1;
|
||||
updateMessageBlock(messageId, lastMessage, { rerenderMessage: true });
|
||||
|
||||
// console.log('[RPG Companion] Cleaned message, removed tracker code blocks from DOM');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user