From 1a220b29828a3badb5950c936ba7d17d1e26b93a Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Tue, 13 Jan 2026 18:52:10 +0530 Subject: [PATCH] chore: Improve compose new conversation form (#13176) Co-authored-by: Muhsin Keloth --- .../components-next/Editor/Editor.vue | 9 ++ .../components/ActionButtons.vue | 9 +- .../components/ComposeNewConversationForm.vue | 140 ++++++++++-------- .../components/InboxSelector.vue | 2 +- .../components/MessageEditor.vue | 7 +- .../components-next/taginput/TagInput.vue | 2 +- .../dashboard/helper/editorHelper.js | 14 +- .../helper/specs/editorHelper.spec.js | 72 ++++++--- .../modules/search/components/SearchView.vue | 2 +- 9 files changed, 165 insertions(+), 92 deletions(-) diff --git a/app/javascript/dashboard/components-next/Editor/Editor.vue b/app/javascript/dashboard/components-next/Editor/Editor.vue index 90b7a0c31..c2cde6d17 100644 --- a/app/javascript/dashboard/components-next/Editor/Editor.vue +++ b/app/javascript/dashboard/components-next/Editor/Editor.vue @@ -5,6 +5,7 @@ import WootEditor from 'dashboard/components/widgets/WootWriter/Editor.vue'; const props = defineProps({ modelValue: { type: String, default: '' }, + editorKey: { type: String, default: '' }, label: { type: String, default: '' }, placeholder: { type: String, default: '' }, focusOnMount: { type: Boolean, default: false }, @@ -96,6 +97,7 @@ watch( ]" > { + attachmentId.value += 1; + return `attachment-${attachmentId.value}`; +}; + const uploadAttachment = ref(null); const isEmojiPickerOpen = ref(false); @@ -176,7 +182,8 @@ const onPaste = e => { .filter(file => file.size > 0) .forEach(file => { const { name, type, size } = file; - onFileUpload({ file, name, type, size }); + // Add unique ID for clipboard-pasted files + onFileUpload({ file, name, type, size, id: generateUid() }); }); }; diff --git a/app/javascript/dashboard/components-next/NewConversation/components/ComposeNewConversationForm.vue b/app/javascript/dashboard/components-next/NewConversation/components/ComposeNewConversationForm.vue index 74836219b..82f87a08d 100644 --- a/app/javascript/dashboard/components-next/NewConversation/components/ComposeNewConversationForm.vue +++ b/app/javascript/dashboard/components-next/NewConversation/components/ComposeNewConversationForm.vue @@ -7,6 +7,7 @@ import { appendSignature, removeSignature, getEffectiveChannelType, + stripUnsupportedMarkdown, } from 'dashboard/helper/editorHelper'; import { buildContactableInboxesList, @@ -47,6 +48,8 @@ const emit = defineEmits([ 'createConversation', ]); +const DEFAULT_FORMATTING = 'Context::Default'; + const showContactsDropdown = ref(false); const showInboxesDropdown = ref(false); const showCcEmailsDropdown = ref(false); @@ -198,10 +201,22 @@ const setSelectedContact = async ({ value, action, ...rest }) => { showInboxesDropdown.value = true; }; -const handleInboxAction = ({ value, action, ...rest }) => { +const stripMessageFormatting = channelType => { + if (!state.message || !channelType) return; + + state.message = stripUnsupportedMarkdown(state.message, channelType, false); +}; + +const handleInboxAction = ({ value, action, channelType, medium, ...rest }) => { v$.value.$reset(); - state.message = ''; - emit('updateTargetInbox', { ...rest }); + + // Strip unsupported formatting when changing the target inbox + if (channelType) { + const newChannelType = getEffectiveChannelType(channelType, medium); + stripMessageFormatting(newChannelType); + } + + emit('updateTargetInbox', { ...rest, channelType, medium }); showInboxesDropdown.value = false; state.attachedFiles = []; }; @@ -221,7 +236,9 @@ const removeSignatureFromMessage = () => { const removeTargetInbox = value => { v$.value.$reset(); removeSignatureFromMessage(); - state.message = ''; + + stripMessageFormatting(DEFAULT_FORMATTING); + emit('updateTargetInbox', value); state.attachedFiles = []; }; @@ -324,67 +341,68 @@ const shouldShowMessageEditor = computed(() => {