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:
parent
c7061a3ea4
commit
ee71c5aae8
@ -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":
|
||||
|
||||
Loading…
Reference in New Issue
Block a user