forked from Gitlink/forgeplus-react
atwho
This commit is contained in:
parent
ac4488a907
commit
55a6f93fe3
|
@ -126,7 +126,6 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
||||||
const line = cursor.line;//行
|
const line = cursor.line;//行
|
||||||
const ch = cursor.ch;//列
|
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.replaceRange(username+" ",{line,ch},{line,ch});
|
||||||
//鼠标聚焦
|
//鼠标聚焦
|
||||||
cm.focus();
|
cm.focus();
|
||||||
|
@ -148,10 +147,6 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
||||||
|
|
||||||
//markdown编辑器中输入的键盘监听事件
|
//markdown编辑器中输入的键盘监听事件
|
||||||
function mdKeyDown(e){
|
function mdKeyDown(e){
|
||||||
const cm = editorInstance.cm;
|
|
||||||
//获取鼠标所在行的行数和ch
|
|
||||||
const line = cm.doc.getCursor().line;//行
|
|
||||||
atWhoVisible && console.log('cmaa',cm.getLine(line));
|
|
||||||
console.log("markdown编辑器--------键盘监听事件");
|
console.log("markdown编辑器--------键盘监听事件");
|
||||||
// document.onkeydown = e=>{
|
// document.onkeydown = e=>{
|
||||||
if (e.shiftKey && e.key === "@") {
|
if (e.shiftKey && e.key === "@") {
|
||||||
|
@ -308,11 +303,12 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
//当atWhoVisible为true的时候,失焦,监听上下和enter键
|
//当atWhoVisible为true的时候,失焦,监听上下和enter键
|
||||||
|
// atWhoVisible && editorInstance.cm.
|
||||||
if(atWhoVisible){
|
if(atWhoVisible){
|
||||||
const cm = editorInstance.cm;
|
const cm = editorInstance.cm;
|
||||||
//获取鼠标所在行的行数和ch
|
//获取鼠标所在行的行数和ch
|
||||||
const line = cm.doc.getCursor().line;//行
|
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();
|
// document.activeElement.id !== "blur_atWho" && document.getElementById("blur_atWho").focus();
|
||||||
// const atWhoDivs = document.getElementsByClassName("at_who");
|
// const atWhoDivs = document.getElementsByClassName("at_who");
|
||||||
// let index = 0;
|
// 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()
|
ro = onLayout()
|
||||||
return () => {
|
return () => {
|
||||||
|
|
Loading…
Reference in New Issue