diff options
| author | bob <bcz@cs.brown.edu> | 2020-01-17 17:09:29 -0500 |
|---|---|---|
| committer | bob <bcz@cs.brown.edu> | 2020-01-17 17:09:29 -0500 |
| commit | 03dafe7743dc3e70f9e936aec8bf2e49efbfb041 (patch) | |
| tree | 148b69067c405f1847c89a97f29130098f4f1724 /src/client/views/collections/CollectionStackingViewFieldColumn.tsx | |
| parent | 9af3c5967e45b98186a2862a1f23e2494630ddb3 (diff) | |
changed view types around to be stored on extension doc. added stuff to stackingview to create views of fields using ';"
Diffstat (limited to 'src/client/views/collections/CollectionStackingViewFieldColumn.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionStackingViewFieldColumn.tsx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/client/views/collections/CollectionStackingViewFieldColumn.tsx b/src/client/views/collections/CollectionStackingViewFieldColumn.tsx index 39b4e4e1d..9cdb9b281 100644 --- a/src/client/views/collections/CollectionStackingViewFieldColumn.tsx +++ b/src/client/views/collections/CollectionStackingViewFieldColumn.tsx @@ -18,6 +18,9 @@ import { EditableView } from "../EditableView"; import { CollectionStackingView } from "./CollectionStackingView"; import "./CollectionStackingView.scss"; import { TraceMobx } from "../../../new_fields/util"; +import { FormattedTextBox } from "../nodes/FormattedTextBox"; +import { ImageField } from "../../../new_fields/URLField"; +import { ImageBox } from "../nodes/ImageBox"; library.add(faPalette); @@ -132,6 +135,22 @@ export class CollectionStackingViewFieldColumn extends React.Component<CSVFieldC @action addDocument = (value: string, shiftDown?: boolean) => { + if (value === ":freeForm") { + return this.props.parent.props.addDocument(Docs.Create.FreeformDocument([], { width: 200, height: 200 })); + } else if (value.startsWith(":")) { + const field = value.substring(1); + if (this.props.parent.props.Document[field] instanceof ImageField) { + let doc = Docs.Create.ImageDocument((this.props.parent.props.Document[field] as ImageField).url.href, {}); + doc.layout = ImageBox.LayoutString(field); + doc.proto = Doc.GetProto(this.props.parent.props.Document); + return this.props.parent.props.addDocument(doc); + } else { + let doc = Docs.Create.TextDocument({ width: 200, height: 25, autoHeight: true }); + doc.layout = FormattedTextBox.LayoutString(field); + doc.proto = Doc.GetProto(this.props.parent.props.Document); + return this.props.parent.props.addDocument(doc); + } + } this._createAliasSelected = false; const key = StrCast(this.props.parent.props.Document.sectionFilter); const newDoc = Docs.Create.TextDocument({ height: 18, width: 200, documentText: "@@@" + value, title: value, autoHeight: true }); |
