mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-15 03:27:57 +01:00
Fix map load.
This commit is contained in:
parent
e3d6f5dad5
commit
e7355bc2fe
@ -1,3 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright [2021] [wisemapping]
|
||||||
|
*
|
||||||
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the license at
|
||||||
|
*
|
||||||
|
* http://www.wisemapping.org/license
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
import { DesignerKeyboard, EditorRenderMode, PersistenceManager } from '@wisemapping/mindplot';
|
import { DesignerKeyboard, EditorRenderMode, PersistenceManager } from '@wisemapping/mindplot';
|
||||||
import { useState, useRef, useEffect } from 'react';
|
import { useState, useRef, useEffect } from 'react';
|
||||||
import Capability from '../../classes/action/capability';
|
import Capability from '../../classes/action/capability';
|
||||||
@ -65,12 +82,10 @@ export const useEditor = ({
|
|||||||
}, [mindplotRef, options]);
|
}, [mindplotRef, options]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (options) {
|
if (options && options.enableKeyboardEvents) {
|
||||||
if (options.enableKeyboardEvents) {
|
DesignerKeyboard.resume();
|
||||||
DesignerKeyboard.resume();
|
} else {
|
||||||
} else {
|
DesignerKeyboard.pause();
|
||||||
DesignerKeyboard.pause();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, [options, options?.enableKeyboardEvents]);
|
}, [options, options?.enableKeyboardEvents]);
|
||||||
|
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright [2021] [wisemapping]
|
||||||
|
*
|
||||||
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the license at
|
||||||
|
*
|
||||||
|
* http://www.wisemapping.org/license
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
import DefaultWidgetManager from '../../classes/default-widget-manager';
|
import DefaultWidgetManager from '../../classes/default-widget-manager';
|
||||||
|
|
||||||
export const useWidgetManager = (): {
|
export const useWidgetManager = (): {
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
manifest.json provides metadata used when your web app is installed on a
|
manifest.json provides metadata used when your web app is installed on a
|
||||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||||
-->
|
-->
|
||||||
<link rel="manifest" href="<%=PUBLIC_URL%>/manifest.json" />
|
<!-- <link rel="manifest" href="<%=PUBLIC_URL%>/manifest.json" /> -->
|
||||||
<!--
|
<!--
|
||||||
Notice the use of %PUBLIC_URL% in the tags above.
|
Notice the use of %PUBLIC_URL% in the tags above.
|
||||||
It will be replaced with the URL of the `public` folder during the build.
|
It will be replaced with the URL of the `public` folder during the build.
|
||||||
|
@ -64,7 +64,7 @@ export type MapMetadata = {
|
|||||||
title: string;
|
title: string;
|
||||||
isLocked: boolean;
|
isLocked: boolean;
|
||||||
isLockedBy?: string;
|
isLockedBy?: string;
|
||||||
zoom: number;
|
jsonProps: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ChangeHistory = {
|
export type ChangeHistory = {
|
||||||
|
@ -134,7 +134,7 @@ class MockClient implements Client {
|
|||||||
title: 'my map',
|
title: 'my map',
|
||||||
id: id,
|
id: id,
|
||||||
isLocked: false,
|
isLocked: false,
|
||||||
zoom: 0.8,
|
jsonProps: '{ "zoom": 0.8 }',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +109,7 @@ type EditorMetadata = {
|
|||||||
mode: EditorRenderMode;
|
mode: EditorRenderMode;
|
||||||
title: string;
|
title: string;
|
||||||
isLocked: boolean;
|
isLocked: boolean;
|
||||||
|
isLockedBy?: string;
|
||||||
zoom: number;
|
zoom: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -138,6 +139,8 @@ const EditorPage = ({ mapId, isTryMode }: EditorPropsType): React.ReactElement =
|
|||||||
let mode: EditorRenderMode = null;
|
let mode: EditorRenderMode = null;
|
||||||
let title = '';
|
let title = '';
|
||||||
let isLocked = false;
|
let isLocked = false;
|
||||||
|
let zoom = 0.8;
|
||||||
|
let isLockedBy;
|
||||||
|
|
||||||
if (isTryMode) {
|
if (isTryMode) {
|
||||||
mode = 'showcase';
|
mode = 'showcase';
|
||||||
@ -173,11 +176,14 @@ const EditorPage = ({ mapId, isTryMode }: EditorPropsType): React.ReactElement =
|
|||||||
} else {
|
} else {
|
||||||
mode = `edition-${fetchMapInfoResult.data.role}`;
|
mode = `edition-${fetchMapInfoResult.data.role}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
isLocked = fetchMetadataResult.data.isLocked;
|
isLocked = fetchMetadataResult.data.isLocked;
|
||||||
|
isLockedBy = fetchMetadataResult.data.isLockedBy;
|
||||||
title = fetchMetadataResult.data.title;
|
title = fetchMetadataResult.data.title;
|
||||||
|
zoom = JSON.parse(fetchMetadataResult.data.jsonProps).zoom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mode ? { mode: mode, isLocked: isLocked, title: title, zoom: 0.8 } : undefined;
|
return mode ? { mode, isLocked, isLockedBy, title, zoom } : undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
// What is the role ?
|
// What is the role ?
|
||||||
@ -192,11 +198,12 @@ const EditorPage = ({ mapId, isTryMode }: EditorPropsType): React.ReactElement =
|
|||||||
let mapInfo: MapInfo;
|
let mapInfo: MapInfo;
|
||||||
let options: EditorOptions;
|
let options: EditorOptions;
|
||||||
if (loadCompleted) {
|
if (loadCompleted) {
|
||||||
// Configure de
|
// Configure
|
||||||
options = {
|
options = {
|
||||||
enableKeyboardEvents: hotkey,
|
enableKeyboardEvents: hotkey,
|
||||||
locale: userLocale.code,
|
locale: userLocale.code,
|
||||||
mode: mapMetadata.mode,
|
mode: mapMetadata.mode,
|
||||||
|
enableAppBar: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
persistence = buildPersistenceManagerForEditor(mapMetadata.mode);
|
persistence = buildPersistenceManagerForEditor(mapMetadata.mode);
|
||||||
|
Loading…
Reference in New Issue
Block a user