Browse Source

文本标签无法聚焦bug修改

zhouna 5 years ago
parent
commit
1949a23593
2 changed files with 6 additions and 3 deletions
  1. 5 3
      src/common/components/EditableSpan/index.jsx
  2. 1 0
      src/containers/EditableSpan.js

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

@@ -340,9 +340,11 @@ class EditableSpan extends Component{
     setSelectArea({i,boxMark,dir:'start'});
   }
   selectEnd(){
-    const {i,setSelectArea,boxMark}= this.props;
-    setSelectArea({i,boxMark,dir:'end'});
-    window.getSelection().empty();
+    const {i,setSelectArea,boxMark,select_start}= this.props;
+    if(select_start!==i){     //判断不能省,否则无法聚焦
+      setSelectArea({i,boxMark,dir:'end'});
+      window.getSelection().empty();
+    }
   }
   getClass(){
     const {full,value,saveText,i,preIsExt,afterIsExt,mouseSelect} = this.props;

+ 1 - 0
src/containers/EditableSpan.js

@@ -16,6 +16,7 @@ function mapStateToProps(state){//console.log(state)
     isRead:state.homePage.isRead,
     data:state.currentIll.data,
     select_end:state.homePage.select_end,
+    select_start:state.homePage.select_start,
   }
 }