Procházet zdrojové kódy

Merge remote-tracking branch 'origin/dev5.3.3' into dev/new1

zhouna před 5 roky
rodič
revize
b81988f4b0

+ 7 - 2
src/common/components/ItemBox/index.jsx

@@ -41,6 +41,7 @@ class ItemBox extends Component {
 
   componentDidMount(){
     const {setRef} = this.props;
+    this.$div.current.innerHTML='';     //bug2276,FF26初始光标位置问题
     setRef&&setRef(this.$div);
     if(isIE()){
       $(this.$div.current).onIe8Input(function(e){
@@ -56,13 +57,17 @@ componentWillReceiveProps(nextP){
         that.context.scrollArea&&that.context.scrollArea.refresh();
       });
     }
+    //bug2276,FF26初始光标位置问题
+    if(!nextP.children&&!nextP.fuzhen){
+      this.$div.current.innerHTML='';
+    }
 }
   render(){
     const {title,children,editable,className,handleFocus,fuzhen,border,handleBlur,titleTop,backgroundColor,boxId} = this.props;
     return <div className={style["box"]+" "+"clearfix"} >
       <div className={style["title"] + ' '+(className||'')} style={{marginTop:titleTop?'22px':''}}>{title}</div>
-      <div ref={this.$div} className={`${style["content"]} ${border?style["border"]:''} ${backgroundColor?style["noBorder"]:''}`} contentEditable={editable} style={this.getBoxStyle()} onFocus={handleFocus} onInput={this.handleInput} onClick={(e)=>{this.handleClick(e);}} onBlur={handleBlur} id={boxId} onkeydown={handleEnter}>
-        {fuzhen?children||fuzhen:children}
+      <div ref={this.$div} className={`${style["content"]} ${border?style["border"]:''} ${backgroundColor?style["noBorder"]:''}`} contentEditable={editable} style={this.getBoxStyle()} onFocus={editable?handleFocus:null} onInput={this.handleInput} onClick={(e)=>{this.handleClick(e);}} onBlur={handleBlur} id={boxId} onkeydown={handleEnter}>
+        {fuzhen?children||fuzhen||'':children||''}
       </div>
     </div>
   }

+ 1 - 1
src/common/components/NumberPan/index.jsx

@@ -77,7 +77,7 @@ class NumberPan extends Component{
           <td><button onMouseUp={select}>4</button></td>
           <td><button onMouseUp={select}>5</button></td>
           <td><button onMouseUp={select}>6</button></td>
-          <td><button><img src={backspace} onMouseUp={this.handleBack.bind(this)} /></button></td>
+          <td><button onMouseUp={this.handleBack.bind(this)}><img src={backspace} /></button></td>
         </tr>
         <tr>
           <td><button onMouseUp={select}>7</button></td>

+ 1 - 1
src/common/components/SearchBox/index.jsx

@@ -70,7 +70,7 @@ class SearchBox extends React.Component {
         });
     }
     handleFocus(e){//聚焦时边框变蓝色
-      e.stopPropagation();
+      //e.stopPropagation();
       e.preventDefault();
       this.setState({border:true})
     }

+ 12 - 0
src/common/components/Textarea/index.jsx

@@ -26,6 +26,16 @@ class Textarea extends Component {
   }
   handleFocus(e){            //初始显示props中的值,focus已经显示输入的值,避免值更新闪烁
     const {handleFocus,fuzhen,handleInput,isChronic,hasMain,boxMark} = this.props;
+    //黏贴时去掉html格式
+    const that = this;
+    let txt = '';
+    $(this.$dom.current).on("paste",function(e){
+      setTimeout(function(){
+        txt = that.$dom.current.innerText||that.$dom.current.innerHTML;
+        that.$dom.current.innerHTML = txt;
+        that.moveEnd($(that.$dom.current)[0]);     //光标落到最后去
+      });
+    });
     //const {inpText} = this.state;console.log(inpText,boxMark,hasMain)
     if(boxMark!='1'&&!hasMain&&!e.target.innerText){
       //现病史、其他史无主诉且本身无内容是聚焦提示无法操作
@@ -104,6 +114,8 @@ class Textarea extends Component {
   handleBlur(e){
     const {saveChronic} = this.props;
     const text = e.target.innerText || e.target.innerHTML;
+    //解除绑定事件
+    $(this.$dom.current).off("paste");
     getFeature(text).then((res)=>{
       if(res.data.code==0){
         const result = res.data.data;

+ 1 - 2
src/components/ListItems/index.jsx

@@ -72,8 +72,7 @@ class ListItems extends Component{
       {noPush?'':<p className={style['orderTips']}>按{order?'从左到右从上到下':'点击'}顺序成文</p>}
       {this.getLabels()}
       {noSearch && <div className="search">
-        <input type="text"/>
-        {/*<SearchBox show={show} pushIds={this.getPushItemIds(pushList)} onSelect={this.searchSelect.bind(this)} onRef={(child)=>{this.child = child;}}/>*/}
+        <SearchBox show={show} pushIds={this.getPushItemIds(pushList)} onSelect={this.searchSelect.bind(this)} onRef={(child)=>{this.child = child;}}/>
       </div>}
       <div className="oper clearfix">
         <span className={style['clear']} onClick={handleClear}>清空选项</span>

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

@@ -366,7 +366,7 @@ class SpreadDrop extends Component{
     }
     const {editable} = this.state;
     return  <div className={style['container']}
-              onFocus={(e)=>e.stopPropagation()}
+              /*onFocus={(e)=>e.stopPropagation()}*/
               onBlur={(e)=>e.stopPropagation()}
               onInput={(e)=>e.stopPropagation()}>
         <div