Files
chatwoot/app/javascript/widget/components/UserMessageBubble.vue
Sivin Varghese 3a693947b5 feat: Add RTL Support to Widget (#11022)
This PR adds RTL support to the web widget for improved right-to-left language compatibility, updates colors, and cleans up code.

Fixes https://linear.app/chatwoot/issue/CW-4089/rtl-issues-on-widget

https://github.com/chatwoot/chatwoot/issues/9791

Other PR: https://github.com/chatwoot/chatwoot/pull/11016
2025-03-21 09:39:03 -07:00

62 lines
1.1 KiB
Vue
Executable File

<script>
import { useMessageFormatter } from 'shared/composables/useMessageFormatter';
import { getContrastingTextColor } from '@chatwoot/utils';
export default {
name: 'UserMessageBubble',
props: {
message: {
type: String,
default: '',
},
widgetColor: {
type: String,
default: '',
},
},
setup() {
const { formatMessage } = useMessageFormatter();
return {
formatMessage,
};
},
computed: {
textColor() {
return getContrastingTextColor(this.widgetColor);
},
},
};
</script>
<template>
<div
v-dompurify-html="formatMessage(message, false)"
class="chat-bubble user"
:style="{ background: widgetColor, color: textColor }"
/>
</template>
<style lang="scss" scoped>
.chat-bubble.user::v-deep {
p code {
@apply bg-n-alpha-2 dark:bg-n-alpha-1 text-white;
}
pre {
@apply text-white bg-n-alpha-2 dark:bg-n-alpha-1;
code {
@apply bg-transparent text-white;
}
}
blockquote {
@apply bg-transparent border-n-slate-7 ltr:border-l-2 rtl:border-r-2 border-solid;
p {
@apply text-n-slate-5 dark:text-n-slate-12/90;
}
}
}
</style>