|
@@ -29,6 +29,7 @@ class InlineTag extends Component {
|
|
|
this.handleInput = this.handleInput.bind(this);
|
|
|
this.handleFocus = this.handleFocus.bind(this);
|
|
|
this.handleFixClick = this.handleFixClick.bind(this);
|
|
|
+ this.handleBoxInput = this.handleBoxInput.bind(this);
|
|
|
}
|
|
|
changeToEdit(e){
|
|
|
const {handledbClick,id} = this.props;
|
|
@@ -43,6 +44,14 @@ class InlineTag extends Component {
|
|
|
//埋点记录
|
|
|
handledbClick&&handledbClick({id});
|
|
|
}
|
|
|
+ handleBoxInput(e){
|
|
|
+ const {handleInput,ikey,prefix,suffix} = this.props;
|
|
|
+ const total = e.target.innerText;
|
|
|
+ const text = this.$span.current.innerText;
|
|
|
+ if(!total){
|
|
|
+ handleInput&&handleInput({text:total,ikey});
|
|
|
+ }
|
|
|
+ }
|
|
|
changeToClick(event){
|
|
|
event.returnValue = true;
|
|
|
const {canEditable} = this.props;
|
|
@@ -52,6 +61,7 @@ class InlineTag extends Component {
|
|
|
});
|
|
|
}
|
|
|
handleInput(e){ //输入时保存临时值,在修改灰显为黑色时判断用
|
|
|
+ e.stopPropagation();
|
|
|
const {handleInput,ikey,prefix,suffix} = this.props;
|
|
|
const text = e.target.innerText || e.target.innerHTML;
|
|
|
// 内容全部删除时,要把空值存到store,否则会遗留最后一个字且为灰色无法删除
|
|
@@ -130,7 +140,10 @@ class InlineTag extends Component {
|
|
|
onDoubleClick={this.changeToEdit}
|
|
|
onClick={!editable?this.handleFixClick:''}
|
|
|
onkeydown={handleEnter}
|
|
|
- onBlur={this.changeToClick} ref={this.$box} contentEditable={editable}>
|
|
|
+ onBlur={this.changeToClick}
|
|
|
+ ref={this.$box}
|
|
|
+ contentEditable={editable}
|
|
|
+ onInput={this.handleBoxInput}>
|
|
|
{prefix}
|
|
|
<span className={style['free-in']}
|
|
|
contentEditable={true}
|