forked from Gitlink/forgeplus-react
This commit is contained in:
parent
a38ba5c7e2
commit
59edb107ee
|
@ -4403,9 +4403,9 @@ window._whenPasterDoUpload = function (event, action, callback) {
|
|||
// 读取该图片
|
||||
var file = item.getAsFile();
|
||||
var oMyForm = new FormData();
|
||||
oMyForm.append("file", file);
|
||||
// oMyForm.append("file_param_name", "editormd-image-file");
|
||||
// oMyForm.append("byxhr", "true");
|
||||
oMyForm.append("editormd-image-file", file);
|
||||
oMyForm.append("file_param_name", "editormd-image-file");
|
||||
oMyForm.append("byxhr", "true");
|
||||
var xhr = new window.XMLHttpRequest();
|
||||
xhr.addEventListener("load",
|
||||
function (_xhr) {
|
||||
|
|
|
@ -127,11 +127,10 @@ class MessageCount extends Component{
|
|||
this.setState({
|
||||
showFiles: false,
|
||||
quillFlag:false,
|
||||
commentsContent:undefined
|
||||
commentsContent:''
|
||||
})
|
||||
this.getjournalslist(page, limit);
|
||||
this.props.showNotification("评论成功!");
|
||||
// this.UploadFunc(undefined)
|
||||
}
|
||||
}).catch(error=>{
|
||||
console.log(error);
|
||||
|
|
|
@ -110,7 +110,7 @@ class UpdateMerge extends Component{
|
|||
|
||||
onContentChange=(value)=>{
|
||||
this.setState({
|
||||
textcount:JSON.stringify(value)
|
||||
textcount:value
|
||||
})
|
||||
}
|
||||
changmodelname=(e)=>{
|
||||
|
@ -118,11 +118,6 @@ class UpdateMerge extends Component{
|
|||
subject:e.target.value
|
||||
})
|
||||
}
|
||||
// changmodelcount=(e)=>{
|
||||
// this.setState({
|
||||
// textcount:e.target.value
|
||||
// })
|
||||
// }
|
||||
stringJson=(value) =>{
|
||||
let _value = null;
|
||||
|
||||
|
@ -156,7 +151,7 @@ class UpdateMerge extends Component{
|
|||
this.props.form.validateFieldsAndScroll((err, values) => {
|
||||
if(!err){
|
||||
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`;
|
||||
|
||||
|
||||
|
@ -178,6 +173,9 @@ class UpdateMerge extends Component{
|
|||
}).then(result=>{
|
||||
if(result){
|
||||
this.props.history.push(`/projects/${projectsId}/merge`);
|
||||
this.setState({
|
||||
textcount:''
|
||||
})
|
||||
}
|
||||
}).catch(error=>{
|
||||
console.log(error);
|
||||
|
@ -214,7 +212,7 @@ class UpdateMerge extends Component{
|
|||
)}
|
||||
</Form.Item>
|
||||
<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>
|
||||
{
|
||||
get_attachments ?
|
||||
|
|
|
@ -6,20 +6,12 @@ import Nav from './Nav';
|
|||
import UploadComponent from '../Upload/Index';
|
||||
import { getImageUrl } from 'educoder';
|
||||
import{ Modal ,Form , Input , Select } from 'antd';
|
||||
import QuillForEditor from '../quillForEditor';
|
||||
import { QuillDeltaToHtmlConverter } from 'quill-delta-to-html'
|
||||
import MDEditor from '../../modules/tpm/challengesnew/tpm-md-editor';
|
||||
import Attachments from '../Upload/attachment'
|
||||
|
||||
const Option = Select.Option;
|
||||
|
||||
|
||||
const options = [
|
||||
['bold', 'italic', 'underline'],
|
||||
[{header: [1,2,3,false]}],
|
||||
['blockquote', 'code-block'],
|
||||
['link', 'image'],
|
||||
['formula']
|
||||
];
|
||||
class CopyDetail extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
|
@ -179,18 +171,12 @@ class CopyDetail extends Component{
|
|||
values.assigned_to_id = ""
|
||||
}
|
||||
const { textcount } = this.state;
|
||||
let _html = '';
|
||||
try {
|
||||
_html = new QuillDeltaToHtmlConverter(textcount.ops, {}).convert();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
axios.put(url,{
|
||||
project_id:projectsId,
|
||||
subject:subject,
|
||||
id: orderId,
|
||||
description:_html,
|
||||
description:textcount,
|
||||
attachment_ids:fileList,
|
||||
...values
|
||||
}).then(result=>{
|
||||
|
@ -235,27 +221,9 @@ class CopyDetail extends Component{
|
|||
)}
|
||||
</Form.Item>
|
||||
<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>
|
||||
{/* <Form.Item>
|
||||
{getFieldDecorator('description', {
|
||||
rules: [],
|
||||
initialValue: textcount
|
||||
})(
|
||||
<TextArea placeholder="请输入任务的描述..." style={{height: "300px"}} onChange={this.changmodelcount}/>
|
||||
)}
|
||||
</Form.Item> */}
|
||||
<MDEditor placeholder={'请输入任务的描述...'} height={200}
|
||||
mdID={'order-copy-description'} initValue={textcount} onChange={this.onContentChange} ></MDEditor>
|
||||
<UploadComponent load={this.UploadFunc}
|
||||
showNotification={this.props.showNotification} isComplete={true} ></UploadComponent>
|
||||
{
|
||||
|
|
|
@ -119,6 +119,9 @@ class New extends Component{
|
|||
if(result){
|
||||
this.props.showNotification("任务创建成功!");
|
||||
this.props.history.push(`/projects/${projectsId}/orders`);
|
||||
this.setState({
|
||||
description:''
|
||||
})
|
||||
}
|
||||
}).catch(error=>{
|
||||
console.log(error);
|
||||
|
|
|
@ -211,8 +211,7 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
|||
|
||||
useEffect(() => {
|
||||
if (editorInstance && initValue !== undefined) {
|
||||
if (initValue && initValue != editorInstance.getValue()) {
|
||||
console.log(initValue)
|
||||
if (initValue != null && initValue != editorInstance.getValue()) {
|
||||
editorInstance.setValue(initValue.toString())
|
||||
}
|
||||
}
|
||||
|
@ -258,8 +257,8 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
|||
|
||||
return (
|
||||
<Fragment>
|
||||
<div ref={editorEl} className={`df ${className} ${imageExpand && 'editormd-image-click-expand'}`} >
|
||||
<div className={`edu-back-greyf5 radius4 ${error ? 'error' : ''}`} id={containerId} >
|
||||
<div ref={editorEl} className={`df ${className} ${imageExpand && 'editormd-image-click-expand'} `} >
|
||||
<div className={`edu-back-greyf5 radius4 editormd ${error ? 'error' : ''}`} id={containerId} >
|
||||
<textarea style={{ display: 'none' }} id={editorBodyId} name="content"></textarea>
|
||||
<div className="CodeMirror cm-s-defualt"></div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue