2022-02-22 19:43:16 +01:00
|
|
|
import { EditorOptions } from '@wisemapping/editor';
|
2022-02-22 06:37:00 +01:00
|
|
|
import AppConfig from '../../classes/app-config';
|
|
|
|
|
|
|
|
export default class EditorOptionsBulder {
|
|
|
|
static build(locale: string, hotkeys: boolean, isTryMode: boolean): { options: EditorOptions, mapId: number } {
|
|
|
|
|
|
|
|
let options: EditorOptions = {
|
2022-02-22 19:43:16 +01:00
|
|
|
enableKeyboardEvents: hotkeys,
|
2022-02-22 06:37:00 +01:00
|
|
|
locale: locale,
|
|
|
|
mode: isTryMode ? 'showcase' : 'editor',
|
|
|
|
};
|
|
|
|
|
|
|
|
let mapId: number;
|
|
|
|
if (!AppConfig.isDevelopEnv()) {
|
|
|
|
options = {
|
|
|
|
zoom: (global.userOptions?.zoom != undefined
|
|
|
|
? Number.parseFloat(global?.userOptions?.zoom as string)
|
|
|
|
: 0.8),
|
|
|
|
locked: global.mindmapLocked,
|
|
|
|
lockedMsg: global.mindmapLockedMsg,
|
|
|
|
mapTitle: global.mapTitle,
|
|
|
|
...options
|
|
|
|
}
|
|
|
|
mapId = global.mapId;
|
|
|
|
} else {
|
|
|
|
// Running in a development mode.
|
|
|
|
console.log('Running editor in development mode');
|
|
|
|
options = {
|
|
|
|
zoom: 0.8,
|
|
|
|
locked: false,
|
|
|
|
mapTitle: "Develop Mindnap",
|
|
|
|
...options
|
|
|
|
}
|
|
|
|
mapId = 666;
|
|
|
|
}
|
|
|
|
return { options, mapId };
|
|
|
|
}
|
|
|
|
}
|