diff --git a/apps/remix-ide/src/app/editor/editor.js b/apps/remix-ide/src/app/editor/editor.js index 0c922296b8..4d2cd1052e 100644 --- a/apps/remix-ide/src/app/editor/editor.js +++ b/apps/remix-ide/src/app/editor/editor.js @@ -25,13 +25,6 @@ class Editor extends Plugin { remixDark: 'remix-dark' } - const translateTheme = (theme) => this._themes[theme.name === 'Dark' ? 'remixDark' : theme.quality] - this.on('theme', 'themeChanged', (theme) => { - this.currentTheme = translateTheme(theme) - this.renderComponent() - }) - this.call('theme', 'currentTheme', (theme) => { this.currentTheme = translateTheme(theme) }) - // Init this.event = new EventManager() this.sessions = {} @@ -115,6 +108,16 @@ class Editor extends Plugin { this.on('sidePanel', 'pluginDisabled', (name) => { this.clearAllDecorationsFor(name) }) + + const translateTheme = (theme) => this._themes[theme.name === 'Dark' ? 'remixDark' : theme.quality] + this.on('theme', 'themeChanged', (theme) => { + this.currentTheme = translateTheme(theme) + this.renderComponent() + }) + this.call('theme', 'currentTheme', (theme) => { + this.currentTheme = translateTheme(theme) + this.renderComponent() + }) } onDeactivation () { diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index afb7351eed..1fd17a57d5 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -82,6 +82,8 @@ export const EditorUI = (props: EditorUIProps) => { monacoRef.current.editor.setTheme(props.theme) }, [props.theme]) + if (monacoRef.current) monacoRef.current.editor.setTheme(props.theme) + const setAnnotationsbyFile = (uri) => { if (props.sourceAnnotationsPerFile[uri]) { const model = editorModelsState[uri]?.model