|
|
|
@ -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) => {
|
|
|
|
|