Clean up code.

This commit is contained in:
Paulo Gustavo Veiga 2022-04-11 15:40:49 -03:00
parent 79fb1c307e
commit e31aa2a547

View File

@ -17,7 +17,6 @@
*/ */
import jquery from 'jquery'; import jquery from 'jquery';
import { import {
$notify,
} from './components/widget/ToolbarNotifier'; } from './components/widget/ToolbarNotifier';
import { import {
buildDesigner, buildDesigner,
@ -26,20 +25,19 @@ import PersistenceManager from './components/PersistenceManager';
import LocalStorageManager from './components/LocalStorageManager'; import LocalStorageManager from './components/LocalStorageManager';
import DesignerOptionsBuilder from './components/DesignerOptionsBuilder'; import DesignerOptionsBuilder from './components/DesignerOptionsBuilder';
console.log('loading static mindmap in read-only');
// This hack is required to initialize Bootstrap. In future, this should be removed. // This hack is required to initialize Bootstrap. In future, this should be removed.
const globalAny: any = global; const globalAny: any = global;
globalAny.jQuery = jquery; globalAny.jQuery = jquery;
require('../../../libraries/bootstrap/js/bootstrap.min'); require('../../../libraries/bootstrap/js/bootstrap.min');
// Configure designer options ... // Configure designer options ...
let persistence: PersistenceManager; const historyId = global.historyId ? `${global.historyId}/` : '';
if (global.readOnly) { const persistence: PersistenceManager = new LocalStorageManager(
const historyId = global.historyId ? `${global.historyId}/` : ''; `/c/restful/maps/{id}/${historyId}document/xml${!global.isAuth ? '-pub' : ''}`,
persistence = new LocalStorageManager( true,
`/c/restful/maps/{id}/${historyId}document/xml${!global.isAuth ? '-pub' : ''}`, );
true,
);
}
// Obtain map zoom from query param if it was specified... // Obtain map zoom from query param if it was specified...
const params = new URLSearchParams(window.location.search.substring(1)); const params = new URLSearchParams(window.location.search.substring(1));
@ -63,7 +61,3 @@ const designer = buildDesigner(options);
const instance = PersistenceManager.getInstance(); const instance = PersistenceManager.getInstance();
const mindmap = instance.load(global.mapId); const mindmap = instance.load(global.mapId);
designer.loadMap(mindmap); designer.loadMap(mindmap);
if (global.mindmapLocked) {
$notify(global.mindmapLockedMsg);
}