Skip to content

Commit

Permalink
move apply theme call to after editor creation otherwise the theme ma…
Browse files Browse the repository at this point in the history
…y be applied after the setContent
  • Loading branch information
handreyrc committed Mar 14, 2024
1 parent e35ecb6 commit fccb9b2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/editor/src/envelope/KogitoEditorEnvelopeApiImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ export class KogitoEditorEnvelopeApiImpl<

this.editor = await this.editorFactory.createEditor(this.args.envelopeContext, initArgs);

// "Permanent" theme subscription, destroyed along editor's iFrame
this.args.envelopeContext.channelApi.shared.kogitoEditor_theme.subscribe((theme: EditorTheme) => {
this.editor.setTheme(theme);
});

await this.view().setEditor(this.editor);

this.editor.af_onStartup?.();
Expand All @@ -95,11 +100,6 @@ export class KogitoEditorEnvelopeApiImpl<
const editorContent = await this.args.envelopeContext.channelApi.requests.kogitoEditor_contentRequest();
this.normalizedPosixPathRelativeToTheWorkspaceRoot = editorContent.normalizedPosixPathRelativeToTheWorkspaceRoot;

// "Permanent" theme subscription, destroyed along editor's iFrame
this.args.envelopeContext.channelApi.shared.kogitoEditor_theme.subscribe((theme: EditorTheme) => {
this.editor.setTheme(theme);
});

await this.editor
.setContent(editorContent.normalizedPosixPathRelativeToTheWorkspaceRoot, editorContent.content)
.catch((e) => this.args.envelopeContext.channelApi.notifications.kogitoEditor_setContentError.send(editorContent))
Expand Down

0 comments on commit fccb9b2

Please sign in to comment.