From ef8acbf3859bd13e759fbb9b8ba726039c1fb2c5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 14 十一月 2023 15:51:59 +0800 Subject: [PATCH] 2023-11-14 --- src/tabviews/zshare/mutilform/mkInput/index.jsx | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/tabviews/zshare/mutilform/mkInput/index.jsx b/src/tabviews/zshare/mutilform/mkInput/index.jsx index f147110..cad739c 100644 --- a/src/tabviews/zshare/mutilform/mkInput/index.jsx +++ b/src/tabviews/zshare/mutilform/mkInput/index.jsx @@ -83,9 +83,13 @@ handleChange = (e) => { let val = e.target.value - let submit = /\n/ig.test(val) + let submit = /\n/g.test(val) - val = val.replace(/\n/ig, '') + val = val.replace(/\n/g, '') + + if (submit && /^\s+$/.test(val)) { + submit = false + } let _val = val @@ -119,7 +123,7 @@ MKEmitter.emit('mkFC', 'focus', config.tabUuid) } else { MKEmitter.emit('mkFC', 'focus', config.tabUuid) - this.props.onSubmit() + this.props.onSubmit(config.tabUuid) } } @@ -127,6 +131,10 @@ const { config } = this.props const { value } = this.state + if (config.inputType === 'password') { + return <Input.Password ref={this.inputRef} className="mk-form-input" placeholder={config.placeholder || ''} value={value} autoComplete="off" disabled={config.readonly} onChange={this.handleChange} onPressEnter={this.handleInputSubmit}/> + } + return <Input ref={this.inputRef} className="mk-form-input" allowClear placeholder={config.placeholder || ''} value={value} autoComplete="off" disabled={config.readonly} onChange={this.handleChange} onPressEnter={this.handleInputSubmit} /> } } -- Gitblit v1.8.0