From 5a76ed69d488cc5798161fb2a528baabc690928d Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 23 Jul 2025 13:49:26 -0400 Subject: fixes for chatbox that already exists when a collection is opened to still have access to the collection's docs. --- .../collectionFreeForm/CollectionFreeFormView.tsx | 69 +++++++++++----------- 1 file changed, 35 insertions(+), 34 deletions(-) (limited to 'src/client/views/collections/collectionFreeForm') diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 3e6aa777f..fe5910671 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -1,5 +1,4 @@ import { Button, Colors, NumberDropdown, Size, Type } from '@dash/components'; -import { Slider } from '@mui/material'; import { Bezier } from 'bezier-js'; import { Property } from 'csstype'; import { action, computed, IReactionDisposer, makeObservable, observable, reaction, runInAction } from 'mobx'; @@ -94,7 +93,7 @@ export interface collectionFreeformViewProps { @observer export class CollectionFreeFormView extends CollectionSubView>() { private static _infoUIInstance: CollectionFreeFormInfoUI | null = null; - + public get displayName() { return 'CollectionFreeFormView(' + (this.Document.title?.toString() ?? '') + ')'; } // this makes mobx trace() statements more descriptive @@ -1756,47 +1755,46 @@ export class CollectionFreeFormView extends CollectionSubView { Doc.IsInfoUIDisabled || this.Document.annotationOn || this._props.renderDepth ? null // : CollectionFreeFormView._infoUI?.(this.Document, this.layoutDoc, this.childDocsFunc, this.closeInfo) || null; - if (Doc.IsInfoUIDisabled || this.Document.annotationOn || this._props.renderDepth) { - return null; - } - const creator = CollectionFreeFormView._infoUI; - if (!creator) return null; - const element = creator(this.Document, this.layoutDoc, this.childDocsFunc, this.closeInfo); - // attach ref so we can call skipToState(...) later - return React.isValidElement(element) - ? React.cloneElement(element, { - ref: (r: CollectionFreeFormInfoUI) => { - CollectionFreeFormView._infoUIInstance = r; - } - }) - : element; - + if (Doc.IsInfoUIDisabled || this.Document.annotationOn || this._props.renderDepth) { + return null; + } + const creator = CollectionFreeFormView._infoUI; + if (!creator) return null; + const element = creator(this.Document, this.layoutDoc, this.childDocsFunc, this.closeInfo); + // attach ref so we can call skipToState(...) later + return React.isValidElement(element) + ? React.cloneElement(element, { + ref: (r: CollectionFreeFormInfoUI) => { + CollectionFreeFormView._infoUIInstance = r; + }, + }) + : element; }; componentDidMount() { this._props.setContentViewBox?.(this); @@ -2248,7 +2246,10 @@ export class CollectionFreeFormView extends CollectionSubView (this._fireflyRefStrength = val as number)),`${this.Document.title} button set from list` )} + setNumber={undoable( + action(val => (this._fireflyRefStrength = val as number)), + `${this.Document.title} button set from list` + )} fillWidth /> -- cgit v1.2.3-70-g09d2