md@谁列表
This commit is contained in:
parent
5c2330512e
commit
999a15761d
|
@ -13,7 +13,7 @@
|
||||||
<link rel="stylesheet" type="text/css" href="%PUBLIC_URL%css/edu-purge.css">
|
<link rel="stylesheet" type="text/css" href="%PUBLIC_URL%css/edu-purge.css">
|
||||||
<link rel="stylesheet" type="text/css" href="%PUBLIC_URL%css/editormd.min.css">
|
<link rel="stylesheet" type="text/css" href="%PUBLIC_URL%css/editormd.min.css">
|
||||||
<link rel="stylesheet" type="text/css" href="%PUBLIC_URL%css/merge.css">
|
<link rel="stylesheet" type="text/css" href="%PUBLIC_URL%css/merge.css">
|
||||||
<link rel="stylesheet" type="text/css" href="%PUBLIC_URL%css/jquery.atwho.css">
|
<link rel="stylesheet" type="text/css" href="%PUBLIC_URL%css/jquery.atwho.min.css">
|
||||||
<%= htmlWebpackPlugin.tags.headTags %>
|
<%= htmlWebpackPlugin.tags.headTags %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -27,8 +27,8 @@
|
||||||
<script src="%PUBLIC_URL%js/editormd/editormd.min.js"></script>
|
<script src="%PUBLIC_URL%js/editormd/editormd.min.js"></script>
|
||||||
<script src="%PUBLIC_URL%js/codemirror/merge/merge.js"></script>
|
<script src="%PUBLIC_URL%js/codemirror/merge/merge.js"></script>
|
||||||
<!--markdown编辑器中@谁-->
|
<!--markdown编辑器中@谁-->
|
||||||
<script src="%PUBLIC_URL%js/jquery.caret.js"></script>
|
<script src="%PUBLIC_URL%js/jquery.caret.min.js"></script>
|
||||||
<script src="%PUBLIC_URL%js/jquery.atwho.js"></script>
|
<script src="%PUBLIC_URL%js/jquery.atwho.min.js"></script>
|
||||||
<%= htmlWebpackPlugin.tags.bodyTags %>
|
<%= htmlWebpackPlugin.tags.bodyTags %>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -6,6 +6,7 @@ import ResizeObserver from 'resize-observer-polyfill';
|
||||||
import '../../courses/css/Courses.css';
|
import '../../courses/css/Courses.css';
|
||||||
import './css/TPMchallengesnew.css';
|
import './css/TPMchallengesnew.css';
|
||||||
import 'codemirror/lib/codemirror.css';
|
import 'codemirror/lib/codemirror.css';
|
||||||
|
import { AutoComplete } from 'antd';
|
||||||
const $ = window.$
|
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"];
|
||||||
|
@ -200,6 +201,10 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
||||||
}
|
}
|
||||||
if (onChange) {
|
if (onChange) {
|
||||||
editorInstance.cm.on('change', (cm) => {
|
editorInstance.cm.on('change', (cm) => {
|
||||||
|
$(`#editorBodyId`).atwho({
|
||||||
|
at: '@',
|
||||||
|
data:['111','222']
|
||||||
|
})
|
||||||
// if(forMember){
|
// if(forMember){
|
||||||
// document.onkeydown = (e) => {
|
// document.onkeydown = (e) => {
|
||||||
// if (e.key === "@") {
|
// if (e.key === "@") {
|
||||||
|
@ -225,6 +230,11 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (editorInstance && initValue !== undefined) {
|
if (editorInstance && initValue !== undefined) {
|
||||||
|
$(`#editorBodyId`).atwho({
|
||||||
|
at: '@',
|
||||||
|
data:['111','222']
|
||||||
|
})
|
||||||
|
const val = editorInstance.getValue();
|
||||||
if (initValue !== null && initValue !== editorInstance.getValue()) {
|
if (initValue !== null && initValue !== editorInstance.getValue()) {
|
||||||
editorInstance.setValue(initValue.toString())
|
editorInstance.setValue(initValue.toString())
|
||||||
}
|
}
|
||||||
|
@ -273,7 +283,7 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<div ref={editorEl} className={`df ${className} ${imageExpand && 'editormd-image-click-expand'} `} >
|
<div ref={editorEl} className={`df ${className} ${imageExpand && 'editormd-image-click-expand'} `} >
|
||||||
<div className={`edu-back-greyf5 radius4 editormd ${error ? 'error' : ''}`} id={containerId} >
|
<div className={`edu-back-greyf5 radius4 editormd ${error ? 'error' : ''}`} id={containerId} >
|
||||||
<textarea style={{ display: 'none' }} id={editorBodyId} name="content"></textarea>
|
<textarea style={{ display: 'none' }} id={editorBodyId} name="content"><AutoComplete></AutoComplete></textarea>
|
||||||
<div className="CodeMirror cm-s-defualt"></div>
|
<div className="CodeMirror cm-s-defualt"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue