aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionStackingViewFieldColumn.tsx
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2020-01-17 18:26:45 -0500
committerSam Wilkins <samwilkins333@gmail.com>2020-01-17 18:26:45 -0500
commit82851b81ced87c6c71b1bbdfbba797992f585a03 (patch)
tree488dff666750a4522d725a98a7b103afefb94e65 /src/client/views/collections/CollectionStackingViewFieldColumn.tsx
parente4c8cd2fef1242cfb3e4a14e3e3d7bfc852126bd (diff)
parent9843b5c5b3d07003aeafc358abdaa6c8c8b1ba48 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/views/collections/CollectionStackingViewFieldColumn.tsx')
-rw-r--r--src/client/views/collections/CollectionStackingViewFieldColumn.tsx19
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 });