diff options
| author | andrewdkim <adkim414@gmail.com> | 2019-07-19 11:21:47 -0400 |
|---|---|---|
| committer | andrewdkim <adkim414@gmail.com> | 2019-07-19 11:21:47 -0400 |
| commit | e453e7010def252b6cc10ad49d64708767c5589b (patch) | |
| tree | 4353a4be5495acd61d813066d001e2b12da7d207 /src/client/views/EditableView.tsx | |
| parent | 9cad9abcf164c7d81b8debf4aa2639d83edd227b (diff) | |
| parent | 8854d3277541a67aef4187b5d3592bea5a7fcfa2 (diff) | |
merge from master
Diffstat (limited to 'src/client/views/EditableView.tsx')
| -rw-r--r-- | src/client/views/EditableView.tsx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/client/views/EditableView.tsx b/src/client/views/EditableView.tsx index 97a2d19dd..989fb1be9 100644 --- a/src/client/views/EditableView.tsx +++ b/src/client/views/EditableView.tsx @@ -14,7 +14,7 @@ export interface EditableProps { * @param value - The string entered by the user to set the value to * @returns `true` if setting the value was successful, `false` otherwise * */ - SetValue(value: string): boolean; + SetValue(value: string, shiftDown?: boolean): boolean; OnFillDown?(value: string): void; @@ -25,6 +25,7 @@ export interface EditableProps { */ contents: any; fontStyle?: string; + fontSize?: number; height?: number; display?: string; oneLine?: boolean; @@ -52,7 +53,7 @@ export class EditableView extends React.Component<EditableProps> { this.props.OnTab && this.props.OnTab(); } else if (e.key === "Enter") { if (!e.ctrlKey) { - if (this.props.SetValue(e.currentTarget.value)) { + if (this.props.SetValue(e.currentTarget.value, e.shiftKey)) { this._editing = false; } } else if (this.props.OnFillDown) { @@ -76,11 +77,16 @@ export class EditableView extends React.Component<EditableProps> { e.stopPropagation(); } + @action + setIsFocused = (value: boolean) => { + this._editing = value; + } + render() { if (this._editing) { return <input className="editableView-input" defaultValue={this.props.GetValue()} onKeyDown={this.onKeyDown} autoFocus onBlur={action(() => this._editing = false)} onPointerDown={this.stopPropagation} onClick={this.stopPropagation} onPointerUp={this.stopPropagation} - style={{ display: this.props.display }} />; + style={{ display: this.props.display, fontSize: this.props.fontSize }} />; } else { return ( <div className={`editableView-container-editing${this.props.oneLine ? "-oneLine" : ""}`} |
