forked from Gitlink/forgeplus-react
md文件和gitlink同步
This commit is contained in:
parent
ec113b5748
commit
04640a0ecb
|
|
@ -558,20 +558,20 @@
|
|||
|
||||
_this.setToolbar();
|
||||
|
||||
// editormd.loadScript(loadPath + "marked.min", function () {
|
||||
// });
|
||||
// 此处影响公式加载
|
||||
editormd.loadScript(loadPath + "marked.min", function () {
|
||||
editormd.$marked = marked;
|
||||
|
||||
editormd.$marked = marked;
|
||||
|
||||
if (settings.previewCodeHighlight) {
|
||||
editormd.loadScript(loadPath + "prettify.min", function () {
|
||||
if (settings.previewCodeHighlight) {
|
||||
editormd.loadScript(loadPath + "prettify.min", function () {
|
||||
loadFlowChartOrSequenceDiagram();
|
||||
});
|
||||
}
|
||||
else {
|
||||
loadFlowChartOrSequenceDiagram();
|
||||
});
|
||||
}
|
||||
else {
|
||||
loadFlowChartOrSequenceDiagram();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
|
@ -831,7 +831,7 @@
|
|||
if (scrollTop === 0) {
|
||||
preview.scrollTop(0);
|
||||
}
|
||||
else if (scrollTop + height >= cmScroll.scrollHeight - 16) {
|
||||
else if (scrollTop + height >= cmScroll.scrollHeight - 30) {
|
||||
preview.scrollTop(preview[0].scrollHeight);
|
||||
}
|
||||
else {
|
||||
|
|
@ -1434,7 +1434,7 @@
|
|||
var tex = $(this);
|
||||
editormd.$katex.render(tex.text(), tex[0]);
|
||||
|
||||
tex.find(".katex").css("font-size", "1.0em");
|
||||
tex.find(".katex").css("font-size", "1.6em");
|
||||
});
|
||||
|
||||
return this;
|
||||
|
|
@ -1471,7 +1471,6 @@
|
|||
var preview = $this.preview;
|
||||
var codeMirror = $this.codeMirror;
|
||||
var codeView = codeMirror.find(".CodeMirror-scroll");
|
||||
|
||||
var height = codeView.height();
|
||||
var scrollTop = codeView.scrollTop();
|
||||
var percent = (scrollTop / codeView[0].scrollHeight);
|
||||
|
|
@ -1483,11 +1482,11 @@
|
|||
|
||||
var tocMenuHeight = preview.find(".editormd-toc-menu").height();
|
||||
tocMenuHeight = (!tocMenuHeight) ? 0 : tocMenuHeight;
|
||||
|
||||
|
||||
if (scrollTop === 0) {
|
||||
preview.scrollTop(0);
|
||||
}
|
||||
else if (scrollTop + height >= codeView[0].scrollHeight - 16) {
|
||||
else if (scrollTop + height >= codeView[0].scrollHeight - 30) {
|
||||
preview.scrollTop(preview[0].scrollHeight);
|
||||
}
|
||||
else {
|
||||
|
|
@ -1595,8 +1594,7 @@
|
|||
codeMirror.find(".CodeMirror-scroll").bind(mouseOrTouch("scroll", "touchmove"), function (event) {
|
||||
var height = $(this).height();
|
||||
var scrollTop = $(this).scrollTop();
|
||||
var percent = (scrollTop / $(this)[0].scrollHeight);
|
||||
|
||||
var percent = (scrollTop / ($(this)[0].scrollHeight-100));
|
||||
var tocHeight = 0;
|
||||
|
||||
preview.find(".markdown-toc-list").each(function () {
|
||||
|
|
@ -1609,7 +1607,7 @@
|
|||
if (scrollTop === 0) {
|
||||
preview.scrollTop(0);
|
||||
}
|
||||
else if (scrollTop + height >= $(this)[0].scrollHeight - 16) {
|
||||
else if (scrollTop + height >= $(this)[0].scrollHeight - 30) {
|
||||
preview.scrollTop(preview[0].scrollHeight);
|
||||
}
|
||||
else {
|
||||
|
|
@ -3319,9 +3317,9 @@
|
|||
text = text.replace(emailReg, function ($1, $2, $3, $4) {
|
||||
return $1.replace(/@/g, "_#_@_#_");
|
||||
});
|
||||
|
||||
// " + editormd.urls.atLinkBase + "" + $2 + "
|
||||
text = text.replace(atLinkReg, function ($1, $2) {
|
||||
return "<a href=\"" + editormd.urls.atLinkBase + "" + $2 + "\" title=\"@" + $2 + "\" class=\"at-link\">" + $1 + "</a>";
|
||||
return "<span title=\"@" + $2 + "\" class=\"at-link\"> " + $1 + " </span>";
|
||||
}).replace(/_#_@_#_/g, "@");
|
||||
}
|
||||
|
||||
|
|
@ -3810,7 +3808,7 @@
|
|||
div.find("." + editormd.classNames.tex).each(function () {
|
||||
var tex = $(this);
|
||||
katex.render(tex.text(), tex[0]);
|
||||
tex.find(".katex").css("font-size", "1.0em");
|
||||
tex.find(".katex").css("font-size", "1.6em");
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,4 +4,7 @@
|
|||
.Permanentban{
|
||||
color:#5091FF !important;
|
||||
border-color: #5091FF !important;
|
||||
}
|
||||
}
|
||||
.editormd-menu>li:last-child {
|
||||
float: right;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import React, { Fragment, useEffect, useRef, useState } from 'react';
|
||||
import { getUploadActionUrl, getUrl } from 'educoder';
|
||||
import ResizeObserver from 'resize-observer-polyfill';
|
||||
// import myxss from '../../../common/filterXss';
|
||||
import xss from 'xss';
|
||||
import { getImageUrl } from 'educoder';
|
||||
import axios from 'axios';
|
||||
import '../../courses/css/Courses.css';
|
||||
|
|
@ -11,7 +9,7 @@ import 'codemirror/lib/codemirror.css';
|
|||
import './css/newquestion.css';
|
||||
const $ = window.$
|
||||
|
||||
const mdIcons = ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "link", "|", "inline-latex", "latex", '|', "image", "table", '|', "line-break", "watch", "clear","fullscreen"];
|
||||
const mdIcons = ["bold", "italic", "del", "|", "list-ul", "list-ol", "|", "code", "code-block", "link", "|", "inline-latex", "latex", '|', "image", "table", '|', "line-break", "watch", "clear","fullscreen"];
|
||||
|
||||
const NULL_CH = '▁';
|
||||
|
||||
|
|
@ -122,7 +120,7 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
|||
// 请求issues接口获取全部可quote的issue列表
|
||||
function getIssueList(keyword){
|
||||
axios.get(`/v1/${owner}/${projectsId}/issues`,{params:{
|
||||
only_name:true,keyword,sort_direction:"desc",sort_by:"issues.created_on"
|
||||
only_name:true,keyword,sort_direction:"desc",sort_by:"issues.created_on",limit:500,page:1
|
||||
}}).then(result=>{
|
||||
if(result){
|
||||
!keyword && setIssues(result.data.issues);
|
||||
|
|
@ -319,7 +317,7 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
|||
{users && users.map((item,key)=>{
|
||||
return(
|
||||
<div key={key} className={`at_who ${key===0 && `active`}`} onClick={()=>{selectAtWho(item.username)}} onMouseOver={()=>{onMouseOver(key)}}>
|
||||
{item.image_url && <img src={getImageUrl(`/${item.image_url}`)}></img>}
|
||||
{item.image_url && <img src={getImageUrl(`/${item.image_url}`)} alt=''></img>}
|
||||
<span>{item.username}</span>
|
||||
</div>
|
||||
)
|
||||
|
|
@ -505,7 +503,6 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
|||
}
|
||||
}
|
||||
}
|
||||
// xss()防止恶意代码:如alert等
|
||||
onChange && onChange(v);
|
||||
if(quoteVisibleRef.current){
|
||||
const cur = cm.doc.getCursor();
|
||||
|
|
@ -764,12 +761,12 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
|||
|
||||
return (
|
||||
<Fragment>
|
||||
{atWhoVisible && atWhoList}
|
||||
<div ref={editorEl} className={`df editormd-editing ${className} ${imageExpand && 'editormd-image-click-expand'} `}>
|
||||
{quoteVisible && QuoteDiv }
|
||||
<div className={`edu-back-greyf5 radius4 editormd ${error ? 'error' : ''}`} id={containerId} >
|
||||
<div className={`edu-back-greyf5 radius4 editormd ${error ? 'error' : ''} ${quoteVisible || atWhoVisible ? 'quoteBox' : ''}`} id={containerId} >
|
||||
{quoteVisible && QuoteDiv }
|
||||
{atWhoVisible && atWhoList}
|
||||
<textarea style={{ display: 'none' }} id={editorBodyId} name="content"></textarea>
|
||||
<div className="CodeMirror cm-s-defualt"></div>
|
||||
<div className="CodeMirror cm-s-defualt" style={{ display: 'none' }}></div>
|
||||
</div>
|
||||
</div>
|
||||
{showResizeBar ? <a ref={resizeBarEl} className='editor-resize'></a> : null}
|
||||
|
|
|
|||
Loading…
Reference in New Issue