Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-book
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-book
Commits
007984f7
提交
007984f7
authored
7月 22, 2026
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(admin): host expand read dialog
上级
2f38b3c8
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
17 行增加
和
74 行删除
+17
-74
FeatureDialog.jsx
...angeditor-customer/features/expand-read/FeatureDialog.jsx
+8
-0
feature.js
...ommon/wangeditor-customer/features/expand-read/feature.js
+5
-1
node.js
...c/common/wangeditor-customer/features/expand-read/node.js
+2
-1
simple-node.js
...n/wangeditor-customer/features/expand-read/simple-node.js
+2
-1
WangEditorCustomer.jsx
...c/common/wangeditor-customer/shell/WangEditorCustomer.jsx
+0
-71
没有找到文件。
apps/admin/src/common/wangeditor-customer/features/expand-read/FeatureDialog.jsx
0 → 100644
浏览文件 @
007984f7
import
{
Modal
}
from
'antd'
import
ExpandReadDialog
from
'./ExpandReadDialog'
export
default
function
ExpandReadFeatureDialog
({
open
,
onClose
,
payload
,
runtime
})
{
return
<
Modal
open=
{
open
}
footer=
{
null
}
centered
destroyOnHidden
title=
"扩展阅读"
classNames=
{
{
header
:
'editor-header-customer'
,
body
:
'editor-body-customer'
,
wrapper
:
'editor-wrapper-customer'
}
}
maskClosable=
{
false
}
onCancel=
{
onClose
}
width=
"70%"
>
<
ExpandReadDialog
editor=
{
runtime
.
editor
}
chapterId=
{
runtime
.
chapterId
}
bookId=
{
runtime
.
bookId
}
expandInfo=
{
payload
}
selectionSize=
{
payload
.
selectionSize
||
18
}
setExpandInfo=
{
()
=>
{}
}
setExpandVisible=
{
visible
=>
!
visible
&&
onClose
()
}
/>
</
Modal
>
}
apps/admin/src/common/wangeditor-customer/features/expand-read/feature.js
浏览文件 @
007984f7
...
@@ -2,6 +2,9 @@ import { defineEditorFeature } from '../../core/define-editor-feature'
...
@@ -2,6 +2,9 @@ import { defineEditorFeature } from '../../core/define-editor-feature'
import
menu
from
'./menu'
import
menu
from
'./menu'
import
nodeModule
from
'./node'
import
nodeModule
from
'./node'
import
simpleNodeModule
from
'./simple-node'
import
simpleNodeModule
from
'./simple-node'
import
{
openEditorDialog
}
from
'../../core/editor-dialog'
import
{
getSelectionFontSize
}
from
'../../core/selection'
import
ExpandReadFeatureDialog
from
'./FeatureDialog'
export
default
defineEditorFeature
({
export
default
defineEditorFeature
({
id
:
'expand-read'
,
id
:
'expand-read'
,
...
@@ -10,5 +13,6 @@ export default defineEditorFeature({
...
@@ -10,5 +13,6 @@ export default defineEditorFeature({
{
order
:
120
,
types
:
[
'chapterExpandRead'
],
module
:
nodeModule
},
{
order
:
120
,
types
:
[
'chapterExpandRead'
],
module
:
nodeModule
},
{
order
:
130
,
types
:
[
'chapterExpandReadSimple'
],
module
:
simpleNodeModule
},
{
order
:
130
,
types
:
[
'chapterExpandReadSimple'
],
module
:
simpleNodeModule
},
],
],
events
:
[{
name
:
'ExpandReadClick'
,
handler
:
({
runtime
})
=>
{
runtime
.
captureSelectionFontSize
();
runtime
.
openExpandRead
()
}
}],
dialogs
:
[{
id
:
'expand-read.insert'
,
component
:
ExpandReadFeatureDialog
},
{
id
:
'expand-read.edit'
,
component
:
ExpandReadFeatureDialog
}],
events
:
[{
name
:
'ExpandReadClick'
,
handler
:
({
editor
})
=>
openEditorDialog
(
editor
,
'expand-read.insert'
,
{
selectionSize
:
getSelectionFontSize
(
editor
)
})
}],
})
})
apps/admin/src/common/wangeditor-customer/features/expand-read/node.js
浏览文件 @
007984f7
...
@@ -6,6 +6,7 @@ import {
...
@@ -6,6 +6,7 @@ import {
SlateNode
,
SlateNode
,
}
from
"@wangeditor/editor"
;
}
from
"@wangeditor/editor"
;
import
{
h
}
from
"snabbdom"
;
import
{
h
}
from
"snabbdom"
;
import
{
openEditorDialog
}
from
'../../core/editor-dialog'
import
iconExpand
from
"@/assets/images/editor/icon_expand_read.png"
;
import
iconExpand
from
"@/assets/images/editor/icon_expand_read.png"
;
import
iconClose
from
"@/assets/images/icon_chapter_close.png"
;
import
iconClose
from
"@/assets/images/icon_chapter_close.png"
;
import
{
findNodeWithParent
}
from
"../../utils/setting"
;
import
{
findNodeWithParent
}
from
"../../utils/setting"
;
...
@@ -229,7 +230,7 @@ const renderExpandRead = (elem, children, editor) => {
...
@@ -229,7 +230,7 @@ const renderExpandRead = (elem, children, editor) => {
flex
,
flex
,
theme
,
theme
,
};
};
editor
.
emit
(
"wangeditor-customer:legacy-dialog"
,
{
key
:
"chapterExpand"
,
payload
:
data
});
openEditorDialog
(
editor
,
'expand-read.edit'
,
data
)
},
},
},
},
},
},
...
...
apps/admin/src/common/wangeditor-customer/features/expand-read/simple-node.js
浏览文件 @
007984f7
...
@@ -6,6 +6,7 @@ import {
...
@@ -6,6 +6,7 @@ import {
SlateNode
,
SlateNode
,
}
from
"@wangeditor/editor"
;
}
from
"@wangeditor/editor"
;
import
{
h
}
from
"snabbdom"
;
import
{
h
}
from
"snabbdom"
;
import
{
openEditorDialog
}
from
'../../core/editor-dialog'
import
iconExpand
from
"@/assets/images/editor/icon_expand_tips.png"
;
import
iconExpand
from
"@/assets/images/editor/icon_expand_tips.png"
;
import
iconExpandT
from
"@/assets/images/editor/icon_expand_editor.png"
;
import
iconExpandT
from
"@/assets/images/editor/icon_expand_editor.png"
;
...
@@ -115,7 +116,7 @@ const renderExpandRead = (elem, children, editor) => {
...
@@ -115,7 +116,7 @@ const renderExpandRead = (elem, children, editor) => {
theme
,
theme
,
fontsize
,
fontsize
,
};
};
editor
.
emit
(
"wangeditor-customer:legacy-dialog"
,
{
key
:
"chapterExpand"
,
payload
:
data
});
openEditorDialog
(
editor
,
'expand-read.edit'
,
data
)
},
},
},
},
},
},
...
...
apps/admin/src/common/wangeditor-customer/shell/WangEditorCustomer.jsx
浏览文件 @
007984f7
...
@@ -24,7 +24,6 @@ dayjs.extend(relativeTime);
...
@@ -24,7 +24,6 @@ dayjs.extend(relativeTime);
import
PracticeModal
from
"../features/practice/PracticeInsertDialog"
;
import
PracticeModal
from
"../features/practice/PracticeInsertDialog"
;
import
ExpandModal
from
"../features/expand-read/ExpandReadDialog"
;
import
PracticeSettingModal
from
"../features/practice/PracticeSettingsDialog"
;
import
PracticeSettingModal
from
"../features/practice/PracticeSettingsDialog"
;
...
@@ -69,22 +68,16 @@ const WangEditorCustomer = (props, ref) => {
...
@@ -69,22 +68,16 @@ const WangEditorCustomer = (props, ref) => {
const
[
practiceOpenVisible
,
setPracticeOpenVisible
]
=
useState
(
false
);
// 练习
const
[
practiceOpenVisible
,
setPracticeOpenVisible
]
=
useState
(
false
);
// 练习
const
[
practiceVisible
,
setPracticeVisible
]
=
useState
(
false
);
// 练习答题设置
const
[
practiceVisible
,
setPracticeVisible
]
=
useState
(
false
);
// 练习答题设置
const
[
expandVisible
,
setExpandVisible
]
=
useState
(
false
);
// 扩展阅读
const
[
expandInfo
,
setExpandInfo
]
=
useState
({});
// 扩展阅读内容
const
[
priviewVisible
,
setPreviewVisible
]
=
useState
(
false
);
const
[
priviewVisible
,
setPreviewVisible
]
=
useState
(
false
);
const
[
historyVisible
,
setHistoryVisible
]
=
useState
(
false
);
//点击历史
const
[
historyVisible
,
setHistoryVisible
]
=
useState
(
false
);
//点击历史
const
[
selectionSize
,
setSelectionSize
]
=
useState
(
16
);
// 当前字号大小
const
handleLegacyDialog
=
({
key
,
payload
})
=>
{
const
handleLegacyDialog
=
({
key
,
payload
})
=>
{
if
(
key
===
"practiceNum"
)
{
if
(
key
===
"practiceNum"
)
{
const
{
practiceNum
,
title
,
theme
}
=
payload
;
const
{
practiceNum
,
title
,
theme
}
=
payload
;
dispatch
(
setPracticeRandom
({
practiceNum
,
practiceTitle
:
title
,
practiceTheme
:
theme
}));
dispatch
(
setPracticeRandom
({
practiceNum
,
practiceTitle
:
title
,
practiceTheme
:
theme
}));
setPracticeVisible
(
true
);
setPracticeVisible
(
true
);
}
else
if
(
key
===
"chapterExpand"
)
{
setExpandInfo
(
payload
);
setExpandVisible
(
true
);
}
}
};
};
...
@@ -107,38 +100,6 @@ const WangEditorCustomer = (props, ref) => {
...
@@ -107,38 +100,6 @@ const WangEditorCustomer = (props, ref) => {
};
};
});
});
const
listenNodeStyle
=
(
path
)
=>
{
const
children
=
editor
.
children
;
const
getNodeFontSize
=
(
targetNode
)
=>
{
const
element
=
editor
.
toDOMNode
(
targetNode
);
const
textElement
=
element
.
querySelector
(
"[data-slate-string='true']"
);
const
parentNode
=
editor
.
getParentNode
(
targetNode
);
const
fallbackElement
=
parentNode
?
editor
.
toDOMNode
(
parentNode
)
:
element
;
return
window
.
getComputedStyle
(
textElement
||
fallbackElement
).
fontSize
;
};
let
node
=
null
;
if
(
path
[
1
]
===
0
)
{
node
=
children
[
path
[
0
]];
if
(
node
.
children
.
length
>
0
)
{
setSelectionSize
(
parseInt
(
getNodeFontSize
(
node
)));
}
else
{
node
=
children
[
path
[
0
]].
children
[
0
];
if
(
node
.
fontSize
)
{
setSelectionSize
(
parseInt
(
node
.
fontSize
));
}
else
{
setSelectionSize
(
parseInt
(
getNodeFontSize
(
node
)));
}
}
}
else
{
node
=
children
[
path
[
0
]].
children
[
path
[
1
]];
if
(
node
.
fontSize
)
{
setSelectionSize
(
parseInt
(
node
.
fontSize
));
}
else
{
setSelectionSize
(
parseInt
(
getNodeFontSize
(
node
)));
}
}
};
// 工具栏配置
// 工具栏配置
const
toolbarConfig
=
{
const
toolbarConfig
=
{
toolbarKeys
:
[
toolbarKeys
:
[
...
@@ -298,10 +259,6 @@ const WangEditorCustomer = (props, ref) => {
...
@@ -298,10 +259,6 @@ const WangEditorCustomer = (props, ref) => {
const
featureRuntime
=
{
const
featureRuntime
=
{
openPractice
:
()
=>
setPracticeOpenVisible
(
true
),
openPractice
:
()
=>
setPracticeOpenVisible
(
true
),
openExpandRead
:
()
=>
setExpandVisible
(
true
),
captureSelectionFontSize
:
()
=>
{
if
(
editor
?.
selection
)
listenNodeStyle
(
editor
.
selection
.
anchor
.
path
)
},
}
}
useEditorFeatureEvents
({
editor
,
registry
:
editorFeatureRegistry
,
runtime
:
featureRuntime
})
useEditorFeatureEvents
({
editor
,
registry
:
editorFeatureRegistry
,
runtime
:
featureRuntime
})
...
@@ -410,34 +367,6 @@ const WangEditorCustomer = (props, ref) => {
...
@@ -410,34 +367,6 @@ const WangEditorCustomer = (props, ref) => {
/>
/>
</
Modal
>
</
Modal
>
{
/* 扩展 */
}
<
Modal
open=
{
expandVisible
}
footer=
{
null
}
centered
destroyOnHidden
title=
"扩展阅读"
classNames=
{
{
header
:
"editor-header-customer"
,
body
:
"editor-body-customer"
,
wrapper
:
"editor-wrapper-customer"
,
}
}
maskClosable=
{
false
}
onCancel=
{
()
=>
setExpandVisible
(
false
)
}
width=
"70%"
>
<
ExpandModal
ref=
{
previewRef
}
editor=
{
editor
}
chapterId=
{
chapterId
}
bookId=
{
bookId
}
expandInfo=
{
expandInfo
}
setExpandInfo=
{
setExpandInfo
}
setExpandVisible=
{
setExpandVisible
}
selectionSize=
{
selectionSize
}
/>
</
Modal
>
<
Modal
<
Modal
open=
{
practiceVisible
}
open=
{
practiceVisible
}
footer=
{
null
}
footer=
{
null
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论