|
@@ -10,9 +10,11 @@ class Textarea extends Component {
|
|
|
timer:null,
|
|
|
val:'报告描述或意见'
|
|
|
};
|
|
|
+ this.textInput = React.createRef();
|
|
|
this.$dom = React.createRef();
|
|
|
this.$domW = React.createRef();
|
|
|
this.handleInput = this.handleInput.bind(this);
|
|
|
+ this.handleFocus = this.handleFocus.bind(this);
|
|
|
}
|
|
|
handleInput(e){
|
|
|
const {handleChangeAssistValue,idx,handlePush} = this.props;
|
|
@@ -25,13 +27,11 @@ class Textarea extends Component {
|
|
|
handlePush&&handlePush();
|
|
|
clearTimeout(stimer);
|
|
|
},config.delayPushTime);
|
|
|
-
|
|
|
if(text.trim() != '' && text != '<br>'){
|
|
|
- e.target.nextSibling.innerText = ''
|
|
|
- e.target.nextSibling.innerHTML = ''
|
|
|
+ console.log(e.target.nextSibling)
|
|
|
+ e.target.nextSibling.innerText?(e.target.nextSibling.innerText = ''):(e.target.nextSibling.innerHTML = '')
|
|
|
}else{
|
|
|
- e.target.nextSibling.innerText = '报告描述或意见'
|
|
|
- e.target.nextSibling.innerHTML = '报告描述或意见'
|
|
|
+ e.target.nextSibling.innerText?(e.target.nextSibling.innerText = '报告描述或意见'):(e.target.nextSibling.innerHTML = '报告描述或意见')
|
|
|
}
|
|
|
this.setState({
|
|
|
timer
|
|
@@ -53,13 +53,14 @@ class Textarea extends Component {
|
|
|
const {value} = this.props;
|
|
|
if(value && value.trim()){
|
|
|
this.$dom.current.innerText?(this.$dom.current.innerText = value) : (this.$dom.current.innerHTML = value)
|
|
|
- this.$dom.current.nextSibling.innerText = '';
|
|
|
- this.$dom.current.nextSibling.innerHTML = '';
|
|
|
+ this.$dom.current.nextSibling.innerText?(this.$dom.current.nextSibling.innerText = ''):(this.$dom.current.nextSibling.innerHTML = '')
|
|
|
}else{
|
|
|
- this.$dom.current.nextSibling.innerText = '报告描述或意见'
|
|
|
- this.$dom.current.nextSibling.innerHTML = '报告描述或意见'
|
|
|
+ this.$dom.current.nextSibling.innerText?(this.$dom.current.nextSibling.innerText = '报告描述或意见'):(this.$dom.current.nextSibling.innerHTML = '报告描述或意见')
|
|
|
}
|
|
|
}
|
|
|
+ handleFocus(){ //ie8下提示语挡住输入框,导致输入框无法聚焦
|
|
|
+ this.textInput.current.previousSibling.focus();
|
|
|
+ }
|
|
|
render() {
|
|
|
const {idx} = this.props;
|
|
|
return (
|
|
@@ -68,9 +69,9 @@ class Textarea extends Component {
|
|
|
contenteditable={true}
|
|
|
ref={this.$dom}
|
|
|
onInput={this.handleInput}
|
|
|
- onPropertyChange={this.handleInput}
|
|
|
+ onKeyUp={this.handleInput}
|
|
|
></div>
|
|
|
- <p style={{position: "absolute",left: '0',top: '0',color: "#a5a3a3",zIndex: '5'}} className="textareaWarring"></p>
|
|
|
+ <p ref={this.textInput} onClick={this.handleFocus} className={style.textareaWarring}></p>
|
|
|
</div>
|
|
|
);
|
|
|
}
|