forked from Gitlink/forgeplus-react
This commit is contained in:
parent
4f3e385f78
commit
3498390974
|
@ -117,6 +117,9 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
|||
const ch = cursor.ch;//列
|
||||
//替换最后的内容
|
||||
cm.replaceRange(username+" ",{line,ch},{line,ch});
|
||||
//鼠标聚焦到此行的最后
|
||||
editorInstance.focus();
|
||||
editorInstance.setCursor({line,ch:ch+username.length+1});
|
||||
//将此user的login存储到atWhoLoginList集合中
|
||||
const list = new Set(atWhoLoginList.current);
|
||||
users.map((item)=>{
|
||||
|
@ -148,6 +151,15 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
|||
document.addEventListener('click',()=>{setAtWhoVisible(false)});
|
||||
})
|
||||
|
||||
useEffect(()=>{
|
||||
//当atWhoVisible为true的时候,失焦,监听上下和enter键
|
||||
if(atWhoVisible && editorInstance && editorInstance.cm){
|
||||
console.log('弹框啦');
|
||||
//焦点转移到非monaco-editer编辑器上
|
||||
editorInstance.cm.addEventListener('blur',()=>{})
|
||||
}
|
||||
},[atWhoVisible])
|
||||
|
||||
useEffect(() => {
|
||||
if (editorInstance) {
|
||||
return
|
||||
|
@ -352,7 +364,6 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
ro = onLayout()
|
||||
return () => {
|
||||
|
@ -368,7 +379,6 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
|||
|
||||
useEffect(() => {
|
||||
if (editorInstance && initValue !== undefined) {
|
||||
const val = editorInstance.getValue();
|
||||
if (initValue !== null && initValue !== editorInstance.getValue()) {
|
||||
editorInstance.setValue(initValue.toString())
|
||||
}
|
||||
|
@ -419,7 +429,6 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
|||
<textarea style={{ display: 'none' }} id={editorBodyId} name="content"></textarea>
|
||||
<div className="CodeMirror cm-s-defualt"></div>
|
||||
{atWhoVisible && atWhoList}
|
||||
{/* {atWhoList} */}
|
||||
</div>
|
||||
</div>
|
||||
{showResizeBar ? <a ref={resizeBarEl} className='editor-resize'></a> : null}
|
||||
|
|
Loading…
Reference in New Issue