修改markdown编辑器

This commit is contained in:
何童崇 2022-11-15 15:11:23 +08:00
parent 45247e6a03
commit 6a552fd2d5
7 changed files with 859 additions and 25 deletions

View File

@ -558,20 +558,21 @@
_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();
}
}
});
});
@ -1434,7 +1435,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;
@ -3810,7 +3811,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");
});
};

830
public/katex/katex.min.css vendored Executable file → Normal file

File diff suppressed because one or more lines are too long

7
public/katex/katex.min.js vendored Executable file → Normal file

File diff suppressed because one or more lines are too long

View File

@ -33,7 +33,13 @@
}
/* md样式 */
.editormd-fullscreen{
z-index: 9999;
}
.editormd-menu>li:last-child{
float: right;
}
/* 控制md编辑器列行的宽度
codermirror maybeUpdateLineNumberWidth方法
*/
@ -94,7 +100,7 @@ body {
border-left: 1px solid rgb(221, 221, 221);
/* 某些情况下被cm盖住了 */
z-index: 99;
padding:8px 8px 50px;
padding: 0 8px;
}
.editormd-preview .markdown-body{
padding:0px !important;
@ -118,7 +124,6 @@ body {
padding: 0 12px;
}
/* antd扩展 */
.formItemInline.ant-form-item {
display: flex;

View File

@ -99,7 +99,7 @@ li {
pre.prettyprint {
border: 0px solid transparent;
padding: 10px;
padding: 10px 38px;
}
.-flex-basic0 {

View File

@ -313,7 +313,7 @@ export default class TPMMDEditor extends Component {
}
return (
<React.Fragment>
<div className={`df ${className} ${imageExpand && 'editormd-image-click-expand'}`} >
<div className={`df editormd-editing ${className} ${imageExpand && 'editormd-image-click-expand'}`} >
{/* padding10-20 */}
<div className="edu-back-greyf5 radius4" id={`mdEditor_${mdID}`} style={{ ..._style }}>
<textarea style={{ display: 'none' }} id={`mdEditors_${mdID}`} name="content"></textarea>

View File

@ -9,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"];
const mdIcons = ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "link", "|", "inline-latex", "latex", '|', "image", "table", '|', "line-break", "watch", "clear","fullscreen"];
const NULL_CH = '▁';
@ -289,7 +289,8 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
setEditorInstance(this)
}
})
console.log('editor_instance');
console.log(editor_instance);
}, [containerId, editorInstance, startInit])
@ -566,7 +567,7 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
return (
<Fragment>
{atWhoVisible && atWhoList}
<div ref={editorEl} className={`df ${className} ${imageExpand && 'editormd-image-click-expand'} `}>
<div ref={editorEl} className={`df editormd-editing ${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>