diff options
| author | yipstanley <stanley_yip@brown.edu> | 2019-06-24 15:59:22 -0400 |
|---|---|---|
| committer | yipstanley <stanley_yip@brown.edu> | 2019-06-24 15:59:22 -0400 |
| commit | a99639e9073ea154728ff9676c41af646791f4cd (patch) | |
| tree | 027ef2ae68f00432c99cf1caf6ad4d9c9547b5d8 /src/client/views/EditableView.tsx | |
| parent | 65288e33b49404d21012323fcb53fefb3f646fbf (diff) | |
| parent | d475b19e9ba7bc8870ec7bc1e10b5cc88decea0b (diff) | |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into pdf_snippet
Diffstat (limited to 'src/client/views/EditableView.tsx')
| -rw-r--r-- | src/client/views/EditableView.tsx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/client/views/EditableView.tsx b/src/client/views/EditableView.tsx index 70d6c22bf..97a2d19dd 100644 --- a/src/client/views/EditableView.tsx +++ b/src/client/views/EditableView.tsx @@ -29,6 +29,7 @@ export interface EditableProps { display?: string; oneLine?: boolean; editing?: boolean; + onClick?: (e: React.MouseEvent) => boolean; } /** @@ -65,14 +66,20 @@ export class EditableView extends React.Component<EditableProps> { @action onClick = (e: React.MouseEvent) => { - this._editing = true; + if (!this.props.onClick || !this.props.onClick(e)) { + this._editing = true; + } + e.stopPropagation(); + } + + stopPropagation(e: React.SyntheticEvent) { e.stopPropagation(); } render() { if (this._editing) { return <input className="editableView-input" defaultValue={this.props.GetValue()} onKeyDown={this.onKeyDown} autoFocus - onBlur={action(() => this._editing = false)} + onBlur={action(() => this._editing = false)} onPointerDown={this.stopPropagation} onClick={this.stopPropagation} onPointerUp={this.stopPropagation} style={{ display: this.props.display }} />; } else { return ( |
