Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d48f5c737 |
@@ -318,6 +318,7 @@ const contextMenuEnabledOptions = computed(() => {
|
|||||||
delete: hasText || hasAttachments,
|
delete: hasText || hasAttachments,
|
||||||
cannedResponse: isOutgoing && hasText,
|
cannedResponse: isOutgoing && hasText,
|
||||||
replyTo: !props.private && props.inboxSupportsReplyTo.outgoing,
|
replyTo: !props.private && props.inboxSupportsReplyTo.outgoing,
|
||||||
|
toggleBg: variant.value === MESSAGE_VARIANTS.EMAIL,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -353,6 +354,20 @@ function handleReplyTo() {
|
|||||||
emitter.emit(BUS_EVENTS.TOGGLE_REPLY_TO_MESSAGE, props);
|
emitter.emit(BUS_EVENTS.TOGGLE_REPLY_TO_MESSAGE, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleBg() {
|
||||||
|
const key = `bg-light-toggle::${props.id}`;
|
||||||
|
const isToggled = LocalStorage.get(key);
|
||||||
|
|
||||||
|
if (isToggled) {
|
||||||
|
LocalStorage.remove(key);
|
||||||
|
} else {
|
||||||
|
LocalStorage.set(`bg-light-toggle::${props.id}`, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
emitter.emit(BUS_EVENTS.TOGGLE_MESSAGE_BG, props.id);
|
||||||
|
closeContextMenu();
|
||||||
|
}
|
||||||
|
|
||||||
provideMessageContext({
|
provideMessageContext({
|
||||||
...toRefs(props),
|
...toRefs(props),
|
||||||
isPrivate: computed(() => props.private),
|
isPrivate: computed(() => props.private),
|
||||||
@@ -425,6 +440,7 @@ provideMessageContext({
|
|||||||
@open="openContextMenu"
|
@open="openContextMenu"
|
||||||
@close="closeContextMenu"
|
@close="closeContextMenu"
|
||||||
@reply-to="handleReplyTo"
|
@reply-to="handleReplyTo"
|
||||||
|
@toggle-bg="toggleBg"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { computed, useTemplateRef, ref, onMounted } from 'vue';
|
import { computed, useTemplateRef, ref, onMounted } from 'vue';
|
||||||
|
import { emitter } from 'shared/helpers/mitt';
|
||||||
|
import { BUS_EVENTS } from 'shared/constants/busEvents';
|
||||||
import { Letter } from 'vue-letter';
|
import { Letter } from 'vue-letter';
|
||||||
|
import { LocalStorage } from 'shared/helpers/localStorage';
|
||||||
|
|
||||||
import Icon from 'next/icon/Icon.vue';
|
import Icon from 'next/icon/Icon.vue';
|
||||||
import { EmailQuoteExtractor } from './removeReply.js';
|
import { EmailQuoteExtractor } from './removeReply.js';
|
||||||
@@ -12,16 +15,22 @@ import EmailMeta from './EmailMeta.vue';
|
|||||||
import { useMessageContext } from '../../provider.js';
|
import { useMessageContext } from '../../provider.js';
|
||||||
import { MESSAGE_TYPES } from 'next/message/constants.js';
|
import { MESSAGE_TYPES } from 'next/message/constants.js';
|
||||||
|
|
||||||
const { content, contentAttributes, attachments, messageType } =
|
const { id, content, contentAttributes, attachments, messageType } =
|
||||||
useMessageContext();
|
useMessageContext();
|
||||||
|
|
||||||
const isExpandable = ref(false);
|
const isExpandable = ref(false);
|
||||||
const isExpanded = ref(false);
|
const isExpanded = ref(false);
|
||||||
const showQuotedMessage = ref(false);
|
const showQuotedMessage = ref(false);
|
||||||
|
const useWhiteBackground = ref(false);
|
||||||
const contentContainer = useTemplateRef('contentContainer');
|
const contentContainer = useTemplateRef('contentContainer');
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
isExpandable.value = contentContainer.value.scrollHeight > 400;
|
isExpandable.value = contentContainer.value.scrollHeight > 400;
|
||||||
|
|
||||||
|
useWhiteBackground.value = LocalStorage.get(`bg-light-toggle::${id.value}`);
|
||||||
|
emitter.on(BUS_EVENTS.TOGGLE_MESSAGE_BG, () => {
|
||||||
|
useWhiteBackground.value = LocalStorage.get(`bg-light-toggle::${id.value}`);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const isOutgoing = computed(() => {
|
const isOutgoing = computed(() => {
|
||||||
@@ -70,7 +79,12 @@ const textToShow = computed(() => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<FormattedContent v-if="isOutgoing && content" :content="content" />
|
<FormattedContent v-if="isOutgoing && content" :content="content" />
|
||||||
<template v-else>
|
<div
|
||||||
|
v-else
|
||||||
|
:class="{
|
||||||
|
'dark:bg-white dark:p-4 rounded-lg text-black': useWhiteBackground,
|
||||||
|
}"
|
||||||
|
>
|
||||||
<Letter
|
<Letter
|
||||||
v-if="showQuotedMessage"
|
v-if="showQuotedMessage"
|
||||||
class-name="prose prose-email !max-w-none"
|
class-name="prose prose-email !max-w-none"
|
||||||
@@ -83,7 +97,7 @@ const textToShow = computed(() => {
|
|||||||
:html="unquotedHTML"
|
:html="unquotedHTML"
|
||||||
:text="textToShow"
|
:text="textToShow"
|
||||||
/>
|
/>
|
||||||
</template>
|
</div>
|
||||||
<button
|
<button
|
||||||
v-if="hasQuotedMessage"
|
v-if="hasQuotedMessage"
|
||||||
class="text-n-slate-11 px-1 leading-none text-sm bg-n-alpha-black2 text-center flex items-center gap-1 mt-2"
|
class="text-n-slate-11 px-1 leading-none text-sm bg-n-alpha-black2 text-center flex items-center gap-1 mt-2"
|
||||||
|
|||||||
@@ -218,6 +218,7 @@
|
|||||||
"DELETE": "Delete",
|
"DELETE": "Delete",
|
||||||
"CREATE_A_CANNED_RESPONSE": "Add to canned responses",
|
"CREATE_A_CANNED_RESPONSE": "Add to canned responses",
|
||||||
"TRANSLATE": "Translate",
|
"TRANSLATE": "Translate",
|
||||||
|
"TOGGLE_BG": "Toggle background color",
|
||||||
"COPY_PERMALINK": "Copy link to the message",
|
"COPY_PERMALINK": "Copy link to the message",
|
||||||
"LINK_COPIED": "Message URL copied to the clipboard",
|
"LINK_COPIED": "Message URL copied to the clipboard",
|
||||||
"DELETE_CONFIRMATION": {
|
"DELETE_CONFIRMATION": {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export default {
|
|||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
emits: ['open', 'close', 'replyTo'],
|
emits: ['open', 'close', 'replyTo', 'toggleBg'],
|
||||||
setup() {
|
setup() {
|
||||||
const { getPlainText } = useMessageFormatter();
|
const { getPlainText } = useMessageFormatter();
|
||||||
return {
|
return {
|
||||||
@@ -116,6 +116,9 @@ export default {
|
|||||||
handleClose(e) {
|
handleClose(e) {
|
||||||
this.$emit('close', e);
|
this.$emit('close', e);
|
||||||
},
|
},
|
||||||
|
toggleBackground(e) {
|
||||||
|
this.$emit('toggleBg', e);
|
||||||
|
},
|
||||||
handleTranslate() {
|
handleTranslate() {
|
||||||
const { locale } = this.getAccount(this.currentAccountId);
|
const { locale } = this.getAccount(this.currentAccountId);
|
||||||
this.$store.dispatch('translateMessage', {
|
this.$store.dispatch('translateMessage', {
|
||||||
@@ -232,6 +235,15 @@ export default {
|
|||||||
variant="icon"
|
variant="icon"
|
||||||
@click.stop="handleTranslate"
|
@click.stop="handleTranslate"
|
||||||
/>
|
/>
|
||||||
|
<MenuItem
|
||||||
|
v-if="enabledOptions['toggleBg']"
|
||||||
|
:option="{
|
||||||
|
icon: 'arrow-rotate-clockwise',
|
||||||
|
label: $t('CONVERSATION.CONTEXT_MENU.TOGGLE_BG'),
|
||||||
|
}"
|
||||||
|
variant="icon"
|
||||||
|
@click.stop="toggleBackground"
|
||||||
|
/>
|
||||||
<hr />
|
<hr />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
:option="{
|
:option="{
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ export const BUS_EVENTS = {
|
|||||||
NEW_CONVERSATION_MODAL: 'newConversationModal',
|
NEW_CONVERSATION_MODAL: 'newConversationModal',
|
||||||
INSERT_INTO_RICH_EDITOR: 'insertIntoRichEditor',
|
INSERT_INTO_RICH_EDITOR: 'insertIntoRichEditor',
|
||||||
INSERT_INTO_NORMAL_EDITOR: 'insertIntoNormalEditor',
|
INSERT_INTO_NORMAL_EDITOR: 'insertIntoNormalEditor',
|
||||||
|
TOGGLE_MESSAGE_BG: 'toggleMessageBackground',
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user