diff options
Diffstat (limited to 'src')
3 files changed, 12 insertions, 8 deletions
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Backend/TemplateManager.ts b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Backend/TemplateManager.ts index 760940127..6fcca7e30 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Backend/TemplateManager.ts +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Backend/TemplateManager.ts @@ -9,7 +9,7 @@ import { TemplateMenuAIUtils } from './TemplateMenuAIUtils'; export type Conditional = { field: string; - operator: '=' | '>' | '<'; + operator: '=' | '>' | '<' | 'contains'; condition: string; target: string; attribute: string; diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx index 873bfa734..b024a6e9b 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx @@ -80,7 +80,7 @@ export class DocCreatorMenu extends ObservableReactComponent<DocCreateMenuProps> // eslint-disable-next-line no-use-before-define static Instance: DocCreatorMenu; - private DEBUG_MODE: boolean = false; + private DEBUG_MODE: boolean = true; private _ref: HTMLDivElement | null = null; private templateManager: TemplateManager; @@ -589,6 +589,8 @@ export class DocCreatorMenu extends ObservableReactComponent<DocCreateMenuProps> this.variations = []; const mainCollection = this._dataViz?.DocumentView?.().containerViewPath?.().lastElement()?.ComponentView as CollectionFreeFormView; + console.log('styleref: ', useStyleRef); + const clone: Doc = (await Doc.MakeClone(onDoc)).clone; mainCollection.addDocument(clone); clone.x = 10000; @@ -909,14 +911,14 @@ export class DocCreatorMenu extends ObservableReactComponent<DocCreateMenuProps> } get dashboardContents() { - const contentFieldTitles = this.fieldsInfos.filter(field => field.type !== TemplateFieldType.DATA).map(field => field.title).concat('template'); + const contentFieldTitles = this.fieldsInfos.filter(field => field.type !== TemplateFieldType.DATA).map(field => field.title).concat('Template'); const conditionForm = (title: string, parameters?: Conditional, empty: boolean = false) => { const params: Conditional = parameters ?? this._currEditingConditional; return ( - <div className='form'> + <div className='form' id={String(Math.random() * 100000)}> <div className='form-row'> <div className='form-row-plain-text'>If</div> <div className='form-row-plain-text'>{title}</div> @@ -925,6 +927,7 @@ export class DocCreatorMenu extends ObservableReactComponent<DocCreateMenuProps> <div className='operator-dropdown-option' onPointerDown={() => {params.operator = '='}}>{'='}</div> <div className='operator-dropdown-option' onPointerDown={() => {params.operator = '>'}}>{'>'}</div> <div className='operator-dropdown-option' onPointerDown={() => {params.operator = '<'}}>{'<'}</div> + <div className='operator-dropdown-option' onPointerDown={() => {params.operator = 'contains'}}>{'has'}</div> </div> <textarea className="form-row-textarea" @@ -934,9 +937,9 @@ export class DocCreatorMenu extends ObservableReactComponent<DocCreateMenuProps> /> <div className='form-row-plain-text'>then</div> <div className="operator-options-dropdown"> - <span className="operator-dropdown-current">{params.target ?? 'self'}</span> + <span className="operator-dropdown-current">{params.target ?? 'Own'}</span> {contentFieldTitles.map(fieldTitle => - <div className='operator-dropdown-option' onPointerDown={() => {params.target = fieldTitle}}>{fieldTitle === title ? 'own' : fieldTitle}</div> + <div className='operator-dropdown-option' onPointerDown={() => {params.target = fieldTitle}}>{fieldTitle === title ? 'Own' : fieldTitle}</div> )} </div> <textarea diff --git a/src/client/views/smartdraw/DrawingFillHandler.tsx b/src/client/views/smartdraw/DrawingFillHandler.tsx index 48107ff0d..73a47681a 100644 --- a/src/client/views/smartdraw/DrawingFillHandler.tsx +++ b/src/client/views/smartdraw/DrawingFillHandler.tsx @@ -25,8 +25,8 @@ export class DrawingFillHandler { : [] : Doc.Links(drawing) .map(link => Doc.getOppositeAnchor(link, drawing)) - .map(anchor => anchor && DocCast(anchor.embedContainer)); - const styleUrl = await DocumentView.GetDocImage(styleDocs.filter(doc => doc?.data instanceof ImageField).lastElement())?.then(styleImg => { + .map(anchor => anchor && DocCast(anchor.embedContainer)); + const styyleUrl = await DocumentView.GetDocImage(styleDocs.lastElement())?.then(styleImg => { const hrefParts = ImageCast(styleImg).url.href.split('.'); return `${hrefParts.slice(0, -1).join('.')}_o.${hrefParts.lastElement()}`; }); @@ -42,6 +42,7 @@ export class DrawingFillHandler { const { href } = ImageCast(imageField).url; const hrefParts = href.split('.'); const structureUrl = `${hrefParts.slice(0, -1).join('.')}_o.${hrefParts.lastElement()}`; + const styleUrl = styleDoc ? `${hrefParts.slice(0, -1).join('.')}_o.${hrefParts.lastElement()}` : undefined; return imageUrlToBase64(structureUrl) .then(gptDescribeImage) .then((prompt, newPrompt = user_prompt || prompt) => |