|
@@ -62,6 +62,8 @@ class EditableSpan extends Component{
|
|
|
const {handleChange,boxMark,i,handleSearch,value,mainSaveText,mainIds,handleClear} = this.props;
|
|
|
const {labelVal,searchPre} = this.state;
|
|
|
const text1 = e.target.innerText || e.target.innerHTML;
|
|
|
+ // e.newValue IE浏览器DOMCharacterDataModified监听
|
|
|
+ // const text1 = e.target.innerText || e.target.innerHTML || e.newValue;
|
|
|
let mainText = filterDataArr(mainSaveText);//主诉字数
|
|
|
if(+boxMark==1){
|
|
|
if(mainText.length >= config.limited){
|
|
@@ -196,6 +198,10 @@ class EditableSpan extends Component{
|
|
|
const ev = e||window.event;
|
|
|
const target = ev.target||ev.srcElement;
|
|
|
let innerVal = target.innerText || target.innerHTML,ele,boxTop;
|
|
|
+ // 可编辑div不支持oninput事件,用此事件替代
|
|
|
+ /*if(isIE() && innerVal != preVal){
|
|
|
+ this.onChange(ev);
|
|
|
+ }*/
|
|
|
if(ev.keyCode==46){//delete
|
|
|
//判断nexObj
|
|
|
let nextObj = $(this.$span.current).next();
|
|
@@ -277,13 +283,17 @@ class EditableSpan extends Component{
|
|
|
}
|
|
|
componentDidMount(){
|
|
|
const {value} = this.props;
|
|
|
+ const that = this;
|
|
|
if(value){
|
|
|
this.$span.current.innerText?(this.$span.current.innerText = value||''):(this.$span.current.innerHTML = value||'');
|
|
|
}
|
|
|
if(isIE()){
|
|
|
- $(this.$span.current).onIe8Input(function(e){
|
|
|
+ // 左右移动没问题,但是输入过程中会失焦,并且有时光标在但是无法输入
|
|
|
+ // $(this.$span.current)[0].addEventListener('DOMCharacterDataModified', function(e){that.onChange(e);}, false);
|
|
|
+ // 此方法会影响左右切换时光标消失
|
|
|
+ /*$(this.$span.current).onIe8Input(function(e){
|
|
|
this.onChange(e)
|
|
|
- },this);
|
|
|
+ },this);*/
|
|
|
}
|
|
|
}
|
|
|
/*cancelSelect(e){//双击不选中
|