This commit is contained in:
caishi 2023-04-21 13:53:40 +08:00
parent cbc34891ca
commit eb1434c351
1 changed files with 10 additions and 10 deletions

View File

@ -495,18 +495,18 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
}); });
editorInstance.cm.on("change", (cm) => { editorInstance.cm.on("change", (cm) => {
//调用父组件的onchange方法将输入内容传入父级组件 //调用父组件的onchange方法将输入内容传入父级组件
// let reg = /alert\((.*?)\)/g; let reg = /alert\((.*?)\)/g;
let v = cm.getValue(); let v = cm.getValue();
// if(v){ if(v){
// let matchvalue = v.match(reg); let matchvalue = v.match(reg);
// if(matchvalue && matchvalue.length>0){ if(matchvalue && matchvalue.length>0){
// for(var x=0;x<matchvalue.length;x++){ for(var x=0;x<matchvalue.length;x++){
// v = v.replace(matchvalue[x],""); v = v.replace(matchvalue[x],"");
// } }
// } }
// } }
// xss()防止恶意代码如alert等 // xss()防止恶意代码如alert等
onChange && onChange(xss(v)); onChange && onChange(v);
if(quoteVisibleRef.current){ if(quoteVisibleRef.current){
const cur = cm.doc.getCursor(); const cur = cm.doc.getCursor();
const line = cur.line; const line = cur.line;