Merge remote-tracking branch 'origin/main'

2.0/email-builder
Lei OT 11 months ago
commit 5e85bb3ef8

@ -87,38 +87,29 @@ function LexicalDefaultValuePlugin({ value = "" }= {}) {
const nodes = $generateNodesFromDOM(editor, dom);
if (clear) {
root.clear();
// $getRoot().clear();
// $getRoot().select();
}
// const p = $createParagraphNode();
// const _p =
nodes.filter(n => n.__size !== 0).forEach((n) => {
const paragraphNode = $createParagraphNode();
paragraphNode.append(n);
// p.append(paragraphNode);
root.append(paragraphNode);
});
// root.append(...nodes.filter(n => n));
};
//
// HTML
useEffect(() => {
if (editor && !isEmpty(value)) {
editor.update(() => {
updateHTML(editor, value, true);
});
}
}, [value]);
}, [editor, value]);
return null;
}
function MyOnChangePlugin({ ignoreHistoryMergeTagChange = true, ignoreSelectionChange = true, onChange }) {
const [editor] = useLexicalComposerContext();
useEffect(() => {
if (onChange) {
if (typeof onChange === 'function') {
return editor.registerUpdateListener(({editorState, dirtyElements, dirtyLeaves, prevEditorState, tags}) => {
if (
@ -130,21 +121,11 @@ function MyOnChangePlugin({ ignoreHistoryMergeTagChange = true, ignoreSelectionC
) {
return;
}
// const editorStateJSON = editorState.toJSON();
let html;
let textContent;
editorState.read(() => {
const root = $getRoot();
const textContent = root.getTextContent();
// console.log('textContent', textContent);
const html = $generateHtmlFromNodes(editor);
// console.log('html', html);
// setEditorContent(content);
if (typeof onChange === 'function') {
onChange({ editorStateJSON: editorState.toJSON(), editor, tags, htmlContent: html, textContent });
}
onChange({ editorStateJSON: editorState.toJSON(), editor, tags, htmlContent: html, textContent });
});
});
}

@ -6,7 +6,7 @@
// export const WS_URL = 'wss://p9axztuwd7x8a7.mycht.cn/whatsapp_144'; // prod: Slave
// debug:
export const API_HOST = 'http://202.103.68.157:8889/v2';
export const API_HOST = 'http://202.103.68.144:8889/v2';
export const WS_URL = 'ws://202.103.68.157:8889';
// prod:
// export const API_HOST = 'https://p9axztuwd7x8a7.mycht.cn/whatsapp_server';

@ -51,7 +51,7 @@ const useAuthStore = create(devtools((set, get) => ({
setLoginStatus(200)
const json = await fetchJSON(
'http://202.103.68.157:889/dingtalk/dingtalkwork/WhatsAppAuth',
'http://202.103.68.144:889/dingtalk/dingtalkwork/WhatsAppAuth',
//`https://p9axztuwd7x8a7.mycht.cn/dingtalk/dingtalkwork/WhatsAppAuth`,
{ authCode },
)

@ -1,4 +1,4 @@
import { Row, Col, Tag, List, Form, Input, Button, Space, Modal, Select, message } from 'antd'
import { App, Row, Col, Tag, List, Form, Input, Button, Space, Modal, Select, message } from 'antd'
import { useState, useEffect } from 'react'
import EditorInput from '../../components/EditorInput'
import HtmlPreview from './HtmlPreview'
@ -25,12 +25,28 @@ function SnippetList() {
const [loginUser] = useAuthStore((state) => [state.loginUser])
const { notification } = App.useApp()
const [isSnippetModalOpen, setSnippetModalOpen] = useState(false)
const [isHtmlLoading, setHtmlLoading] = useState(false)
const onSnippetFinish = (values) => {
console.log('onSnippetFinish:', values)
saveOrUpdateSnippet(values)
.then(() => {
notification.info({
message: 'Notification',
description: '图文保存成功',
placement: 'top',
})
setSnippetModalOpen(false)
})
.catch(ex => {
notification.error({
message: 'Notification',
description: ex.message,
placement: 'top',
duration: 4,
})
})
}
const onSnippetFailed = (error) => {

Loading…
Cancel
Save