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

feat: 在编辑器中恢复选择逻辑,优化空段落处理

上级 8d6dd989
......@@ -97,10 +97,6 @@ const ExpandModal = (props, ref) => {
}, [expandInfo])
const onFinish = async (values) => {
editor.restoreSelection()
if (parseInt(values.flex) === 1) {
removeSelectedEmptyParagraph(editor, SlateTransforms)
}
setLoadLoading(true)
const { flex, theme, fontSize, ...other } = values
......@@ -148,7 +144,9 @@ const ExpandModal = (props, ref) => {
...other,
})
editor.restoreSelection()
if (parseInt(values.flex) === 1) {
removeSelectedEmptyParagraph(editor, SlateTransforms)
insertBlockNodesAndFocus(editor, SlateTransforms, {
type: 'chapterExpandRead',
flex: parseInt(values.flex),
......
......@@ -210,15 +210,10 @@ const GalleryModal = (props, ref) => {
}, [galleryInfo])
const onFinish = async (values) => {
editor.restoreSelection()
// setLoading(true);
const { galleryTitle, flex, gallery, fontSize, theme = '' } = values
console.log(values)
if (parseInt(flex) !== 2) {
removeSelectedEmptyParagraph(editor, SlateTransforms)
}
if (nowRandom) {
const props = {
title: galleryTitle,
......@@ -265,6 +260,10 @@ const GalleryModal = (props, ref) => {
content: JSON.stringify(gallery),
position: random,
})
editor.restoreSelection()
if (parseInt(flex) !== 2) {
removeSelectedEmptyParagraph(editor, SlateTransforms)
}
if (parseInt(flex) === 2) {
editor.insertNode({
type: 'chapterGalleryInline',
......
......@@ -65,7 +65,6 @@ const TooltipModal = (props, ref) => {
}
const onFinish = async (values) => {
editor.restoreSelection()
setLoading(true)
const { tooltipType, link, theme, ...other } = values
let newLink = ''
......@@ -118,6 +117,7 @@ const TooltipModal = (props, ref) => {
})
if (data) {
editor.restoreSelection()
editor.insertNode({
type: 'chapterTooltip',
title: values.title,
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论