@bcc-code/vue-bcc-chat-ui 2.1.2 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@bcc-code/vue-bcc-chat-ui",
|
|
3
3
|
"author": "bcc-code",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"version": "2.1
|
|
5
|
+
"version": "2.2.1",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"private": false,
|
|
8
8
|
"files": [
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@cometchat/uikit-resources": "^4.2.2",
|
|
39
39
|
"@cometchat/uikit-shared": "^4.2.2",
|
|
40
40
|
"jwt-decode": "^4.0.0",
|
|
41
|
-
"markdown-it": "
|
|
41
|
+
"markdown-it": "^14.1.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"dev": "vite",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import MarkdownIt from 'markdown-it'
|
|
3
3
|
|
|
4
4
|
defineProps<{
|
|
5
|
-
text: string
|
|
5
|
+
text: string,
|
|
6
|
+
metadata: Record<string, any>,
|
|
6
7
|
}>()
|
|
7
8
|
|
|
8
9
|
function toMarkdownHtml(str: string) {
|
|
@@ -22,7 +23,8 @@ function toMarkdownHtml(str: string) {
|
|
|
22
23
|
|
|
23
24
|
// Replacing URLs in the string with Markdown links
|
|
24
25
|
const outStr = str.replace(urlRegex, formatUrlToMarkdown);
|
|
25
|
-
const md = new
|
|
26
|
+
const md = new MarkdownIt({
|
|
27
|
+
breaks: true,
|
|
26
28
|
typographer: true,
|
|
27
29
|
});
|
|
28
30
|
|
|
@@ -31,7 +33,15 @@ function toMarkdownHtml(str: string) {
|
|
|
31
33
|
</script>
|
|
32
34
|
|
|
33
35
|
<template>
|
|
34
|
-
<div v-
|
|
36
|
+
<div v-if="metadata.translated_message"
|
|
37
|
+
v-html="toMarkdownHtml(metadata.translated_message)"
|
|
38
|
+
class="bcc-chat-msg-bubble bcc-chat-msg-bubble--translation"
|
|
39
|
+
/>
|
|
40
|
+
<div
|
|
41
|
+
v-html="toMarkdownHtml(text)"
|
|
42
|
+
class="bcc-chat-msg-bubble"
|
|
43
|
+
:class="{'bcc-chat-msg-bubble--translated': !!metadata.translated_message}"
|
|
44
|
+
/>
|
|
35
45
|
</template>
|
|
36
46
|
|
|
37
47
|
<style lang="scss">
|
|
@@ -48,6 +58,7 @@ function toMarkdownHtml(str: string) {
|
|
|
48
58
|
word-break: break-word;
|
|
49
59
|
text-align: left;
|
|
50
60
|
white-space: pre-line;
|
|
61
|
+
margin: 8px 0;
|
|
51
62
|
}
|
|
52
63
|
|
|
53
64
|
p:first-child {
|
|
@@ -57,6 +68,23 @@ function toMarkdownHtml(str: string) {
|
|
|
57
68
|
margin-bottom: 0;
|
|
58
69
|
}
|
|
59
70
|
|
|
71
|
+
h1 {
|
|
72
|
+
font-size: 1.6em;
|
|
73
|
+
font-weight: 800;
|
|
74
|
+
}
|
|
75
|
+
h2 {
|
|
76
|
+
font-size: 1.4em;
|
|
77
|
+
font-weight: 700;
|
|
78
|
+
}
|
|
79
|
+
h3 {
|
|
80
|
+
font-size: 1.2em;
|
|
81
|
+
font-weight: 600;
|
|
82
|
+
}
|
|
83
|
+
h4 {
|
|
84
|
+
font-size: 1em;
|
|
85
|
+
font-weight: 500;
|
|
86
|
+
}
|
|
87
|
+
|
|
60
88
|
a {
|
|
61
89
|
color: var(--cc__link-color);
|
|
62
90
|
text-decoration: underline;
|
|
@@ -65,6 +93,26 @@ function toMarkdownHtml(str: string) {
|
|
|
65
93
|
|
|
66
94
|
ul {
|
|
67
95
|
padding-left: 16px;
|
|
96
|
+
list-style: disc;
|
|
97
|
+
margin: 8px 0;
|
|
98
|
+
}
|
|
99
|
+
ol {
|
|
100
|
+
padding-left: 16px;
|
|
101
|
+
list-style: decimal;
|
|
102
|
+
margin: 8px 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&--translated {
|
|
106
|
+
border-top: 1px solid;
|
|
107
|
+
opacity: 0.8;
|
|
108
|
+
|
|
109
|
+
&:before {
|
|
110
|
+
content: 'original: ';
|
|
111
|
+
opacity: 0.8;
|
|
112
|
+
margin-bottom: 8px;
|
|
113
|
+
font-size: 12px;
|
|
114
|
+
display: block;
|
|
115
|
+
}
|
|
68
116
|
}
|
|
69
117
|
}
|
|
70
118
|
</style>
|