提交 bb1ea15d authored 作者: 王鹏飞's avatar 王鹏飞

refactor: 优化代码格式,统一箭头函数语法

上级 c32d0b8d
......@@ -38,7 +38,7 @@ const ImageModal = (props, ref) => {
maxCount: 1,
showUploadList: false,
accept: fileAccept.join(','),
beforeUpload: file => {
beforeUpload: (file) => {
const fileExt = file.name.substring(file.name.lastIndexOf('.'))
if (!fileAccept.includes(fileExt.toLowerCase())) {
message.error('请上传正确格式的图片')
......@@ -52,7 +52,7 @@ const ImageModal = (props, ref) => {
setImgUrl(url)
form.setFieldsValue({ imgUrl: url })
setUploading(false)
}
},
}
const clear = () => {
......@@ -65,12 +65,12 @@ const ImageModal = (props, ref) => {
setImageVisible(false)
}
const onFinish = values => {
const onFinish = (values) => {
console.log(values)
editor.restoreSelection()
const nodeEntries = SlateEditor.nodes(editor, {
match: node => {
match: (node) => {
// JS syntax
if (SlateElement.isElement(node)) {
if (node.type === 'paragraph') {
......@@ -79,7 +79,7 @@ const ImageModal = (props, ref) => {
}
return false
},
universal: true
universal: true,
})
for (let nodeEntry of nodeEntries) {
const [node] = nodeEntry
......@@ -100,16 +100,16 @@ const ImageModal = (props, ref) => {
children: [
{
// 该字段必须要
text: ''
}
]
}
]
text: '',
},
],
},
],
}
const oP = {
type: 'paragraph',
textAlign: 'center',
children: [{ text: values.imgTitle }]
children: [{ text: values.imgTitle }],
}
if (tempNodeInfo && Object.entries(tempNodeInfo).length > 0) {
......@@ -142,7 +142,7 @@ const ImageModal = (props, ref) => {
clear()
}
const onOnlineImageChange = url => {
const onOnlineImageChange = (url) => {
setImgUrl(url)
form.setFieldsValue({ imgUrl: url })
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论