mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
updates for codeedit light mode (#399)
This commit is contained in:
@@ -372,6 +372,11 @@ class Model {
|
||||
return theme;
|
||||
}
|
||||
|
||||
isThemeDark(): boolean {
|
||||
let cdata = this.clientData.get();
|
||||
return cdata?.feopts?.theme != "light";
|
||||
}
|
||||
|
||||
getTermFontSize(): number {
|
||||
return this.termFontSize.get();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
.monaco-editor {
|
||||
.monaco-editor-background,
|
||||
.margin-view-overlays {
|
||||
background-color: black !important;
|
||||
background-color: var(--app-bg-color) !important;
|
||||
}
|
||||
.scrollbar {
|
||||
height: 4px !important;
|
||||
|
||||
@@ -15,10 +15,11 @@ import { Button, Dropdown } from "@/elements";
|
||||
|
||||
import "./code.less";
|
||||
|
||||
// TODO: need to update these on theme change (pull from CSS vars)
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
loader.config({ paths: { vs: "./node_modules/monaco-editor/min/vs" } });
|
||||
loader.init().then(() => {
|
||||
monaco.editor.defineTheme("wave-theme", {
|
||||
monaco.editor.defineTheme("wave-theme-dark", {
|
||||
base: "hc-black",
|
||||
inherit: true,
|
||||
rules: [],
|
||||
@@ -26,6 +27,15 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
"editor.background": "#000000",
|
||||
},
|
||||
});
|
||||
|
||||
monaco.editor.defineTheme("wave-theme-light", {
|
||||
base: "hc-light",
|
||||
inherit: true,
|
||||
rules: [],
|
||||
colors: {
|
||||
"editor.background": "#fefefe",
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -374,11 +384,13 @@ class SourceCodeRenderer extends React.Component<
|
||||
}
|
||||
|
||||
getCodeEditor = () => {
|
||||
let theme = GlobalModel.isThemeDark() ? "wave-theme-dark" : "wave-theme-light";
|
||||
console.log("monaco theme", theme);
|
||||
return (
|
||||
<div className="editor-wrap" style={{ maxHeight: this.state.editorHeight }}>
|
||||
{this.state.showReadonly && <div className="readonly">{"read-only"}</div>}
|
||||
<Editor
|
||||
theme="wave-theme"
|
||||
theme={theme}
|
||||
height={this.state.editorHeight}
|
||||
defaultLanguage={this.state.selectedLanguage}
|
||||
value={this.state.code}
|
||||
|
||||
Reference in New Issue
Block a user