2022-10-07 21:52:39 -07: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.
|
|
|
|
*/
|
2022-10-06 22:16:21 -07:00
|
|
|
import React from 'react';
|
2022-10-05 21:54:23 +00:00
|
|
|
import BrushOutlinedIcon from '@mui/icons-material/BrushOutlined';
|
|
|
|
import FontDownloadOutlinedIcon from '@mui/icons-material/FontDownloadOutlined';
|
|
|
|
import TextIncreaseOutlinedIcon from '@mui/icons-material/TextIncreaseOutlined';
|
|
|
|
import TextDecreaseOutlinedIcon from '@mui/icons-material/TextDecreaseOutlined';
|
|
|
|
import FormatBoldOutlinedIcon from '@mui/icons-material/FormatBoldOutlined';
|
|
|
|
import SettingsEthernetIcon from '@mui/icons-material/SettingsEthernet';
|
|
|
|
import FormatItalicIcon from '@mui/icons-material/FormatItalic';
|
|
|
|
import NoteOutlinedIcon from '@mui/icons-material/NoteOutlined';
|
|
|
|
import LinkOutlinedIcon from '@mui/icons-material/LinkOutlined';
|
|
|
|
import ZoomOutOutlinedIcon from '@mui/icons-material/ZoomOutOutlined';
|
|
|
|
import ZoomInOutlinedIcon from '@mui/icons-material/ZoomInOutlined';
|
|
|
|
import CenterFocusStrongOutlinedIcon from '@mui/icons-material/CenterFocusStrongOutlined';
|
|
|
|
import SentimentSatisfiedAltIcon from '@mui/icons-material/SentimentSatisfiedAlt';
|
|
|
|
import UndoOutlinedIcon from '@mui/icons-material/UndoOutlined';
|
|
|
|
import RedoOutlinedIcon from '@mui/icons-material/RedoOutlined';
|
|
|
|
import RestoreOutlinedIcon from '@mui/icons-material/RestoreOutlined';
|
|
|
|
import SaveOutlinedIcon from '@mui/icons-material/SaveOutlined';
|
|
|
|
import PrintOutlinedIcon from '@mui/icons-material/PrintOutlined';
|
|
|
|
import FileDownloadOutlinedIcon from '@mui/icons-material/FileDownloadOutlined';
|
|
|
|
import CloudUploadOutlinedIcon from '@mui/icons-material/CloudUploadOutlined';
|
|
|
|
import HelpOutlineOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
|
|
import ArrowBackIosNewOutlinedIcon from '@mui/icons-material/ArrowBackIosNewOutlined';
|
|
|
|
import CircleOutlinedIcon from '@mui/icons-material/CircleOutlined';
|
|
|
|
import SquareOutlinedIcon from '@mui/icons-material/SquareOutlined';
|
|
|
|
import CheckBoxOutlineBlankOutlinedIcon from '@mui/icons-material/CheckBoxOutlineBlankOutlined';
|
|
|
|
import HorizontalRuleOutlinedIcon from '@mui/icons-material/HorizontalRuleOutlined';
|
|
|
|
import RemoveCircleOutlineIcon from '@mui/icons-material/RemoveCircleOutline';
|
|
|
|
import AddCircleOutlineOutlinedIcon from '@mui/icons-material/AddCircleOutlineOutlined';
|
|
|
|
import Button from '@mui/material/Button';
|
|
|
|
import Box from '@mui/material/Box';
|
|
|
|
|
|
|
|
import LogoTextBlackSvg from '../../../images/logo-text-black.svg';
|
|
|
|
import Palette from '@mui/icons-material/Square';
|
|
|
|
import SquareOutlined from '@mui/icons-material/SquareOutlined';
|
2022-10-07 01:58:24 +00:00
|
|
|
import { $msg, Designer } from '@wisemapping/mindplot';
|
2022-10-06 20:41:02 -07:00
|
|
|
import ActionConfig from '../../classes/action-config';
|
2022-10-07 21:52:39 -07:00
|
|
|
import { SwitchValueDirection } from './ToolbarValueModelBuilder';
|
|
|
|
import NodePropertyBuilder from '../../classes/model/node-property-builder';
|
2022-10-05 21:54:23 +00:00
|
|
|
import Typography from '@mui/material/Typography';
|
|
|
|
import { ToolbarActionType } from '.';
|
|
|
|
import KeyboardOutlined from '@mui/icons-material/KeyboardOutlined';
|
|
|
|
import Tooltip from '@mui/material/Tooltip';
|
2022-10-07 19:18:34 -07:00
|
|
|
import ColorPicker from '../action-widget/pane/color-picker';
|
|
|
|
import { KeyboardShorcutsHelp } from '../action-widget/pane/keyboard-shortcut-help';
|
|
|
|
import UndoAndRedo from '../action-widget/button/undo-and-redo';
|
|
|
|
import TopicLink from '../action-widget/pane/topic-link';
|
|
|
|
import TopicNote from '../action-widget/pane/topic-note';
|
|
|
|
import IconPicker from '../action-widget/pane/icon-picker';
|
|
|
|
import FontFamilySelector from '../action-widget/button/font-family-selector';
|
2022-10-05 21:54:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param designer designer to aply changes
|
2022-10-06 22:30:46 -07:00
|
|
|
* @returns configuration for @wisemapping/editor priAppbarmary toolbar
|
2022-10-05 21:54:23 +00:00
|
|
|
*/
|
2022-10-06 20:30:27 -07:00
|
|
|
export function buildToolbarCongiruation(designer: Designer): ActionConfig[] {
|
2022-10-05 21:54:23 +00:00
|
|
|
if (!designer) return [];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* model builder
|
|
|
|
*/
|
2022-10-07 21:52:39 -07:00
|
|
|
const toolbarValueModelBuilder = new NodePropertyBuilder(designer);
|
2022-10-05 21:54:23 +00:00
|
|
|
|
|
|
|
// <div id="rectagle" model="rectagle"><img src="${RectangleImage}" alt="Rectangle"></div>
|
|
|
|
// <div id="rounded_rectagle" model="rounded rectagle" ><img src="${RectangleRoundImage}" alt="Rounded Rectangle"></div>
|
|
|
|
// <div id="line" model="line"><img src="${LineImage}" alt="Line"></div>
|
|
|
|
// <div id="elipse" model="elipse"><img src="${CircleImage}"></div>`;
|
|
|
|
/**
|
|
|
|
* submenu to manipulate node color and shape
|
|
|
|
*/
|
2022-10-06 20:30:27 -07:00
|
|
|
const colorAndShapeToolbarConfiguration: ActionConfig = {
|
2022-10-05 21:54:23 +00:00
|
|
|
icon: <BrushOutlinedIcon />,
|
|
|
|
|
|
|
|
tooltip: $msg('TOPIC_SHAPE'),
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
icon: <SquareOutlinedIcon />,
|
|
|
|
tooltip: $msg('TOPIC_SHAPE_RECTANGLE'),
|
|
|
|
onClick: () => toolbarValueModelBuilder.getTopicShapeModel().setValue('rectagle'),
|
|
|
|
selected: () => toolbarValueModelBuilder.getTopicShapeModel().getValue() === 'rectagle',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: <CheckBoxOutlineBlankOutlinedIcon />,
|
|
|
|
tooltip: $msg('TOPIC_SHAPE_ROUNDED'),
|
|
|
|
onClick: () => toolbarValueModelBuilder.getTopicShapeModel().setValue('rounded rectagle'),
|
|
|
|
selected: () =>
|
|
|
|
toolbarValueModelBuilder.getTopicShapeModel().getValue() === 'rounded rectagle',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: <HorizontalRuleOutlinedIcon />,
|
|
|
|
tooltip: $msg('TOPIC_SHAPE_LINE'),
|
|
|
|
onClick: () => toolbarValueModelBuilder.getTopicShapeModel().setValue('line'),
|
|
|
|
selected: () => toolbarValueModelBuilder.getTopicShapeModel().getValue() === 'line',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: <CircleOutlinedIcon />,
|
|
|
|
tooltip: $msg('TOPIC_SHAPE_ELLIPSE'),
|
|
|
|
onClick: () => toolbarValueModelBuilder.getTopicShapeModel().setValue('elipse'),
|
|
|
|
selected: () => toolbarValueModelBuilder.getTopicShapeModel().getValue() === 'elipse',
|
|
|
|
},
|
|
|
|
null,
|
|
|
|
{
|
|
|
|
icon: () => (
|
|
|
|
<Palette
|
|
|
|
htmlColor={toolbarValueModelBuilder.getSelectedTopicColorModel().getValue()}
|
|
|
|
></Palette>
|
|
|
|
),
|
|
|
|
tooltip: $msg('TOPIC_COLOR'),
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
render: (closeModal) => {
|
|
|
|
return (
|
|
|
|
<ColorPicker
|
|
|
|
closeModal={closeModal}
|
|
|
|
colorModel={toolbarValueModelBuilder.getSelectedTopicColorModel()}
|
|
|
|
></ColorPicker>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: () => (
|
|
|
|
<SquareOutlined
|
|
|
|
htmlColor={toolbarValueModelBuilder.getColorBorderModel().getValue()}
|
|
|
|
></SquareOutlined>
|
|
|
|
),
|
|
|
|
tooltip: $msg('TOPIC_BORDER_COLOR'),
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
render: (closeModal) => {
|
|
|
|
return (
|
|
|
|
<ColorPicker
|
|
|
|
closeModal={closeModal}
|
|
|
|
colorModel={toolbarValueModelBuilder.getColorBorderModel()}
|
|
|
|
></ColorPicker>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
disabled: () => designer.getModel().filterSelectedTopics().length === 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* submenu to manipulate node font
|
|
|
|
*/
|
2022-10-06 20:30:27 -07:00
|
|
|
const fontFormatToolbarConfiguration: ActionConfig = {
|
2022-10-05 21:54:23 +00:00
|
|
|
icon: <FontDownloadOutlinedIcon></FontDownloadOutlinedIcon>,
|
|
|
|
tooltip: $msg('FONT_FORMAT'),
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
render: () => (
|
2022-10-07 19:18:34 -07:00
|
|
|
<FontFamilySelector fontFamilyModel={toolbarValueModelBuilder.getFontFamilyModel()} />
|
2022-10-05 21:54:23 +00:00
|
|
|
),
|
|
|
|
},
|
|
|
|
null,
|
|
|
|
{
|
|
|
|
icon: <TextIncreaseOutlinedIcon></TextIncreaseOutlinedIcon>,
|
|
|
|
tooltip: $msg('FONT_INCREASE'),
|
|
|
|
onClick: () =>
|
|
|
|
toolbarValueModelBuilder.getFontSizeModel().switchValue(SwitchValueDirection.up),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: <TextDecreaseOutlinedIcon></TextDecreaseOutlinedIcon>,
|
|
|
|
tooltip: $msg('FONT_DECREASE'),
|
|
|
|
onClick: () =>
|
|
|
|
toolbarValueModelBuilder.getFontSizeModel().switchValue(SwitchValueDirection.down),
|
|
|
|
},
|
|
|
|
null,
|
|
|
|
{
|
|
|
|
icon: <FormatBoldOutlinedIcon></FormatBoldOutlinedIcon>,
|
|
|
|
tooltip: $msg('FONT_BOLD') + ' (' + $msg('CTRL') + ' + B)',
|
|
|
|
onClick: toolbarValueModelBuilder.fontWeigthModel().switchValue,
|
|
|
|
selected: () => toolbarValueModelBuilder.fontWeigthModel().getValue() === 'bold',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: <FormatItalicIcon />,
|
|
|
|
tooltip: $msg('FONT_ITALIC') + ' (' + $msg('CTRL') + ' + I)',
|
|
|
|
onClick: toolbarValueModelBuilder.getFontStyleModel().switchValue,
|
|
|
|
selected: () => toolbarValueModelBuilder.getFontStyleModel().getValue() === 'italic',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: () => (
|
|
|
|
<Palette htmlColor={toolbarValueModelBuilder.getFontColorModel().getValue()}></Palette>
|
|
|
|
),
|
|
|
|
tooltip: $msg('FONT_COLOR'),
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
render: (closeModal) => {
|
|
|
|
return (
|
|
|
|
<ColorPicker
|
|
|
|
closeModal={closeModal}
|
|
|
|
colorModel={toolbarValueModelBuilder.getFontColorModel()}
|
|
|
|
></ColorPicker>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
disabled: () => designer.getModel().filterSelectedTopics().length === 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* button to show relation pivot
|
|
|
|
*/
|
2022-10-06 20:30:27 -07:00
|
|
|
const addRelationConfiguration: ActionConfig = {
|
2022-10-05 21:54:23 +00:00
|
|
|
icon: <SettingsEthernetIcon></SettingsEthernetIcon>,
|
|
|
|
tooltip: $msg('TOPIC_RELATIONSHIP'),
|
|
|
|
onClick: (e) => {
|
|
|
|
designer.showRelPivot(e);
|
|
|
|
},
|
|
|
|
disabled: () => designer.getModel().filterSelectedTopics().length === 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* tool for node link edition
|
|
|
|
*/
|
2022-10-06 20:30:27 -07:00
|
|
|
const editLinkUrlConfiguration: ActionConfig = {
|
2022-10-05 21:54:23 +00:00
|
|
|
icon: <LinkOutlinedIcon />,
|
|
|
|
tooltip: $msg('TOPIC_LINK'),
|
|
|
|
useClickToClose: true,
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
render: (closeModal) => (
|
2022-10-07 19:18:34 -07:00
|
|
|
<TopicLink
|
2022-10-05 21:54:23 +00:00
|
|
|
closeModal={closeModal}
|
|
|
|
urlModel={toolbarValueModelBuilder.getLinkModel()}
|
2022-10-07 19:18:34 -07:00
|
|
|
></TopicLink>
|
2022-10-05 21:54:23 +00:00
|
|
|
),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
disabled: () => designer.getModel().filterSelectedTopics().length === 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* tool for node note edition
|
|
|
|
*/
|
2022-10-06 20:30:27 -07:00
|
|
|
const editNoteConfiguration: ActionConfig = {
|
2022-10-05 21:54:23 +00:00
|
|
|
icon: <NoteOutlinedIcon />,
|
|
|
|
tooltip: $msg('TOPIC_NOTE'),
|
|
|
|
useClickToClose: true,
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
tooltip: 'Node note',
|
|
|
|
render: (closeModal) => (
|
2022-10-07 19:18:34 -07:00
|
|
|
<TopicNote
|
2022-10-05 21:54:23 +00:00
|
|
|
closeModal={closeModal}
|
|
|
|
noteModel={toolbarValueModelBuilder.getNoteModel()}
|
2022-10-07 19:18:34 -07:00
|
|
|
></TopicNote>
|
2022-10-05 21:54:23 +00:00
|
|
|
),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
disabled: () => designer.getModel().filterSelectedTopics().length === 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* tool for emoji selection
|
|
|
|
*/
|
2022-10-06 20:30:27 -07:00
|
|
|
const editIconConfiguration: ActionConfig = {
|
2022-10-05 21:54:23 +00:00
|
|
|
icon: <SentimentSatisfiedAltIcon />,
|
|
|
|
tooltip: $msg('TOPIC_ICON'),
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
tooltip: 'Node icon',
|
|
|
|
render: (closeModal) => (
|
2022-10-07 19:18:34 -07:00
|
|
|
<IconPicker
|
2022-10-05 21:54:23 +00:00
|
|
|
closeModal={closeModal}
|
|
|
|
iconModel={toolbarValueModelBuilder.getTopicIconModel()}
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
disabled: () => designer.getModel().filterSelectedTopics().length === 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
const addNodeToolbarConfiguration = {
|
|
|
|
icon: <AddCircleOutlineOutlinedIcon />,
|
|
|
|
tooltip: $msg('TOPIC_ADD'),
|
|
|
|
onClick: () => designer.createSiblingForSelectedNode(),
|
|
|
|
disabled: () => designer.getModel().filterSelectedTopics().length === 0,
|
|
|
|
};
|
|
|
|
const deleteNodeToolbarConfiguration = {
|
|
|
|
icon: <RemoveCircleOutlineIcon />,
|
|
|
|
tooltip: $msg('TOPIC_DELETE'),
|
|
|
|
onClick: () => designer.deleteSelectedEntities(),
|
|
|
|
disabled: () => designer.getModel().filterSelectedTopics().length === 0,
|
|
|
|
};
|
|
|
|
return [
|
|
|
|
addNodeToolbarConfiguration,
|
|
|
|
deleteNodeToolbarConfiguration,
|
|
|
|
colorAndShapeToolbarConfiguration,
|
|
|
|
fontFormatToolbarConfiguration,
|
|
|
|
editIconConfiguration,
|
|
|
|
editNoteConfiguration,
|
|
|
|
editLinkUrlConfiguration,
|
|
|
|
addRelationConfiguration,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
export function buildZoomToolbarConfiguration(isMobile: boolean, designer: Designer) {
|
|
|
|
if (!designer) return [];
|
|
|
|
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
icon: <KeyboardOutlined />,
|
|
|
|
tooltip: $msg('KEYBOARD_SHOTCUTS'),
|
|
|
|
visible: !isMobile,
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
render: () => <KeyboardShorcutsHelp />,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// zoom value candidate, neds to fixit
|
|
|
|
render: () => (
|
|
|
|
<Box sx={{ p: 0.5 }}>
|
|
|
|
<Typography variant="overline" color="gray">
|
|
|
|
%{Math.floor((1 / designer.getWorkSpace()?.getZoom()) * 100)}
|
|
|
|
</Typography>
|
|
|
|
</Box>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: <ZoomInOutlinedIcon />,
|
|
|
|
tooltip: $msg('ZOOM_IN'),
|
|
|
|
onClick: (e) => {
|
|
|
|
designer.zoomIn();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: <ZoomOutOutlinedIcon />,
|
|
|
|
tooltip: $msg('ZOOM_OUT'),
|
|
|
|
onClick: (e) => {
|
|
|
|
designer.zoomOut();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: <CenterFocusStrongOutlinedIcon />,
|
|
|
|
tooltip: $msg('CENTER_POSITION'),
|
|
|
|
onClick: (e) => {
|
|
|
|
designer.zoomToFit();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
export function buildEditorAppBarConfiguration(
|
|
|
|
designer: Designer,
|
2022-10-06 21:18:25 -07:00
|
|
|
mapTitle: string,
|
2022-10-05 21:54:23 +00:00
|
|
|
onAction: (type: ToolbarActionType) => void,
|
|
|
|
save: () => void,
|
2022-10-07 01:58:24 +00:00
|
|
|
showOnlyCommonActions: boolean,
|
|
|
|
showAccessChangeActions: boolean,
|
|
|
|
showMapEntityActions: boolean,
|
|
|
|
showMindMapNodesActions: boolean,
|
|
|
|
showPersistenceActions: boolean,
|
2022-10-06 20:30:27 -07:00
|
|
|
): ActionConfig[] {
|
2022-10-07 01:58:24 +00:00
|
|
|
if (!designer) return [];
|
|
|
|
|
2022-10-05 21:54:23 +00:00
|
|
|
let commonConfiguration = [
|
|
|
|
{
|
|
|
|
icon: <ArrowBackIosNewOutlinedIcon />,
|
|
|
|
tooltip: $msg('BACK_TO_MAP_LIST'),
|
|
|
|
onClick: () => history.back(),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
render: () => <img src={LogoTextBlackSvg} />,
|
|
|
|
},
|
2022-10-07 01:58:24 +00:00
|
|
|
{
|
|
|
|
render: () => (
|
2022-10-06 21:18:25 -07:00
|
|
|
<Tooltip title={mapTitle}>
|
2022-10-07 01:58:24 +00:00
|
|
|
<Typography
|
|
|
|
className="truncated"
|
|
|
|
variant="body1"
|
|
|
|
component="div"
|
|
|
|
sx={{ marginX: '1.5rem' }}
|
|
|
|
>
|
2022-10-06 21:18:25 -07:00
|
|
|
{mapTitle}
|
2022-10-07 01:58:24 +00:00
|
|
|
</Typography>
|
|
|
|
</Tooltip>
|
|
|
|
),
|
|
|
|
},
|
2022-10-05 21:54:23 +00:00
|
|
|
];
|
|
|
|
|
2022-10-06 20:30:27 -07:00
|
|
|
const exportConfiguration: ActionConfig = {
|
2022-10-07 01:58:24 +00:00
|
|
|
icon: <FileDownloadOutlinedIcon />,
|
|
|
|
tooltip: $msg('EXPORT'),
|
|
|
|
onClick: () => onAction('export'),
|
|
|
|
};
|
2022-10-06 20:30:27 -07:00
|
|
|
|
|
|
|
const helpConfiguration: ActionConfig = {
|
2022-10-07 01:58:24 +00:00
|
|
|
icon: <HelpOutlineOutlinedIcon />,
|
|
|
|
onClick: () => onAction('info'),
|
|
|
|
tooltip: $msg('MAP_INFO'),
|
|
|
|
};
|
2022-10-06 20:30:27 -07:00
|
|
|
|
2022-10-07 01:58:24 +00:00
|
|
|
const appBarDivisor = {
|
|
|
|
render: () => <Typography component="div" sx={{ flexGrow: 1 }} />,
|
|
|
|
};
|
2022-10-05 21:54:23 +00:00
|
|
|
|
2022-10-06 20:30:27 -07:00
|
|
|
if (showOnlyCommonActions) {
|
|
|
|
return [...commonConfiguration, appBarDivisor, exportConfiguration];
|
|
|
|
}
|
2022-10-07 01:58:24 +00:00
|
|
|
|
|
|
|
return [
|
|
|
|
...commonConfiguration,
|
|
|
|
null,
|
|
|
|
{
|
|
|
|
render: () => (
|
2022-10-07 19:18:34 -07:00
|
|
|
<UndoAndRedo
|
2022-10-07 01:58:24 +00:00
|
|
|
configuration={{
|
|
|
|
icon: <UndoOutlinedIcon />,
|
|
|
|
tooltip: $msg('UNDO') + ' (' + $msg('CTRL') + ' + Z)',
|
|
|
|
onClick: () => designer.undo(),
|
|
|
|
}}
|
|
|
|
disabledCondition={(event) => event.undoSteps > 0}
|
2022-10-07 19:18:34 -07:00
|
|
|
></UndoAndRedo>
|
2022-10-07 01:58:24 +00:00
|
|
|
),
|
|
|
|
visible: showMindMapNodesActions,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
render: () => (
|
2022-10-07 19:18:34 -07:00
|
|
|
<UndoAndRedo
|
2022-10-07 01:58:24 +00:00
|
|
|
configuration={{
|
|
|
|
icon: <RedoOutlinedIcon />,
|
|
|
|
tooltip: $msg('REDO') + ' (' + $msg('CTRL') + ' + Shift + Z)',
|
|
|
|
onClick: () => designer.redo(),
|
|
|
|
}}
|
|
|
|
disabledCondition={(event) => event.redoSteps > 0}
|
2022-10-07 19:18:34 -07:00
|
|
|
></UndoAndRedo>
|
2022-10-07 01:58:24 +00:00
|
|
|
),
|
|
|
|
visible: showMindMapNodesActions,
|
|
|
|
},
|
|
|
|
null,
|
|
|
|
{
|
|
|
|
icon: <RestoreOutlinedIcon />,
|
|
|
|
tooltip: $msg('HISTORY'),
|
|
|
|
onClick: () => onAction('history'),
|
|
|
|
visible: showPersistenceActions,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: <SaveOutlinedIcon />,
|
|
|
|
tooltip: $msg('SAVE') + ' (' + $msg('CTRL') + ' + S)',
|
|
|
|
onClick: save,
|
|
|
|
visible: showPersistenceActions,
|
|
|
|
},
|
|
|
|
appBarDivisor,
|
|
|
|
{
|
|
|
|
icon: <PrintOutlinedIcon />,
|
|
|
|
tooltip: $msg('PRINT'),
|
|
|
|
onClick: () => onAction('print'),
|
|
|
|
visible: showMapEntityActions,
|
|
|
|
},
|
|
|
|
exportConfiguration,
|
|
|
|
{
|
|
|
|
icon: <CloudUploadOutlinedIcon />,
|
|
|
|
onClick: () => onAction('publish'),
|
|
|
|
tooltip: $msg('PUBLISH'),
|
|
|
|
disabled: () => !showAccessChangeActions,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
render: () => (
|
|
|
|
<Button
|
|
|
|
variant="contained"
|
|
|
|
onClick={() => onAction('share')}
|
|
|
|
disabled={!showAccessChangeActions}
|
|
|
|
>
|
|
|
|
{$msg('COLLABORATE')}
|
|
|
|
</Button>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
helpConfiguration,
|
|
|
|
];
|
2022-10-05 21:54:23 +00:00
|
|
|
}
|