feat: allow toggle bg

This commit is contained in:
Shivam Mishra
2024-12-25 19:42:40 +05:30
parent c19d70a6a0
commit 9d48f5c737
5 changed files with 48 additions and 4 deletions
@@ -318,6 +318,7 @@ const contextMenuEnabledOptions = computed(() => {
delete: hasText || hasAttachments,
cannedResponse: isOutgoing && hasText,
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);
}
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({
...toRefs(props),
isPrivate: computed(() => props.private),
@@ -425,6 +440,7 @@ provideMessageContext({
@open="openContextMenu"
@close="closeContextMenu"
@reply-to="handleReplyTo"
@toggle-bg="toggleBg"
/>
</div>
</div>