mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 14:47:56 +01:00
Fix export in mindmap list.
This commit is contained in:
parent
4253479b75
commit
eb12d6cc94
@ -38,11 +38,11 @@ export const buildPersistenceManagerForEditor = (mode: string): PersistenceManag
|
|||||||
return persistenceManager;
|
return persistenceManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getMindmapFromPersistence = (mapId: string): Mindmap => {
|
export const fetchMindmap = async (mapId: number): Promise<Mindmap> => {
|
||||||
let mindmap: Mindmap;
|
let mindmap: Mindmap;
|
||||||
if (AppConfig.isRestClient()) {
|
if (AppConfig.isRestClient()) {
|
||||||
const persistence = new LocalStorageManager(`/c/restful/maps/{id}/document/xml`, true);
|
const persistence = new LocalStorageManager(`/c/restful/maps/{id}/document/xml`, true);
|
||||||
mindmap = persistence.load(String(mapId));
|
mindmap = await persistence.load(String(mapId));
|
||||||
} else {
|
} else {
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
const xmlDoc = parser.parseFromString(
|
const xmlDoc = parser.parseFromString(
|
||||||
@ -55,7 +55,7 @@ export const getMindmapFromPersistence = (mapId: string): Mindmap => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const serializer = XMLSerializerFactory.getSerializer('tango');
|
const serializer = XMLSerializerFactory.getSerializer('tango');
|
||||||
mindmap = serializer.loadFromDom(xmlDoc, String(mapId));
|
mindmap = Promise.resolve(serializer.loadFromDom(xmlDoc, String(mapId)));
|
||||||
}
|
}
|
||||||
return mindmap;
|
return mindmap;
|
||||||
};
|
};
|
||||||
|
@ -18,7 +18,7 @@ import {
|
|||||||
Mindmap,
|
Mindmap,
|
||||||
SizeType,
|
SizeType,
|
||||||
} from '@wisemapping/editor';
|
} from '@wisemapping/editor';
|
||||||
import { getMindmapFromPersistence } from '../../../editor-page/PersistenceManagerUtils';
|
import { fetchMindmap } from '../../../editor-page/PersistenceManagerUtils';
|
||||||
|
|
||||||
import Checkbox from '@mui/material/Checkbox';
|
import Checkbox from '@mui/material/Checkbox';
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ const ExportDialog = ({
|
|||||||
setZoomToFit(!zoomToFit);
|
setZoomToFit(!zoomToFit);
|
||||||
};
|
};
|
||||||
|
|
||||||
const exporter = (formatType: ExportFormat): Promise<string> => {
|
const exporter = async (formatType: ExportFormat): Promise<string> => {
|
||||||
let svgElement: Element | null = null;
|
let svgElement: Element | null = null;
|
||||||
let size: SizeType;
|
let size: SizeType;
|
||||||
let mindmap: Mindmap;
|
let mindmap: Mindmap;
|
||||||
@ -103,7 +103,7 @@ const ExportDialog = ({
|
|||||||
}
|
}
|
||||||
// exporting from map list
|
// exporting from map list
|
||||||
else {
|
else {
|
||||||
mindmap = getMindmapFromPersistence(String(mapId));
|
mindmap = await fetchMindmap(mapId);
|
||||||
}
|
}
|
||||||
|
|
||||||
let exporter: Exporter;
|
let exporter: Exporter;
|
||||||
|
Loading…
Reference in New Issue
Block a user