From 4ac7a62d813738b0047caefbcf40d3063ec9e6c1 Mon Sep 17 00:00:00 2001 From: bobzel Date: Tue, 5 Feb 2019 22:37:46 -0500 Subject: checkpoint --- src/views/nodes/CollectionFreeFormDocumentView.tsx | 5 ++++- src/views/nodes/DocumentView.tsx | 7 ++++--- src/views/nodes/ImageBox.tsx | 20 ++++++++------------ 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src/views/nodes') diff --git a/src/views/nodes/CollectionFreeFormDocumentView.tsx b/src/views/nodes/CollectionFreeFormDocumentView.tsx index 08068b384..9f13733c9 100644 --- a/src/views/nodes/CollectionFreeFormDocumentView.tsx +++ b/src/views/nodes/CollectionFreeFormDocumentView.tsx @@ -11,6 +11,7 @@ import "./NodeView.scss"; import React = require("react"); import { DocumentView, DocumentViewProps } from "./DocumentView"; import { WAITING } from "../../fields/Field"; +import { ImageField } from '../../fields/ImageField'; @observer @@ -206,6 +207,8 @@ export class CollectionFreeFormDocumentView extends DocumentView { render() { var freestyling = this.props.ContainingCollectionView instanceof CollectionFreeFormView; + let data = this.props.Document.GetFieldT(KeyStore.Data, ImageField); + console.log("CollectionFFDocView " + this.props.Document.Title + "<" + data + "> x=" + this.x); return (
- +
); } diff --git a/src/views/nodes/DocumentView.tsx b/src/views/nodes/DocumentView.tsx index 334ea1cb2..94fe0440f 100644 --- a/src/views/nodes/DocumentView.tsx +++ b/src/views/nodes/DocumentView.tsx @@ -21,6 +21,7 @@ export interface DocumentViewProps { Document: Document; DocumentView: Opt // needed only to set ContainingDocumentView on CollectionViewProps when invoked from JsxParser -- is there a better way? ContainingCollectionView: Opt; + Data: any; } @observer export class DocumentView extends React.Component { @@ -131,15 +132,15 @@ export class DocumentView extends React.Component { let bindings = { ...this.props } as any; for (const key of this.layoutKeys) { bindings[key.Name + "Key"] = key; + let val = this.props.Document.GetField(key); } if (bindings.DocumentView === undefined) bindings.DocumentView = this; for (const key of this.layoutFields) { let field = doc.GetField(key); - if (field && field != WAITING) { - bindings[key.Name] = field.GetValue(); - } + bindings[key.Name] = field && field != WAITING ? field.GetValue() : field; } + console.log("DocumentView Rendering " + doc.Title + " data = " + this.props.Data); return (
{ render() { let field = this.props.doc.GetFieldT(this.props.fieldKey, ImageField); - let path = ""; - if (field) { - if (field === WAITING) { - path = "https://image.flaticon.com/icons/svg/66/66163.svg" - } else { - path = field.Data.href; - } - } - const images = [path,]; + let path = field == WAITING ? "https://image.flaticon.com/icons/svg/66/66163.svg" : + field instanceof ImageField ? field.Data.href : ""; + console.log("ImageBox Rendering " + this.props.doc.Title); var lightbox = () => { + const images = [path, "http://www.cs.brown.edu/~bcz/face.gif"]; const { photoIndex } = this.state; if (this.state.isOpen && this.props.DocumentViewForField instanceof CollectionFreeFormDocumentView && SelectionManager.IsSelected(this.props.DocumentViewForField)) { return ( 0 ? images[(photoIndex + images.length - 1) % images.length] : undefined} + nextSrc={images[(photoIndex + 1) % images.length]} + prevSrc={images[(photoIndex + images.length - 1) % images.length]} onCloseRequest={() => this.setState({ isOpen: false })} onMovePrevRequest={() => this.setState({ photoIndex: (photoIndex + images.length - 1) % images.length, }) @@ -89,7 +85,7 @@ export class ImageBox extends React.Component { } return (
- Image not found + Image not found {lightbox()}
) } -- cgit v1.2.3-70-g09d2