1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Switching AceEditor theme reactively

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2020-08-21 15:07:21 +03:00
parent c7061a3ea4
commit ee71c5aae8

View File

@ -3,10 +3,11 @@
import "./ace-editor.scss"
import React from "react"
import { observer } from "mobx-react";
import { observer, disposeOnUnmount } from "mobx-react";
import AceBuild, { Ace } from "ace-builds"
import { autobind, cssNames } from "../../utils";
import { themeStore } from "../../theme.store";
import { reaction } from "mobx";
interface Props extends Partial<Ace.EditorOptions> {
className?: string;
@ -46,6 +47,11 @@ export class AceEditor extends React.Component<Props, State> {
require("ace-builds/src-noconflict/ext-searchbox")
}
@disposeOnUnmount
themeSwitcher = reaction(() => themeStore.activeTheme, () => {
this.setTheme(this.theme);
});
get theme() {
switch (themeStore.activeTheme.type) {
case "light":