Merge remote-tracking branch 'origin/master'

dev_forum
杨树明 6 years ago
commit 5b1ed94501

@ -1,5 +1,5 @@
import { bytesToSize } from 'educoder'; import { bytesToSize } from 'educoder';
export function markdownToHTML(oldContent) { export function markdownToHTML(oldContent, selector) {
window.$('#md_div').html('') window.$('#md_div').html('')
// markdown to html // markdown to html
var markdwonParser = window.editormd.markdownToHTML("md_div", { var markdwonParser = window.editormd.markdownToHTML("md_div", {
@ -12,6 +12,9 @@ export function markdownToHTML(oldContent) {
sequenceDiagram: true // 默认不解析 sequenceDiagram: true // 默认不解析
}); });
const content = window.$('#md_div').html() const content = window.$('#md_div').html()
if (selector) {
window.$(selector).html(content)
}
return content return content
} }

@ -6,40 +6,23 @@ class MarkdownToHtml extends Component{
this.state={ this.state={
} }
} }
// componentDidUpdate = (prevProps) => { componentDidUpdate = (prevProps) => {
// if (this.props.content) { if (this.props.content) {
// if ( prevProps.content != this.props.content ) { if ( prevProps.content != this.props.content ) {
// if (!this.shixunDescr) { markdownToHTML(this.props.content, `.markdown_to_html_${this.props.selector || ''}`)
// this.shixunDescr = window.editormd.markdownToHTML("memo_content_editorMd", { }
// markdown: this.props.content, }
// htmlDecode: "style,script,iframe", // you can filter tags decode }
// taskList: true, componentDidMount () {
// tex: true, // 默认不解析 this.props.content && markdownToHTML(this.props.content, `.markdown_to_html_${this.props.selector || ''}`)
// flowChart: true, // 默认不解析
// sequenceDiagram: true // 默认不解析 }
// });
// } else {
// this.shixunDescr.html(this.props.content)
// }
// }
// }
// }
// componentDidMount () {
// if (!this.shixunDescr) {
// this.shixunDescr = window.editormd.markdownToHTML("memo_content_editorMd", {
// markdown: this.props.content,
// htmlDecode: "style,script,iframe", // you can filter tags decode
// taskList: true,
// tex: true, // 默认不解析
// flowChart: true, // 默认不解析
// sequenceDiagram: true // 默认不解析
// });
// }
// }
render(){ render(){
return( return(
<div id="memo_content_editorMd" className="new_li markdown-body" dangerouslySetInnerHTML={{__html: markdownToHTML(this.props.content)}}> <div id="memo_content_editorMd" className={`new_li markdown-body ${this.props.className} markdown_to_html_${this.props.selector || ''}`}
// dangerouslySetInnerHTML={{__html: markdownToHTML(this.props.content)}}
>
</div> </div>
) )
} }

