mirror of
https://github.com/Alamantus/Lexiconga.git
synced 2025-07-02 05:34:17 +02:00
Expand IPAField customization options
This commit is contained in:
parent
9b7e797aef
commit
53bf992226
1 changed files with 26 additions and 6 deletions
|
@ -109,24 +109,44 @@ export class IPAField extends Component {
|
||||||
this.setState({ value: val }, () => {
|
this.setState({ value: val }, () => {
|
||||||
this.field.focus();
|
this.field.focus();
|
||||||
this.field.setSelectionRange(pos, pos);
|
this.field.setSelectionRange(pos, pos);
|
||||||
|
|
||||||
|
if (this.props.onInput) {
|
||||||
|
this.props.onInput(this.state.value);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onChange () {
|
||||||
|
if (this.props.onChange) {
|
||||||
|
this.props.onChange(this.state.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
return (
|
return (
|
||||||
<div className='field'>
|
<div className='field'>
|
||||||
<label className='label'>Pronunciation</label>
|
<label className='label' htmlFor={ this.props.id || null }>
|
||||||
<p className='control'>
|
{ this.props.label || 'Pronunciation' }
|
||||||
<input className='input' type='text'
|
</label>
|
||||||
placeholder='[prə.ˌnʌn.si.ˈeɪ.ʃən]'
|
{
|
||||||
|
this.props.helpText
|
||||||
|
&& (
|
||||||
|
<p className='help'>
|
||||||
|
{ this.props.helpText }
|
||||||
|
</p>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
<div className='control'>
|
||||||
|
<input className='input' id={ this.props.id || null } type='text'
|
||||||
|
placeholder={ this.props.placeholder || '[prə.ˌnʌn.si.ˈeɪ.ʃən]' }
|
||||||
disabled={ !!this.props.isDisplayOnly }
|
disabled={ !!this.props.isDisplayOnly }
|
||||||
ref={ (input) => this.field = input }
|
ref={ (input) => this.field = input }
|
||||||
value={ this.state.value }
|
value={ this.state.value }
|
||||||
onInput={ (event) => this.onInput(event) }
|
onInput={ (event) => this.onInput(event) }
|
||||||
onKeyDown={ (event) => this.onInput(event) }
|
onKeyDown={ (event) => this.onInput(event) }
|
||||||
onChange={ () => this.props.onChange(this.state.value) } />
|
onChange={ () => this.onChange() } />
|
||||||
</p>
|
</div>
|
||||||
{ this.showButtons() }
|
{ this.showButtons() }
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue