@@ -39,6 +39,7 @@ import {
3939 getIsStopAnimations ,
4040 setStopAnimations ,
4141} from '../follow-path/animate-path' ;
42+ import { OCWGExporter } from '../exporters/export-ocwg' ;
4243
4344export class NavbarComponent extends Component <
4445 AppNavComponentsProps < NodeInfo >
@@ -156,7 +157,45 @@ export class NavbarComponent extends Component<
156157 {
157158 caption : 'Export as mermaid' ,
158159 onClick : ( ) => {
159- this . exportToMermaid ( ) ;
160+ try {
161+ this . exportToMermaid ( ) ;
162+ } catch ( err ) {
163+ console . error ( err ) ;
164+ }
165+ } ,
166+ } ,
167+ {
168+ caption : 'Export as OCIF' ,
169+ onClick : ( ) => {
170+ const canvasApp = this . props . getCanvasApp ( ) ;
171+ if ( ! canvasApp ) {
172+ return ;
173+ }
174+ const exporter = new OCWGExporter (
175+ {
176+ canvasApp : canvasApp ,
177+ downloadFile : (
178+ _data : any ,
179+ _name : string ,
180+ _dataType : string
181+ ) => {
182+ //
183+ } ,
184+ } ,
185+ getNodeTaskFactory
186+ ) ;
187+ const ocifFile = exporter . convertToExportFile ( ) ;
188+ try {
189+ saveFile (
190+ JSON . stringify ( ocifFile , null , 2 ) ,
191+ 'code-flow-canvas.ocif.json' ,
192+ 'application/json' ,
193+ '.ocif.json' ,
194+ 'ocif-json'
195+ ) ;
196+ } catch ( err ) {
197+ console . error ( err ) ;
198+ }
160199 } ,
161200 } ,
162201 ] }
@@ -428,19 +467,19 @@ export class NavbarComponent extends Component<
428467 compositions ,
429468 canvasApp . elements
430469 ) ,
431- 'vps -flow' ,
470+ 'code -flow-canvas.ts ' ,
432471 'text/x.typescript' ,
433472 '.ts' ,
434- 'vps -flow-typescript'
473+ 'code-flow-canvas -flow-typescript'
435474 ) ;
436475 return ;
437476 }
438477 saveFile (
439478 exportFlowToJson < NodeInfo > ( '1234' , data , compositions ) ,
440- 'vps -flow' ,
479+ 'code -flow-canvas.json ' ,
441480 'application/json' ,
442481 '.json' ,
443- 'vps -flow-json'
482+ 'code -flow-canvas -json'
444483 ) ;
445484 } ;
446485
@@ -478,10 +517,10 @@ export class NavbarComponent extends Component<
478517
479518 saveFile (
480519 mermaid ,
481- 'vps -flow' ,
520+ 'code -flow-canvas.mermaid ' ,
482521 'text/vnd.mermaid' ,
483522 '.mermaid' ,
484- 'vps -flow-mermaid'
523+ 'code -flow-canvas -mermaid'
485524 ) ;
486525 } ;
487526
0 commit comments