From 2a385f377c8ffc1e75463a85f80ac678557f4fb2 Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Thu, 2 Mar 2023 23:56:54 -0800 Subject: [PATCH] chore: Use markdown-it instead of marked (#6123) * chore: Use markdown-it instead of marked * Adds styling for markdown rendered content * fixes codeclimate issue * Fixes blockquote styles for widget in darkmode * fix: issue block quote color issue in light mode * fix: issue block quote color issue in light mode * Fixes blockquote color in dark mode * Remove usage of dark mode mixin in user bubble * chore: code clean up --------- Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: iamsivin --- .../scss/widgets/_conversation-view.scss | 21 +----- .../widgets/conversation/Message.vue | 75 ++++++++++++++++++- .../widgets/conversation/bubble/Text.vue | 20 ++++- .../shared/helpers/MessageFormatter.js | 62 +++++++-------- .../shared/helpers/markdownIt/link.js | 69 +++++++++++++++++ .../helpers/specs/MessageFormatter.spec.js | 14 ++-- .../widget/assets/scss/_variables.scss | 15 +++- .../assets/scss/views/_conversation.scss | 26 +++---- .../widget/components/AgentMessageBubble.vue | 13 +--- .../widget/components/ChatMessage.vue | 53 +++++++++++++ .../widget/components/UserMessageBubble.vue | 31 ++++++-- package.json | 3 +- yarn.lock | 36 ++++++++- 13 files changed, 332 insertions(+), 106 deletions(-) create mode 100644 app/javascript/shared/helpers/markdownIt/link.js diff --git a/app/javascript/dashboard/assets/scss/widgets/_conversation-view.scss b/app/javascript/dashboard/assets/scss/widgets/_conversation-view.scss index dc75ee29d..97adeed4c 100644 --- a/app/javascript/dashboard/assets/scss/widgets/_conversation-view.scss +++ b/app/javascript/dashboard/assets/scss/widgets/_conversation-view.scss @@ -380,14 +380,6 @@ text-decoration: underline; } - blockquote { - border-left-color: var(--s-300); - - p { - color: var(--s-300); - } - } - p:last-child { margin-bottom: 0; } @@ -408,19 +400,8 @@ text-decoration: underline; } - blockquote { - border-left-color: var(--w-100); - - p { - color: var(--w-100); - } - } - - pre code { - background: var(--color-background); - } - p:last-child { margin-bottom: 0; } } + diff --git a/app/javascript/dashboard/components/widgets/conversation/Message.vue b/app/javascript/dashboard/components/widgets/conversation/Message.vue index b4179b696..f8d50bfca 100644 --- a/app/javascript/dashboard/components/widgets/conversation/Message.vue +++ b/app/javascript/dashboard/components/widgets/conversation/Message.vue @@ -243,14 +243,14 @@ export default { return this.contentAttributes.translations || {}; }, displayQuotedButton() { - if (!this.isIncoming) { - return false; - } - if (this.emailMessageContent.includes(' diff --git a/app/javascript/dashboard/components/widgets/conversation/bubble/Text.vue b/app/javascript/dashboard/components/widgets/conversation/bubble/Text.vue index e5294db99..d69abf626 100644 --- a/app/javascript/dashboard/components/widgets/conversation/bubble/Text.vue +++ b/app/javascript/dashboard/components/widgets/conversation/bubble/Text.vue @@ -2,14 +2,14 @@