aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/EditableView.tsx
diff options
context:
space:
mode:
authorSam Wilkins <abdullah_ahmed@brown.edu>2019-07-23 22:07:55 -0400
committerSam Wilkins <abdullah_ahmed@brown.edu>2019-07-23 22:07:55 -0400
commit40b7197fb9b4748a63845bb664fa9ab02ad6915a (patch)
treebe500c54ece77f20ceec3e6b82a08ae67811ff9b /src/client/views/EditableView.tsx
parent6bf6c34a4c3643a2ee438e49e10267de15e431e7 (diff)
minor styling
Diffstat (limited to 'src/client/views/EditableView.tsx')
-rw-r--r--src/client/views/EditableView.tsx13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/client/views/EditableView.tsx b/src/client/views/EditableView.tsx
index 5cbecf2c9..31e4557be 100644
--- a/src/client/views/EditableView.tsx
+++ b/src/client/views/EditableView.tsx
@@ -39,7 +39,7 @@ export interface EditableProps {
oneLine?: boolean;
editing?: boolean;
onClick?: (e: React.MouseEvent) => boolean;
- isEditingCallback?: (isEditing: boolean) => void;
+ isEditingCallback?: (isEditing: boolean) => void;
}
/**
@@ -58,7 +58,12 @@ export class EditableView extends React.Component<EditableProps> {
@action
componentWillReceiveProps(nextProps: EditableProps) {
- this._editing = nextProps.editing ? true : false;
+ // this is done because when autosuggest is turned on, the suggestions are passed in as a prop,
+ // so when the suggestions are passed in, and no editing prop is passed in, it used to set it
+ // to false. this will no longer do so -syip
+ if (nextProps.editing && nextProps.editing !== this._editing) {
+ this._editing = nextProps.editing;
+ }
}
@action
@@ -88,7 +93,7 @@ export class EditableView extends React.Component<EditableProps> {
if (!this.props.onClick || !this.props.onClick(e)) {
this._editing = true;
this.props.isEditingCallback && this.props.isEditingCallback(true);
- }
+ }
e.stopPropagation();
}
@@ -119,7 +124,7 @@ export class EditableView extends React.Component<EditableProps> {
}}
/>
: <input className="editableView-input" defaultValue={this.props.GetValue()} onKeyDown={this.onKeyDown} autoFocus
- onBlur={action(() => {this._editing = false; this.props.isEditingCallback && this.props.isEditingCallback(false);})} onPointerDown={this.stopPropagation} onClick={this.stopPropagation} onPointerUp={this.stopPropagation}
+ onBlur={action(() => { this._editing = false; this.props.isEditingCallback && this.props.isEditingCallback(false); })} onPointerDown={this.stopPropagation} onClick={this.stopPropagation} onPointerUp={this.stopPropagation}
style={{ display: this.props.display, fontSize: this.props.fontSize }} />;
} else {
if (this.props.autosuggestProps) this.props.autosuggestProps.resetValue();