Add delay render support.

This commit is contained in:
Paulo Gustavo Veiga
2022-11-16 21:12:33 -08:00
parent a1f0fa6281
commit 046215898e
10 changed files with 110 additions and 39 deletions

View File

@ -32,7 +32,7 @@ class Editor {
}
isMapLoadded(): boolean {
return this.component?.getDesigner()?.getMindmap() != null;
return this.component.isLoaded();
}
save(minor: boolean): void {
@ -57,9 +57,9 @@ class Editor {
mapId: string,
persistenceManager: PersistenceManager,
widgetManager: WidgetManager,
): void {
): Promise<void> {
this.component.buildDesigner(persistenceManager, widgetManager);
this.component.loadMap(mapId);
return this.component.loadMap(mapId);
}
registerEvents(canvasUpdate: (timestamp: number) => void, capability: Capability): void {

View File

@ -79,10 +79,12 @@ const Editor = ({
const capability = new Capability(options.mode, mapInfo.isLocked());
const mindplotRef = useCallback((component: MindplotWebComponent) => {
// Initialized model ...
const model = new Model(component);
model.loadMindmap(mapInfo.getId(), persistenceManager, widgetManager);
model.registerEvents(setCanvasUpdate, capability);
// Force refresh after map load ...
model.loadMindmap(mapInfo.getId(), persistenceManager, widgetManager).then(() => {
setCanvasUpdate(Date.now());
});
setModel(model);
}, []);
@ -137,7 +139,7 @@ const Editor = ({
message={mapInfo.isLocked() ? mapInfo.getLockedMessage() : ''}
/>
{!model && (
{!model?.isMapLoadded() && (
<SpinnerCentered>
<Vortex
visible={true}