mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-26 08:04:56 +01:00
Toolbar actions buttons are dissabled until maps is created.
This commit is contained in:
parent
d45472134f
commit
0dcdfc69ff
@ -24,6 +24,10 @@ class Editor {
|
|||||||
this.component = mindplotComponent;
|
this.component = mindplotComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isMapLoadded(): boolean {
|
||||||
|
return this.component.getDesigner()?.getMindmap() != null;
|
||||||
|
}
|
||||||
|
|
||||||
save(minor: boolean) {
|
save(minor: boolean) {
|
||||||
this.component.save(minor);
|
this.component.save(minor);
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ const Editor = ({
|
|||||||
const msg = I18nMsg.loadLocaleData(locale);
|
const msg = I18nMsg.loadLocaleData(locale);
|
||||||
|
|
||||||
const menubarConfiguration = buildAppBarConfig(
|
const menubarConfiguration = buildAppBarConfig(
|
||||||
model?.getDesigner(),
|
model,
|
||||||
options.mapTitle,
|
options.mapTitle,
|
||||||
capability,
|
capability,
|
||||||
onAction,
|
onAction,
|
||||||
|
@ -48,6 +48,7 @@ import TopicNote from '../action-widget/pane/topic-note';
|
|||||||
import IconPicker from '../action-widget/pane/icon-picker';
|
import IconPicker from '../action-widget/pane/icon-picker';
|
||||||
import FontFamilySelector from '../action-widget/button/font-family-selector';
|
import FontFamilySelector from '../action-widget/button/font-family-selector';
|
||||||
import Capability from '../../classes/action/capability';
|
import Capability from '../../classes/action/capability';
|
||||||
|
import Editor from '../../classes/model/editor';
|
||||||
|
|
||||||
export type ToolbarActionType = 'export' | 'publish' | 'history' | 'print' | 'share' | 'info';
|
export type ToolbarActionType = 'export' | 'publish' | 'history' | 'print' | 'share' | 'info';
|
||||||
|
|
||||||
@ -348,18 +349,18 @@ export function buildZoomToolbarConfig(capability: Capability, designer: Designe
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function buildAppBarConfig(
|
export function buildAppBarConfig(
|
||||||
designer: Designer,
|
model: Editor,
|
||||||
mapTitle: string,
|
mapTitle: string,
|
||||||
capability: Capability,
|
capability: Capability,
|
||||||
onAction: (type: ToolbarActionType) => void,
|
onAction: (type: ToolbarActionType) => void,
|
||||||
accountConfiguration,
|
accountConfiguration,
|
||||||
save: () => void,
|
save: () => void,
|
||||||
): ActionConfig[] {
|
): ActionConfig[] {
|
||||||
if (!designer) {
|
const appBarDivisor = {
|
||||||
return [];
|
render: () => <Typography component="div" sx={{ flexGrow: 1 }} />,
|
||||||
}
|
};
|
||||||
|
|
||||||
let commonConfiguration: ActionConfig[] = [
|
return [
|
||||||
{
|
{
|
||||||
icon: <ArrowBackIosNewOutlinedIcon />,
|
icon: <ArrowBackIosNewOutlinedIcon />,
|
||||||
tooltip: $msg('BACK_TO_MAP_LIST'),
|
tooltip: $msg('BACK_TO_MAP_LIST'),
|
||||||
@ -382,14 +383,6 @@ export function buildAppBarConfig(
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
];
|
|
||||||
|
|
||||||
const appBarDivisor = {
|
|
||||||
render: () => <Typography component="div" sx={{ flexGrow: 1 }} />,
|
|
||||||
};
|
|
||||||
|
|
||||||
return [
|
|
||||||
...commonConfiguration,
|
|
||||||
null,
|
null,
|
||||||
{
|
{
|
||||||
render: () => (
|
render: () => (
|
||||||
@ -403,6 +396,7 @@ export function buildAppBarConfig(
|
|||||||
></UndoAndRedo>
|
></UndoAndRedo>
|
||||||
),
|
),
|
||||||
visible: !capability.isHidden('undo-changes'),
|
visible: !capability.isHidden('undo-changes'),
|
||||||
|
disabled: () => !model?.isMapLoadded(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
render: () => (
|
render: () => (
|
||||||
@ -416,6 +410,7 @@ export function buildAppBarConfig(
|
|||||||
></UndoAndRedo>
|
></UndoAndRedo>
|
||||||
),
|
),
|
||||||
visible: !capability.isHidden('redo-changes'),
|
visible: !capability.isHidden('redo-changes'),
|
||||||
|
disabled: () => !model?.isMapLoadded(),
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
{
|
{
|
||||||
@ -423,6 +418,7 @@ export function buildAppBarConfig(
|
|||||||
tooltip: $msg('SAVE') + ' (' + $msg('CTRL') + ' + S)',
|
tooltip: $msg('SAVE') + ' (' + $msg('CTRL') + ' + S)',
|
||||||
onClick: save,
|
onClick: save,
|
||||||
visible: !capability.isHidden('save'),
|
visible: !capability.isHidden('save'),
|
||||||
|
disabled: () => !model?.isMapLoadded(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: <RestoreOutlinedIcon />,
|
icon: <RestoreOutlinedIcon />,
|
||||||
|
Loading…
Reference in New Issue
Block a user