diff options
author | tschicke-brown <tyler_schicke@brown.edu> | 2019-03-19 18:02:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-19 18:02:51 -0400 |
commit | 9914582c733bbd345ab725609d9b122d6fe57d5f (patch) | |
tree | 5455db0a91cf8c4490223021ea6e4f01c7104aaa /src/client/views/nodes/KeyValuePair.tsx | |
parent | 9eff1894078c0cbf5592646acb5e20e5761fc167 (diff) | |
parent | ef0e1ecc441d300531a09a2b5b0746b04eb25c11 (diff) |
Merge pull request #70 from browngraphicslab/kvp_delete
deleting keys is functional
Diffstat (limited to 'src/client/views/nodes/KeyValuePair.tsx')
-rw-r--r-- | src/client/views/nodes/KeyValuePair.tsx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/client/views/nodes/KeyValuePair.tsx b/src/client/views/nodes/KeyValuePair.tsx index 111f85a05..7ed5ee272 100644 --- a/src/client/views/nodes/KeyValuePair.tsx +++ b/src/client/views/nodes/KeyValuePair.tsx @@ -1,5 +1,6 @@ import 'react-image-lightbox/style.css'; // This only needs to be imported once in your app import "./KeyValueBox.scss"; +import "./KeyValuePair.scss"; import React = require("react") import { FieldViewProps, FieldView } from './FieldView'; import { Opt, Field } from '../../../fields/Field'; @@ -55,7 +56,18 @@ export class KeyValuePair extends React.Component<KeyValuePairProps> { ); return ( <tr className={this.props.rowStyle}> - <td>{this.key.Name}</td> + {/* <button>X</button> */} + <td> + <div className="container"> + <div>{this.key.Name}</div> + <button className="delete" onClick={() => { + let field = props.doc.Get(props.fieldKey); + if (field && field instanceof Field) { + props.doc.Set(props.fieldKey, undefined); + } + }}>X</button> + </div> + </td> <td><EditableView contents={contents} height={36} GetValue={() => { let field = props.doc.Get(props.fieldKey); if (field && field instanceof Field) { |