diff --git a/packages/editor/src/components/index.tsx b/packages/editor/src/components/index.tsx index c11625fb..a4d9164a 100644 --- a/packages/editor/src/components/index.tsx +++ b/packages/editor/src/components/index.tsx @@ -20,7 +20,7 @@ import Popover from '@mui/material/Popover'; import Model from '../classes/model/editor'; import { buildAppBarConfig, - buildToolbarConfig, + buildEditorPanelConfig, buildZoomToolbarConfig, } from './toolbar/toolbarConfigBuilder'; @@ -62,12 +62,6 @@ const Editor = ({ setModel(model); }, []); - useEffect(() => { - if (model) { - toolbarConfiguration.current = buildToolbarConfig(model.getDesigner()); - } - }, [model]); - useEffect(() => { if (options.enableKeyboardEvents) { DesignerKeyboard.resume(); @@ -108,9 +102,9 @@ const Editor = ({ > {widgetManager.getEditorContent()} - {!capability.isHidden('edition-toolbar') && ( + {!capability.isHidden('edition-toolbar') && model?.isMapLoadded() && ( )} diff --git a/packages/editor/src/components/toolbar/toolbarConfigBuilder.tsx b/packages/editor/src/components/toolbar/toolbarConfigBuilder.tsx index 94131dd9..5b4614c5 100644 --- a/packages/editor/src/components/toolbar/toolbarConfigBuilder.tsx +++ b/packages/editor/src/components/toolbar/toolbarConfigBuilder.tsx @@ -57,13 +57,8 @@ export type ToolbarActionType = 'export' | 'publish' | 'history' | 'print' | 'sh * @param designer designer to aply changes * @returns configuration for @wisemapping/editor priAppbarmary toolbar */ -export function buildToolbarConfig(designer: Designer): ActionConfig[] { - if (!designer) return []; - - /** - * model builder - */ - const toolbarValueModelBuilder = new NodePropertyValueModelBuilder(designer); +export function buildEditorPanelConfig(model: Editor): ActionConfig[] { + const toolbarValueModelBuilder = new NodePropertyValueModelBuilder(model.getDesigner()); /** * submenu to manipulate node color and shape