Skip to content

Commit

Permalink
we dont really need to initialise these in the constructor tbh
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
  • Loading branch information
BeryJu committed Jan 25, 2025
1 parent 408841b commit 31364ee
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions web/src/elements/CodeMirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,17 @@ export class CodeMirrorTextarea<T> extends AKElement {
theme: Compartment = new Compartment();
syntaxHighlighting: Compartment = new Compartment();

themeLight: Extension;
themeDark: Extension;
syntaxHighlightingLight: Extension;
syntaxHighlightingDark: Extension;
themeLight = EditorView.theme(
{
"&": {
backgroundColor: "var(--pf-global--BackgroundColor--light-300)",
},
},
{ dark: false },
);
themeDark = oneDark;
syntaxHighlightingLight = syntaxHighlighting(defaultHighlightStyle);
syntaxHighlightingDark = syntaxHighlighting(oneDarkHighlightStyle);

static get styles(): CSSResult[] {
return [
Expand Down Expand Up @@ -123,21 +130,6 @@ export class CodeMirrorTextarea<T> extends AKElement {
}
}

constructor() {
super();
this.themeLight = EditorView.theme(
{
"&": {
backgroundColor: "var(--pf-global--BackgroundColor--light-300)",
},
},
{ dark: false },
);
this.themeDark = oneDark;
this.syntaxHighlightingLight = syntaxHighlighting(defaultHighlightStyle);
this.syntaxHighlightingDark = syntaxHighlighting(oneDarkHighlightStyle);
}

private getInnerValue(): string {
if (!this.editor) {
return "";
Expand Down

0 comments on commit 31364ee

Please sign in to comment.