mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-04 13:07:55 +00:00 
			
		
		
		
	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
		
			
				
	
	
		
			62 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Vue
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			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>
 |