This commit is contained in:
caishi 2020-04-29 11:55:40 +08:00
parent a38ba5c7e2
commit 59edb107ee
6 changed files with 20 additions and 53 deletions

View File

@ -4403,9 +4403,9 @@ window._whenPasterDoUpload = function (event, action, callback) {
// 读取该图片 // 读取该图片
var file = item.getAsFile(); var file = item.getAsFile();
var oMyForm = new FormData(); var oMyForm = new FormData();
oMyForm.append("file", file); oMyForm.append("editormd-image-file", file);
// oMyForm.append("file_param_name", "editormd-image-file"); oMyForm.append("file_param_name", "editormd-image-file");
// oMyForm.append("byxhr", "true"); oMyForm.append("byxhr", "true");
var xhr = new window.XMLHttpRequest(); var xhr = new window.XMLHttpRequest();
xhr.addEventListener("load", xhr.addEventListener("load",
function (_xhr) { function (_xhr) {

View File

@ -127,11 +127,10 @@ class MessageCount extends Component{
this.setState({ this.setState({
showFiles: false, showFiles: false,
quillFlag:false, quillFlag:false,
commentsContent:undefined commentsContent:''
}) })
this.getjournalslist(page, limit); this.getjournalslist(page, limit);
this.props.showNotification("评论成功!"); this.props.showNotification("评论成功!");
// this.UploadFunc(undefined)
} }
}).catch(error=>{ }).catch(error=>{
console.log(error); console.log(error);

View File

@ -110,7 +110,7 @@ class UpdateMerge extends Component{
onContentChange=(value)=>{ onContentChange=(value)=>{
this.setState({ this.setState({
textcount:JSON.stringify(value) textcount:value
}) })
} }
changmodelname=(e)=>{ changmodelname=(e)=>{
@ -118,11 +118,6 @@ class UpdateMerge extends Component{
subject:e.target.value subject:e.target.value
}) })
} }
// changmodelcount=(e)=>{
// this.setState({
// textcount:e.target.value
// })
// }
stringJson=(value) =>{ stringJson=(value) =>{
let _value = null; let _value = null;
@ -156,7 +151,7 @@ class UpdateMerge extends Component{
this.props.form.validateFieldsAndScroll((err, values) => { this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){ if(!err){
const { projectsId , mergeId } = this.props.match.params; const { projectsId , mergeId } = this.props.match.params;
const { subject ,data , textcount } = this.state; const { data , textcount } = this.state;
const url = `/projects/${projectsId}/pull_requests/${mergeId}.json`; const url = `/projects/${projectsId}/pull_requests/${mergeId}.json`;
@ -178,6 +173,9 @@ class UpdateMerge extends Component{
}).then(result=>{ }).then(result=>{
if(result){ if(result){
this.props.history.push(`/projects/${projectsId}/merge`); this.props.history.push(`/projects/${projectsId}/merge`);
this.setState({
textcount:''
})
} }
}).catch(error=>{ }).catch(error=>{
console.log(error); console.log(error);
@ -214,7 +212,7 @@ class UpdateMerge extends Component{
)} )}
</Form.Item> </Form.Item>
<MDEditor placeholder={'请输入合并请求的描述...'} height={200} <MDEditor placeholder={'请输入合并请求的描述...'} height={200}
mdID={`orderdetail-add-description`} initValue={textcount} onChange={this.textcount} ></MDEditor> mdID={`orderdetail-add-description`} initValue={textcount} onChange={this.onContentChange} ></MDEditor>
<UploadComponent load={this.UploadFunc} showNotification={this.props.showNotification} isComplete={true} ></UploadComponent> <UploadComponent load={this.UploadFunc} showNotification={this.props.showNotification} isComplete={true} ></UploadComponent>
{ {
get_attachments ? get_attachments ?

View File

@ -6,20 +6,12 @@ import Nav from './Nav';
import UploadComponent from '../Upload/Index'; import UploadComponent from '../Upload/Index';
import { getImageUrl } from 'educoder'; import { getImageUrl } from 'educoder';
import{ Modal ,Form , Input , Select } from 'antd'; import{ Modal ,Form , Input , Select } from 'antd';
import QuillForEditor from '../quillForEditor'; import MDEditor from '../../modules/tpm/challengesnew/tpm-md-editor';
import { QuillDeltaToHtmlConverter } from 'quill-delta-to-html'
import Attachments from '../Upload/attachment' import Attachments from '../Upload/attachment'
const Option = Select.Option; const Option = Select.Option;
const options = [
['bold', 'italic', 'underline'],
[{header: [1,2,3,false]}],
['blockquote', 'code-block'],
['link', 'image'],
['formula']
];
class CopyDetail extends Component{ class CopyDetail extends Component{
constructor(props){ constructor(props){
super(props); super(props);
@ -179,18 +171,12 @@ class CopyDetail extends Component{
values.assigned_to_id = "" values.assigned_to_id = ""
} }
const { textcount } = this.state; const { textcount } = this.state;
let _html = '';
try {
_html = new QuillDeltaToHtmlConverter(textcount.ops, {}).convert();
} catch (error) {
console.log(error);
}
axios.put(url,{ axios.put(url,{
project_id:projectsId, project_id:projectsId,
subject:subject, subject:subject,
id: orderId, id: orderId,
description:_html, description:textcount,
attachment_ids:fileList, attachment_ids:fileList,
...values ...values
}).then(result=>{ }).then(result=>{
@ -235,27 +221,9 @@ class CopyDetail extends Component{
)} )}
</Form.Item> </Form.Item>
<div className="quillContent" style={{marginBottom:"20px"}}> <div className="quillContent" style={{marginBottom:"20px"}}>
<QuillForEditor
value = {this.stringJson(textcount)}
wrapStyle={{
height: '220px',
opacity:1,
}}
// autoFocus={true}
style={{ height: '170px' }}
placeholder="请输入任务的描述..."
options={options}
onContentChange={this.onContentChange}
/>
</div> </div>
{/* <Form.Item> <MDEditor placeholder={'请输入任务的描述...'} height={200}
{getFieldDecorator('description', { mdID={'order-copy-description'} initValue={textcount} onChange={this.onContentChange} ></MDEditor>
rules: [],
initialValue: textcount
})(
<TextArea placeholder="请输入任务的描述..." style={{height: "300px"}} onChange={this.changmodelcount}/>
)}
</Form.Item> */}
<UploadComponent load={this.UploadFunc} <UploadComponent load={this.UploadFunc}
showNotification={this.props.showNotification} isComplete={true} ></UploadComponent> showNotification={this.props.showNotification} isComplete={true} ></UploadComponent>
{ {

View File

@ -119,6 +119,9 @@ class New extends Component{
if(result){ if(result){
this.props.showNotification("任务创建成功!"); this.props.showNotification("任务创建成功!");
this.props.history.push(`/projects/${projectsId}/orders`); this.props.history.push(`/projects/${projectsId}/orders`);
this.setState({
description:''
})
} }
}).catch(error=>{ }).catch(error=>{
console.log(error); console.log(error);

View File

@ -211,8 +211,7 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
useEffect(() => { useEffect(() => {
if (editorInstance && initValue !== undefined) { if (editorInstance && initValue !== undefined) {
if (initValue && initValue != editorInstance.getValue()) { if (initValue != null && initValue != editorInstance.getValue()) {
console.log(initValue)
editorInstance.setValue(initValue.toString()) editorInstance.setValue(initValue.toString())
} }
} }
@ -258,8 +257,8 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
return ( return (
<Fragment> <Fragment>
<div ref={editorEl} className={`df ${className} ${imageExpand && 'editormd-image-click-expand'}`} > <div ref={editorEl} className={`df ${className} ${imageExpand && 'editormd-image-click-expand'} `} >
<div className={`edu-back-greyf5 radius4 ${error ? 'error' : ''}`} id={containerId} > <div className={`edu-back-greyf5 radius4 editormd ${error ? 'error' : ''}`} id={containerId} >
<textarea style={{ display: 'none' }} id={editorBodyId} name="content"></textarea> <textarea style={{ display: 'none' }} id={editorBodyId} name="content"></textarea>
<div className="CodeMirror cm-s-defualt"></div> <div className="CodeMirror cm-s-defualt"></div>
</div> </div>