This commit is contained in:
caishi 2020-12-17 14:35:36 +08:00
parent 5d0afb265b
commit 7795fe1d04
1 changed files with 10 additions and 1 deletions

View File

@ -75,7 +75,7 @@ function md_elocalStorage(editor, mdu, id) {
}
export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, className = '', noStorage = false, imageExpand = true, placeholder = '', width = '100%', height = 400, initValue = '', emoji, watch, showNullButton = false, showResizeBar = false, startInit = true }) => {
export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, className = '', noStorage = false, imageExpand = true, placeholder = '', width = '100%', height = 400, initValue = '', emoji, watch, showNullButton = false, showResizeBar = false, startInit = true , forMember}) => {
const editorEl = useRef();
const resizeBarEl = useRef();
@ -194,6 +194,15 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
}
if (onChange) {
editorInstance.cm.on('change', (cm) => {
if(forMember){
document.onkeydown = (e) => {
if (e.key === "@") {
// 输入@键后在对应的位置显示可选的项目成员
console.log("e",document.selectionStart);
console.log("e",document.getSelection());
}
};
}
onChange(cm.getValue())
})
}