diff --git a/src/modules/tpm/challengesnew/css/newquestion.css b/src/modules/tpm/challengesnew/css/newquestion.css index ca1ebb05e..46bb22c30 100644 --- a/src/modules/tpm/challengesnew/css/newquestion.css +++ b/src/modules/tpm/challengesnew/css/newquestion.css @@ -15,7 +15,7 @@ background: #FFFFFF; box-shadow: 0px 4px 8px 2px rgba(212, 212, 212, 0.5); border-radius: 4px; - top: 100px; + top: 60px; left: 100px; overflow-y: scroll; cursor: pointer; diff --git a/src/modules/tpm/challengesnew/tpm-md-editor.js b/src/modules/tpm/challengesnew/tpm-md-editor.js index c1feec481..eae4f23e4 100644 --- a/src/modules/tpm/challengesnew/tpm-md-editor.js +++ b/src/modules/tpm/challengesnew/tpm-md-editor.js @@ -79,7 +79,6 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla const resizeBarEl = useRef(); const [editorInstance, setEditorInstance] = useState(); const [atWhoVisible, setAtWhoVisible] = useState(false); - // const [atWho, setAtWho] = useState(undefined); const containerId = `mdEditor_${mdID}`; const editorBodyId = `mdEditors_${mdID}`; const tipId = `e_tips_mdEditor_${mdID}`; @@ -109,19 +108,17 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla function selectAtWho(username){ setAtWhoVisible(false); - const a = editorInstance.cm; - const b = editorInstance.cm.on; - console.log('cm.getValue()', editorInstance.cm) - console.log('onchange', editorInstance.cm.doc.getCursor()); - editorInstance.setValue(initValue.toString()+username); - // editorInstance.cm.on('change',(cm)=>{ - // onchange(cm.getValue()+username); - // }) - // setAtWho(username); - // console.log('editorInstance1',editorInstance); - // console.log('editorInstance2',editorInstance); + const cm = editorInstance.cm; + //获取鼠标所在行的行数和ch + const cursor = cm.doc.getCursor(); + const line = cursor.line;//行 + const ch = cursor.ch;//列 + //替换最后的内容 + cm.replaceRange(username+" ",{line,ch},{line,ch}); } + console.log('window.event',window.event); + const atWhoList = (