|
|
|
@ -5,12 +5,15 @@ import Modal from '@dckj/react-better-modal';
|
|
|
|
|
import '@dckj/react-better-modal/dist/index.css';
|
|
|
|
|
import DnDModal from '@/components/DndModal';
|
|
|
|
|
import useStyleStore from '@/stores/StyleStore';
|
|
|
|
|
import useConversationStore from '@/stores/ConversationStore';
|
|
|
|
|
|
|
|
|
|
import LexicalEditor from '@/components/LexicalEditor';
|
|
|
|
|
|
|
|
|
|
import { v4 as uuid } from 'uuid';
|
|
|
|
|
import { isEmpty } from '@/utils/commons';
|
|
|
|
|
import './EmailEditor.css';
|
|
|
|
|
import { postSendEmail } from '@/actions/EmailActions';
|
|
|
|
|
import { sentMsgTypeMapped, whatsappSupportFileTypes, uploadProgressSimulate } from '@/channel/bubbleMsgUtils';
|
|
|
|
|
|
|
|
|
|
const getAbstract = (longtext) => {
|
|
|
|
|
const lines = longtext.split('\n');
|
|
|
|
@ -191,6 +194,28 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, reference, quote = {}, ini
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 先推到消息记录上面, 再发送
|
|
|
|
|
*/
|
|
|
|
|
const sentOrReceivedNewMessage = useConversationStore((state) => state.sentOrReceivedNewMessage);
|
|
|
|
|
const invokeEmailMessage = (msgObj) => {
|
|
|
|
|
const msgObjMerge = {
|
|
|
|
|
sender: 'me',
|
|
|
|
|
senderName: 'me',
|
|
|
|
|
msg_source: 'email',
|
|
|
|
|
// to: currentConversation.whatsapp_phone_number,
|
|
|
|
|
date: new Date(),
|
|
|
|
|
status: 'waiting',
|
|
|
|
|
...msgObj,
|
|
|
|
|
// id: `${currentConversation.sn}.${msgObj.id}`,
|
|
|
|
|
id: `1148.${msgObj.id}`,
|
|
|
|
|
};
|
|
|
|
|
// olog('invoke upload', msgObjMerge)
|
|
|
|
|
const contentToRender = sentMsgTypeMapped[msgObjMerge.type].contentToRender(msgObjMerge);
|
|
|
|
|
// console.log(contentToRender, 'contentToRender sendMessage------------------');
|
|
|
|
|
sentOrReceivedNewMessage(contentToRender.conversationid, contentToRender);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const onHandleSend = async () => {
|
|
|
|
|
console.log('onSend callback', '\nisRichText', isRichText);
|
|
|
|
|
// console.log(form.getFieldsValue());
|
|
|
|
@ -201,14 +226,19 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, reference, quote = {}, ini
|
|
|
|
|
body.opi_sn = 29; // debug:
|
|
|
|
|
body.mat_sn = 278;
|
|
|
|
|
console.log('body', body);
|
|
|
|
|
await form.validateFields();
|
|
|
|
|
await postSendEmail(body);
|
|
|
|
|
const values = await form.validateFields();
|
|
|
|
|
const msgObj = {
|
|
|
|
|
type: 'email',
|
|
|
|
|
id: uuid(),
|
|
|
|
|
}
|
|
|
|
|
invokeEmailMessage(msgObj);
|
|
|
|
|
const result = await postSendEmail(body);
|
|
|
|
|
// form.validateFields().then((values) => {
|
|
|
|
|
// form.resetFields();
|
|
|
|
|
// });
|
|
|
|
|
// .catch((err) => {})
|
|
|
|
|
|
|
|
|
|
// setOpen(false);
|
|
|
|
|
setOpen(false);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
@ -258,8 +288,8 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, reference, quote = {}, ini
|
|
|
|
|
// labelCol={{ span: 3 }}
|
|
|
|
|
>
|
|
|
|
|
<Form.Item label='收件人' className='w-full'>
|
|
|
|
|
{/* <Space.Compact className='w-full'> */}
|
|
|
|
|
<Flex justify='space-between'>
|
|
|
|
|
<Space.Compact className='w-full'>
|
|
|
|
|
{/* <Flex justify='space-between' className='w-full'> */}
|
|
|
|
|
{/* <Mentions // todo: 用客人列表
|
|
|
|
|
split='; '
|
|
|
|
|
options={[
|
|
|
|
@ -270,7 +300,7 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, reference, quote = {}, ini
|
|
|
|
|
placeholder='@'
|
|
|
|
|
/> */}
|
|
|
|
|
<Form.Item name={'to'} rules={[{ required: true }]} className='flex-1'>
|
|
|
|
|
<Input />
|
|
|
|
|
<Input className='w-full' />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Flex gap={4}>
|
|
|
|
|
{!showCc && (
|
|
|
|
@ -284,8 +314,8 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, reference, quote = {}, ini
|
|
|
|
|
</Button>
|
|
|
|
|
)}
|
|
|
|
|
</Flex>
|
|
|
|
|
</Flex>
|
|
|
|
|
{/* </Space.Compact> */}
|
|
|
|
|
{/* </Flex> */}
|
|
|
|
|
</Space.Compact>
|
|
|
|
|
{/* <Input
|
|
|
|
|
addonAfter={
|
|
|
|
|
<Flex gap={4}>
|
|
|
|
|