fix usage of monaco editor theme

pull/1701/head^2
yann300 3 years ago
parent 5a5bc45510
commit 7dc51f823d
  1. 17
      apps/remix-ide/src/app/editor/editor.js
  2. 2
      libs/remix-ui/editor/src/lib/remix-ui-editor.tsx

@ -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 () {

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

Loading…
Cancel
Save