mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-12 17:08:11 +00:00
perf: 聊天输入框支持粘贴文件
This commit is contained in:
parent
35daeb443c
commit
7a8fcad27c
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="chat-input-wrapper" :class="modeClass">
|
||||
<div ref="editor" class="no-dark-content" :style="editorStyle"></div>
|
||||
<div ref="editor" class="no-dark-content" :style="editorStyle" @paste="handlePaste"></div>
|
||||
<div class="chat-input-toolbar">
|
||||
<slot name="toolbarBefore"/>
|
||||
|
||||
@ -578,6 +578,15 @@ export default {
|
||||
let IOSVersion = match ? match[1].replace(/_/g, ".") : "unknown";
|
||||
const iosVsn = IOSVersion.split(".");
|
||||
return +iosVsn[0] == 11 && +iosVsn[1] >= 0 && +iosVsn[1] < 3;
|
||||
},
|
||||
|
||||
handlePaste(e) {
|
||||
const {files} = e.clipboardData;
|
||||
const postFiles = Array.prototype.slice.call(files).filter(file => !$A.leftExists(file.type, 'image/'));
|
||||
if (postFiles.length > 0) {
|
||||
e.preventDefault()
|
||||
this.$emit('on-file', postFiles)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,6 +100,7 @@
|
||||
@on-focus="onEventFocus"
|
||||
@on-blur="onEventBlur"
|
||||
@on-more="onEventMore"
|
||||
@on-file="sendFileMsg"
|
||||
@on-send="sendMsg"
|
||||
:placeholder="$L('输入消息...')"/>
|
||||
<slot name="inputAfter"/>
|
||||
@ -396,7 +397,8 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
sendFileMsg(files) {
|
||||
sendFileMsg(row) {
|
||||
const files = $A.isArray(row) ? row : [row];
|
||||
if (files.length > 0) {
|
||||
this.pasteFile = [];
|
||||
this.pasteItem = [];
|
||||
|
||||
@ -407,6 +407,7 @@
|
||||
:maxlength="20000"
|
||||
:placeholder="$L('输入消息...')"
|
||||
@on-more="onEventMore"
|
||||
@on-file="onSelectFile"
|
||||
@on-send="msgDialog">
|
||||
<Badge slot="toolbarAfter" :count="taskDetail.msg_num"/>
|
||||
</ChatInput>
|
||||
@ -1166,8 +1167,8 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
onSelectFile(file) {
|
||||
this.msgFile = [file];
|
||||
onSelectFile(row) {
|
||||
this.msgFile = $A.isArray(row) ? row : [row];
|
||||
this.msgDialog()
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user