diff --git a/packages/mindplot/src/components/Designer.ts b/packages/mindplot/src/components/Designer.ts index 428302f9..dd048f21 100644 --- a/packages/mindplot/src/components/Designer.ts +++ b/packages/mindplot/src/components/Designer.ts @@ -58,6 +58,8 @@ import { DesignerOptions } from './DesignerOptionsBuilder'; import MainTopic from './MainTopic'; import DragTopic from './DragTopic'; +export type ExportFormat = 'png' | 'svg' | 'jpg' | 'wxml'; + class Designer extends Events { private _mindmap: Mindmap; @@ -80,11 +82,11 @@ class Designer extends Events { private _cleanScreen: any; constructor(options: DesignerOptions, divElement: JQuery) { + super(); $assert(options, 'options must be defined'); $assert(options.zoom, 'zoom must be defined'); $assert(options.containerSize, 'size must be defined'); $assert(divElement, 'divElement must be defined'); - super(); // Set up i18n location ... Messages.init(options.locale); @@ -342,7 +344,9 @@ class Designer extends Events { } } - export(formatType: 'png' | 'svg' | 'jpg' | 'wxml'): Promise { + EXPORT_SUPPORTED_FORMATS: ExportFormat[] = ['png', 'svg', 'jpg', 'wxml']; + + export(formatType: ExportFormat): Promise { const workspace = this._workspace; const svgElement = workspace.getSVGElement(); const size = workspace.getSize(); diff --git a/packages/mindplot/src/components/widget/AccountSettingsPanel.js b/packages/mindplot/src/components/widget/AccountSettingsPanel.js index f1cf3f3e..ea0c172d 100644 --- a/packages/mindplot/src/components/widget/AccountSettingsPanel.js +++ b/packages/mindplot/src/components/widget/AccountSettingsPanel.js @@ -57,8 +57,8 @@ class AccountSettingsPanel extends ListToolbarPanel { const content = $("
"); content[0].innerHTML = `

${global.accountName}

-

pveiga@wisemapping.com

-
+

${global.accountEmail}

+
Logout
`; diff --git a/packages/webapp/lang/de.json b/packages/webapp/lang/de.json index 029bda71..0d5a0a7a 100644 --- a/packages/webapp/lang/de.json +++ b/packages/webapp/lang/de.json @@ -467,5 +467,11 @@ }, "share.message": { "defaultMessage": "Message" + }, + "editor.try-welcome": { + "defaultMessage": "This edition space showcases some of the mindmap editor capabilities !" + }, + "editor.try-welcome-description": { + "defaultMessage": "Sign Up to start creating, sharing and publishing unlimited number of mindmaps for free." } } \ No newline at end of file diff --git a/packages/webapp/lang/en.json b/packages/webapp/lang/en.json index 029bda71..0d5a0a7a 100644 --- a/packages/webapp/lang/en.json +++ b/packages/webapp/lang/en.json @@ -467,5 +467,11 @@ }, "share.message": { "defaultMessage": "Message" + }, + "editor.try-welcome": { + "defaultMessage": "This edition space showcases some of the mindmap editor capabilities !" + }, + "editor.try-welcome-description": { + "defaultMessage": "Sign Up to start creating, sharing and publishing unlimited number of mindmaps for free." } } \ No newline at end of file diff --git a/packages/webapp/lang/es.json b/packages/webapp/lang/es.json index 029bda71..0d5a0a7a 100644 --- a/packages/webapp/lang/es.json +++ b/packages/webapp/lang/es.json @@ -467,5 +467,11 @@ }, "share.message": { "defaultMessage": "Message" + }, + "editor.try-welcome": { + "defaultMessage": "This edition space showcases some of the mindmap editor capabilities !" + }, + "editor.try-welcome-description": { + "defaultMessage": "Sign Up to start creating, sharing and publishing unlimited number of mindmaps for free." } } \ No newline at end of file diff --git a/packages/webapp/lang/fr.json b/packages/webapp/lang/fr.json index 029bda71..0d5a0a7a 100644 --- a/packages/webapp/lang/fr.json +++ b/packages/webapp/lang/fr.json @@ -467,5 +467,11 @@ }, "share.message": { "defaultMessage": "Message" + }, + "editor.try-welcome": { + "defaultMessage": "This edition space showcases some of the mindmap editor capabilities !" + }, + "editor.try-welcome-description": { + "defaultMessage": "Sign Up to start creating, sharing and publishing unlimited number of mindmaps for free." } } \ No newline at end of file diff --git a/packages/webapp/src/app.tsx b/packages/webapp/src/app.tsx index aebc8d42..48a57f87 100644 --- a/packages/webapp/src/app.tsx +++ b/packages/webapp/src/app.tsx @@ -32,6 +32,12 @@ const queryClient = new QueryClient({ const App = (): ReactElement => { const appi18n = new AppI18n(); const locale = appi18n.getBrowserLocale(); + + // global variables set server-side + const memoryPersistence = global.memoryPersistence; + const readOnlyMode = global.readOnly; + const mapId = parseInt(global.mapId, 10); + return locale.message ? ( @@ -66,7 +72,8 @@ const App = (): ReactElement => { - + 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 453d313c..04563aa7 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 @@ -74,13 +74,30 @@ const ExportDialog = ({ useEffect(() => { if (submit) { + // TODO: Remove usage of global "designer" + const designer = global.designer; // Depending on the type of export. It will require differt POST. if ( - exportFormat == 'pdf' || - exportFormat == 'svg' || - exportFormat == 'jpg' || - exportFormat == 'png' + designer && + designer.EXPORT_SUPPORTED_FORMATS.includes(exportFormat) ) { + designer.export(exportFormat) + .then((url: string) => { + // Create hidden anchor to force download ... + const anchor: HTMLAnchorElement = document.createElement('a'); + anchor.style.display = 'display: none'; + anchor.download = `${mapId}.${exportFormat}`; + anchor.href = url; + document.body.appendChild(anchor); + + // Trigger click ... + anchor.click(); + + // Clean up ... + URL.revokeObjectURL(url); + document.body.removeChild(anchor); + }); + } else if (exportFormat === 'pdf') { formTransformtRef?.submit(); } else { formExportRef?.submit(); @@ -99,13 +116,15 @@ const ExportDialog = ({ description={intl.formatMessage({ id: 'export.desc', defaultMessage: 'Export this map in the format that you want and start using it in your presentations or sharing by email' })} submitButton={intl.formatMessage({ id: 'export.title', defaultMessage: 'Export' })} > - - - - + { + !enableImgExport && + + + + } @@ -124,7 +143,7 @@ const ExportDialog = ({ /> {exportGroup == 'image' && (