提交 3333b5da authored 作者: 钟是志's avatar 钟是志

一站式wangEditor组件开发

上级 c93df65a
......@@ -3077,6 +3077,7 @@ export default class tableCom extends Component {
})(<WangEditor json={json}
dataColumn={dataColumn}
disabled={disabled}
uuid={this.props.uuid}
/>);
break;
......
import React, { useState, useEffect, forwardRef } from 'react';
import WangEditor from './OneStopWangEditor';
function Index({ onChange, value, otherProps, dataColumn, disabled, json }) {
function Index({ onChange, value, otherProps, dataColumn, disabled, json, uuid }) {
const [ready, setReady] = useState(false);
const domKey = dataColumn.base52 || 'wang-editor-dom-content';
const domKey = uuid || 'wang-editor-dom-content';
useEffect(() => {
let dom = document.getElementById(`wangEditor${domKey}`);
let dom = document.getElementById(`wangEditor-${domKey}`);
if(dom && dom.parentNode){
dom.parentNode.removeChild(dom);
}
......@@ -15,6 +15,10 @@ function Index({ onChange, value, otherProps, dataColumn, disabled, json }) {
if(!ready){
return null;
}
if(disabled){
return <div dangerouslySetInnerHTML={{__html: value}}></div>
}
return (
<WangEditor
key={'cmsContent'}
......@@ -23,7 +27,7 @@ function Index({ onChange, value, otherProps, dataColumn, disabled, json }) {
placeholder={json.placeholder || ''}
height={otherProps?.height || 450}
value={value || ''}
domKey={dataColumn.base52 || 'wang-editor-dom-content'}
domKey={domKey}
onChangeValue={onChange}
/>
);
......@@ -31,7 +35,8 @@ function Index({ onChange, value, otherProps, dataColumn, disabled, json }) {
export default forwardRef((props, _ref) => {
let otherProps = {};
if(!props.json || typeof props.json.initialValue === 'undefined'){
// console.log(props);
if(!props.uuid){
return <div></div>;
}
if (props.json?.otherProps) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论