mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-14 11:17:57 +01:00
Fix export to images
This commit is contained in:
parent
b076f482f1
commit
e331ba77b9
@ -43,10 +43,10 @@ class BinaryImageExporter extends Exporter {
|
|||||||
throw new Error('Images can not be exporeted');
|
throw new Error('Images can not be exporeted');
|
||||||
}
|
}
|
||||||
|
|
||||||
async exportAndEndcode(): Promise<string> {
|
exportAndEncode(): Promise<string> {
|
||||||
const svgExporter = new SVGExporter(this.svgElement);
|
const svgExporter = new SVGExporter(this.svgElement);
|
||||||
const svgUrl = await svgExporter.exportAndEncode();
|
const svgUrl = svgExporter.exportAndEncode();
|
||||||
|
return svgUrl.then((value: string) => {
|
||||||
// Get the device pixel ratio, falling back to 1. But, I will double the resolution to look nicer.
|
// Get the device pixel ratio, falling back to 1. But, I will double the resolution to look nicer.
|
||||||
const dpr = (window.devicePixelRatio || 1) * 2;
|
const dpr = (window.devicePixelRatio || 1) * 2;
|
||||||
|
|
||||||
@ -68,12 +68,13 @@ class BinaryImageExporter extends Exporter {
|
|||||||
.toDataURL(this.getContentType())
|
.toDataURL(this.getContentType())
|
||||||
.replace('image/png', 'octet/stream');
|
.replace('image/png', 'octet/stream');
|
||||||
|
|
||||||
URL.revokeObjectURL(svgUrl);
|
URL.revokeObjectURL(value);
|
||||||
resolve(imgDataUri);
|
resolve(imgDataUri);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
img.src = svgUrl;
|
img.src = value;
|
||||||
return result;
|
return result;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default BinaryImageExporter;
|
export default BinaryImageExporter;
|
||||||
|
@ -15,6 +15,7 @@ import Client from '../../../../classes/client';
|
|||||||
import { activeInstance } from '../../../../redux/clientSlice';
|
import { activeInstance } from '../../../../redux/clientSlice';
|
||||||
|
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
|
import SizeType from '@wisemapping/mindplot/src/components/SizeType';
|
||||||
|
|
||||||
type ExportFormat = 'svg' | 'jpg' | 'png' | 'txt' | 'mm' | 'wxml' | 'xls' | 'md';
|
type ExportFormat = 'svg' | 'jpg' | 'png' | 'txt' | 'mm' | 'wxml' | 'xls' | 'md';
|
||||||
type ExportGroup = 'image' | 'document' | 'mindmap-tool';
|
type ExportGroup = 'image' | 'document' | 'mindmap-tool';
|
||||||
@ -77,7 +78,7 @@ const ExportDialog = ({
|
|||||||
|
|
||||||
const exporter = (formatType: ExportFormat): Promise<string> => {
|
const exporter = (formatType: ExportFormat): Promise<string> => {
|
||||||
let svgElement: Element | null = null;
|
let svgElement: Element | null = null;
|
||||||
let size;
|
let size: SizeType;
|
||||||
let mindmap: Mindmap;
|
let mindmap: Mindmap;
|
||||||
|
|
||||||
const designer: Designer = global.designer;
|
const designer: Designer = global.designer;
|
||||||
|
Loading…
Reference in New Issue
Block a user