aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/EditableView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/EditableView.tsx')
-rw-r--r--src/client/views/EditableView.tsx17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/client/views/EditableView.tsx b/src/client/views/EditableView.tsx
index 73467eb9d..c946d68e1 100644
--- a/src/client/views/EditableView.tsx
+++ b/src/client/views/EditableView.tsx
@@ -22,8 +22,9 @@ export interface EditableProps {
* The contents to render when not editing
*/
contents: any;
- height: number;
+ height?: number;
display?: string;
+ oneLine?: boolean;
}
/**
@@ -52,14 +53,20 @@ export class EditableView extends React.Component<EditableProps> {
}
}
+ @action
+ onClick = (e: React.MouseEvent) => {
+ this.editing = true;
+ e.stopPropagation();
+ }
+
render() {
if (this.editing) {
- return <input defaultValue={this.props.GetValue()} onKeyDown={this.onKeyDown} autoFocus onBlur={action(() => this.editing = false)}
- style={{ display: this.props.display }}></input>;
+ return <input className="editableView-input" defaultValue={this.props.GetValue()} onKeyDown={this.onKeyDown} autoFocus onBlur={action(() => this.editing = false)}
+ style={{ display: this.props.display }} />;
} else {
return (
- <div className="editableView-container-editing" style={{ display: this.props.display, height: "auto", maxHeight: `${this.props.height}` }}
- onClick={action(() => this.editing = true)} >
+ <div className={`editableView-container-editing${this.props.oneLine ? "-oneLine" : ""}`} style={{ display: this.props.display, height: "auto", maxHeight: `${this.props.height}` }}
+ onClick={this.onClick} >
<span>{this.props.contents}</span>
</div>
);