From 18673fd0d17beea9dda2a51a99f0e78e175c88be Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Tue, 25 Jan 2022 22:40:55 -0800 Subject: [PATCH] Add mindmap load --- .../action-dispatcher/export-dialog/index.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/webapp/src/components/maps-page/action-dispatcher/export-dialog/index.tsx b/packages/webapp/src/components/maps-page/action-dispatcher/export-dialog/index.tsx index 18aef68f..3175a71b 100644 --- a/packages/webapp/src/components/maps-page/action-dispatcher/export-dialog/index.tsx +++ b/packages/webapp/src/components/maps-page/action-dispatcher/export-dialog/index.tsx @@ -10,7 +10,7 @@ import FormControlLabel from '@material-ui/core/FormControlLabel'; import Radio from '@material-ui/core/Radio'; import Select from '@material-ui/core/Select'; import MenuItem from '@material-ui/core/MenuItem'; -import { Designer, TextExporterFactory, ImageExpoterFactory, Exporter, MindMap } from '@wisemapping/mindplot'; +import { Designer, TextExporterFactory, ImageExpoterFactory, Exporter, MindMap, RESTPersistenceManager } from '@wisemapping/mindplot'; type ExportFormat = 'svg' | 'jpg' | 'png' | 'txt' | 'mm' | 'wxml' | 'xls' | 'md'; type ExportGroup = 'image' | 'document' | 'mindmap-tool'; @@ -81,6 +81,17 @@ const ExportDialog = ({ svgElement = workspace.getSVGElement(); size = workspace.getSize(); mindmpap = designer.getMindmap(); + } else { + // Load mindmap ... + const persistence = new RESTPersistenceManager({ + documentUrl: '/c/restful/maps/{id}/document', + revertUrl: '/c/restful/maps/{id}/history/latest', + lockUrl: '/c/restful/maps/{id}/lock', + timestamp: global.lockTimestamp, + session: global.lockSession, + }); + mindmap = persistence.load(global.mapId) + } let exporter: Exporter; @@ -105,8 +116,8 @@ const ExportDialog = ({ }; useEffect(() => { + const { map } = fetchMapById(mapId); if (submit) { - const { map } = fetchMapById(mapId); exporter(exportFormat) .then((url: string) => { // Create hidden anchor to force download ...