diff options
Diffstat (limited to 'src/client/views/collections')
| -rw-r--r-- | src/client/views/collections/CollectionCarousel3DView.tsx | 7 | ||||
| -rw-r--r-- | src/client/views/collections/CollectionCarouselView.tsx | 18 | ||||
| -rw-r--r-- | src/client/views/collections/CollectionMenu.tsx | 5 |
3 files changed, 15 insertions, 15 deletions
diff --git a/src/client/views/collections/CollectionCarousel3DView.tsx b/src/client/views/collections/CollectionCarousel3DView.tsx index 2251b60e5..3c66faf0c 100644 --- a/src/client/views/collections/CollectionCarousel3DView.tsx +++ b/src/client/views/collections/CollectionCarousel3DView.tsx @@ -133,10 +133,9 @@ export class CollectionCarousel3DView extends CollectionSubView(Carousel3DDocume } @computed get dots() { - return (this.childLayoutPairs.map((_child, index) => { - return <div key={Utils.GenerateGuid()} className={`dot${index === NumCast(this.layoutDoc._itemIndex) ? "-active" : ""}`} - onClick={() => this.layoutDoc._itemIndex = index} />; - })); + return (this.childLayoutPairs.map((_child, index) => + <div key={Utils.GenerateGuid()} className={`dot${index === NumCast(this.layoutDoc._itemIndex) ? "-active" : ""}`} + onClick={() => this.layoutDoc._itemIndex = index} />)); } render() { diff --git a/src/client/views/collections/CollectionCarouselView.tsx b/src/client/views/collections/CollectionCarouselView.tsx index cd81a99c9..6c2c27e8e 100644 --- a/src/client/views/collections/CollectionCarouselView.tsx +++ b/src/client/views/collections/CollectionCarouselView.tsx @@ -38,9 +38,10 @@ export class CollectionCarouselView extends CollectionSubView(CarouselDocument) e.stopPropagation(); this.layoutDoc._itemIndex = (NumCast(this.layoutDoc._itemIndex) - 1 + this.childLayoutPairs.length) % this.childLayoutPairs.length; } - captionStyleProvider = (doc: (Doc | undefined), props: Opt<DocumentViewProps>, property: string): any => { - const captionProps = { ...this.props, fieldKey: "caption" }; - return this.props.styleProvider?.(doc, props, property) || this.props.styleProvider?.(this.layoutDoc, captionProps, property); + captionStyleProvider = (doc: (Doc | undefined), captionProps: Opt<DocumentViewProps>, property: string): any => { + // first look for properties on the document in the carousel, then fallback to properties on the container + const childValue = doc?.["caption-" + property] ? this.props.styleProvider?.(doc, captionProps, property) : undefined; + return childValue ?? this.props.styleProvider?.(this.layoutDoc, captionProps, property); } panelHeight = () => this.props.PanelHeight() - (StrCast(this.layoutDoc._showCaption) ? 50 : 0); onContentDoubleClick = () => ScriptCast(this.layoutDoc.onChildDoubleClick); @@ -51,12 +52,14 @@ export class CollectionCarouselView extends CollectionSubView(CarouselDocument) const captionProps = { ...this.props, fieldKey: "caption" }; const marginX = NumCast(this.layoutDoc["caption-xMargin"]); const marginY = NumCast(this.layoutDoc["caption-yMargin"]); + const showCaptions = StrCast(this.layoutDoc._showCaption); return !(curDoc?.layout instanceof Doc) ? (null) : <> <div className="collectionCarouselView-image" key="image"> <DocumentView {...OmitKeys(this.props, ["NativeWidth", "NativeHeight", "childLayoutTemplate", "childLayoutString"]).omit} onDoubleClick={this.onContentDoubleClick} onClick={this.onContentClick} + hideCaptions={showCaptions ? true : false} renderDepth={this.props.renderDepth + 1} ContainingCollectionView={this} LayoutTemplate={this.props.childLayoutTemplate} @@ -69,17 +72,16 @@ export class CollectionCarouselView extends CollectionSubView(CarouselDocument) </div> <div className="collectionCarouselView-caption" key="caption" style={{ - display: StrCast(this.layoutDoc._showCaption) ? undefined : "none", + display: showCaptions ? undefined : "none", borderRadius: this.props.styleProvider?.(this.layoutDoc, captionProps, StyleProp.BorderRounding), marginRight: marginX, marginLeft: marginX, width: `calc(100% - ${marginX * 2}px)` }}> <FormattedTextBox key={index} {...captionProps} + fieldKey={showCaptions} styleProvider={this.captionStyleProvider} - Document={curDoc.layout} DataDoc={undefined} - fontSize={NumCast(this.layoutDoc["caption-fontSize"])} - xPadding={NumCast(this.layoutDoc["caption-xPadding"])} - yPadding={NumCast(this.layoutDoc["caption-yPadding"])} /> + Document={curDoc.layout} + DataDoc={undefined} /> </div> </>; } diff --git a/src/client/views/collections/CollectionMenu.tsx b/src/client/views/collections/CollectionMenu.tsx index 08290a9b3..6e6fabd0d 100644 --- a/src/client/views/collections/CollectionMenu.tsx +++ b/src/client/views/collections/CollectionMenu.tsx @@ -763,7 +763,7 @@ export class CollectionFreeFormViewChrome extends React.Component<CollectionMenu render() { return !this.props.docView.layoutDoc ? (null) : <div className="collectionFreeFormMenu-cont"> - + <RichTextMenu key="rich" /> {!this.isText ? <> {this.drawButtons} @@ -789,8 +789,7 @@ export class CollectionFreeFormViewChrome extends React.Component<CollectionMenu </div> </Tooltip> </>} - </> : - <RichTextMenu /> + </> : (null) } {!this.selectedDocumentView?.ComponentView?.menuControls ? (null) : this.selectedDocumentView?.ComponentView?.menuControls?.()} </div>; |
