This commit is contained in:
caishi 2020-12-17 17:59:30 +08:00
parent 7795fe1d04
commit e3c1e7b82f
1 changed files with 9 additions and 10 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 , forMember}) => {
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 = true }) => {
const editorEl = useRef();
const resizeBarEl = useRef();
@ -194,15 +194,14 @@ 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());
}
};
}
// if(forMember){
// document.onkeydown = (e) => {
// if (e.key === "@") {
// // 输入@键后在对应的位置显示可选的项目成员
// }
// };
// }
onChange(cm.getValue())
})
}