Browse Source

814(IE11)

liucf 5 years ago
parent
commit
ee43bae81c

+ 10 - 5
src/common/components/EditableSpan/index.jsx

@@ -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'});

+ 1 - 1
src/components/CurrentIll/index.jsx

@@ -44,7 +44,7 @@ class CurrentIll extends Component{
       this.setState({
         forbidInput:true
       })
-    }else if(!text) {//现病史框里没有内容时才设置模板
+    }else if(!text || (isIE() && text=='<br>')) {//现病史框里没有内容时才设置模板
       let num = moduleNum.num;//主诉使用了几个模板
       if(data.length==0 && !isChronic){
         clearTimeout(setDataTimer);

+ 7 - 0
src/components/MainSuit/index.jsx

@@ -200,6 +200,13 @@ class MainSuit extends Component{
         symptom:true
       })
     }
+
+    // IE11聚焦时也会触发change事件,导致常见症状下拉出不来
+    if(isIE() && data == '<br>'){
+      this.setState({
+        symptom:true
+      })
+    }
     /*clearTimeout(this.state.timer);
     const timer = setTimeout(function(){
       pushMessage && pushMessage(data);