Pārlūkot izejas kodu

黏贴文字去掉格式2255

zhouna 5 gadi atpakaļ
vecāks
revīzija
bc6367ced9
2 mainītis faili ar 12 papildinājumiem un 13 dzēšanām
  1. 11 12
      src/common/components/EditableSpan/index.jsx
  2. 1 1
      src/utils/config.js

+ 11 - 12
src/common/components/EditableSpan/index.jsx

@@ -41,6 +41,15 @@ class EditableSpan extends Component{
   }
   handleFocus(e){
     e.stopPropagation();
+    const that = this;
+    let txt = '';
+    //黏贴时去掉html格式
+    $(this.$span.current).on("paste",function(e){
+      setTimeout(function(){
+        txt = that.$span.current.innerText;
+        that.$span.current.innerHTML = txt;
+      });
+    })
     const {mainSaveText,full,setFocusIndex,i,boxMark,value}= this.props;
     let mainText = filterDataArr(mainSaveText);//主诉字数
     if(+boxMark==3||+boxMark==4){         //主诉为空,且第一次聚焦其他史查体时提示且不可输入
@@ -100,13 +109,10 @@ class EditableSpan extends Component{
       clearTimeout(that.state.timer);
       temp = newText.replace(searchPre,'');
       isEnd = !(newText.indexOf(searchPre)>0);
-      // search = temp.replace(/[(^\s*)|(\s*$)|(^\,*)|(\,*$)]/g,'');
       search = temp.replace(config.regPreAndAft,'');
-      // if(!search&&searchPre){
       if(!temp&&searchPre&&newText){
         search = searchPre;
       }
-      //console.log(labelVal,'旧:',searchPre,'新:',newText,'搜索:',search);
       if(config.punctuationReg.test(search)){    //只有标点符号时不搜索
         handleSearch&&handleSearch({text:search,isEnd,boxMark,mainIds});
       }else{//只有标点符号时要清空搜索结果
@@ -123,16 +129,9 @@ class EditableSpan extends Component{
   }
 
   handleBlur(e){//为了阻止冒泡事件
-    const {boxMark,handleClear,handleChange,i} = this.props;
     e.stopPropagation();
-    // 延时清空搜索结果,不延时会影响选中
-    /*clearTimeout(this.state.clearTimer);
-    const clearTimer = setTimeout(function(){
-      handleClear && handleClear({boxMark})
-    },config.delayTime);
-    this.setState({
-      clearTimer
-    });*/
+    //解除绑定事件
+    $(this.$span.current).off("paste");
   }
 
   moveEnd(obj) {

+ 1 - 1
src/utils/config.js

@@ -1,6 +1,6 @@
 // const host='http://192.168.3.1:5050';//赵
 // const host='http://192.168.3.100:5050';//王峰
-const host='http://192.168.2.241:5050';//后端接口访问地址
+const host='http://192.168.2.121:5050';//后端接口访问地址
 // const host='http://192.168.2.121:5050';//后端接口访问地址
 // const host='http://192.168.2.241:5050';//后端接口访问地址
 // const host='http://192.168.3.11:5050';//王宇