aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionTreeView.tsx
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-12-04 14:28:24 -0500
committerbob <bcz@cs.brown.edu>2019-12-04 14:28:24 -0500
commit710dda13398c01b2b0f63b033ccca0c8ea4f7e49 (patch)
treee7548d99883059235495aeae59e73a5250fb49b0 /src/client/views/collections/CollectionTreeView.tsx
parent97a4a9b1cfddc8b147ff61be13624704949c97f7 (diff)
fixed mainview flyoutbehavior a bit. fixed keyvaluebox editing of lists a little.
Diffstat (limited to 'src/client/views/collections/CollectionTreeView.tsx')
-rw-r--r--src/client/views/collections/CollectionTreeView.tsx16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx
index 48ea35c6b..95503147a 100644
--- a/src/client/views/collections/CollectionTreeView.tsx
+++ b/src/client/views/collections/CollectionTreeView.tsx
@@ -279,7 +279,7 @@ class TreeView extends React.Component<TreeViewProps> {
const contents = doc[key];
let contentElement: (JSX.Element | null)[] | JSX.Element = [];
- if (contents instanceof Doc || Cast(contents, listSpec(Doc))) {
+ if (contents instanceof Doc || (Cast(contents, listSpec(Doc)) && (Cast(contents, listSpec(Doc))!.length && Cast(contents, listSpec(Doc))![0] instanceof Doc))) {
const remDoc = (doc: Doc) => this.remove(doc, key);
const addDoc = (doc: Doc, addBefore?: Doc, before?: boolean) => Doc.AddDocToList(this.dataDoc, key, doc, addBefore, before, false, true);
contentElement = TreeView.GetChildElements(contents instanceof Doc ? [contents] :
@@ -294,7 +294,7 @@ class TreeView extends React.Component<TreeViewProps> {
height={13}
fontSize={12}
GetValue={() => Field.toKeyValueString(doc, key)}
- SetValue={(value: string) => KeyValueBox.SetField(doc, key, value)} />;
+ SetValue={(value: string) => KeyValueBox.SetField(doc, key, value, true)} />;
}
rows.push(<div style={{ display: "flex" }} key={key}>
<span style={{ fontWeight: "bold" }}>{key + ":"}</span>
@@ -302,6 +302,18 @@ class TreeView extends React.Component<TreeViewProps> {
{contentElement}
</div>);
}
+ rows.push(<div style={{ display: "flex" }} key={"newKeyValue"}>
+ <EditableView
+ key="editableView"
+ contents={"+key:value"}
+ height={13}
+ fontSize={12}
+ GetValue={() => ""}
+ SetValue={(value: string) => {
+ value.indexOf(":") !== -1 && KeyValueBox.SetField(doc, value.substring(0, value.indexOf(":")), value.substring(value.indexOf(":") + 1, value.length), true);
+ return true;
+ }} />
+ </div>);
return rows;
}