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

View File

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

View File

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