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 { useState, useRef, useEffect } from 'react';
|
||||
import Capability from '../../classes/action/capability';
|
||||
@ -65,13 +82,11 @@ export const useEditor = ({
|
||||
}, [mindplotRef, options]);
|
||||
|
||||
useEffect(() => {
|
||||
if (options) {
|
||||
if (options.enableKeyboardEvents) {
|
||||
if (options && options.enableKeyboardEvents) {
|
||||
DesignerKeyboard.resume();
|
||||
} else {
|
||||
DesignerKeyboard.pause();
|
||||
}
|
||||
}
|
||||
}, [options, options?.enableKeyboardEvents]);
|
||||
|
||||
return { model, mindplotRef, mapInfo, capability, options };
|
||||
|
@ -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';
|
||||
|
||||
export const useWidgetManager = (): {
|
||||
|
@ -46,7 +46,7 @@
|
||||
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/
|
||||
-->
|
||||
<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.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
|
@ -64,7 +64,7 @@ export type MapMetadata = {
|
||||
title: string;
|
||||
isLocked: boolean;
|
||||
isLockedBy?: string;
|
||||
zoom: number;
|
||||
jsonProps: string;
|
||||
};
|
||||
|
||||
export type ChangeHistory = {
|
||||
|
@ -134,7 +134,7 @@ class MockClient implements Client {
|
||||
title: 'my map',
|
||||
id: id,
|
||||
isLocked: false,
|
||||
zoom: 0.8,
|
||||
jsonProps: '{ "zoom": 0.8 }',
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -109,6 +109,7 @@ type EditorMetadata = {
|
||||
mode: EditorRenderMode;
|
||||
title: string;
|
||||
isLocked: boolean;
|
||||
isLockedBy?: string;
|
||||
zoom: number;
|
||||
};
|
||||
|
||||
@ -138,6 +139,8 @@ const EditorPage = ({ mapId, isTryMode }: EditorPropsType): React.ReactElement =
|
||||
let mode: EditorRenderMode = null;
|
||||
let title = '';
|
||||
let isLocked = false;
|
||||
let zoom = 0.8;
|
||||
let isLockedBy;
|
||||
|
||||
if (isTryMode) {
|
||||
mode = 'showcase';
|
||||
@ -173,11 +176,14 @@ const EditorPage = ({ mapId, isTryMode }: EditorPropsType): React.ReactElement =
|
||||
} else {
|
||||
mode = `edition-${fetchMapInfoResult.data.role}`;
|
||||
}
|
||||
|
||||
isLocked = fetchMetadataResult.data.isLocked;
|
||||
isLockedBy = fetchMetadataResult.data.isLockedBy;
|
||||
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 ?
|
||||
@ -192,11 +198,12 @@ const EditorPage = ({ mapId, isTryMode }: EditorPropsType): React.ReactElement =
|
||||
let mapInfo: MapInfo;
|
||||
let options: EditorOptions;
|
||||
if (loadCompleted) {
|
||||
// Configure de
|
||||
// Configure
|
||||
options = {
|
||||
enableKeyboardEvents: hotkey,
|
||||
locale: userLocale.code,
|
||||
mode: mapMetadata.mode,
|
||||
enableAppBar: true,
|
||||
};
|
||||
|
||||
persistence = buildPersistenceManagerForEditor(mapMetadata.mode);
|
||||
|
Loading…
Reference in New Issue
Block a user