diff --git a/src/modules/tpm/challengesnew/tpm-md-editor.js b/src/modules/tpm/challengesnew/tpm-md-editor.js index ae9f10e2..385005b6 100644 --- a/src/modules/tpm/challengesnew/tpm-md-editor.js +++ b/src/modules/tpm/challengesnew/tpm-md-editor.js @@ -126,7 +126,6 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla const line = cursor.line;//行 const ch = cursor.ch;//列 //替换最后的内容 - // cm.getLine(line).endsWith("@") ? cm.replaceRange(username+" ",{line,ch},{line,ch}) : cm.replaceRange("@"+username+" ",{line,ch},{line,ch}) cm.replaceRange(username+" ",{line,ch},{line,ch}); //鼠标聚焦 cm.focus(); @@ -148,10 +147,6 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla //markdown编辑器中输入的键盘监听事件 function mdKeyDown(e){ - const cm = editorInstance.cm; - //获取鼠标所在行的行数和ch - const line = cm.doc.getCursor().line;//行 - atWhoVisible && console.log('cmaa',cm.getLine(line)); console.log("markdown编辑器--------键盘监听事件"); // document.onkeydown = e=>{ if (e.shiftKey && e.key === "@") { @@ -308,11 +303,12 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla useEffect(()=>{ //当atWhoVisible为true的时候,失焦,监听上下和enter键 + // atWhoVisible && editorInstance.cm. if(atWhoVisible){ const cm = editorInstance.cm; //获取鼠标所在行的行数和ch const line = cm.doc.getCursor().line;//行 - // console.log('cmaa',cm.getLine(line)); + console.log('useEffect',cm.getLine(line)); // document.activeElement.id !== "blur_atWho" && document.getElementById("blur_atWho").focus(); // const atWhoDivs = document.getElementsByClassName("at_who"); // let index = 0; @@ -487,10 +483,6 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla }) } } - // const cm = editorInstance.cm; - //获取鼠标所在行的行数和ch - const line = cmEl.doc.getCursor().line;//行 - atWhoVisible && console.log('cmaa',cmEl.getLine(line)); }); ro = onLayout() return () => {