Преглед изворни кода

ff26初始光标位置bug2276

zhouna пре 5 година
родитељ
комит
7f173390b3
1 измењених фајлова са 8 додато и 2 уклоњено
  1. 8 2
      src/common/components/ItemBox/index.jsx

+ 8 - 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,18 @@ 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;
+    console.log(children,'***',fuzhen)
     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={editable?handleFocus:null} 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={true} 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>
   }