| | |
| | | } else { |
| | | this.props.onChange(_val, true) |
| | | } |
| | | } else if (type === 'reset') { |
| | | let _val = this.props.config.initval |
| | | |
| | | if (this.state.encryption === 'true' && _val) { |
| | | try { |
| | | _val = window.decodeURIComponent(window.atob(_val)) |
| | | } catch (e) { |
| | | _val = this.props.config.initval |
| | | } |
| | | } |
| | | |
| | | this.setState({value: _val}, () => { |
| | | this.inputRef.current.select() |
| | | }) |
| | | |
| | | this.props.onChange(this.props.config.initval) |
| | | } |
| | | } |
| | | |
| | |
| | | let val = e.target.value |
| | | let submit = /\n/g.test(val) |
| | | |
| | | val = val.replace(/\n/g, '') |
| | | if (submit) { |
| | | val = val.replace(/\n|'/g, '') |
| | | } |
| | | |
| | | if (submit && /^\s+$/.test(val)) { |
| | | submit = false |
| | |
| | | MKEmitter.emit('mkFC', 'focus', config.tabUuid) |
| | | } else { |
| | | MKEmitter.emit('mkFC', 'focus', config.tabUuid) |
| | | this.props.onSubmit() |
| | | this.props.onSubmit(config.tabUuid, config.errTabUuid) |
| | | } |
| | | } |
| | | |