chore: Default to rich content editor in website and email channel (#5357)

This commit is contained in:
Pranav Raj S 2022-09-13 05:41:42 -07:00 committed by GitHub
parent 59b31615ed
commit 8af27d861b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 3 additions and 58 deletions

View file

@ -37,17 +37,6 @@
size="small" size="small"
/> />
</file-upload> </file-upload>
<woot-button
v-if="enableRichEditor && !isOnPrivateNote"
v-tooltip.top-end="$t('CONVERSATION.REPLYBOX.TIP_FORMAT_ICON')"
icon="quote"
emoji="🖊️"
color-scheme="secondary"
variant="smooth"
size="small"
:title="$t('CONVERSATION.REPLYBOX.TIP_FORMAT_ICON')"
@click="toggleFormatMode"
/>
<woot-button <woot-button
v-if="showAudioRecorderButton" v-if="showAudioRecorderButton"
:icon="!isRecordingAudio ? 'microphone' : 'microphone-off'" :icon="!isRecordingAudio ? 'microphone' : 'microphone-off'"
@ -128,10 +117,7 @@
<script> <script>
import FileUpload from 'vue-upload-component'; import FileUpload from 'vue-upload-component';
import * as ActiveStorage from 'activestorage'; import * as ActiveStorage from 'activestorage';
import { import { hasPressedAltAndAKey } from 'shared/helpers/KeyboardHelpers';
hasPressedAltAndWKey,
hasPressedAltAndAKey,
} from 'shared/helpers/KeyboardHelpers';
import eventListenerMixins from 'shared/mixins/eventListenerMixins'; import eventListenerMixins from 'shared/mixins/eventListenerMixins';
import uiSettingsMixin from 'dashboard/mixins/uiSettings'; import uiSettingsMixin from 'dashboard/mixins/uiSettings';
import inboxMixin from 'shared/mixins/inboxMixin'; import inboxMixin from 'shared/mixins/inboxMixin';
@ -207,10 +193,6 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
setFormatMode: {
type: Function,
default: () => {},
},
isFormatMode: { isFormatMode: {
type: Boolean, type: Boolean,
default: false, default: false,
@ -219,10 +201,6 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
enableRichEditor: {
type: Boolean,
default: false,
},
enterToSendEnabled: { enterToSendEnabled: {
type: Boolean, type: Boolean,
default: true, default: true,
@ -296,16 +274,10 @@ export default {
}, },
methods: { methods: {
handleKeyEvents(e) { handleKeyEvents(e) {
if (hasPressedAltAndWKey(e)) {
this.toggleFormatMode();
}
if (hasPressedAltAndAKey(e)) { if (hasPressedAltAndAKey(e)) {
this.$refs.upload.$children[1].$el.click(); this.$refs.upload.$children[1].$el.click();
} }
}, },
toggleFormatMode() {
this.setFormatMode(!this.isFormatMode);
},
toggleEnterToSend() { toggleEnterToSend() {
this.$emit('toggleEnterToSend', !this.enterToSendEnabled); this.$emit('toggleEnterToSend', !this.enterToSendEnabled);
}, },

View file

@ -107,10 +107,8 @@
:recording-audio-duration-text="recordingAudioDurationText" :recording-audio-duration-text="recordingAudioDurationText"
:recording-audio-state="recordingAudioState" :recording-audio-state="recordingAudioState"
:is-recording-audio="isRecordingAudio" :is-recording-audio="isRecordingAudio"
:set-format-mode="setFormatMode"
:is-on-private-note="isOnPrivateNote" :is-on-private-note="isOnPrivateNote"
:is-format-mode="showRichContentEditor" :is-format-mode="showRichContentEditor"
:enable-rich-editor="isRichEditorEnabled"
:enter-to-send-enabled="enterToSendEnabled" :enter-to-send-enabled="enterToSendEnabled"
:enable-multiple-file-upload="enableMultipleFileUpload" :enable-multiple-file-upload="enableMultipleFileUpload"
:has-whatsapp-templates="hasWhatsappTemplates" :has-whatsapp-templates="hasWhatsappTemplates"
@ -229,17 +227,10 @@ export default {
accountId: 'getCurrentAccountId', accountId: 'getCurrentAccountId',
}), }),
showRichContentEditor() { showRichContentEditor() {
if (this.isOnPrivateNote) { if (this.isOnPrivateNote || this.isRichEditorEnabled) {
return true; return true;
} }
if (this.isRichEditorEnabled) {
const {
display_rich_content_editor: displayRichContentEditor,
} = this.uiSettings;
return displayRichContentEditor;
}
return false; return false;
}, },
assignedAgent: { assignedAgent: {
@ -375,7 +366,7 @@ export default {
); );
}, },
isRichEditorEnabled() { isRichEditorEnabled() {
return this.isAWebWidgetInbox || this.isAnEmailChannel; return this.isAWebWidgetInbox || this.isAnEmailChannel || this.isAPIInbox;
}, },
showAudioRecorder() { showAudioRecorder() {
return !this.isOnPrivateNote && this.showFileUpload; return !this.isOnPrivateNote && this.showFileUpload;
@ -799,9 +790,6 @@ export default {
return messagePayload; return messagePayload;
}, },
setFormatMode(value) {
this.updateUISettings({ display_rich_content_editor: value });
},
setCcEmails(value) { setCcEmails(value) {
this.bccEmails = value.bccEmails; this.bccEmails = value.bccEmails;
this.ccEmails = value.ccEmails; this.ccEmails = value.ccEmails;

View file

@ -65,12 +65,6 @@ export const SHORTCUT_KEYS = [
firstkey: 'Alt / ⌥', firstkey: 'Alt / ⌥',
secondKey: 'P', secondKey: 'P',
}, },
{
id: 12,
label: 'TOGGLE_RICH_CONTENT_EDITOR',
firstkey: 'Alt / ⌥',
secondKey: 'W',
},
{ {
id: 13, id: 13,
label: 'SWITCH_TO_REPLY', label: 'SWITCH_TO_REPLY',

View file

@ -253,7 +253,6 @@
"GO_TO_SETTINGS": "Go to Settings", "GO_TO_SETTINGS": "Go to Settings",
"SWITCH_CONVERSATION_STATUS": "Switch to the next conversation status", "SWITCH_CONVERSATION_STATUS": "Switch to the next conversation status",
"SWITCH_TO_PRIVATE_NOTE": "Switch to Private Note", "SWITCH_TO_PRIVATE_NOTE": "Switch to Private Note",
"TOGGLE_RICH_CONTENT_EDITOR": "Toggle Rich Content editor",
"SWITCH_TO_REPLY": "Switch to Reply", "SWITCH_TO_REPLY": "Switch to Reply",
"TOGGLE_SNOOZE_DROPDOWN": "Toggle snooze dropdown" "TOGGLE_SNOOZE_DROPDOWN": "Toggle snooze dropdown"
}, },

View file

@ -16,7 +16,6 @@ describe('uiSettingsMixin', () => {
actions = { updateUISettings: jest.fn(), toggleSidebarUIState: jest.fn() }; actions = { updateUISettings: jest.fn(), toggleSidebarUIState: jest.fn() };
getters = { getters = {
getUISettings: () => ({ getUISettings: () => ({
display_rich_content_editor: false,
enter_to_send_enabled: false, enter_to_send_enabled: false,
is_ct_labels_open: true, is_ct_labels_open: true,
conversation_sidebar_items_order: DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER, conversation_sidebar_items_order: DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER,
@ -34,7 +33,6 @@ describe('uiSettingsMixin', () => {
}; };
const wrapper = shallowMount(Component, { store, localVue }); const wrapper = shallowMount(Component, { store, localVue });
expect(wrapper.vm.uiSettings).toEqual({ expect(wrapper.vm.uiSettings).toEqual({
display_rich_content_editor: false,
enter_to_send_enabled: false, enter_to_send_enabled: false,
is_ct_labels_open: true, is_ct_labels_open: true,
conversation_sidebar_items_order: DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER, conversation_sidebar_items_order: DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER,
@ -55,7 +53,6 @@ describe('uiSettingsMixin', () => {
expect.anything(), expect.anything(),
{ {
uiSettings: { uiSettings: {
display_rich_content_editor: false,
enter_to_send_enabled: true, enter_to_send_enabled: true,
is_ct_labels_open: true, is_ct_labels_open: true,
conversation_sidebar_items_order: DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER, conversation_sidebar_items_order: DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER,
@ -80,7 +77,6 @@ describe('uiSettingsMixin', () => {
expect.anything(), expect.anything(),
{ {
uiSettings: { uiSettings: {
display_rich_content_editor: false,
enter_to_send_enabled: false, enter_to_send_enabled: false,
is_ct_labels_open: false, is_ct_labels_open: false,
conversation_sidebar_items_order: DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER, conversation_sidebar_items_order: DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER,

View file

@ -42,10 +42,6 @@ export const hasPressedAltAndNKey = e => {
return e.altKey && e.keyCode === 78; return e.altKey && e.keyCode === 78;
}; };
export const hasPressedAltAndWKey = e => {
return e.altKey && e.keyCode === 87;
};
export const hasPressedAltAndAKey = e => { export const hasPressedAltAndAKey = e => {
return e.altKey && e.keyCode === 65; return e.altKey && e.keyCode === 65;
}; };