@tencentcloud/ai-desk-customer-vue 1.7.3 → 1.7.5
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/CHANGELOG.md +14 -0
- package/components/CustomerServiceChat/index-web.vue +3 -0
- package/components/CustomerServiceChat/message-input/message-input-editor-web.vue +5 -5
- package/components/CustomerServiceChat/message-list/index-web.vue +70 -9
- package/components/CustomerServiceChat/message-list/message-elements/message-bubble-web.vue +16 -7
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-desk.vue +7 -1
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-rich-text.vue +7 -48
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-stream.vue +6 -16
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-plugin-web.vue +6 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-image-web.vue +1 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-large-stream.vue +2 -16
- package/components/CustomerServiceChat/message-list/message-elements/message-video-web.vue +20 -8
- package/components/CustomerServiceChat/message-toolbar-button/index.vue +11 -0
- package/components/CustomerServiceChat/message-toolbar-button/toolbar-button-end-human-service.vue +108 -1
- package/components/CustomerServiceChat/style/h5.scss +2 -0
- package/components/common/Dialog/index.vue +28 -7
- package/components/common/Dialog/style/h5.scss +1 -9
- package/components/common/Dialog/style/web.scss +25 -11
- package/components/common/ImagePreviewer/image-item-web.vue +9 -1
- package/components/common/ImagePreviewer/index-web.vue +179 -42
- package/locales/en/aidesk.ts +4 -0
- package/locales/es/aidesk.ts +4 -0
- package/locales/fil/aidesk.ts +4 -0
- package/locales/id/aidesk.ts +5 -1
- package/locales/ja/aidesk.ts +4 -0
- package/locales/ko/aidesk.ts +4 -0
- package/locales/ms/aidesk.ts +4 -0
- package/locales/ru/aidesk.ts +4 -0
- package/locales/th/aidesk.ts +4 -0
- package/locales/vi/aidesk.ts +4 -0
- package/locales/zh_cn/aidesk.ts +4 -0
- package/locales/zh_tw/aidesk.ts +4 -0
- package/package.json +1 -1
- package/utils/utils.ts +24 -0
package/CHANGELOG.md
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
@closeBottomQuickOrder="closeBottomQuickOrder"
|
|
28
28
|
:enableFeedback="props.enableFeedback"
|
|
29
29
|
:enableAINote="props.enableAINote"
|
|
30
|
+
:enableFileMediaPreview="props.enableFileMediaPreview"
|
|
30
31
|
@like="onLike"
|
|
31
32
|
@dislike="onDislike"
|
|
32
33
|
/>
|
|
@@ -153,6 +154,7 @@ interface IProps {
|
|
|
153
154
|
enableFeedback?: number;
|
|
154
155
|
enableAINote?: number;
|
|
155
156
|
enableURLDetection?: number;
|
|
157
|
+
enableFileMediaPreview?: number;
|
|
156
158
|
headerConfig?: IHeaderConfig;
|
|
157
159
|
enableSendingAudio?: number;
|
|
158
160
|
showQueuePage?: number;
|
|
@@ -205,6 +207,7 @@ const props = withDefaults(defineProps<IProps>(), {
|
|
|
205
207
|
enableAINote: 1,
|
|
206
208
|
langList: () => [],
|
|
207
209
|
enableURLDetection: 0,
|
|
210
|
+
enableFileMediaPreview: 0,
|
|
208
211
|
enableSendingAudio: 0,
|
|
209
212
|
showQueuePage: 0,
|
|
210
213
|
showAllRobotWelcomeItems: 0,
|
|
@@ -357,14 +357,14 @@ function handlePaste(e: ClipboardEvent) {
|
|
|
357
357
|
}
|
|
358
358
|
|
|
359
359
|
function handlePasteText(e: ClipboardEvent) {
|
|
360
|
-
e.preventDefault();
|
|
361
360
|
const html = e.clipboardData?.getData('text/html');
|
|
362
361
|
const text = e.clipboardData?.getData('text/plain') || '';
|
|
363
|
-
|
|
364
|
-
|
|
362
|
+
if (isH5 && !text) {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
e.preventDefault();
|
|
365
366
|
if (isH5 || !html) {
|
|
366
|
-
|
|
367
|
-
insertEditorContent(renderArray);
|
|
367
|
+
insertEditorContent(parseTextToRenderArray(text));
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
:enableAINote="props.enableAINote"
|
|
54
54
|
@like="onLike"
|
|
55
55
|
@dislike="onDislike"
|
|
56
|
+
@previewImage="handleImagePreviewByUrl"
|
|
56
57
|
/>
|
|
57
58
|
<div
|
|
58
59
|
v-else
|
|
@@ -72,6 +73,7 @@
|
|
|
72
73
|
:messageItem="JSON.parse(JSON.stringify(item))"
|
|
73
74
|
:enableFeedback="props.enableFeedback"
|
|
74
75
|
:enableAINote="props.enableAINote"
|
|
76
|
+
:fileMediaType="getFileMediaType(item)"
|
|
75
77
|
@blinkMessage="blinkMessage"
|
|
76
78
|
@resendMessage="resendMessage(item)"
|
|
77
79
|
@like="onLike"
|
|
@@ -85,23 +87,27 @@
|
|
|
85
87
|
:flow="item.flow"
|
|
86
88
|
/>
|
|
87
89
|
<ProgressMessage
|
|
88
|
-
v-else-if="item.type === TYPES.MSG_IMAGE
|
|
89
|
-
|
|
90
|
+
v-else-if="item.type === TYPES.MSG_IMAGE
|
|
91
|
+
|| (item.type === TYPES.MSG_FILE && getFileMediaType(item) === 'image')"
|
|
92
|
+
:content="getDisplayImageContent(item)"
|
|
90
93
|
:messageItem="item"
|
|
91
94
|
>
|
|
92
95
|
<MessageImage
|
|
93
|
-
:content="item
|
|
96
|
+
:content="getDisplayImageContent(item)"
|
|
94
97
|
:messageItem="item"
|
|
95
|
-
@previewImage="
|
|
98
|
+
@previewImage="item.type === TYPES.MSG_IMAGE
|
|
99
|
+
? handleImagePreview(item)
|
|
100
|
+
: handleImagePreviewByUrl(item.getMessageContent()?.url)"
|
|
96
101
|
/>
|
|
97
102
|
</ProgressMessage>
|
|
98
103
|
<ProgressMessage
|
|
99
|
-
v-else-if="item.type === TYPES.MSG_VIDEO
|
|
100
|
-
|
|
104
|
+
v-else-if="item.type === TYPES.MSG_VIDEO
|
|
105
|
+
|| (item.type === TYPES.MSG_FILE && getFileMediaType(item) === 'video')"
|
|
106
|
+
:content="getDisplayVideoContent(item)"
|
|
101
107
|
:messageItem="item"
|
|
102
108
|
>
|
|
103
109
|
<MessageVideo
|
|
104
|
-
:content="item
|
|
110
|
+
:content="getDisplayVideoContent(item)"
|
|
105
111
|
:messageItem="item"
|
|
106
112
|
/>
|
|
107
113
|
</ProgressMessage>
|
|
@@ -143,6 +149,7 @@
|
|
|
143
149
|
v-else-if="item.type === TYPES.MSG_STREAM"
|
|
144
150
|
:content="shallowCopyMessage(item.payload)"
|
|
145
151
|
@heightChanged="onHeightChanged"
|
|
152
|
+
@previewImage="handleImagePreviewByUrl"
|
|
146
153
|
/>
|
|
147
154
|
</template>
|
|
148
155
|
</MessageBubble>
|
|
@@ -171,7 +178,6 @@
|
|
|
171
178
|
v-if="reSendDialogShow"
|
|
172
179
|
class="resend-dialog"
|
|
173
180
|
:show="reSendDialogShow"
|
|
174
|
-
:isH5="!isPC"
|
|
175
181
|
:center="true"
|
|
176
182
|
:isHeaderShow="isPC"
|
|
177
183
|
@submit="resendMessageConfirm()"
|
|
@@ -185,6 +191,7 @@
|
|
|
185
191
|
v-if="showImagePreview"
|
|
186
192
|
:currentImage="currentImagePreview"
|
|
187
193
|
:imageList="imageMessageList"
|
|
194
|
+
:imageUrl="markdownImagePreviewUrl || undefined"
|
|
188
195
|
@close="onImagePreviewerClose"
|
|
189
196
|
/>
|
|
190
197
|
<BottomQuickOrder
|
|
@@ -243,12 +250,14 @@ import {
|
|
|
243
250
|
isNonEmptyObject,
|
|
244
251
|
updateCustomStore,
|
|
245
252
|
throttle,
|
|
246
|
-
shallowCopyMessage
|
|
253
|
+
shallowCopyMessage,
|
|
254
|
+
getMediaTypeByUrl
|
|
247
255
|
} from '../../../utils/utils';
|
|
248
256
|
import { isMessageInvisible, isThinkingMessage, isThinkingMessageOverTime, JSONToObject, isTransferMessageWithoutDesc } from '../../../utils/index';
|
|
249
257
|
import { isCustomerConversation } from '../../../index';
|
|
250
258
|
import { CUSTOM_MESSAGE_SRC } from '../../../constant';
|
|
251
259
|
import { QuickOrderModel } from '../../../interface';
|
|
260
|
+
import type { IImageMessageContent, IVideoMessageContent } from '../../../interface';
|
|
252
261
|
import Log from '../../../utils/logger';
|
|
253
262
|
|
|
254
263
|
interface ScrollConfig {
|
|
@@ -265,11 +274,13 @@ interface IProps {
|
|
|
265
274
|
showBottomQuickOrder: boolean;
|
|
266
275
|
enableFeedback: number;
|
|
267
276
|
enableAINote: number;
|
|
277
|
+
enableFileMediaPreview?: number;
|
|
268
278
|
}
|
|
269
279
|
const props = withDefaults(defineProps<IProps>(), {
|
|
270
280
|
showBottomQuickOrder: false,
|
|
271
281
|
enableFeedback: 0,
|
|
272
282
|
enableAINote: 1,
|
|
283
|
+
enableFileMediaPreview: 0,
|
|
273
284
|
});
|
|
274
285
|
|
|
275
286
|
interface IEmits {
|
|
@@ -310,6 +321,7 @@ const enableAutoScroll = ref(true);
|
|
|
310
321
|
// image preview
|
|
311
322
|
const showImagePreview = ref(false);
|
|
312
323
|
const currentImagePreview = ref<IMessageModel>();
|
|
324
|
+
const markdownImagePreviewUrl = ref<string>('');
|
|
313
325
|
const imageMessageList = computed(() =>
|
|
314
326
|
messageList?.value?.filter((item: IMessageModel) => {
|
|
315
327
|
return (
|
|
@@ -598,9 +610,55 @@ const handleImagePreview = (message: IMessageModel) => {
|
|
|
598
610
|
currentImagePreview.value = message;
|
|
599
611
|
};
|
|
600
612
|
|
|
613
|
+
const getFileMediaType = (message: IMessageModel): '' | 'image' | 'video' => {
|
|
614
|
+
if (!props.enableFileMediaPreview) return '';
|
|
615
|
+
if (message.type !== TYPES.value.MSG_FILE) return '';
|
|
616
|
+
const content = message.getMessageContent?.() || {};
|
|
617
|
+
const mediaType = getMediaTypeByUrl(content.url, content.name);
|
|
618
|
+
return mediaType === 'image' || mediaType === 'video' ? mediaType : '';
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
const getDisplayImageContent = (message: IMessageModel): IImageMessageContent => {
|
|
622
|
+
if (message.type === TYPES.value.MSG_FILE) {
|
|
623
|
+
return mapFileToImageContent(message.getMessageContent());
|
|
624
|
+
}
|
|
625
|
+
return message.getMessageContent();
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
const getDisplayVideoContent = (message: IMessageModel): IVideoMessageContent => {
|
|
629
|
+
if (message.type === TYPES.value.MSG_FILE) {
|
|
630
|
+
return mapFileToVideoContent(message.getMessageContent());
|
|
631
|
+
}
|
|
632
|
+
return message.getMessageContent();
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
const mapFileToImageContent = (content: any): IImageMessageContent => ({
|
|
636
|
+
url: content.url,
|
|
637
|
+
showName: content.name,
|
|
638
|
+
width: 0,
|
|
639
|
+
height: 0,
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
const mapFileToVideoContent = (content: any): IVideoMessageContent => ({
|
|
643
|
+
url: content.url,
|
|
644
|
+
showName: content.name,
|
|
645
|
+
snapshotUrl: '',
|
|
646
|
+
snapshotWidth: 0,
|
|
647
|
+
snapshotHeight: 0,
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
const handleImagePreviewByUrl = (url: string) => {
|
|
651
|
+
if (showImagePreview.value || isLongpressing.value || !url) {
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
markdownImagePreviewUrl.value = url;
|
|
655
|
+
showImagePreview.value = true;
|
|
656
|
+
};
|
|
657
|
+
|
|
601
658
|
const onImagePreviewerClose = () => {
|
|
602
659
|
showImagePreview.value = false;
|
|
603
660
|
currentImagePreview.value = null;
|
|
661
|
+
markdownImagePreviewUrl.value = '';
|
|
604
662
|
};
|
|
605
663
|
|
|
606
664
|
// toggle message
|
|
@@ -890,4 +948,7 @@ defineExpose({
|
|
|
890
948
|
z-index: 1000;
|
|
891
949
|
width: 100%;
|
|
892
950
|
}
|
|
951
|
+
.delDialog-title {
|
|
952
|
+
font-size: 16px;
|
|
953
|
+
}
|
|
893
954
|
</style>
|
|
@@ -55,11 +55,7 @@
|
|
|
55
55
|
/>
|
|
56
56
|
<div class="content-main">
|
|
57
57
|
<img
|
|
58
|
-
v-if="
|
|
59
|
-
(message.type === TYPES.MSG_IMAGE ||
|
|
60
|
-
message.type === TYPES.MSG_VIDEO) &&
|
|
61
|
-
message.hasRiskContent
|
|
62
|
-
"
|
|
58
|
+
v-if="isDisplayAsImageOrVideo && message.hasRiskContent"
|
|
63
59
|
:class="[
|
|
64
60
|
'message-risk-replace',
|
|
65
61
|
!isPC && 'message-risk-replace-h5',
|
|
@@ -168,6 +164,7 @@ interface IProps {
|
|
|
168
164
|
isAudioPlayed?: boolean | undefined;
|
|
169
165
|
enableFeedback: number;
|
|
170
166
|
enableAINote: number;
|
|
167
|
+
fileMediaType?: '' | 'image' | 'video';
|
|
171
168
|
}
|
|
172
169
|
|
|
173
170
|
interface IEmits {
|
|
@@ -189,6 +186,7 @@ const props = withDefaults(defineProps<IProps>(), {
|
|
|
189
186
|
classNameList: () => [],
|
|
190
187
|
enableFeedback: 0,
|
|
191
188
|
enableAINote: 1,
|
|
189
|
+
fileMediaType: '',
|
|
192
190
|
});
|
|
193
191
|
|
|
194
192
|
const TYPES = TUIChatEngine.TYPES;
|
|
@@ -317,11 +315,22 @@ const isProductCardOrOrderMessage = computed(() => {
|
|
|
317
315
|
return false;
|
|
318
316
|
});
|
|
319
317
|
|
|
318
|
+
const isDisplayAsImageOrVideo = computed(() => {
|
|
319
|
+
if (props.fileMediaType === 'image' || props.fileMediaType === 'video') {
|
|
320
|
+
return true;
|
|
321
|
+
}
|
|
322
|
+
return (
|
|
323
|
+
message.value.type === TYPES.MSG_IMAGE
|
|
324
|
+
|| message.value.type === TYPES.MSG_VIDEO
|
|
325
|
+
);
|
|
326
|
+
});
|
|
327
|
+
|
|
320
328
|
const isNoPadding = computed(() => {
|
|
321
329
|
return (
|
|
322
330
|
!hasEmojiReaction.value
|
|
323
|
-
&&
|
|
324
|
-
|
|
331
|
+
&& (
|
|
332
|
+
isDisplayAsImageOrVideo.value
|
|
333
|
+
|| message.value.type === TYPES.MSG_MERGER
|
|
325
334
|
)
|
|
326
335
|
);
|
|
327
336
|
});
|
|
@@ -38,12 +38,14 @@
|
|
|
38
38
|
<MessageRichText
|
|
39
39
|
:payload="payload"
|
|
40
40
|
@heightChanged="onHeightChanged"
|
|
41
|
+
@previewImage="onPreviewImage"
|
|
41
42
|
/>
|
|
42
43
|
</div>
|
|
43
44
|
<div v-if="payload.src === CUSTOM_MESSAGE_SRC.STREAM_TEXT">
|
|
44
45
|
<MessageStream
|
|
45
46
|
:payload="payload"
|
|
46
47
|
@heightChanged="onHeightChanged"
|
|
48
|
+
@previewImage="onPreviewImage"
|
|
47
49
|
/>
|
|
48
50
|
</div>
|
|
49
51
|
<div v-if="payload.src === CUSTOM_MESSAGE_SRC.MULTI_BRANCH">
|
|
@@ -132,7 +134,7 @@ export default {
|
|
|
132
134
|
default: () => ({}),
|
|
133
135
|
},
|
|
134
136
|
},
|
|
135
|
-
emits: ['showFormPopup', 'heightChanged', 'messageSent'],
|
|
137
|
+
emits: ['showFormPopup', 'heightChanged', 'messageSent', 'previewImage'],
|
|
136
138
|
setup(props: Props, { emit }) {
|
|
137
139
|
const payload = computed<customerServicePayloadType>(() => {
|
|
138
140
|
return props.message && JSONToObject(props.message?.payload?.data);
|
|
@@ -163,6 +165,9 @@ export default {
|
|
|
163
165
|
const onHeightChanged = () => {
|
|
164
166
|
emit('heightChanged');
|
|
165
167
|
};
|
|
168
|
+
const onPreviewImage = (url: string) => {
|
|
169
|
+
emit('previewImage', url);
|
|
170
|
+
};
|
|
166
171
|
|
|
167
172
|
return {
|
|
168
173
|
payload,
|
|
@@ -172,6 +177,7 @@ export default {
|
|
|
172
177
|
sendCustomMessage,
|
|
173
178
|
handleShowFormPopup,
|
|
174
179
|
onHeightChanged,
|
|
180
|
+
onPreviewImage,
|
|
175
181
|
};
|
|
176
182
|
},
|
|
177
183
|
};
|
|
@@ -5,15 +5,6 @@
|
|
|
5
5
|
class="message-marked"
|
|
6
6
|
v-html="parsedContent"
|
|
7
7
|
/>
|
|
8
|
-
<div v-if="image" class="rich-image-previewer" @click="closeImage">
|
|
9
|
-
<img
|
|
10
|
-
class="rich-image-preview"
|
|
11
|
-
:style="{
|
|
12
|
-
transform: `scale(1) rotate(0deg)`,
|
|
13
|
-
}"
|
|
14
|
-
:src="imageSrc"
|
|
15
|
-
/>
|
|
16
|
-
</div>
|
|
17
8
|
</div>
|
|
18
9
|
</div>
|
|
19
10
|
</template>
|
|
@@ -22,7 +13,7 @@
|
|
|
22
13
|
import vue from '../../../../../../adapter-vue';
|
|
23
14
|
import { parseMarkdown } from "./marked";
|
|
24
15
|
import { customerServicePayloadType } from '../../../../../../interface';
|
|
25
|
-
const { computed
|
|
16
|
+
const { computed } = vue;
|
|
26
17
|
interface Props {
|
|
27
18
|
payload: customerServicePayloadType;
|
|
28
19
|
}
|
|
@@ -34,15 +25,12 @@ export default {
|
|
|
34
25
|
default: () => ({}),
|
|
35
26
|
},
|
|
36
27
|
},
|
|
28
|
+
emits: ['heightChanged', 'previewImage'],
|
|
37
29
|
setup(props: Props, { emit }) {
|
|
38
|
-
const image = ref(false);
|
|
39
|
-
const imageSrc = ref('');
|
|
40
|
-
const imageList = [];
|
|
41
30
|
const parsedContent = computed(() => {
|
|
42
31
|
// @ts-ignore
|
|
43
32
|
window.onMarkdownImageClicked = function(href: string) {
|
|
44
|
-
|
|
45
|
-
imageSrc.value = decodeURIComponent(href);
|
|
33
|
+
emit('previewImage', decodeURIComponent(href));
|
|
46
34
|
}
|
|
47
35
|
// @ts-ignore
|
|
48
36
|
window.onMarkdownMediaLoad = function() {
|
|
@@ -51,47 +39,14 @@ export default {
|
|
|
51
39
|
return parseMarkdown(props.payload.content);
|
|
52
40
|
});
|
|
53
41
|
|
|
54
|
-
const closeImage = () => {
|
|
55
|
-
image.value = !image.value;
|
|
56
|
-
imageSrc.value = '';
|
|
57
|
-
}
|
|
58
|
-
|
|
59
42
|
return {
|
|
60
43
|
props,
|
|
61
44
|
parsedContent,
|
|
62
|
-
image,
|
|
63
|
-
imageSrc,
|
|
64
|
-
closeImage,
|
|
65
|
-
imageList,
|
|
66
45
|
};
|
|
67
46
|
},
|
|
68
47
|
};
|
|
69
48
|
</script>
|
|
70
49
|
<style lang="scss">
|
|
71
|
-
.rich-image-previewer {
|
|
72
|
-
position: fixed;
|
|
73
|
-
z-index: 101;
|
|
74
|
-
width: 100vw;
|
|
75
|
-
height: 100vh;
|
|
76
|
-
background: rgba(#000, 0.8);
|
|
77
|
-
top: 0;
|
|
78
|
-
left: 0;
|
|
79
|
-
display: flex;
|
|
80
|
-
flex-direction: column;
|
|
81
|
-
align-items: center;
|
|
82
|
-
justify-content: center;
|
|
83
|
-
user-select: none;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.rich-image-preview {
|
|
87
|
-
max-width: 90%;
|
|
88
|
-
height: auto;
|
|
89
|
-
display: flex;
|
|
90
|
-
align-items: center;
|
|
91
|
-
justify-content: center;
|
|
92
|
-
overflow: hidden;
|
|
93
|
-
pointer-events: auto;
|
|
94
|
-
}
|
|
95
50
|
.message-video {
|
|
96
51
|
position: relative;
|
|
97
52
|
display: flex;
|
|
@@ -145,4 +100,8 @@ export default {
|
|
|
145
100
|
}
|
|
146
101
|
}
|
|
147
102
|
}
|
|
103
|
+
|
|
104
|
+
.message-marked .image-container {
|
|
105
|
+
-webkit-tap-highlight-color: transparent;
|
|
106
|
+
}
|
|
148
107
|
</style>
|
|
@@ -4,12 +4,6 @@
|
|
|
4
4
|
<span v-if="isCursorBlinking" class="blinking-cursor">|</span>
|
|
5
5
|
<div ref="contentRef" :class="['message-marked']"></div>
|
|
6
6
|
</div>
|
|
7
|
-
<div v-if="image" class="rich-image-previewer" @click="closeImage">
|
|
8
|
-
<img
|
|
9
|
-
class="rich-image-preview"
|
|
10
|
-
:src="imageSrc"
|
|
11
|
-
/>
|
|
12
|
-
</div>
|
|
13
7
|
</div>
|
|
14
8
|
</template>
|
|
15
9
|
|
|
@@ -32,8 +26,6 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
32
26
|
|
|
33
27
|
const isCursorBlinking = ref<boolean>(true);
|
|
34
28
|
const isStreaming = ref<boolean>(false);
|
|
35
|
-
const image = ref(false);
|
|
36
|
-
const imageSrc = ref('');
|
|
37
29
|
const chunks = ref<string>('');
|
|
38
30
|
const isFinished = ref<boolean>(true);
|
|
39
31
|
const prevChunksLength = ref<number>(0);
|
|
@@ -43,8 +35,7 @@ const contentRef = ref<HTMLElement>(); // DOM 容器引用
|
|
|
43
35
|
// 设置全局回调函数(只需设置一次)
|
|
44
36
|
// @ts-ignore
|
|
45
37
|
window.onMarkdownImageClicked = function(href: string) {
|
|
46
|
-
|
|
47
|
-
imageSrc.value = decodeURIComponent(href);
|
|
38
|
+
emits('previewImage', decodeURIComponent(href));
|
|
48
39
|
}
|
|
49
40
|
// @ts-ignore
|
|
50
41
|
window.onMarkdownMediaLoad = function() {
|
|
@@ -288,7 +279,7 @@ watch(streamContent, () => {
|
|
|
288
279
|
doRender();
|
|
289
280
|
});
|
|
290
281
|
|
|
291
|
-
const emits = defineEmits(['heightChanged']);
|
|
282
|
+
const emits = defineEmits(['heightChanged', 'previewImage']);
|
|
292
283
|
// 不支持 ResizeObserver 的浏览器太老旧,默认不处理了
|
|
293
284
|
const canIUseResizeObserver = typeof ResizeObserver === 'undefined' ? false : true;
|
|
294
285
|
|
|
@@ -431,11 +422,6 @@ const observeHeightChanged = (newHeight) => {
|
|
|
431
422
|
}
|
|
432
423
|
};
|
|
433
424
|
|
|
434
|
-
const closeImage = () => {
|
|
435
|
-
image.value = !image.value;
|
|
436
|
-
imageSrc.value = '';
|
|
437
|
-
};
|
|
438
|
-
|
|
439
425
|
</script>
|
|
440
426
|
<style lang="scss" scoped>
|
|
441
427
|
@import "../../../../style/common.scss";
|
|
@@ -452,6 +438,10 @@ const closeImage = () => {
|
|
|
452
438
|
margin-left: 1.5em;
|
|
453
439
|
}
|
|
454
440
|
|
|
441
|
+
::v-deep .message-marked .image-container {
|
|
442
|
+
-webkit-tap-highlight-color: transparent;
|
|
443
|
+
}
|
|
444
|
+
|
|
455
445
|
.blinking-cursor {
|
|
456
446
|
animation: blink 0.8s step-end infinite;
|
|
457
447
|
color: #000;
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
:message="props.message"
|
|
21
21
|
@heightChanged="onHeightChanged"
|
|
22
22
|
@messageSent="onMessageSent"
|
|
23
|
+
@previewImage="onPreviewImage"
|
|
23
24
|
/>
|
|
24
25
|
</template>
|
|
25
26
|
<template #messageTip>
|
|
@@ -65,6 +66,7 @@ const emits = defineEmits([
|
|
|
65
66
|
'messageSent',
|
|
66
67
|
'like',
|
|
67
68
|
'dislike',
|
|
69
|
+
'previewImage',
|
|
68
70
|
]);
|
|
69
71
|
const messageModel = computed(() => TUIStore.getMessageModel(props.message.ID));
|
|
70
72
|
|
|
@@ -111,6 +113,10 @@ const onMessageSent = () => {
|
|
|
111
113
|
emits('messageSent');
|
|
112
114
|
};
|
|
113
115
|
|
|
116
|
+
const onPreviewImage = (url: string) => {
|
|
117
|
+
emits('previewImage', url);
|
|
118
|
+
};
|
|
119
|
+
|
|
114
120
|
function onLike(type: number, messageInfo: Object) {
|
|
115
121
|
emits('like', type, messageInfo);
|
|
116
122
|
};
|
package/components/CustomerServiceChat/message-list/message-elements/message-large-stream.vue
CHANGED
|
@@ -4,12 +4,6 @@
|
|
|
4
4
|
<span v-if="isCursorBlinking" class="blinking-cursor">|</span>
|
|
5
5
|
<div ref="preRef" :class="['message-marked']" v-html="displayedContent" />
|
|
6
6
|
</div>
|
|
7
|
-
<div v-if="image" class="rich-image-previewer" @click="closeImage">
|
|
8
|
-
<img
|
|
9
|
-
class="rich-image-preview"
|
|
10
|
-
:src="imageSrc"
|
|
11
|
-
/>
|
|
12
|
-
</div>
|
|
13
7
|
</div>
|
|
14
8
|
</template>
|
|
15
9
|
|
|
@@ -32,8 +26,6 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
32
26
|
|
|
33
27
|
const isCursorBlinking = ref<boolean>(true);
|
|
34
28
|
const isStreaming = ref<boolean>(false);
|
|
35
|
-
const image = ref(false);
|
|
36
|
-
const imageSrc = ref('');
|
|
37
29
|
const markdown = ref<string>('');
|
|
38
30
|
const isStreamEnded = ref<boolean>(true);
|
|
39
31
|
const prevmarkdownLength = ref<number>(0);
|
|
@@ -41,8 +33,7 @@ const streamContent = ref<string>('');
|
|
|
41
33
|
const displayedContent = computed(() => {
|
|
42
34
|
// @ts-ignore
|
|
43
35
|
window.onMarkdownImageClicked = function(href:string) {
|
|
44
|
-
|
|
45
|
-
imageSrc.value = decodeURIComponent(href);
|
|
36
|
+
emits('previewImage', decodeURIComponent(href));
|
|
46
37
|
}
|
|
47
38
|
// @ts-ignore
|
|
48
39
|
window.onMarkdownMediaLoad = function() {
|
|
@@ -53,7 +44,7 @@ const displayedContent = computed(() => {
|
|
|
53
44
|
return result;
|
|
54
45
|
});
|
|
55
46
|
const preRef = ref();
|
|
56
|
-
const emits = defineEmits(['heightChanged']);
|
|
47
|
+
const emits = defineEmits(['heightChanged', 'previewImage']);
|
|
57
48
|
// 不支持 ResizeObserver 的浏览器太老旧,默认不处理了
|
|
58
49
|
const canIUseResizeObserver = typeof ResizeObserver === 'undefined' ? false : true;
|
|
59
50
|
|
|
@@ -141,11 +132,6 @@ const observeHeightChanged = (newHeight) => {
|
|
|
141
132
|
}
|
|
142
133
|
};
|
|
143
134
|
|
|
144
|
-
const closeImage = () => {
|
|
145
|
-
image.value = !image.value;
|
|
146
|
-
imageSrc.value = '';
|
|
147
|
-
};
|
|
148
|
-
|
|
149
135
|
</script>
|
|
150
136
|
<style lang="scss" scoped>
|
|
151
137
|
@import "../../style/common.scss";
|
|
@@ -45,10 +45,14 @@
|
|
|
45
45
|
class="dialog-video"
|
|
46
46
|
>
|
|
47
47
|
<div
|
|
48
|
-
class="
|
|
48
|
+
class="icon icon-close"
|
|
49
49
|
@click.stop="toggleVideoPreviewer"
|
|
50
50
|
>
|
|
51
|
-
<Icon
|
|
51
|
+
<Icon
|
|
52
|
+
:file="closeSVG"
|
|
53
|
+
width="14px"
|
|
54
|
+
height="14px"
|
|
55
|
+
/>
|
|
52
56
|
</div>
|
|
53
57
|
<div
|
|
54
58
|
class="dialog-video-box"
|
|
@@ -277,13 +281,21 @@ async function handlePosterUrl(
|
|
|
277
281
|
flex-direction: column;
|
|
278
282
|
align-items: center;
|
|
279
283
|
|
|
280
|
-
|
|
284
|
+
.icon-close {
|
|
285
|
+
position: absolute;
|
|
286
|
+
cursor: pointer;
|
|
287
|
+
border-radius: 50%;
|
|
288
|
+
top: 3%;
|
|
289
|
+
right: 3%;
|
|
290
|
+
padding: 8px;
|
|
291
|
+
background: #fff;
|
|
281
292
|
display: flex;
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
293
|
+
z-index: 1;
|
|
294
|
+
|
|
295
|
+
&:before,
|
|
296
|
+
&:after {
|
|
297
|
+
background-color: #444;
|
|
298
|
+
}
|
|
287
299
|
}
|
|
288
300
|
|
|
289
301
|
&-box {
|
|
@@ -349,6 +349,11 @@ const updatePopoverPosition = () => {
|
|
|
349
349
|
position: relative;
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
+
.toolbar-button:hover {
|
|
353
|
+
border-color: #3b82f6;
|
|
354
|
+
color: #3b82f6;
|
|
355
|
+
}
|
|
356
|
+
|
|
352
357
|
.toolbar-button:first-child {
|
|
353
358
|
margin-left: 5px;
|
|
354
359
|
}
|
|
@@ -357,6 +362,11 @@ const updatePopoverPosition = () => {
|
|
|
357
362
|
border: none;
|
|
358
363
|
background-color: #fff;
|
|
359
364
|
box-shadow: 0px 2px 2px 0px rgba(70, 98, 140, 0.06);
|
|
365
|
+
-webkit-tap-highlight-color: transparent;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.toolbar-button-h5:active {
|
|
369
|
+
background-color: #f5f7fa;
|
|
360
370
|
}
|
|
361
371
|
|
|
362
372
|
.toolbar-button-icon {
|
|
@@ -425,6 +435,7 @@ const updatePopoverPosition = () => {
|
|
|
425
435
|
box-shadow: none;
|
|
426
436
|
}
|
|
427
437
|
.overflow-popover-item:hover {
|
|
438
|
+
color: #3b82f6;
|
|
428
439
|
background: #f9fafc;
|
|
429
440
|
}
|
|
430
441
|
|