This commit is contained in:
Wang Kejun 2023-07-03 11:45:08 +08:00
parent a24fca334a
commit 3b30154048
3 changed files with 19 additions and 26 deletions

View File

@ -9,9 +9,7 @@ exports.default = OakComponent({
content: 1, content: 1,
articleMenu: { articleMenu: {
id: 1, id: 1,
}, }
entity: 1,
entityId: 1,
}, },
formData: function (_a) { formData: function (_a) {
var article = _a.data, features = _a.features; var article = _a.data, features = _a.features;
@ -19,8 +17,6 @@ exports.default = OakComponent({
id: article === null || article === void 0 ? void 0 : article.id, id: article === null || article === void 0 ? void 0 : article.id,
content: article === null || article === void 0 ? void 0 : article.content, content: article === null || article === void 0 ? void 0 : article.content,
name: article === null || article === void 0 ? void 0 : article.name, name: article === null || article === void 0 ? void 0 : article.name,
// entity: article?.entity,
// entityId: article?.entityId,
}; };
}, },
// listeners: { // listeners: {

View File

@ -16,8 +16,6 @@ export default OakComponent({
id: article?.id, id: article?.id,
content: article?.content, content: article?.content,
name: article?.name, name: article?.name,
// entity: article?.entity,
// entityId: article?.entityId,
}; };
}, },
// listeners: { // listeners: {

View File

@ -2,11 +2,10 @@ import React from 'react';
import Style from './web.module.less'; import Style from './web.module.less';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { Editor } from "@wangeditor/editor-for-react"; import { Editor } from '@wangeditor/editor-for-react';
import { IEditorConfig } from "@wangeditor/editor"; import { IEditorConfig } from '@wangeditor/editor';
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
export default function Render( export default function Render(
props: WebComponentProps< props: WebComponentProps<
EntityDict, EntityDict,
@ -28,16 +27,16 @@ export default function Render(
) { ) {
const { id, name, editor, title, content } = props.data; const { id, name, editor, title, content } = props.data;
const editorConfig: Partial<IEditorConfig> = { const editorConfig: Partial<IEditorConfig> = {
readOnly: true, readOnly: true,
autoFocus: true, autoFocus: true,
scroll: false, scroll: false,
}; };
const [value, setValue] = useState(''); const [value, setValue] = useState('');
useEffect(() => { useEffect(() => {
if(content) { if (content) {
setValue(content) setValue(content);
} }
},[content]); }, [content]);
return ( return (
<div className={Style.container}> <div className={Style.container}>
<div className={Style.content}> <div className={Style.content}>
@ -48,15 +47,15 @@ export default function Render(
{/* <div className={Style.authorContainer}> {/* <div className={Style.authorContainer}>
<span className={Style.author}>{author}</span> <span className={Style.author}>{author}</span>
</div> */} </div> */}
<div id="article-content" style={{width:"100%"}}> <div id="article-content" style={{ width: '100%' }}>
<Editor <Editor
defaultConfig={editorConfig} defaultConfig={editorConfig}
value={value} value={value}
mode="default" mode="default"
style={{ style={{
width: '100%' width: '100%',
}} }}
/> />
</div> </div>
</div> </div>
</div> </div>