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 Model from '../classes/model/editor';
import { import {
buildAppBarConfig, buildAppBarConfig,
buildToolbarConfig, buildEditorPanelConfig,
buildZoomToolbarConfig, buildZoomToolbarConfig,
} from './toolbar/toolbarConfigBuilder'; } from './toolbar/toolbarConfigBuilder';
@ -62,12 +62,6 @@ const Editor = ({
setModel(model); setModel(model);
}, []); }, []);
useEffect(() => {
if (model) {
toolbarConfiguration.current = buildToolbarConfig(model.getDesigner());
}
}, [model]);
useEffect(() => { useEffect(() => {
if (options.enableKeyboardEvents) { if (options.enableKeyboardEvents) {
DesignerKeyboard.resume(); DesignerKeyboard.resume();
@ -108,9 +102,9 @@ const Editor = ({
> >
{widgetManager.getEditorContent()} {widgetManager.getEditorContent()}
</Popover> </Popover>
{!capability.isHidden('edition-toolbar') && ( {!capability.isHidden('edition-toolbar') && model?.isMapLoadded() && (
<Toolbar <Toolbar
configurations={toolbarConfiguration.current} configurations={buildEditorPanelConfig(model)}
rerender={toolbarsRerenderSwitch} rerender={toolbarsRerenderSwitch}
></Toolbar> ></Toolbar>
)} )}

View File

@ -57,13 +57,8 @@ export type ToolbarActionType = 'export' | 'publish' | 'history' | 'print' | 'sh
* @param designer designer to aply changes * @param designer designer to aply changes
* @returns configuration for @wisemapping/editor priAppbarmary toolbar * @returns configuration for @wisemapping/editor priAppbarmary toolbar
*/ */
export function buildToolbarConfig(designer: Designer): ActionConfig[] { export function buildEditorPanelConfig(model: Editor): ActionConfig[] {
if (!designer) return []; const toolbarValueModelBuilder = new NodePropertyValueModelBuilder(model.getDesigner());
/**
* model builder
*/
const toolbarValueModelBuilder = new NodePropertyValueModelBuilder(designer);
/** /**
* submenu to manipulate node color and shape * submenu to manipulate node color and shape