2021-12-25 23:39:34 +01:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
2021-12-25 02:30:36 +01:00
|
|
|
import jquery from 'jquery';
|
2021-12-23 19:51:26 +01:00
|
|
|
import PersistenceManager from './components/PersistenceManager';
|
2021-12-23 20:55:07 +01:00
|
|
|
import LocalStorageManager from './components/LocalStorageManager';
|
2022-08-26 03:35:59 +02:00
|
|
|
import MindplotWebComponent from './components/MindplotWebComponent';
|
2022-01-09 19:43:04 +01:00
|
|
|
|
2022-04-11 20:40:49 +02:00
|
|
|
console.log('loading static mindmap in read-only');
|
|
|
|
|
2022-10-08 23:21:03 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2022-01-31 01:05:22 +01:00
|
|
|
const globalAny: any = global;
|
|
|
|
globalAny.jQuery = jquery;
|
2021-12-25 02:30:36 +01:00
|
|
|
|
2022-08-26 03:35:59 +02:00
|
|
|
// WebComponent registration
|
|
|
|
customElements.define('mindplot-component', MindplotWebComponent);
|
2021-12-23 19:51:26 +01:00
|
|
|
// Configure designer options ...
|
2022-10-31 07:10:39 +01:00
|
|
|
const historyId = globalThis.historyId ? `${globalThis.historyId}/` : '';
|
2022-04-11 20:40:49 +02:00
|
|
|
const persistence: PersistenceManager = new LocalStorageManager(
|
2022-10-31 07:10:39 +01:00
|
|
|
`/c/restful/maps/{id}/${historyId}document/xml${!globalThis.isAuth ? '-pub' : ''}`,
|
2022-04-11 20:40:49 +02:00
|
|
|
true,
|
|
|
|
);
|
2021-12-23 19:51:26 +01:00
|
|
|
|
2022-08-26 03:35:59 +02:00
|
|
|
const webComponent: MindplotWebComponent = document.getElementById(
|
|
|
|
'mindmap-comp',
|
|
|
|
) as MindplotWebComponent;
|
|
|
|
webComponent.buildDesigner(persistence);
|
2022-10-31 07:10:39 +01:00
|
|
|
webComponent.loadMap(globalThis.mapId);
|