@ -236,6 +236,7 @@
/* line-height: 14px; */ /* line-height: 14px; */
width: 100%; width: 100%;
word-wrap: break-word; word-wrap: break-word;
margin-bottom: 4px;
} }
.childComment .break_word_comments{ .childComment .break_word_comments{
line-height: 22px; line-height: 22px;

@ -168,7 +168,7 @@ class Comments extends Component {
} }
</div> </div>
<p className="fr mr10 orig_reply lineh-20"> <p className="fr orig_reply lineh-20">
<span id="hidden_discuss_btn_952"> <span id="hidden_discuss_btn_952">
</span> </span>
@ -225,7 +225,7 @@ class Comments extends Component {
<div className="comment_content clearfix" id={`reply_content_${item.id}`}> <div className="comment_content clearfix" id={`reply_content_${item.id}`}>
<div className="color-grey-3" id={`reply_content_${item.id}`}> <div className="color-grey-3" id={`reply_content_${item.id}`}>
<div className={"break_word_comments"} dangerouslySetInnerHTML={{__html: _content}}></div> <div className={"break_word_comments markdown-body"} dangerouslySetInnerHTML={{__html: _content}}></div>
<div className="cl"></div> <div className="cl"></div>
</div> </div>
</div> </div>
@ -326,7 +326,7 @@ class Comments extends Component {
{ item.hidden && ((this.props.onlySuperAdminCouldHide && !item.isSuperAdmin) { item.hidden && ((this.props.onlySuperAdminCouldHide && !item.isSuperAdmin)
|| !this.props.onlySuperAdminCouldHide && item.admin === false && (item.manager === false || item.manager == undefined)) || !this.props.onlySuperAdminCouldHide && item.admin === false && (item.manager === false || item.manager == undefined))
? <p className="color-orange font-16">违规评论已被屏蔽</p> ? <p className="color-orange font-16">违规评论已被屏蔽</p>
: <div className={"break_word_comments"} dangerouslySetInnerHTML={{__html: _content}}></div> : <div className={"break_word_comments markdown-body"} dangerouslySetInnerHTML={{__html: _content}}></div>
} }
<div className="cl"></div> <div className="cl"></div>
</div> </div>

@ -1,6 +1,7 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import {Tooltip} from 'antd' import {Tooltip} from 'antd'
import moment from 'moment' import moment from 'moment'
import { getUrl } from 'educoder'
class BoardsListItem extends Component{ class BoardsListItem extends Component{
constructor(props){ constructor(props){
super(props); super(props);
@ -37,11 +38,11 @@ class BoardsListItem extends Component{
} }
`}</style> `}</style>
{ checkBox } { checkBox }
<a href="/users/innov" alt="用户" style={{"width":"50px","height":"50px","display":"block", margin: "0 10px"}}> <a href={`/users/${discussMessage.author.login}`} alt="用户" style={{"width":"50px","height":"50px","display":"block", margin: "0 10px"}}>
{/* /images/avatars/User/1?1529221779 */} {/* /images/avatars/User/1?1529221779 */}
<img <img
alt="1?1529221779" className="panel-list-img mr15" height="50" alt="1?1529221779" className="panel-list-img mr15" height="50"
src={`/images/${discussMessage.author.image_url}`} width="50" src={`${getUrl()}/images/${discussMessage.author.image_url}`} width="50"
></img> ></img>
</a> </a>
<div className="clearfix ds pr pt5 contentSection" onClick={() => onItemClick(discussMessage)}> <div className="clearfix ds pr pt5 contentSection" onClick={() => onItemClick(discussMessage)}>
@ -62,7 +63,7 @@ class BoardsListItem extends Component{
<div className="cl"></div> <div className="cl"></div>
<p className="color-grey panel-lightgrey mt10 fl"> <p className="color-grey panel-lightgrey mt10 fl">
<span className="mr50"> <span className="mr50">
<a href="/users/innov" className="panel-name-small hide fl mr15 mr30 color-grey3">{discussMessage.author.name}</a> <a href={`/users/${discussMessage.author.login}`} className="panel-name-small hide fl mr15 mr30 color-grey3">{discussMessage.author.name}</a>
{ discussMessage.total_replies_count != 0 && <span className="mr15 color-grey9">{discussMessage.total_replies_count} 回复</span> } { discussMessage.total_replies_count != 0 && <span className="mr15 color-grey9">{discussMessage.total_replies_count} 回复</span> }
{ discussMessage.total_praises_count != 0 && <span className="mr15 color-grey9">{discussMessage.total_praises_count} 点赞</span> } { discussMessage.total_praises_count != 0 && <span className="mr15 color-grey9">{discussMessage.total_praises_count} 点赞</span> }

@ -24,7 +24,7 @@ import '../../forums/RightSection.css'
import './TopicDetail.css' import './TopicDetail.css'
import '../common/courseMessage.css' import '../common/courseMessage.css'
import { Pagination, Tooltip } from 'antd' import { Pagination, Tooltip } from 'antd'
import { bytesToSize, ConditionToolTip } from 'educoder' import { bytesToSize, ConditionToolTip, markdownToHTML, MarkdownToHtml } from 'educoder'
import SendToCourseModal from '../coursesPublic/modal/SendToCourseModal' import SendToCourseModal from '../coursesPublic/modal/SendToCourseModal'
import CBreadcrumb from '../common/CBreadcrumb' import CBreadcrumb from '../common/CBreadcrumb'
import { generateComments, generateChildComments, _findById, handleContentBeforeCreateNew, addNewComment import { generateComments, generateChildComments, _findById, handleContentBeforeCreateNew, addNewComment
@ -87,15 +87,6 @@ class TopicDetail extends Component {
replies_count: response.data.data.total_replies_count replies_count: response.data.data.total_replies_count
}, {...this.state.memo}) }, {...this.state.memo})
}, () => { }, () => {
setTimeout(()=>{
var shixunDescr = window.editormd.markdownToHTML("memo_content_editorMd", {
htmlDecode: "style,script,iframe", // you can filter tags decode
taskList: true,
tex: true, // 默认不解析
flowChart: true, // 默认不解析
sequenceDiagram: true // 默认不解析
});
}, 200)
}) })
// const { memo_replies, memo } = response.data; // const { memo_replies, memo } = response.data;
@ -181,13 +172,13 @@ class TopicDetail extends Component {
// md渲染content等xhr执行完即memoLoading变化memo.content更新后初始化md // md渲染content等xhr执行完即memoLoading变化memo.content更新后初始化md
setTimeout(()=>{ setTimeout(()=>{
var shixunDescr = window.editormd.markdownToHTML("memo_content_editorMd", { // var shixunDescr = window.editormd.markdownToHTML("memo_content_editorMd", {
htmlDecode: "style,script,iframe", // you can filter tags decode // htmlDecode: "style,script,iframe", // you can filter tags decode
taskList: true, // taskList: true,
tex: true, // 默认不解析 // tex: true, // 默认不解析
flowChart: true, // 默认不解析 // flowChart: true, // 默认不解析
sequenceDiagram: true // 默认不解析 // sequenceDiagram: true // 默认不解析
}); // });
}, 200) }, 200)
} }
@ -629,13 +620,8 @@ class TopicDetail extends Component {
<div className="padding40 memoContent new_li"> <div className="padding40 memoContent new_li">
<div id="memo_content_editorMd" className="new_li"> <MarkdownToHtml content={memo.content}></MarkdownToHtml>
<textarea style={{'display': 'none'}}>
{memo.content}
</textarea>
</div>
</div> </div>
{/* style={{ paddingTop: '0px'}} */}
<div className="padding40 bor-bottom-greyE" > <div className="padding40 bor-bottom-greyE" >
<div className="mt10 mb20"> <div className="mt10 mb20">
{/* ${memo.user_praise ? '' : ''} */} {/* ${memo.user_praise ? '' : ''} */}

@ -17,7 +17,7 @@
} }
/* 子回复按钮 */ /* 子回复按钮 */
.course-message .reply_to_message a.commentsbtn.task-btn-blue { .course-message .reply_to_message a.commentsbtn.task-btn-blue {
margin-right: 50px; /* margin-right: 50px; */
} }
/* 改边距 */ /* 改边距 */
/* .course-message .commentsDelegateParent { /* .course-message .commentsDelegateParent {

@ -169,7 +169,7 @@ class MemoDetailMDEditor extends Component {
} */} } */}
</style> </style>
<div nhname={`new_message_${memo.id}`} className="commentInput commentInputs" <div nhname={`new_message_${memo.id}`} className="commentInput commentInputs"
style={{ padding: '30px',boxSizing:"border-box", display: isInited ? '' : 'none' }} > style={{ padding: '30px',boxSizing:"border-box", display: isInited ? '' : 'none', paddingBottom: '40px' }} >
<div id="memo_comment_editorMd" className="editorMD" style={{ marginBottom: '0px' <div id="memo_comment_editorMd" className="editorMD" style={{ marginBottom: '0px'
, border: errorMsg ? '1px solid red' : '1px solid #ddd'}}> , border: errorMsg ? '1px solid red' : '1px solid #ddd'}}>
<textarea style={{'display': 'none'}}> <textarea style={{'display': 'none'}}>
@ -180,7 +180,7 @@ class MemoDetailMDEditor extends Component {
marginLeft: '4px'}}>{errorMsg}</span> } marginLeft: '4px'}}>{errorMsg}</span> }
<a id={`new_message_submit_btn_${memo.id}`} href="javascript:void(0)" <a id={`new_message_submit_btn_${memo.id}`} href="javascript:void(0)"
onClick={this.onCommit} className="commentsbtn task-btn task-btn-blue fr"> onClick={this.onCommit} className="commentsbtn task-btn task-btn-blue fr">
发送 {this.props.buttonText || '发送'}
</a> </a>
</div> </div>
</React.Fragment> </React.Fragment>

@ -88,7 +88,7 @@ class ShixunDiscuss extends Component {
<a href={i.user.user_url} className="content-username hide fl">{i.user.name}</a> <a href={i.user.user_url} className="content-username hide fl">{i.user.name}</a>
<span className="t_area fl">{i.time}</span> <span className="t_area fl">{i.time}</span>
</div> </div>
<p className="fr mr10 orig_reply lineh-20"> <p className="fr orig_reply lineh-20">
<span id="hidden_discuss_btn_952"></span> <span id="hidden_discuss_btn_952"></span>
<a className="color-grey-8"> <a className="color-grey-8">
<i className="iconfont icon-jiangli fl mt2"></i> <i className="iconfont icon-jiangli fl mt2"></i>

Loading…
Cancel
Save