Kaynağa Gözat

体征标签最后一个不显示标点

zhouna 5 yıl önce
ebeveyn
işleme
1583db324f
1 değiştirilmiş dosya ile 4 ekleme ve 19 silme
  1. 4 19
      src/common/components/EditableSpan/index.jsx

+ 4 - 19
src/common/components/EditableSpan/index.jsx

@@ -291,28 +291,13 @@ class EditableSpan extends Component{
     $(this.$span.current).attr({"contentEditable":true}).focus()
   }
   componentDidMount(){
-    const {value} = this.props;
-    //const that = this;
+    const {preIsExt,afterIsExt,value} = this.props;
+    const br = preIsExt&&!afterIsExt;       //最后一个体征标签
+    const val = br&&!config.punctuationReg.test(value)?'':value;
     if(value){
-      this.$span.current.innerText?(this.$span.current.innerText = value||''):(this.$span.current.innerHTML = value||'');
+      this.$span.current.innerText?(this.$span.current.innerText = val||''):(this.$span.current.innerHTML = val||'');
     }
-    /*if(isIE()){
-      // 左右移动没问题,但是输入过程中会失焦,并且有时光标在但是无法输入 
-      // $(this.$span.current)[0].addEventListener('DOMCharacterDataModified', function(e){that.onChange(e);}, false);
-      // 此方法会影响左右切换时光标消失
-      $(this.$span.current).onIe8Input(function(e){
-        this.onChange(e)
-      },this);
-    }*/
   }
-  /*cancelSelect(e){//双击不选中
-    if(document.selection&&document.selection.empty){
-        document.selection.empty();
-      }else if (window.getSelection) {
-        var sel=window.getSelection();
-        sel.removeAllRanges();
-      }
-    }*/
   getClass(){
     const {full,value,saveText,i,preIsExt} = this.props;
     const preSelected = saveText[i-1];