aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/EditableView.tsx
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-05-20 00:09:47 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-05-20 00:09:47 -0400
commitaf2346983eae1145167b70faf96a9aec0ca82427 (patch)
tree36f89aeaaf335f0d12fd690592556d831162a59c /src/client/views/EditableView.tsx
parentfa602aa4dec7b39b48779ffe907229db4d9f6264 (diff)
Fixed a bunch of demo bugs
Moved Field Symbols to separate file Editing is mostly working in debug viewer
Diffstat (limited to 'src/client/views/EditableView.tsx')
-rw-r--r--src/client/views/EditableView.tsx10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client/views/EditableView.tsx b/src/client/views/EditableView.tsx
index 78143ccda..c946d68e1 100644
--- a/src/client/views/EditableView.tsx
+++ b/src/client/views/EditableView.tsx
@@ -22,7 +22,7 @@ export interface EditableProps {
* The contents to render when not editing
*/
contents: any;
- height: number;
+ height?: number;
display?: string;
oneLine?: boolean;
}
@@ -53,6 +53,12 @@ export class EditableView extends React.Component<EditableProps> {
}
}
+ @action
+ onClick = (e: React.MouseEvent) => {
+ this.editing = true;
+ e.stopPropagation();
+ }
+
render() {
if (this.editing) {
return <input className="editableView-input" defaultValue={this.props.GetValue()} onKeyDown={this.onKeyDown} autoFocus onBlur={action(() => this.editing = false)}
@@ -60,7 +66,7 @@ export class EditableView extends React.Component<EditableProps> {
} else {
return (
<div className={`editableView-container-editing${this.props.oneLine ? "-oneLine" : ""}`} style={{ display: this.props.display, height: "auto", maxHeight: `${this.props.height}` }}
- onClick={action(() => this.editing = true)} >
+ onClick={this.onClick} >
<span>{this.props.contents}</span>
</div>
);