From 8af27d861ba46b236229132330b7430ba9870cd7 Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Tue, 13 Sep 2022 05:41:42 -0700 Subject: [PATCH] chore: Default to rich content editor in website and email channel (#5357) --- .../widgets/WootWriter/ReplyBottomPanel.vue | 30 +------------------ .../widgets/conversation/ReplyBox.vue | 16 ++-------- .../components/widgets/modal/constants.js | 6 ---- .../dashboard/i18n/locale/en/settings.json | 1 - .../dashboard/mixins/specs/uiSettings.spec.js | 4 --- .../shared/helpers/KeyboardHelpers.js | 4 --- 6 files changed, 3 insertions(+), 58 deletions(-) diff --git a/app/javascript/dashboard/components/widgets/WootWriter/ReplyBottomPanel.vue b/app/javascript/dashboard/components/widgets/WootWriter/ReplyBottomPanel.vue index 5c288ed68..74cd9de4d 100644 --- a/app/javascript/dashboard/components/widgets/WootWriter/ReplyBottomPanel.vue +++ b/app/javascript/dashboard/components/widgets/WootWriter/ReplyBottomPanel.vue @@ -37,17 +37,6 @@ size="small" /> - import FileUpload from 'vue-upload-component'; import * as ActiveStorage from 'activestorage'; -import { - hasPressedAltAndWKey, - hasPressedAltAndAKey, -} from 'shared/helpers/KeyboardHelpers'; +import { hasPressedAltAndAKey } from 'shared/helpers/KeyboardHelpers'; import eventListenerMixins from 'shared/mixins/eventListenerMixins'; import uiSettingsMixin from 'dashboard/mixins/uiSettings'; import inboxMixin from 'shared/mixins/inboxMixin'; @@ -207,10 +193,6 @@ export default { type: Boolean, default: false, }, - setFormatMode: { - type: Function, - default: () => {}, - }, isFormatMode: { type: Boolean, default: false, @@ -219,10 +201,6 @@ export default { type: Boolean, default: false, }, - enableRichEditor: { - type: Boolean, - default: false, - }, enterToSendEnabled: { type: Boolean, default: true, @@ -296,16 +274,10 @@ export default { }, methods: { handleKeyEvents(e) { - if (hasPressedAltAndWKey(e)) { - this.toggleFormatMode(); - } if (hasPressedAltAndAKey(e)) { this.$refs.upload.$children[1].$el.click(); } }, - toggleFormatMode() { - this.setFormatMode(!this.isFormatMode); - }, toggleEnterToSend() { this.$emit('toggleEnterToSend', !this.enterToSendEnabled); }, diff --git a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue index 286ac0a88..d24b31d30 100644 --- a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue +++ b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue @@ -107,10 +107,8 @@ :recording-audio-duration-text="recordingAudioDurationText" :recording-audio-state="recordingAudioState" :is-recording-audio="isRecordingAudio" - :set-format-mode="setFormatMode" :is-on-private-note="isOnPrivateNote" :is-format-mode="showRichContentEditor" - :enable-rich-editor="isRichEditorEnabled" :enter-to-send-enabled="enterToSendEnabled" :enable-multiple-file-upload="enableMultipleFileUpload" :has-whatsapp-templates="hasWhatsappTemplates" @@ -229,17 +227,10 @@ export default { accountId: 'getCurrentAccountId', }), showRichContentEditor() { - if (this.isOnPrivateNote) { + if (this.isOnPrivateNote || this.isRichEditorEnabled) { return true; } - if (this.isRichEditorEnabled) { - const { - display_rich_content_editor: displayRichContentEditor, - } = this.uiSettings; - - return displayRichContentEditor; - } return false; }, assignedAgent: { @@ -375,7 +366,7 @@ export default { ); }, isRichEditorEnabled() { - return this.isAWebWidgetInbox || this.isAnEmailChannel; + return this.isAWebWidgetInbox || this.isAnEmailChannel || this.isAPIInbox; }, showAudioRecorder() { return !this.isOnPrivateNote && this.showFileUpload; @@ -799,9 +790,6 @@ export default { return messagePayload; }, - setFormatMode(value) { - this.updateUISettings({ display_rich_content_editor: value }); - }, setCcEmails(value) { this.bccEmails = value.bccEmails; this.ccEmails = value.ccEmails; diff --git a/app/javascript/dashboard/components/widgets/modal/constants.js b/app/javascript/dashboard/components/widgets/modal/constants.js index faec60dc1..5741d954e 100644 --- a/app/javascript/dashboard/components/widgets/modal/constants.js +++ b/app/javascript/dashboard/components/widgets/modal/constants.js @@ -65,12 +65,6 @@ export const SHORTCUT_KEYS = [ firstkey: 'Alt / ⌥', secondKey: 'P', }, - { - id: 12, - label: 'TOGGLE_RICH_CONTENT_EDITOR', - firstkey: 'Alt / ⌥', - secondKey: 'W', - }, { id: 13, label: 'SWITCH_TO_REPLY', diff --git a/app/javascript/dashboard/i18n/locale/en/settings.json b/app/javascript/dashboard/i18n/locale/en/settings.json index 038af64a5..88c967a55 100644 --- a/app/javascript/dashboard/i18n/locale/en/settings.json +++ b/app/javascript/dashboard/i18n/locale/en/settings.json @@ -253,7 +253,6 @@ "GO_TO_SETTINGS": "Go to Settings", "SWITCH_CONVERSATION_STATUS": "Switch to the next conversation status", "SWITCH_TO_PRIVATE_NOTE": "Switch to Private Note", - "TOGGLE_RICH_CONTENT_EDITOR": "Toggle Rich Content editor", "SWITCH_TO_REPLY": "Switch to Reply", "TOGGLE_SNOOZE_DROPDOWN": "Toggle snooze dropdown" }, diff --git a/app/javascript/dashboard/mixins/specs/uiSettings.spec.js b/app/javascript/dashboard/mixins/specs/uiSettings.spec.js index 6b1118ab8..aad1fe3d8 100644 --- a/app/javascript/dashboard/mixins/specs/uiSettings.spec.js +++ b/app/javascript/dashboard/mixins/specs/uiSettings.spec.js @@ -16,7 +16,6 @@ describe('uiSettingsMixin', () => { actions = { updateUISettings: jest.fn(), toggleSidebarUIState: jest.fn() }; getters = { getUISettings: () => ({ - display_rich_content_editor: false, enter_to_send_enabled: false, is_ct_labels_open: true, conversation_sidebar_items_order: DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER, @@ -34,7 +33,6 @@ describe('uiSettingsMixin', () => { }; const wrapper = shallowMount(Component, { store, localVue }); expect(wrapper.vm.uiSettings).toEqual({ - display_rich_content_editor: false, enter_to_send_enabled: false, is_ct_labels_open: true, conversation_sidebar_items_order: DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER, @@ -55,7 +53,6 @@ describe('uiSettingsMixin', () => { expect.anything(), { uiSettings: { - display_rich_content_editor: false, enter_to_send_enabled: true, is_ct_labels_open: true, conversation_sidebar_items_order: DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER, @@ -80,7 +77,6 @@ describe('uiSettingsMixin', () => { expect.anything(), { uiSettings: { - display_rich_content_editor: false, enter_to_send_enabled: false, is_ct_labels_open: false, conversation_sidebar_items_order: DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER, diff --git a/app/javascript/shared/helpers/KeyboardHelpers.js b/app/javascript/shared/helpers/KeyboardHelpers.js index 079b5ab62..a1a746e0d 100644 --- a/app/javascript/shared/helpers/KeyboardHelpers.js +++ b/app/javascript/shared/helpers/KeyboardHelpers.js @@ -42,10 +42,6 @@ export const hasPressedAltAndNKey = e => { return e.altKey && e.keyCode === 78; }; -export const hasPressedAltAndWKey = e => { - return e.altKey && e.keyCode === 87; -}; - export const hasPressedAltAndAKey = e => { return e.altKey && e.keyCode === 65; };