Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-book
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-book
Commits
a24389d3
提交
a24389d3
authored
7月 22, 2026
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(admin): host chapter structure dialogs
上级
3a33655a
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
30 行增加
和
67 行删除
+30
-67
FeatureDialogs.jsx
...or-customer/features/chapter-structure/FeatureDialogs.jsx
+17
-0
feature.js
...wangeditor-customer/features/chapter-structure/feature.js
+8
-2
section-node.js
...ditor-customer/features/chapter-structure/section-node.js
+2
-1
title-node.js
...geditor-customer/features/chapter-structure/title-node.js
+2
-1
WangEditorCustomer.jsx
...c/common/wangeditor-customer/shell/WangEditorCustomer.jsx
+1
-63
没有找到文件。
apps/admin/src/common/wangeditor-customer/features/chapter-structure/FeatureDialogs.jsx
0 → 100644
浏览文件 @
a24389d3
import
{
Modal
}
from
'antd'
import
TitleDialog
from
'./TitleDialog'
import
SectionDialog
from
'./SectionDialog'
const
classNames
=
{
header
:
'editor-header-customer'
,
body
:
'editor-body-customer'
,
wrapper
:
'editor-wrapper-customer'
}
export
function
ChapterTitleFeatureDialog
({
open
,
onClose
,
payload
,
runtime
})
{
return
<
Modal
open=
{
open
}
footer=
{
null
}
centered
destroyOnHidden
title=
"插入章头"
classNames=
{
classNames
}
maskClosable=
{
false
}
onCancel=
{
onClose
}
>
<
TitleDialog
editor=
{
runtime
.
editor
}
titleInfo=
{
payload
}
setTitleInfo=
{
()
=>
{}
}
setTitleVisible=
{
visible
=>
!
visible
&&
onClose
()
}
/>
</
Modal
>
}
export
function
ChapterSectionFeatureDialog
({
open
,
onClose
,
payload
,
runtime
})
{
return
<
Modal
open=
{
open
}
footer=
{
null
}
centered
destroyOnHidden
title=
"插入节头"
classNames=
{
classNames
}
maskClosable=
{
false
}
onCancel=
{
onClose
}
>
<
SectionDialog
editor=
{
runtime
.
editor
}
sectionInfo=
{
payload
}
setSectionInfo=
{
()
=>
{}
}
setSectionVisible=
{
visible
=>
!
visible
&&
onClose
()
}
/>
</
Modal
>
}
apps/admin/src/common/wangeditor-customer/features/chapter-structure/feature.js
浏览文件 @
a24389d3
...
...
@@ -3,6 +3,8 @@ import itemMenu from './section-menu'
import
titleMenu
from
'./title-menu'
import
sectionNodeModule
from
'./section-node'
import
headerNodeModule
from
'./title-node'
import
{
openEditorDialog
}
from
'../../core/editor-dialog'
import
{
ChapterTitleFeatureDialog
,
ChapterSectionFeatureDialog
}
from
'./FeatureDialogs'
export
default
defineEditorFeature
({
id
:
'chapter-structure'
,
...
...
@@ -11,8 +13,12 @@ export default defineEditorFeature({
{
order
:
10
,
types
:
[
'chapterSection'
],
module
:
sectionNodeModule
},
{
order
:
20
,
types
:
[
'chapterHeader'
],
module
:
headerNodeModule
},
],
dialogs
:
[
{
id
:
'chapter-structure.title'
,
component
:
ChapterTitleFeatureDialog
},
{
id
:
'chapter-structure.section'
,
component
:
ChapterSectionFeatureDialog
},
],
events
:
[
{
name
:
'ChapterItemMenuClick'
,
handler
:
({
runtime
})
=>
runtime
.
openSection
(
)
},
{
name
:
'ChapterTitleClick'
,
handler
:
({
runtime
})
=>
runtime
.
openTitle
(
)
},
{
name
:
'ChapterItemMenuClick'
,
handler
:
({
editor
})
=>
openEditorDialog
(
editor
,
'chapter-structure.section'
)
},
{
name
:
'ChapterTitleClick'
,
handler
:
({
editor
})
=>
openEditorDialog
(
editor
,
'chapter-structure.title'
)
},
],
})
apps/admin/src/common/wangeditor-customer/features/chapter-structure/section-node.js
浏览文件 @
a24389d3
import
{
DomEditor
,
SlateTransforms
}
from
"@wangeditor/editor"
;
import
iconClose
from
"@/assets/images/icon_chapter_close.png"
;
import
{
h
}
from
"snabbdom"
;
import
{
openEditorDialog
}
from
'../../core/editor-dialog'
import
{
findNodeWithParent
}
from
"../../utils/setting"
;
const
withChapterSectionNode
=
(
editor
)
=>
{
...
...
@@ -117,7 +118,7 @@ const renderChapterSection = (elem, children, editor) => {
size
:
size
,
family
:
family
,
};
editor
.
emit
(
"wangeditor-customer:legacy-dialog"
,
{
key
:
"chapterItemNum"
,
payload
:
data
});
openEditorDialog
(
editor
,
'chapter-structure.section'
,
data
)
callback
&&
callback
(
data
);
}
/* 其他... */
,
},
...
...
apps/admin/src/common/wangeditor-customer/features/chapter-structure/title-node.js
浏览文件 @
a24389d3
import
{
DomEditor
,
SlateTransforms
}
from
"@wangeditor/editor"
;
import
iconClose
from
"@/assets/images/icon_chapter_close.png"
;
import
{
h
}
from
"snabbdom"
;
import
{
openEditorDialog
}
from
'../../core/editor-dialog'
import
{
findNodeWithParent
}
from
"../../utils/setting"
;
const
withChapterHeaderNode
=
(
editor
)
=>
{
...
...
@@ -123,7 +124,7 @@ const renderChapterHeader = (elem, children, editor) => {
size
:
size
,
family
:
family
,
};
editor
.
emit
(
"wangeditor-customer:legacy-dialog"
,
{
key
:
"chapterTitleNum"
,
payload
:
data
});
openEditorDialog
(
editor
,
'chapter-structure.title'
,
data
)
callback
&&
callback
(
data
);
}
/* 其他... */
,
},
...
...
apps/admin/src/common/wangeditor-customer/shell/WangEditorCustomer.jsx
浏览文件 @
a24389d3
...
...
@@ -23,8 +23,6 @@ import relativeTime from "dayjs/plugin/relativeTime";
dayjs
.
extend
(
relativeTime
);
import
ChapterTitleModal
from
"../features/chapter-structure/TitleDialog"
;
import
ChapterItemModal
from
"../features/chapter-structure/SectionDialog"
;
import
PracticeModal
from
"../features/practice/PracticeInsertDialog"
;
import
TooltipModal
from
"../features/tooltip/TooltipDialog"
;
import
LinkModal
from
"../features/link/LinkDialog"
;
...
...
@@ -71,10 +69,6 @@ const WangEditorCustomer = (props, ref) => {
const
[
content
,
setContent
]
=
useState
(
html
);
const
saveRef
=
useRef
();
const
[
titleVisible
,
setTitleVisible
]
=
useState
(
false
);
// 章头
const
[
titleInfo
,
setTitleInfo
]
=
useState
({});
const
[
sectionVisible
,
setSectionVisible
]
=
useState
(
false
);
const
[
sectionInfo
,
setSectionInfo
]
=
useState
({});
// 节头
const
[
practiceOpenVisible
,
setPracticeOpenVisible
]
=
useState
(
false
);
// 练习
const
[
practiceVisible
,
setPracticeVisible
]
=
useState
(
false
);
// 练习答题设置
const
[
tooltipVisible
,
setTooltipVisible
]
=
useState
(
false
);
// 气泡框
...
...
@@ -90,13 +84,7 @@ const WangEditorCustomer = (props, ref) => {
const
[
selectionSize
,
setSelectionSize
]
=
useState
(
16
);
// 当前字号大小
const
handleLegacyDialog
=
({
key
,
payload
})
=>
{
if
(
key
===
"chapterTitleNum"
)
{
setTitleInfo
(
payload
);
setTitleVisible
(
true
);
}
else
if
(
key
===
"chapterItemNum"
)
{
setSectionInfo
(
payload
);
setSectionVisible
(
true
);
}
else
if
(
key
===
"practiceNum"
)
{
if
(
key
===
"practiceNum"
)
{
const
{
practiceNum
,
title
,
theme
}
=
payload
;
dispatch
(
setPracticeRandom
({
practiceNum
,
practiceTitle
:
title
,
practiceTheme
:
theme
}));
setPracticeVisible
(
true
);
...
...
@@ -235,8 +223,6 @@ const WangEditorCustomer = (props, ref) => {
};
const
tooltipRef
=
useRef
();
const
chapterTitleRef
=
useRef
();
const
chapterItemRef
=
useRef
();
const
practiceRef
=
useRef
();
const
practiceSettingRef
=
useRef
();
const
previewRef
=
useRef
();
...
...
@@ -324,8 +310,6 @@ const WangEditorCustomer = (props, ref) => {
};
const
featureRuntime
=
{
openTitle
:
()
=>
setTitleVisible
(
true
),
openSection
:
()
=>
setSectionVisible
(
true
),
openPractice
:
()
=>
setPracticeOpenVisible
(
true
),
openTooltip
:
()
=>
setTooltipVisible
(
true
),
openLink
:
()
=>
setLinkVisible
(
true
),
...
...
@@ -417,52 +401,6 @@ const WangEditorCustomer = (props, ref) => {
/>
</
div
>
{
!
isView
&&
<
EditorSidebar
editor=
{
editor
}
toolbarConfig=
{
toolbarConfig
}
toolbarRef=
{
toolbarRef
}
tabKey=
{
tabKey
}
onTabChange=
{
tabKeyChange
}
colorList=
{
colorList
}
onApplyColor=
{
setColor
}
/>
}
<
Modal
open=
{
titleVisible
}
footer=
{
null
}
centered
destroyOnHidden
title=
"插入章头"
classNames=
{
{
header
:
"editor-header-customer"
,
body
:
"editor-body-customer"
,
wrapper
:
"editor-wrapper-customer"
,
}
}
maskClosable=
{
false
}
onCancel=
{
()
=>
setTitleVisible
(
false
)
}
>
<
ChapterTitleModal
ref=
{
chapterTitleRef
}
editor=
{
editor
}
setTitleVisible=
{
setTitleVisible
}
titleInfo=
{
titleInfo
}
setTitleInfo=
{
setTitleInfo
}
/>
</
Modal
>
<
Modal
open=
{
sectionVisible
}
footer=
{
null
}
centered
destroyOnHidden
title=
"插入节头"
classNames=
{
{
header
:
"editor-header-customer"
,
body
:
"editor-body-customer"
,
wrapper
:
"editor-wrapper-customer"
,
}
}
maskClosable=
{
false
}
onCancel=
{
()
=>
setSectionVisible
(
false
)
}
>
<
ChapterItemModal
ref=
{
chapterItemRef
}
editor=
{
editor
}
setSectionVisible=
{
setSectionVisible
}
sectionInfo=
{
sectionInfo
}
setSectionInfo=
{
setSectionInfo
}
/>
</
Modal
>
{
/* 插入练习 */
}
<
Modal
open=
{
practiceOpenVisible
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论