Merge branch 'version_forge' of http://gitea.trustie.net/jasder/forgeplus-react into version_forge

This commit is contained in:
sylor_huang@126.com 2020-04-29 16:03:04 +08:00
commit dda52a80c5
3 changed files with 7 additions and 10 deletions

View File

@ -6,22 +6,18 @@ const map = {
'colorBlue': 'colorBlue', // 蓝字白底 'colorBlue': 'colorBlue', // 蓝字白底
} }
class ActionBtn extends Component { class ActionBtn extends Component {
constructor(props) {
super(props);
}
render() { render() {
let { to, children, style, className, ...others } = this.props let { to, children, style, className, ...others } = this.props
return ( return (
<React.Fragment> <React.Fragment>
{ {
to == undefined ? to === undefined ?
<a onClick={this.props.onClick} <a onClick={this.props.onClick}
{...others} {...others}
className={"Actionbtn " + `${map[style || 'blue']} ${this.props.className}`} className={`Actionbtn ${map[style || 'blue']} ${this.props.className}`}
>{children}</a> >{children}</a>
: :
<Link to={to} className={"btn " + `${map[this.props.style]} ${this.props.className}`} {...others}>{this.props.children}</Link> <Link to={to} className={`btn ${map[this.props.style]} ${this.props.className}`} {...others}>{this.props.children}</Link>
} }
</React.Fragment> </React.Fragment>
) )

View File

@ -5,12 +5,13 @@ import { exportMdtoHtml } from 'educoder'
let preRegex = /<pre[^>]*>/g let preRegex = /<pre[^>]*>/g
export default ({ value = '', is_md = true, className, style = {} }) => { export default ({ value = '', is_md = true, className, style = {} }) => {
let html = is_md ? exportMdtoHtml(value) : value let html = is_md ? exportMdtoHtml(value) : value
html = html.replace(/▁/g, "▁▁▁").replace('<p>[TOC]</p>', '') console.log(html, '----========')
html = html.replace(/▁/g, "▁▁▁")
const el = useRef() const el = useRef()
useEffect(() => { useEffect(() => {
if (el.current && html) { if (el.current && html) {
if (preRegex.test(html)) { if (html.match(preRegex)) {
window.PR.prettyPrint() window.PR.prettyPrint()
} }
} }

View File

@ -112,7 +112,7 @@ class CaseDetail extends Component {
} }
{ {
operation && operation.can_editable ? <ActionBtn style="colorBlue" to={`/moop_cases/${this.props.match.params.caseID}/edit`} className="fr mr20">编辑</ActionBtn> : "" operation && operation.can_editable ? <ActionBtn style=" colorBlue" to={`/moop_cases/${this.props.match.params.caseID}/edit`} className="fr mr20">编辑</ActionBtn> : ""
} }
</li> </li>
<li className="clearfix lineh-20"> <li className="clearfix lineh-20">