2022-01-25 19:10:40 +01:00
|
|
|
import React from 'react';
|
2022-02-06 00:09:43 +01:00
|
|
|
import ActionDispatcher from '../maps-page/action-dispatcher';
|
|
|
|
import { ActionType } from '../maps-page/action-chooser';
|
2022-01-25 19:10:40 +01:00
|
|
|
import WiseEditor from '@wisemapping/editor';
|
2022-02-06 00:09:43 +01:00
|
|
|
import AppI18n from '../../classes/app-i18n';
|
2022-01-25 19:10:40 +01:00
|
|
|
|
|
|
|
export type EditorPropsType = {
|
|
|
|
mapId: number;
|
|
|
|
memoryPersistence: boolean;
|
|
|
|
readOnlyMode: boolean;
|
|
|
|
};
|
|
|
|
|
2022-02-06 00:09:43 +01:00
|
|
|
const EditorPage = ({ mapId, ...props }: EditorPropsType): React.ReactElement => {
|
2022-01-25 19:10:40 +01:00
|
|
|
const [activeDialog, setActiveDialog] = React.useState<ActionType | null>(null);
|
2022-02-05 22:53:10 +01:00
|
|
|
|
|
|
|
// Load user locale ...
|
|
|
|
const appi18n = new AppI18n();
|
|
|
|
const userLocale = appi18n.getUserLocale();
|
|
|
|
|
2022-01-25 19:10:40 +01:00
|
|
|
return <>
|
2022-02-05 22:53:10 +01:00
|
|
|
<WiseEditor {...props} onAction={setActiveDialog} locale={userLocale.code} />
|
2022-01-25 19:10:40 +01:00
|
|
|
{
|
2022-02-05 22:53:10 +01:00
|
|
|
activeDialog &&
|
2022-01-25 19:10:40 +01:00
|
|
|
<ActionDispatcher
|
|
|
|
action={activeDialog}
|
|
|
|
onClose={() => setActiveDialog(null)}
|
|
|
|
mapsId={[mapId]}
|
|
|
|
fromEditor
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
</>
|
|
|
|
}
|
|
|
|
|
2022-02-06 00:09:43 +01:00
|
|
|
export default EditorPage;
|
|
|
|
|