|
@@ -24,7 +24,8 @@ class EditableSpan extends Component{
|
|
oldText:props.value,
|
|
oldText:props.value,
|
|
labelVal:'', //存放标签原有的值--主诉字数限制用
|
|
labelVal:'', //存放标签原有的值--主诉字数限制用
|
|
preVal:'',
|
|
preVal:'',
|
|
- index:null
|
|
|
|
|
|
+ index:null,
|
|
|
|
+ searchPre:''
|
|
};
|
|
};
|
|
this.$span = React.createRef();
|
|
this.$span = React.createRef();
|
|
this.handleFocus = this.handleFocus.bind(this);
|
|
this.handleFocus = this.handleFocus.bind(this);
|
|
@@ -40,13 +41,14 @@ class EditableSpan extends Component{
|
|
setFocusIndex&&setFocusIndex({i,boxMark,dom:this.$span});
|
|
setFocusIndex&&setFocusIndex({i,boxMark,dom:this.$span});
|
|
this.setState({
|
|
this.setState({
|
|
labelVal:text,
|
|
labelVal:text,
|
|
- index:i
|
|
|
|
|
|
+ index:i,
|
|
|
|
+ searchPre:text
|
|
});
|
|
});
|
|
}
|
|
}
|
|
onChange(e){
|
|
onChange(e){
|
|
e.stopPropagation();
|
|
e.stopPropagation();
|
|
const {handleChange,boxMark,i,handleSearch,value,mainSaveText,mainIds} = this.props;
|
|
const {handleChange,boxMark,i,handleSearch,value,mainSaveText,mainIds} = this.props;
|
|
- const {labelVal,oldText} = this.state;
|
|
|
|
|
|
+ const {labelVal,oldText,searchPre} = this.state;
|
|
const text1 =e.target.innerText;
|
|
const text1 =e.target.innerText;
|
|
let mainText = filterArr(mainSaveText);//主诉字数
|
|
let mainText = filterArr(mainSaveText);//主诉字数
|
|
if(+boxMark==1){
|
|
if(+boxMark==1){
|
|
@@ -80,9 +82,9 @@ class EditableSpan extends Component{
|
|
let search='';
|
|
let search='';
|
|
clearTimeout(that.state.timer);
|
|
clearTimeout(that.state.timer);
|
|
// temp = newText.replace(oldText.replace(/(^\s*)|(\s*$)/g,''),'');
|
|
// temp = newText.replace(oldText.replace(/(^\s*)|(\s*$)/g,''),'');
|
|
- temp = newText.replace(labelVal.replace(/(^\s*)|(\s*$)/g,''),'');
|
|
|
|
- search = temp.replace(/(^\s*)|(\s*$)/g,'');
|
|
|
|
- // console.log(111,labelVal,333,newText,444,search);
|
|
|
|
|
|
+ temp = newText.replace(searchPre.replace(/(^\s*)|(\s*$)|(^\,*)|(\,*$)/g,''),'');
|
|
|
|
+ search = temp.replace(/(^\s*)|(\s*$)|(^\,*)|(\,*$)/g,'');
|
|
|
|
+ // console.log(111,labelVal,searchPre,333,newText,444,search);
|
|
handleSearch&&handleSearch({text:search,boxMark,mainIds});
|
|
handleSearch&&handleSearch({text:search,boxMark,mainIds});
|
|
/*that.setState({
|
|
/*that.setState({
|
|
oldText:newText.replace(search,'')
|
|
oldText:newText.replace(search,'')
|