weaver_trunk_cli/pc4mobx/prj/components/portal/edit/index.js

51 lines
2.1 KiB
JavaScript

/*
* @Author: lusx
* @Date: 2020-03-12 15:33:18
* @Last Modified by: lusx
* @Last Modified time: 2020-04-21 14:57:29
*/
import React from 'react';
import { Row } from "antd";
import { WeaRichText, WeaNewScroll } from "ecCom";
import { ckConfig, bottomBarRight, bottomBarConfig } from "./config.js";
import { toJS } from "mobx"
export default class Edit extends React.Component {
render() {
const { visibleDialog, exchangeList={}, showRich, showRichfun, richPlaceholder, setIsCreate, canSubmit } = this.props;
const barConfig = visibleDialog ? "complex" : "simple";
if (showRich || visibleDialog) {
const { transfStr, richChange, richSubmitfun, showDialogfun, richid, loading, value } = this.props;
return (
<div>
<WeaRichText ecId={`${this && this.props && this.props.ecId || ''}_WeaRichText@tglw6d`}
richid={richid}
ref={(richtext) => (this.richtext = richtext)}
ckConfig={ckConfig(visibleDialog)}
bottomBarConfig={bottomBarConfig({ exchangeList, type: barConfig }, this.showDialogfun)}
bottomBarRight={!visibleDialog && bottomBarRight(richSubmitfun,loading, (bool) => showRichfun(bool))}
onChange={(text) => richChange(text)}
onToolsChange={(name, ids, list, type) => transfStr(name, ids, list, type, 'create')}
value={value}
/>
</div>
)
} else {
return (
<div className={canSubmit?'writeDiv writeDiv1':'writeDiv'} onClick={() => {
if(canSubmit){
showRichfun(true);
setIsCreate(true);
}
}}>
<i class="icon-coms-edit"></i>&nbsp;{richPlaceholder}
</div>
)
}
}
showDialogfun = () => {
const { showDialogfun, showRichfun } = this.props;
showDialogfun(true);
showRichfun(false);
}
}