mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-10 17:33:24 +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;
|
||||
};
|
||||
|
||||
export const getMindmapFromPersistence = (mapId: string): Mindmap => {
|
||||
export const fetchMindmap = async (mapId: number): Promise<Mindmap> => {
|
||||
let mindmap: Mindmap;
|
||||
if (AppConfig.isRestClient()) {
|
||||
const persistence = new LocalStorageManager(`/c/restful/maps/{id}/document/xml`, true);
|
||||
mindmap = persistence.load(String(mapId));
|
||||
mindmap = await persistence.load(String(mapId));
|
||||
} else {
|
||||
const parser = new DOMParser();
|
||||
const xmlDoc = parser.parseFromString(
|
||||
@ -55,7 +55,7 @@ export const getMindmapFromPersistence = (mapId: string): Mindmap => {
|
||||
);
|
||||
|
||||
const serializer = XMLSerializerFactory.getSerializer('tango');
|
||||
mindmap = serializer.loadFromDom(xmlDoc, String(mapId));
|
||||
mindmap = Promise.resolve(serializer.loadFromDom(xmlDoc, String(mapId)));
|
||||
}
|
||||
return mindmap;
|
||||
};
|
||||
|
@ -18,7 +18,7 @@ import {
|
||||
Mindmap,
|
||||
SizeType,
|
||||
} from '@wisemapping/editor';
|
||||
import { getMindmapFromPersistence } from '../../../editor-page/PersistenceManagerUtils';
|
||||
import { fetchMindmap } from '../../../editor-page/PersistenceManagerUtils';
|
||||
|
||||
import Checkbox from '@mui/material/Checkbox';
|
||||
|
||||
@ -87,7 +87,7 @@ const ExportDialog = ({
|
||||
setZoomToFit(!zoomToFit);
|
||||
};
|
||||
|
||||
const exporter = (formatType: ExportFormat): Promise<string> => {
|
||||
const exporter = async (formatType: ExportFormat): Promise<string> => {
|
||||
let svgElement: Element | null = null;
|
||||
let size: SizeType;
|
||||
let mindmap: Mindmap;
|
||||
@ -103,7 +103,7 @@ const ExportDialog = ({
|
||||
}
|
||||
// exporting from map list
|
||||
else {
|
||||
mindmap = getMindmapFromPersistence(String(mapId));
|
||||
mindmap = await fetchMindmap(mapId);
|
||||
}
|
||||
|
||||
let exporter: Exporter;
|
||||
|
Loading…
Reference in New Issue
Block a user