|
@@ -172,8 +172,10 @@ class EditableSpan extends Component{
|
|
|
ev.preventDefault();
|
|
|
}else{
|
|
|
ev.returnValue=false;
|
|
|
+ }
|
|
|
+ if(obj){
|
|
|
+ this.moveEnd(obj[0]);
|
|
|
}
|
|
|
- this.moveEnd(obj[0]);
|
|
|
}
|
|
|
}
|
|
|
if(ev.keyCode==39){//向右
|
|
@@ -185,8 +187,9 @@ class EditableSpan extends Component{
|
|
|
}else{
|
|
|
ev.returnValue=false;
|
|
|
}
|
|
|
- // obj.focus();
|
|
|
- obj[0].focus();
|
|
|
+ if(obj){
|
|
|
+ obj.focus();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -215,10 +218,11 @@ class EditableSpan extends Component{
|
|
|
//action里往后删除
|
|
|
if(innerVal == preVal){
|
|
|
let data = innerVal.trim();
|
|
|
- if(nextObj && !config.punctuationReg.test(data)){
|
|
|
+ if(nextObj && !config.punctuationReg.test(data) || data=='<br>'){
|
|
|
handleKeydown&&handleKeydown({boxMark,i:index,text:data,flag:'del'});
|
|
|
// nextObj.focus();
|
|
|
if(nextObj && nextObj[0] && nextObj[0].nodeName !=="DIV"){
|
|
|
+ // IE浏览器focus光标在最后,其他浏览器在最前
|
|
|
nextObj.focus();
|
|
|
}
|
|
|
/*this.setState({
|
|
@@ -258,7 +262,8 @@ class EditableSpan extends Component{
|
|
|
//判断是否为空、中英文:, 。、;,且不是第一位
|
|
|
// let pattern = new RegExp(/^\,?$|^\,?$|^\.?$|^\。?$|^\、?$|^\;?$|^\;?$|^\:?$|^\:?$|\s/);
|
|
|
// if(index!==0 && pattern.test(data)){
|
|
|
- if(index!==0 && !config.punctuationReg.test(data)){
|
|
|
+ // 后半段是处理IE
|
|
|
+ if(index!==0 && !config.punctuationReg.test(data) || index!==0 && data=='<br>'){
|
|
|
// let preObj = $(this.$span.current).prev();
|
|
|
let obj = preObj[0].nodeName=="DIV"?preObj.prev():preObj;
|
|
|
handleKeydown&&handleKeydown({boxMark,i:index,text:data,flag:'backsp'});
|