at列表
This commit is contained in:
parent
bc6ef583fb
commit
7fe88aa4d9
|
@ -79,6 +79,7 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
||||||
const resizeBarEl = useRef();
|
const resizeBarEl = useRef();
|
||||||
const [editorInstance, setEditorInstance] = useState();
|
const [editorInstance, setEditorInstance] = useState();
|
||||||
const [atWhoVisible, setAtWhoVisible] = useState(false);
|
const [atWhoVisible, setAtWhoVisible] = useState(false);
|
||||||
|
const [atWho, setAtWho] = useState(undefined);
|
||||||
const containerId = `mdEditor_${mdID}`;
|
const containerId = `mdEditor_${mdID}`;
|
||||||
const editorBodyId = `mdEditors_${mdID}`;
|
const editorBodyId = `mdEditors_${mdID}`;
|
||||||
const tipId = `e_tips_mdEditor_${mdID}`;
|
const tipId = `e_tips_mdEditor_${mdID}`;
|
||||||
|
@ -112,7 +113,10 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
||||||
|
|
||||||
function selectAtWho(username){
|
function selectAtWho(username){
|
||||||
setAtWhoVisible(false);
|
setAtWhoVisible(false);
|
||||||
editorInstance.setValue(initValue.toString()+username);
|
setAtWho(username);
|
||||||
|
// console.log('editorInstance1',editorInstance);
|
||||||
|
// editorInstance.setValue(initValue.toString()+username);
|
||||||
|
// console.log('editorInstance2',editorInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
const atWhoList = (
|
const atWhoList = (
|
||||||
|
@ -231,14 +235,19 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
||||||
document.onkeydown = (e) => {
|
document.onkeydown = (e) => {
|
||||||
if (e.key === "@") {
|
if (e.key === "@") {
|
||||||
// 输入@键后在对应的位置显示可选的项目成员
|
// 输入@键后在对应的位置显示可选的项目成员
|
||||||
const selection = window.getSelection().anchorOffset;
|
const endOffset = window.getSelection();
|
||||||
setAtWhoVisible(true);
|
setAtWhoVisible(true);
|
||||||
|
const addValue = atWho? cm.getValue()+atWho:cm.getValue();
|
||||||
|
onChange(addValue);
|
||||||
}else{
|
}else{
|
||||||
setAtWhoVisible(false);
|
setAtWhoVisible(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}else{
|
||||||
|
onChange(cm.getValue());
|
||||||
}
|
}
|
||||||
onChange(cm.getValue())
|
// const addValue = atWho? cm.getValue():cm.getValue()+atWho;
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ro = onLayout()
|
ro = onLayout()
|
||||||
|
|
Loading…
Reference in New Issue