Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-book
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-book
Commits
2129a2d5
提交
2129a2d5
authored
7月 22, 2026
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(admin): route AI menus through editor dialogs
上级
c16dd116
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
82 行增加
和
13 行删除
+82
-13
feature.js
...c/common/wangeditor-customer/features/ai-media/feature.js
+11
-0
feature.js
...ommon/wangeditor-customer/features/ai-question/feature.js
+5
-0
feature.js
...ommon/wangeditor-customer/features/ai-research/feature.js
+14
-0
feature.js
...rc/common/wangeditor-customer/features/ai-text/feature.js
+9
-0
feature.js
...n/src/common/wangeditor-customer/features/icon/feature.js
+9
-1
index.jsx
apps/admin/src/common/wangeditor-customer/index.jsx
+7
-0
BaseModalMenu.jsx
.../common/wangeditor-customer/menu/common/BaseModalMenu.jsx
+27
-12
没有找到文件。
apps/admin/src/common/wangeditor-customer/features/ai-media/feature.js
浏览文件 @
2129a2d5
import
{
defineEditorFeature
}
from
'../../core/define-editor-feature'
import
{
defineEditorFeature
}
from
'../../core/define-editor-feature'
import
{
createElement
}
from
'react'
import
AIDigitalHuman
from
'./digital-human-menu'
import
AIDigitalHuman
from
'./digital-human-menu'
import
AIImage
from
'./image-menu'
import
AIImage
from
'./image-menu'
import
AIVideo
from
'./video-menu'
import
AIVideo
from
'./video-menu'
import
DigitalHumanDialog
from
'./DigitalHumanDialog'
import
AiImageDialog
from
'./AiImageDialog'
import
AiVideoDialog
from
'./AiVideoDialog'
const
dialog
=
Component
=>
props
=>
createElement
(
Component
,
{
editor
:
props
.
runtime
.
editor
})
export
default
defineEditorFeature
({
export
default
defineEditorFeature
({
id
:
'ai-media'
,
id
:
'ai-media'
,
...
@@ -10,4 +16,9 @@ export default defineEditorFeature({
...
@@ -10,4 +16,9 @@ export default defineEditorFeature({
{
order
:
320
,
config
:
AIImage
},
{
order
:
320
,
config
:
AIImage
},
{
order
:
330
,
config
:
AIVideo
},
{
order
:
330
,
config
:
AIVideo
},
],
],
dialogs
:
[
{
id
:
'ai-media.digital-human'
,
component
:
dialog
(
DigitalHumanDialog
)
},
{
id
:
'ai-media.image'
,
component
:
dialog
(
AiImageDialog
)
},
{
id
:
'ai-media.video'
,
component
:
dialog
(
AiVideoDialog
)
},
],
})
})
apps/admin/src/common/wangeditor-customer/features/ai-question/feature.js
浏览文件 @
2129a2d5
import
{
defineEditorFeature
}
from
'../../core/define-editor-feature'
import
{
defineEditorFeature
}
from
'../../core/define-editor-feature'
import
{
createElement
}
from
'react'
import
AIQuestionGapFill
from
'./gap-fill-menu'
import
AIQuestionGapFill
from
'./gap-fill-menu'
import
AIQuestionJudge
from
'./judge-menu'
import
AIQuestionJudge
from
'./judge-menu'
import
AIQuestionMultiple
from
'./multiple-menu'
import
AIQuestionMultiple
from
'./multiple-menu'
import
AIQuestionOpenEnded
from
'./open-ended-menu'
import
AIQuestionOpenEnded
from
'./open-ended-menu'
import
AIQuestionSingle
from
'./single-menu'
import
AIQuestionSingle
from
'./single-menu'
import
AiQuestionDialog
from
'./AiQuestionDialog'
const
dialog
=
props
=>
createElement
(
AiQuestionDialog
,
{
editor
:
props
.
runtime
.
editor
,
action
:
props
.
payload
.
action
})
export
default
defineEditorFeature
({
export
default
defineEditorFeature
({
id
:
'ai-question'
,
id
:
'ai-question'
,
...
@@ -14,4 +18,5 @@ export default defineEditorFeature({
...
@@ -14,4 +18,5 @@ export default defineEditorFeature({
{
order
:
260
,
config
:
AIQuestionGapFill
},
{
order
:
260
,
config
:
AIQuestionGapFill
},
{
order
:
270
,
config
:
AIQuestionOpenEnded
},
{
order
:
270
,
config
:
AIQuestionOpenEnded
},
],
],
dialogs
:
[{
id
:
'ai-question.generate'
,
component
:
dialog
}],
})
})
apps/admin/src/common/wangeditor-customer/features/ai-research/feature.js
浏览文件 @
2129a2d5
import
{
defineEditorFeature
}
from
'../../core/define-editor-feature'
import
{
defineEditorFeature
}
from
'../../core/define-editor-feature'
import
{
createElement
}
from
'react'
import
AIBaiduSearch
from
'./baidu-search-menu'
import
AIBaiduSearch
from
'./baidu-search-menu'
import
AISearch
from
'./search-menu'
import
AISearch
from
'./search-menu'
import
AIWrite
from
'./write-menu'
import
AIWrite
from
'./write-menu'
import
SearchDialog
from
'./SearchDialog'
import
BaiduSearchDialog
from
'./BaiduSearchDialog'
import
AiWriteDialog
from
'./AiWriteDialog'
const
searchDialog
=
props
=>
{
const
Component
=
props
.
payload
.
provider
===
'baidu'
?
BaiduSearchDialog
:
SearchDialog
return
createElement
(
Component
,
{
editor
:
props
.
runtime
.
editor
})
}
const
writeDialog
=
props
=>
createElement
(
AiWriteDialog
,
{
editor
:
props
.
runtime
.
editor
})
export
default
defineEditorFeature
({
export
default
defineEditorFeature
({
id
:
'ai-research'
,
id
:
'ai-research'
,
...
@@ -10,4 +20,8 @@ export default defineEditorFeature({
...
@@ -10,4 +20,8 @@ export default defineEditorFeature({
{
order
:
310
,
config
:
AIWrite
},
{
order
:
310
,
config
:
AIWrite
},
{
order
:
340
,
config
:
AIBaiduSearch
},
{
order
:
340
,
config
:
AIBaiduSearch
},
],
],
dialogs
:
[
{
id
:
'ai-research.search'
,
component
:
searchDialog
},
{
id
:
'ai-research.write'
,
component
:
writeDialog
},
],
})
})
apps/admin/src/common/wangeditor-customer/features/ai-text/feature.js
浏览文件 @
2129a2d5
import
{
defineEditorFeature
}
from
'../../core/define-editor-feature'
import
{
defineEditorFeature
}
from
'../../core/define-editor-feature'
import
{
createElement
}
from
'react'
import
AIChat
from
'./chat-menu'
import
AIChat
from
'./chat-menu'
import
AIContentInspect
from
'./content-inspect-menu'
import
AIContentInspect
from
'./content-inspect-menu'
import
AIExpand
from
'./expand-menu'
import
AIExpand
from
'./expand-menu'
...
@@ -7,6 +8,10 @@ import AIPunctuation from './punctuation-menu'
...
@@ -7,6 +8,10 @@ import AIPunctuation from './punctuation-menu'
import
AIRewrite
from
'./rewrite-menu'
import
AIRewrite
from
'./rewrite-menu'
import
AISummary
from
'./summary-menu'
import
AISummary
from
'./summary-menu'
import
AITranslate
from
'./translate-menu'
import
AITranslate
from
'./translate-menu'
import
AiChatDialog
from
'./AiChatDialog'
import
AiTextDialog
from
'./AiTextDialog'
const
dialog
=
Component
=>
props
=>
createElement
(
Component
,
{
editor
:
props
.
runtime
.
editor
,
action
:
props
.
payload
.
action
})
export
default
defineEditorFeature
({
export
default
defineEditorFeature
({
id
:
'ai-text'
,
id
:
'ai-text'
,
...
@@ -20,4 +25,8 @@ export default defineEditorFeature({
...
@@ -20,4 +25,8 @@ export default defineEditorFeature({
{
order
:
220
,
config
:
AIContentInspect
},
{
order
:
220
,
config
:
AIContentInspect
},
{
order
:
290
,
config
:
AITranslate
},
{
order
:
290
,
config
:
AITranslate
},
],
],
dialogs
:
[
{
id
:
'ai-text.chat'
,
component
:
dialog
(
AiChatDialog
)
},
{
id
:
'ai-text.action'
,
component
:
dialog
(
AiTextDialog
)
},
],
})
})
apps/admin/src/common/wangeditor-customer/features/icon/feature.js
浏览文件 @
2129a2d5
import
{
defineEditorFeature
}
from
'../../core/define-editor-feature'
import
{
defineEditorFeature
}
from
'../../core/define-editor-feature'
import
{
createElement
}
from
'react'
import
menu
from
'./menu'
import
menu
from
'./menu'
import
IconDialog
from
'./IconDialog'
export
default
defineEditorFeature
({
id
:
'icon'
,
menus
:
[{
order
:
360
,
config
:
menu
}]
})
const
dialog
=
props
=>
createElement
(
IconDialog
,
{
editor
:
props
.
runtime
.
editor
})
export
default
defineEditorFeature
({
id
:
'icon'
,
menus
:
[{
order
:
360
,
config
:
menu
}],
dialogs
:
[{
id
:
'icon.insert'
,
component
:
dialog
}],
})
apps/admin/src/common/wangeditor-customer/index.jsx
浏览文件 @
2129a2d5
...
@@ -10,6 +10,8 @@ import { setPracticeRandom } from "@/store/modules/editor";
...
@@ -10,6 +10,8 @@ import { setPracticeRandom } from "@/store/modules/editor";
import
"./utils/jax.less"
;
import
"./utils/jax.less"
;
import
{
Boot
}
from
"@wangeditor/editor"
;
import
{
Boot
}
from
"@wangeditor/editor"
;
import
{
registerEditorFeatures
}
from
"./core/register-editor-features"
;
import
{
registerEditorFeatures
}
from
"./core/register-editor-features"
;
import
{
EditorDialogHost
}
from
"./core/EditorDialogHost"
;
import
{
editorFeatureRegistry
}
from
"./features"
;
import
{
SlateEditor
,
DomEditor
,
SlateElement
,
SlateTransforms
}
from
"@wangeditor/editor"
;
import
{
SlateEditor
,
DomEditor
,
SlateElement
,
SlateTransforms
}
from
"@wangeditor/editor"
;
import
{
Editor
,
Toolbar
}
from
"@wangeditor/editor-for-react"
;
import
{
Editor
,
Toolbar
}
from
"@wangeditor/editor-for-react"
;
...
@@ -991,6 +993,11 @@ const WangEditorCustomer = (props, ref) => {
...
@@ -991,6 +993,11 @@ const WangEditorCustomer = (props, ref) => {
setContent=
{
setContent
}
setContent=
{
setContent
}
/>
/>
</
Modal
>
</
Modal
>
<
EditorDialogHost
editor=
{
editor
}
registry=
{
editorFeatureRegistry
}
runtime=
{
{
editor
,
chapterId
,
bookId
,
gData
,
nowTitle
,
saveContent
,
setContent
}
}
/>
</
div
>
</
div
>
);
);
};
};
...
...
apps/admin/src/common/wangeditor-customer/menu/common/BaseModalMenu.jsx
浏览文件 @
2129a2d5
import
ReactDOM
from
"react-dom/client
"
;
import
{
openEditorDialog
}
from
"../../core/editor-dialog
"
;
import
{
ConfigProvider
,
App
}
from
"antd"
;
const
dialogByMenu
=
{
import
zhCN
from
"antd/locale/zh_CN"
;
AIChat
:
[
'ai-text.chat'
,
{}],
AIRewrite
:
[
'ai-text.action'
,
{
action
:
'rewrite'
}],
AIExpand
:
[
'ai-text.action'
,
{
action
:
'expand'
}],
AISummary
:
[
'ai-text.action'
,
{
action
:
'summary'
}],
AIPolishing
:
[
'ai-text.action'
,
{
action
:
'abbreviate'
}],
AIPunctuation
:
[
'ai-text.action'
,
{
action
:
'punctuation'
}],
AIContentInspect
:
[
'ai-text.action'
,
{
action
:
'contentInspect'
}],
AITranslate
:
[
'ai-text.action'
,
{
action
:
'translate'
}],
AIQuestionSingle
:
[
'ai-question.generate'
,
{
action
:
'1'
}],
AIQuestionMultiple
:
[
'ai-question.generate'
,
{
action
:
'2'
}],
AIQuestionJudge
:
[
'ai-question.generate'
,
{
action
:
'3'
}],
AIQuestionGapFill
:
[
'ai-question.generate'
,
{
action
:
'4'
}],
AIQuestionOpenEnded
:
[
'ai-question.generate'
,
{
action
:
'5'
}],
AIDigitalHuman
:
[
'ai-media.digital-human'
,
{}],
AIImage
:
[
'ai-media.image'
,
{}],
AIVideo
:
[
'ai-media.video'
,
{}],
AISearch
:
[
'ai-research.search'
,
{
provider
:
'search'
}],
AIBaiduSearch
:
[
'ai-research.search'
,
{
provider
:
'baidu'
}],
AIWrite
:
[
'ai-research.write'
,
{}],
Icon
:
[
'icon.insert'
,
{}],
};
export
default
class
BaseModalMenu
{
export
default
class
BaseModalMenu
{
constructor
()
{
constructor
()
{
this
.
tag
=
"button"
;
this
.
tag
=
"button"
;
this
.
$el
=
document
.
createElement
(
"div"
);
document
.
body
.
appendChild
(
this
.
$el
);
this
.
$root
=
ReactDOM
.
createRoot
(
this
.
$el
);
}
}
isActive
()
{
isActive
()
{
return
false
;
// or true
return
false
;
// or true
...
@@ -16,11 +33,9 @@ export default class BaseModalMenu {
...
@@ -16,11 +33,9 @@ export default class BaseModalMenu {
isDisabled
()
{
isDisabled
()
{
return
false
;
// or true
return
false
;
// or true
}
}
exec
(
editor
,
value
)
{
exec
(
editor
)
{
this
.
$root
.
render
(
const
request
=
dialogByMenu
[
this
.
constructor
.
name
];
<
ConfigProvider
locale=
{
zhCN
}
theme=
{
{
token
:
{
colorPrimary
:
"#aa1941"
}
}
}
>
if
(
!
request
)
return
;
<
App
>
{
value
}
</
App
>
openEditorDialog
(
editor
,
request
[
0
],
request
[
1
]);
</
ConfigProvider
>,
);
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论