Add mindmap load

This commit is contained in:
Paulo Gustavo Veiga 2022-01-25 22:40:55 -08:00
parent 3d53f74117
commit 18673fd0d1

View File

@ -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(() => {
if (submit) {
const { map } = fetchMapById(mapId);
if (submit) {
exporter(exportFormat)
.then((url: string) => {
// Create hidden anchor to force download ...