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

chore: 新增AI菜单

上级 22e56e27
...@@ -45,7 +45,13 @@ import AISummary from './menu/AISummary' ...@@ -45,7 +45,13 @@ import AISummary from './menu/AISummary'
import AIPolishing from './menu/AIPolishing' import AIPolishing from './menu/AIPolishing'
import AIPunctuation from './menu/AIPunctuation' import AIPunctuation from './menu/AIPunctuation'
import AIContentInspect from './menu/AIContentInspect' import AIContentInspect from './menu/AIContentInspect'
import AIQuestionSingle from './menu/AIQuestionSingle'
import AIQuestionMultiple from './menu/AIQuestionMultiple'
import AIQuestionJudge from './menu/AIQuestionJudge'
import AIQuestionGapFill from './menu/AIQuestionGapFill'
import AIQuestionOpenEnded from './menu/AIQuestionOpenEnded'
import AIDigitalHuman from './menu/AIDigitalHuman' import AIDigitalHuman from './menu/AIDigitalHuman'
import AITranslate from './menu/AITranslate'
import ImageModal from './components/image' import ImageModal from './components/image'
import VideoModal from './components/video' import VideoModal from './components/video'
...@@ -104,7 +110,13 @@ const module = { ...@@ -104,7 +110,13 @@ const module = {
AIPolishing, AIPolishing,
AIPunctuation, AIPunctuation,
AIContentInspect, AIContentInspect,
AIDigitalHuman AIQuestionSingle,
AIQuestionMultiple,
AIQuestionJudge,
AIQuestionGapFill,
AIQuestionOpenEnded,
AIDigitalHuman,
AITranslate
] ]
} }
Boot.registerModule(module) Boot.registerModule(module)
...@@ -341,7 +353,14 @@ const WangEditorCustomer = (props, ref) => { ...@@ -341,7 +353,14 @@ const WangEditorCustomer = (props, ref) => {
'AIPunctuation', 'AIPunctuation',
'AIContentInspect', 'AIContentInspect',
'|', '|',
'AIDigitalHuman' 'AIQuestionSingle',
'AIQuestionMultiple',
'AIQuestionJudge',
'AIQuestionGapFill',
'AIQuestionOpenEnded',
'|',
'AIDigitalHuman',
'AITranslate'
] ]
} }
...@@ -408,7 +427,7 @@ const WangEditorCustomer = (props, ref) => { ...@@ -408,7 +427,7 @@ const WangEditorCustomer = (props, ref) => {
const editorToolbar = document.querySelector('.editor-toolbar-container') const editorToolbar = document.querySelector('.editor-toolbar-container')
// 设置菜单模块标题 // 设置菜单模块标题
const dividerElements = editorToolbar.querySelectorAll('.w-e-bar-divider') const dividerElements = editorToolbar.querySelectorAll('.w-e-bar-divider')
const dividerTitles = ['常用格式', '媒体资源', '高级模块', 'AI辅助', 'AI数字人'] const dividerTitles = ['常用格式', '媒体资源', '高级模块', 'AI文本辅助', 'AI试题辅助', '更多AI功能']
dividerElements.forEach((element, index) => { dividerElements.forEach((element, index) => {
element.innerHTML = dividerTitles[index] element.innerHTML = dividerTitles[index]
}) })
...@@ -643,15 +662,27 @@ const WangEditorCustomer = (props, ref) => { ...@@ -643,15 +662,27 @@ const WangEditorCustomer = (props, ref) => {
<div className="img"> <div className="img">
<img src={timesave} /> <span>自动保存</span> <img src={timesave} /> <span>自动保存</span>
</div> </div>
<span className="time">{autosaveTime > 0 ? `上次保存发生在 ${dayjs(autosaveTime).format('YYYY-MM-DD HH:mm:ss')}` : ''}</span> <span className="time">
{autosaveTime > 0 ? `上次保存发生在 ${dayjs(autosaveTime).format('YYYY-MM-DD HH:mm:ss')}` : ''}
</span>
</div> </div>
<Button type="primary" icon={<SaveOutlined />} className="view" onClick={saveContent} style={{ color: '#fff' }} disabled={disabled || !contentId}> <Button
type="primary"
icon={<SaveOutlined />}
className="view"
onClick={saveContent}
style={{ color: '#fff' }}
disabled={disabled || !contentId}>
保存 保存
</Button> </Button>
<Button icon={<EyeOutlined />} className="history" onClick={previewIt} disabled={!contentId}> <Button icon={<EyeOutlined />} className="history" onClick={previewIt} disabled={!contentId}>
预览 预览
</Button> </Button>
<Button icon={<HistoryOutlined />} className="history" onClick={historyIt} disabled={disabled || !contentId}> <Button
icon={<HistoryOutlined />}
className="history"
onClick={historyIt}
disabled={disabled || !contentId}>
历史 历史
</Button> </Button>
</Space> </Space>
...@@ -674,7 +705,10 @@ const WangEditorCustomer = (props, ref) => { ...@@ -674,7 +705,10 @@ const WangEditorCustomer = (props, ref) => {
tabsMenu.length && tabsMenu.length &&
tabsMenu.map(item => { tabsMenu.map(item => {
return ( return (
<div className={`tabs-item ${item.key === tabKey ? 'active' : ''}`} key={item.key} onClick={() => tabKeyChange(item.key)}> <div
className={`tabs-item ${item.key === tabKey ? 'active' : ''}`}
key={item.key}
onClick={() => tabKeyChange(item.key)}>
{item.title} {item.title}
<span></span> <span></span>
</div> </div>
...@@ -684,7 +718,11 @@ const WangEditorCustomer = (props, ref) => { ...@@ -684,7 +718,11 @@ const WangEditorCustomer = (props, ref) => {
<div className="menu-tabs-content"> <div className="menu-tabs-content">
{tabKey === 'text' && ( {tabKey === 'text' && (
<div ref={toolbarRef} className="toolbox-parent"> <div ref={toolbarRef} className="toolbox-parent">
<Toolbar editor={editor} defaultConfig={toolbarConfig} mode="default" className="editor-toolbar-container"></Toolbar> <Toolbar
editor={editor}
defaultConfig={toolbarConfig}
mode="default"
className="editor-toolbar-container"></Toolbar>
</div> </div>
)} )}
{tabKey === 'style' && ( {tabKey === 'style' && (
...@@ -722,7 +760,14 @@ const WangEditorCustomer = (props, ref) => { ...@@ -722,7 +760,14 @@ const WangEditorCustomer = (props, ref) => {
}} }}
maskClosable={false} maskClosable={false}
onCancel={() => setImageVisible(false)}> onCancel={() => setImageVisible(false)}>
<ImageModal ref={imageRef} isOnline={isOnline} editor={editor} setImageVisible={setImageVisible} imageInfo={imageInfo} setImageInfo={setImageInfo} /> <ImageModal
ref={imageRef}
isOnline={isOnline}
editor={editor}
setImageVisible={setImageVisible}
imageInfo={imageInfo}
setImageInfo={setImageInfo}
/>
</Modal> </Modal>
<VideoModal ref={videoRef} editor={editor} /> <VideoModal ref={videoRef} editor={editor} />
<Modal <Modal
...@@ -765,7 +810,13 @@ const WangEditorCustomer = (props, ref) => { ...@@ -765,7 +810,13 @@ const WangEditorCustomer = (props, ref) => {
}} }}
maskClosable={false} maskClosable={false}
onCancel={() => setTitleVisible(false)}> onCancel={() => setTitleVisible(false)}>
<ChapterTitleModal ref={chapterTitleRef} editor={editor} setTitleVisible={setTitleVisible} titleInfo={titleInfo} setTitleInfo={setTitleInfo} /> <ChapterTitleModal
ref={chapterTitleRef}
editor={editor}
setTitleVisible={setTitleVisible}
titleInfo={titleInfo}
setTitleInfo={setTitleInfo}
/>
</Modal> </Modal>
<Modal <Modal
...@@ -804,7 +855,13 @@ const WangEditorCustomer = (props, ref) => { ...@@ -804,7 +855,13 @@ const WangEditorCustomer = (props, ref) => {
}} }}
maskClosable={false} maskClosable={false}
onCancel={() => setPracticeOpenVisible(false)}> onCancel={() => setPracticeOpenVisible(false)}>
<PracticeModal ref={practiceRef} chapterId={chapterId} bookId={bookId} editor={editor} setPracticeOpenVisible={setPracticeOpenVisible} /> <PracticeModal
ref={practiceRef}
chapterId={chapterId}
bookId={bookId}
editor={editor}
setPracticeOpenVisible={setPracticeOpenVisible}
/>
</Modal> </Modal>
<FormulaModal ref={formulaRef} editor={editor} /> <FormulaModal ref={formulaRef} editor={editor} />
...@@ -924,7 +981,14 @@ const WangEditorCustomer = (props, ref) => { ...@@ -924,7 +981,14 @@ const WangEditorCustomer = (props, ref) => {
wrapClassName="wrap-phone-privew" wrapClassName="wrap-phone-privew"
width="494px" width="494px"
onCancel={() => setPreviewVisible(false)}> onCancel={() => setPreviewVisible(false)}>
<PreviewModal ref={previewRef} gData={gData} editor={editor} chapterId={chapterId} bookId={bookId} nowTitle={nowTitle} /> <PreviewModal
ref={previewRef}
gData={gData}
editor={editor}
chapterId={chapterId}
bookId={bookId}
nowTitle={nowTitle}
/>
</Modal> </Modal>
{/* 历史 */} {/* 历史 */}
......
// Extend menu
class AIQuestionGapFill {
constructor() {
this.title = '填空题'
this.iconSvg = `<svg t="1729144440391" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2554" width="200" height="200"><path d="M36.571429 759.222857a36.571429 36.571429 0 0 1 36.571428 36.571429V877.714286a25.6 25.6 0 0 0 25.6 25.6h826.514286A25.6 25.6 0 0 0 950.857143 877.714286v-81.92a36.571429 36.571429 0 0 1 73.142857 0v109.714285a73.142857 73.142857 0 0 1-73.142857 73.142858H73.142857a73.142857 73.142857 0 0 1-73.142857-73.142858v-109.714285a36.571429 36.571429 0 0 1 36.571429-36.571429" fill="#333333" p-id="2555"></path><path d="M833.828571 381.074286L716.068571 253.074286 365.714286 566.857143l-73.142857 172.617143a10.971429 10.971429 0 0 0 13.165714 15.36l177.005714-57.051429zM950.857143 260.388571L851.382857 146.285714a13.165714 13.165714 0 0 0-17.554286 0L731.428571 236.251429 852.114286 365.714286 950.857143 276.48a12.434286 12.434286 0 0 0 0-16.822857z" fill="#333333" p-id="2556"></path></svg>`
this.tag = 'button'
}
getValue() {
return 'hello, 音频'
}
isActive() {
return false
}
isDisabled() {
return true
}
exec() {
return
}
}
export default {
key: 'AIQuestionGapFill',
factory() {
return new AIQuestionGapFill()
}
}
// Extend menu
class AIQuestionJudge {
constructor() {
this.title = '判断题'
this.iconSvg = `<svg t="1729144392928" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1561" width="200" height="200"><path d="M751.2 672.4l79.6-79.6c14.1-14.6 35-20.5 54.7-15.3s35 20.5 40.2 40.2-0.7 40.6-15.3 54.7L830.7 752l79.6 79.6c14.6 14.1 20.5 35 15.3 54.7-5.1 19.7-20.5 35-40.2 40.2s-40.6-0.7-54.7-15.3l-79.5-79.7-79.6 79.6c-22.1 21.3-57.2 21-78.9-0.7-21.7-21.7-22-56.8-0.7-78.9l79.6-79.6-79.6-79.6c-21.3-22.1-21-57.2 0.7-78.9 21.7-21.7 56.8-22 78.9-0.7l79.6 79.7zM273.6 354.1l199-199c14.1-15 35.1-21.1 55-16 19.9 5.1 35.4 20.6 40.5 40.5s-1 41-16 55l-198.9 199-39.8 39.8c-22 22-57.6 22-79.6 0L114.5 354.1c-22-22-22-57.6-0.1-79.6s57.6-22 79.6-0.1l79.6 79.7zM114.5 831.5l716.2-716.2c14.1-14.6 35-20.5 54.7-15.3s35 20.5 40.2 40.2-0.7 40.6-15.3 54.7L194.1 911.1c-22.1 21.3-57.2 21-78.9-0.7-21.7-21.7-22-56.8-0.7-78.9z" opacity=".45" p-id="1562"></path></svg>`
this.tag = 'button'
}
getValue() {
return 'hello, 音频'
}
isActive() {
return false
}
isDisabled() {
return true
}
exec() {
return
}
}
export default {
key: 'AIQuestionJudge',
factory() {
return new AIQuestionJudge()
}
}
// Extend menu
class AIQuestionMultiple {
constructor() {
this.title = '多选题'
this.iconSvg = `<svg t="1729144537633" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4530" width="200" height="200"><path d="M358.4 256h460.8a51.2 51.2 0 0 1 0 102.4H358.4a51.2 51.2 0 1 1 0-102.4zM204.8 358.4a51.2 51.2 0 1 1 0-102.4 51.2 51.2 0 0 1 0 102.4z m0 204.8a51.2 51.2 0 1 1 0-102.4 51.2 51.2 0 0 1 0 102.4z m153.6-102.4h460.8a51.2 51.2 0 0 1 0 102.4H358.4a51.2 51.2 0 0 1 0-102.4z m0 204.8h460.8a51.2 51.2 0 0 1 0 102.4H358.4a51.2 51.2 0 0 1 0-102.4z" fill="#4C4C4C" p-id="4531"></path><path d="M204.8 51.2a153.6 153.6 0 0 0-153.6 153.6v614.4a153.6 153.6 0 0 0 153.6 153.6h614.4a153.6 153.6 0 0 0 153.6-153.6V204.8a153.6 153.6 0 0 0-153.6-153.6H204.8z m0-51.2h614.4a204.8 204.8 0 0 1 204.8 204.8v614.4a204.8 204.8 0 0 1-204.8 204.8H204.8a204.8 204.8 0 0 1-204.8-204.8V204.8a204.8 204.8 0 0 1 204.8-204.8z" fill="#4C4C4C" p-id="4532"></path></svg>`
this.tag = 'button'
}
getValue() {
return 'hello, 音频'
}
isActive() {
return false
}
isDisabled() {
return true
}
exec() {
return
}
}
export default {
key: 'AIQuestionMultiple',
factory() {
return new AIQuestionMultiple()
}
}
// Extend menu
class AIQuestionOpenEnded {
constructor() {
this.title = '问答题'
this.iconSvg = `<svg t="1729144572074" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5526" width="200" height="200"><path d="M847.36 116.363636c33.28 0 60.276364 26.996364 60.276364 60.276364v670.72c0 33.28-26.996364 60.276364-60.276364 60.276364H176.64c-33.28 0-60.276364-26.996364-60.276364-60.276364V176.64c0-33.28 26.996364-60.276364 60.276364-60.276364h670.72z m3.397818 62.045091H178.408727v672.349091h672.349091V178.408727z m-253.44 129.303273v39.842909h-60.322909v318.557091h60.322909v39.842909H416.302545v-39.842909h60.369455V347.554909H416.302545V307.665455h181.061819z" fill="#333333" p-id="5527"></path></svg>`
this.tag = 'button'
}
getValue() {
return 'hello, 音频'
}
isActive() {
return false
}
isDisabled() {
return true
}
exec() {
return
}
}
export default {
key: 'AIQuestionOpenEnded',
factory() {
return new AIQuestionOpenEnded()
}
}
// Extend menu
class AIQuestionSingle {
constructor() {
this.title = '单选题'
this.iconSvg = `<svg t="1729144137119" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1521" width="200" height="200"><path d="M128 76.8c-28.8 0-51.2 22.4-51.2 51.2 0 19.2 9.6 35.2 25.6 44.8 16 9.6 35.2 9.6 51.2 0s25.6-25.6 25.6-44.8c0-28.8-22.4-51.2-51.2-51.2z" p-id="1522"></path><path d="M128 0C57.6 0 0 57.6 0 128s57.6 128 128 128 128-57.6 128-128-57.6-128-128-128z m0 208C83.2 208 48 172.8 48 128S83.2 48 128 48 208 83.2 208 128 172.8 208 128 208zM960 48H448c-35.2 0-64 28.8-64 64v32c0 35.2 28.8 64 64 64h512c35.2 0 64-28.8 64-64v-32c0-35.2-28.8-64-64-64zM128 384c-70.4 0-128 57.6-128 128s57.6 128 128 128 128-57.6 128-128-57.6-128-128-128z m0 208c-44.8 0-80-35.2-80-80s35.2-80 80-80 80 35.2 80 80-35.2 80-80 80zM960 432H448c-35.2 0-64 28.8-64 64v32c0 35.2 28.8 64 64 64h512c35.2 0 64-28.8 64-64v-32c0-35.2-28.8-64-64-64zM128 768c-70.4 0-128 57.6-128 128s57.6 128 128 128 128-57.6 128-128-57.6-128-128-128z m0 208c-44.8 0-80-35.2-80-80s35.2-80 80-80 80 35.2 80 80-35.2 80-80 80zM960 816H448c-35.2 0-64 28.8-64 64v32c0 35.2 28.8 64 64 64h512c35.2 0 64-28.8 64-64v-32c0-35.2-28.8-64-64-64z" p-id="1523"></path></svg>`
this.tag = 'button'
}
getValue() {
return 'hello, 音频'
}
isActive() {
return false
}
isDisabled() {
return true
}
exec() {
return
}
}
export default {
key: 'AIQuestionSingle',
factory() {
return new AIQuestionSingle()
}
}
// Extend menu
class AITranslate {
constructor() {
this.title = '翻译'
this.iconSvg = `<svg fill="#000000" viewBox="0 0 32 32" id="icon" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><defs><style>.cls-1{fill:none;}</style></defs><title>translate</title><path d="M27.85,29H30L24,14H21.65l-6,15H17.8l1.6-4h6.85ZM20.2,23l2.62-6.56L25.45,23Z"></path><path d="M18,7V5H11V2H9V5H2V7H12.74a14.71,14.71,0,0,1-3.19,6.18A13.5,13.5,0,0,1,7.26,9H5.16a16.47,16.47,0,0,0,3,5.58A16.84,16.84,0,0,1,3,18l.75,1.86A18.47,18.47,0,0,0,9.53,16a16.92,16.92,0,0,0,5.76,3.84L16,18a14.48,14.48,0,0,1-5.12-3.37A17.64,17.64,0,0,0,14.8,7Z"></path><rect id="_Transparent_Rectangle_" data-name="<Transparent Rectangle>" class="cls-1" width="32" height="32"></rect></g></svg>`
this.tag = 'button'
}
getValue() {
return 'hello, 音频'
}
isActive() {
return false
}
isDisabled() {
return true
}
exec() {
return
}
}
export default {
key: 'AITranslate',
factory() {
return new AITranslate()
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论