mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 06:37:56 +01:00
Code clean up.
This commit is contained in:
parent
e72531ad03
commit
7a9c89b8ae
@ -22,7 +22,6 @@ import { ToolbarMenuItem } from '../toolbar';
|
||||
import ActionConfig from '../../classes/action/action-config';
|
||||
import Editor from '../../classes/model/editor';
|
||||
import Capability from '../../classes/action/capability';
|
||||
import { ToolbarActionType } from '../toolbar/toolbarConfigBuilder';
|
||||
import Tooltip from '@mui/material/Tooltip';
|
||||
import UndoOutlinedIcon from '@mui/icons-material/UndoOutlined';
|
||||
import RedoOutlinedIcon from '@mui/icons-material/RedoOutlined';
|
||||
@ -40,6 +39,7 @@ import UndoAndRedo from '../action-widget/button/undo-and-redo';
|
||||
import Button from '@mui/material/Button';
|
||||
import LogoTextBlackSvg from '../../../images/logo-text-black.svg';
|
||||
import IconButton from '@mui/material/IconButton';
|
||||
import { ToolbarActionType } from '../toolbar/ToolbarActionType';
|
||||
|
||||
interface AppBarProps {
|
||||
model: Editor;
|
||||
|
@ -21,7 +21,14 @@ import Model from '../classes/model/editor';
|
||||
import { buildEditorPanelConfig, buildZoomToolbarConfig } from './toolbar/toolbarConfigBuilder';
|
||||
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { DesignerKeyboard, MindplotWebComponent } from '@wisemapping/mindplot';
|
||||
import {
|
||||
PersistenceManager,
|
||||
Designer,
|
||||
DesignerKeyboard,
|
||||
MindplotWebComponent,
|
||||
EditorRenderMode,
|
||||
} from '@wisemapping/mindplot';
|
||||
|
||||
import I18nMsg from '../classes/i18n-msg';
|
||||
import Toolbar from './toolbar';
|
||||
import { theme as defaultEditorTheme } from '../theme';
|
||||
@ -31,8 +38,28 @@ import { Notifier } from './warning-dialog/styled';
|
||||
import WarningDialog from './warning-dialog';
|
||||
import DefaultWidgetManager from '../classes/default-widget-manager';
|
||||
import AppBar from './app-bar';
|
||||
import { EditorProps } from '..';
|
||||
import Capability from '../classes/action/capability';
|
||||
import { ToolbarActionType } from './toolbar/ToolbarActionType';
|
||||
|
||||
type EditorOptions = {
|
||||
mode: EditorRenderMode;
|
||||
locale: string;
|
||||
zoom?: number;
|
||||
locked?: boolean;
|
||||
lockedMsg?: string;
|
||||
mapTitle: string;
|
||||
enableKeyboardEvents: boolean;
|
||||
};
|
||||
|
||||
type EditorProps = {
|
||||
mapId: string;
|
||||
options: EditorOptions;
|
||||
persistenceManager: PersistenceManager;
|
||||
onAction: (action: ToolbarActionType) => void;
|
||||
onLoad?: (designer: Designer) => void;
|
||||
theme?: Theme;
|
||||
accountConfiguration?: React.ReactElement;
|
||||
};
|
||||
|
||||
const Editor = ({
|
||||
mapId,
|
||||
|
19
packages/editor/src/components/toolbar/ToolbarActionType.ts
Normal file
19
packages/editor/src/components/toolbar/ToolbarActionType.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
export type ToolbarActionType = 'export' | 'publish' | 'history' | 'print' | 'share' | 'info';
|
@ -54,8 +54,6 @@ import FontFamilySelector from '../action-widget/button/font-family-selector';
|
||||
import Capability from '../../classes/action/capability';
|
||||
import Editor from '../../classes/model/editor';
|
||||
|
||||
export type ToolbarActionType = 'export' | 'publish' | 'history' | 'print' | 'share' | 'info';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param designer designer to aply changes
|
||||
|
@ -15,8 +15,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
|
||||
import './global-styled.css';
|
||||
import {
|
||||
PersistenceManager,
|
||||
DesignerOptionsBuilder,
|
||||
@ -34,10 +34,7 @@ import {
|
||||
Importer,
|
||||
TextImporterFactory,
|
||||
} from '@wisemapping/mindplot';
|
||||
import './global-styled.css';
|
||||
import { Theme } from '@mui/material/styles';
|
||||
import Editor from './components';
|
||||
import { ToolbarActionType } from './components/toolbar/toolbarConfigBuilder';
|
||||
|
||||
declare global {
|
||||
// used in mindplot
|
||||
@ -53,16 +50,6 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
export type EditorOptions = {
|
||||
mode: EditorRenderMode;
|
||||
locale: string;
|
||||
zoom?: number;
|
||||
locked?: boolean;
|
||||
lockedMsg?: string;
|
||||
mapTitle: string;
|
||||
enableKeyboardEvents: boolean;
|
||||
};
|
||||
|
||||
export {
|
||||
PersistenceManager,
|
||||
DesignerOptionsBuilder,
|
||||
@ -80,14 +67,4 @@ export {
|
||||
TextImporterFactory,
|
||||
};
|
||||
|
||||
export type EditorProps = {
|
||||
mapId: string;
|
||||
options: EditorOptions;
|
||||
persistenceManager: PersistenceManager;
|
||||
onAction: (action: ToolbarActionType) => void;
|
||||
onLoad?: (designer: Designer) => void;
|
||||
theme?: Theme;
|
||||
accountConfiguration?: React.ReactElement;
|
||||
};
|
||||
|
||||
export default Editor;
|
||||
|
@ -71,7 +71,7 @@ const EditorPage = ({ isTryMode }: EditorPropsType): React.ReactElement => {
|
||||
if (options?.mapTitle) {
|
||||
document.title = `${options.mapTitle} | WiseMapping `;
|
||||
}
|
||||
});
|
||||
}, options?.mapTitle);
|
||||
|
||||
return loadCompleted ? (
|
||||
<IntlProvider
|
||||
@ -86,7 +86,7 @@ const EditorPage = ({ isTryMode }: EditorPropsType): React.ReactElement => {
|
||||
mapId={mapId}
|
||||
theme={theme}
|
||||
accountConfiguration={
|
||||
// Provent load on non-authenticated.
|
||||
// Prevent load on non-authenticated.
|
||||
options.mode !== 'showcase' ? (
|
||||
<IntlProvider
|
||||
locale={userLocale.code}
|
||||
|
Loading…
Reference in New Issue
Block a user