Explorar el Código

delete删除、火狐右移光标问题

liucf hace 5 años
padre
commit
664a559d8f

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

@@ -179,13 +179,14 @@ class EditableSpan extends Component{
     if(ev.keyCode==39){//向右
       let nextObj = $(this.$span.current).next();
       let obj = nextObj[0]&&nextObj[0].nodeName=="DIV"?nextObj.next():nextObj;
-      if(textIndex == textLength || textLength==undefined){
+      if(textIndex == textLength || textLength==undefined || (textIndex == 0 && textLength==1)){
         if(ev.preventDefault){//阻止默认事件
           ev.preventDefault();
         }else{
           ev.returnValue=false;
         }
-        obj.focus();
+        // obj.focus();
+        obj[0].focus();
       }
     }
   }  

+ 2 - 1
src/common/components/EditableSpan/index.less

@@ -5,10 +5,11 @@
   word-break: break-word;
   min-width: 10px;
   // line-height: 2;
-  /*height: 16px;*/
+  height: 16px;//火狐需要
   line-height: 16px;
   vertical-align: middle;
   text-align: left;
+  padding-right: 1px;//火狐左右移动需要
 }
 .full{
   width: 100%;

+ 2 - 0
src/store/actions/checkBody.js

@@ -505,6 +505,8 @@ export function backspaceText(state,action){
       data.splice(delIndex,1);
       res.selecteds.splice(delIndex,1);      //杂音类样式选中状态对应
       res.saveText.splice(delIndex,1);
+    }else if(!data[delIndex+1]){//最后一个文本标签不删除
+      
     }
     else{
       handleLocalDelTag(4,delIndex,data[delIndex]);

+ 2 - 0
src/store/actions/currentIll.js

@@ -913,6 +913,8 @@ export function backspaceText(state,action){
       data.splice(delIndex,1);
       res.selecteds.splice(delIndex,1);      //杂音类样式选中状态对应
       res.saveText.splice(delIndex,1);
+    }else if(!data[delIndex+1]){//最后一个文本标签不删除
+      // console.log("删除最后一个啦");
     }
     else{
       handleLocalDelTag(2,delIndex,data[delIndex]);

+ 2 - 0
src/store/actions/mainSuit.js

@@ -857,6 +857,8 @@ export function backspaceText(state,action){
     }else if(data[delIndex+1] && data[delIndex+1].tagType==8){
       data.splice(delIndex,1);
       res.saveText.splice(delIndex,1);
+    }else if(data[delIndex-1] && data[delIndex-1].tagType !=8){//最后一个文本标签
+      console.log("删除最后一个啦")
     }
     else{
       handleLocalDelTag(1,delIndex,data[delIndex]);

+ 2 - 0
src/store/actions/otherHistory.js

@@ -476,6 +476,8 @@ export function backspaceText(state,action){
       data.splice(delIndex,1);
       res.selecteds.splice(delIndex,1);      //杂音类样式选中状态对应
       res.saveText.splice(delIndex,1);
+    }else if(!data[delIndex+1]){//最后一个文本标签不删除
+      
     }
     else{
       //月经史删除处理