信息中的链接识别和样式

dev/chat
Lei OT 2 years ago
parent 87d3bce2f4
commit 5f26170df1

@ -96,7 +96,7 @@ export const sentMsgTypeMapped = {
conversationid: msg.id.split('.')[0],
type: 'text',
title: msg.template_origin.components.header?.[0]?.text || '',
text: templateDataMapped?.body?.text || '', // msg.template_origin.components.body?.[0]?.text || '',
text: autoLinkText( templateDataMapped?.body?.text || ''), // msg.template_origin.components.body?.[0]?.text || '',
};
},
},
@ -247,7 +247,7 @@ export const whatsappMsgTypeMapped = {
type: 'text',
data: (msg) => {
const templateDataMapped = msg.template?.components ? msg.template.components.reduce((r, v) => ({...r, [v.type]: v}), {}) : null;
return { id: msg.wamid, text: templateDataMapped?.body?.text || templateDataMapped?.body?.parameters?.[0]?.text || '', title: msg.template.name }
return { id: msg.wamid, text: autoLinkText(templateDataMapped?.body?.text || templateDataMapped?.body?.parameters?.[0]?.text || ''), title: msg.template.name }
},
renderForReply: (msg) => {
const templateDataMapped = msg.template?.components ? msg.template.components.reduce((r, v) => ({ ...r, [v.type]: v }), {}) : null;

@ -58,7 +58,7 @@ const InputTemplate = ({ disabled = false, invokeSendMessage }) => {
name: fromTemplate.name,
language: { code: fromTemplate.language },
components: fromTemplate.components_origin.map((citem) => {
const keys = (citem?.text || '').match(/{{(.*?)}}/g).map((key) => key.replace(/{{|}}/g, ''));
const keys = ((citem?.text || '').match(/{{(.*?)}}/g) || []).map((key) => key.replace(/{{|}}/g, ''));
const params = keys.map((v) => ({ type: 'text', text: getNestedValue(mergeInput, [v]) }));
const paramText = params.map((p) => p.text);
const fillTemplate = paramText.length ? replaceTemplateString(citem?.text || '', paramText) : citem?.text || '';

@ -15,6 +15,9 @@
background: linear-gradient(0deg,#00000014,#0000);
color: #00000073;
}
.chatwindow-wrapper .rce-mbox-text a{
color: #4f81a1;
}
.chatwindow-wrapper .rce-mbox-text:after{
content: none;
}

Loading…
Cancel
Save