|
@@ -1,7 +1,7 @@
|
|
import React, { Component } from "react";
|
|
import React, { Component } from "react";
|
|
import style from "./index.less";
|
|
import style from "./index.less";
|
|
import config from '@config/index';
|
|
import config from '@config/index';
|
|
-import {setFontColorSize} from '@utils/tools';
|
|
|
|
|
|
+import {setFontColorSize,moveEnd} from '@utils/tools';
|
|
import $ from 'jquery';
|
|
import $ from 'jquery';
|
|
|
|
|
|
class Textarea extends Component {
|
|
class Textarea extends Component {
|
|
@@ -20,7 +20,6 @@ class Textarea extends Component {
|
|
e.stopPropagation();
|
|
e.stopPropagation();
|
|
const {handleChangeAssistValue,idx,handlePush} = this.props;
|
|
const {handleChangeAssistValue,idx,handlePush} = this.props;
|
|
const text = e.target.textContent.trim() ? e.target.innerHTML : ''
|
|
const text = e.target.textContent.trim() ? e.target.innerHTML : ''
|
|
- const stimer = this.state.timer;
|
|
|
|
handleChangeAssistValue&&handleChangeAssistValue(text);
|
|
handleChangeAssistValue&&handleChangeAssistValue(text);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -32,13 +31,8 @@ class Textarea extends Component {
|
|
}
|
|
}
|
|
componentWillReceiveProps(next){
|
|
componentWillReceiveProps(next){
|
|
const {isRead, typeConfig} = this.props;
|
|
const {isRead, typeConfig} = this.props;
|
|
- // if(next.isRead != isRead && next.value!=this.props.value){ //value对比解决复诊不显示bug
|
|
|
|
- // next.value ? this.$dom.current.innerText = next.value : this.$dom.current.innerText = next.value
|
|
|
|
- // // this.$dom.current.innerText?(this.$dom.current.innerText = next.value||''):(this.$dom.current.innerHTML = next.value||'');
|
|
|
|
- // }
|
|
|
|
if(next.isRead != isRead && next.value || next.isRead != isRead && next.value!=this.props.value){ //value对比解决复诊不显示bug
|
|
if(next.isRead != isRead && next.value || next.isRead != isRead && next.value!=this.props.value){ //value对比解决复诊不显示bug
|
|
next.value ? this.$dom.current.innerHTML = next.value : this.$dom.current.innerHTML = ''
|
|
next.value ? this.$dom.current.innerHTML = next.value : this.$dom.current.innerHTML = ''
|
|
- // this.$dom.current.innerText?(this.$dom.current.innerText = next.value||''):(this.$dom.current.innerHTML = next.value||'');
|
|
|
|
}
|
|
}
|
|
if(next.typeConfig != typeConfig) {
|
|
if(next.typeConfig != typeConfig) {
|
|
this.$dom.current.innerText = ''
|
|
this.$dom.current.innerText = ''
|
|
@@ -52,8 +46,22 @@ class Textarea extends Component {
|
|
// this.$dom.current.innerText ? (this.$dom.current.innerText = value) : (this.$dom.current.innerHTML = value)
|
|
// this.$dom.current.innerText ? (this.$dom.current.innerText = value) : (this.$dom.current.innerHTML = value)
|
|
// this.$dom.current.nextSibling.innerText?(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 = '')
|
|
}
|
|
}
|
|
|
|
+ const that = this;
|
|
|
|
+ let txt = '';
|
|
|
|
+ //黏贴时去掉html格式
|
|
|
|
+ $(this.$dom.current).on("paste",function(e){
|
|
|
|
+ setTimeout(function(){
|
|
|
|
+ txt = that.$dom.current.innerText||that.$dom.current.innerHTML;
|
|
|
|
+ that.$dom.current.innerHTML = txt;
|
|
|
|
+ });
|
|
|
|
+ setTimeout(function(){
|
|
|
|
+ moveEnd($(that.$dom.current)[0]); //光标落到最后去
|
|
|
|
+ },200)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ componentWillUnmount(){
|
|
|
|
+ $(this.$dom.current).off("paste");
|
|
}
|
|
}
|
|
-
|
|
|
|
render() {
|
|
render() {
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|