diff options
Diffstat (limited to 'src/client/views/nodes/DiagramBox.tsx')
-rw-r--r-- | src/client/views/nodes/DiagramBox.tsx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/client/views/nodes/DiagramBox.tsx b/src/client/views/nodes/DiagramBox.tsx index 902134fb7..2e77d1796 100644 --- a/src/client/views/nodes/DiagramBox.tsx +++ b/src/client/views/nodes/DiagramBox.tsx @@ -14,6 +14,10 @@ import { ContextMenu } from '../ContextMenu'; import { gptAPICall, GPTCallType } from '../../apis/gpt/GPT'; import { ChatCompletionMessageParam } from 'openai/resources/chat/completions'; import OpenAI, { ClientOptions } from 'openai'; +import { line } from 'd3'; +import { InkingStroke } from '../InkingStroke'; +import { DocumentManager } from '../../util/DocumentManager'; +import { C } from '@fullcalendar/core/internal-common'; @observer export class DiagramBox extends ViewBoxAnnotatableComponent<FieldViewProps>() implements ViewBoxInterface { @@ -22,10 +26,11 @@ export class DiagramBox extends ViewBoxAnnotatableComponent<FieldViewProps>() im } private _ref: React.RefObject<HTMLDivElement> = React.createRef(); private _dragRef = React.createRef<HTMLDivElement>(); + private chartContent:string constructor(props: FieldViewProps) { super(props); makeObservable(this); - //this.chartContent = 'flowchart LR;A-->B:::wide;B-->C:::wide; B-->D[hello];'; + this.chartContent = 'flowchart LR;A-->B:::wide;B-->C:::wide; B-->D[hello];'; } @observable inputValue = ''; @@ -43,6 +48,10 @@ export class DiagramBox extends ViewBoxAnnotatableComponent<FieldViewProps>() im startOnLoad: true, flowchart: { useMaxWidth: true, htmlLabels: true, curve: 'cardinal' }, }); + this.renderMermaidAsync.call(this,this.chartContent); + this.mermaidCode=this.chartContent + this.createMermaidCode() + } renderMermaid = async (str:string) => { try { @@ -119,6 +128,10 @@ export class DiagramBox extends ViewBoxAnnotatableComponent<FieldViewProps>() im let rectangleArray = docArray.filter(doc => doc.title == 'rectangle' || doc.title == 'circle'); let lineArray = docArray.filter(doc => doc.title == 'line' || doc.title == 'stroke'); let textArray = docArray.filter(doc => doc.type == 'rich text'); + console.log(docArray) + console.log(this.childDocs + .map(doc => DocumentManager.Instance.getDocumentView(doc, this.DocumentView?.()))); + console.log(this.Document.data.filter(inkView => inkView?.ComponentView instanceof InkingStroke)) for (let i = 0; i < rectangleArray.length; i++) { const rectangle = rectangleArray[i]; for (let j = 0; j < lineArray.length; j++) { @@ -170,7 +183,6 @@ export class DiagramBox extends ViewBoxAnnotatableComponent<FieldViewProps>() im }; render() { - console.log(this.loading) return( <div ref={this._ref} className="DIYNodeBox"> <div ref={this._dragRef} className="DIYNodeBox-wrapper"> |