Editor pane is not reandered until map is loaded.

This commit is contained in:
Paulo Gustavo Veiga 2022-10-09 21:06:57 -07:00
parent 3d8e8dce38
commit e1fcaa0cd2
2 changed files with 5 additions and 16 deletions

View File

@ -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()}
</Popover>
{!capability.isHidden('edition-toolbar') && (
{!capability.isHidden('edition-toolbar') && model?.isMapLoadded() && (
<Toolbar
configurations={toolbarConfiguration.current}
configurations={buildEditorPanelConfig(model)}
rerender={toolbarsRerenderSwitch}
></Toolbar>
)}

View File

@ -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