feat: init base theme for codemirror
This commit is contained in:
@@ -48,6 +48,7 @@ import * as O from "fp-ts/Option"
|
|||||||
import { isJSONContentType } from "../utils/contenttypes"
|
import { isJSONContentType } from "../utils/contenttypes"
|
||||||
import { Completer } from "./completion"
|
import { Completer } from "./completion"
|
||||||
import { LinterDefinition } from "./linting/linter"
|
import { LinterDefinition } from "./linting/linter"
|
||||||
|
import baseTheme from "./themes/baseTheme"
|
||||||
|
|
||||||
type CodeMirrorOptions = {
|
type CodeMirrorOptions = {
|
||||||
extendedEditorConfig: Omit<CodeMirror.EditorConfiguration, "value">
|
extendedEditorConfig: Omit<CodeMirror.EditorConfiguration, "value">
|
||||||
@@ -341,6 +342,7 @@ export function useNewCodemirror(
|
|||||||
doc: value.value,
|
doc: value.value,
|
||||||
extensions: [
|
extensions: [
|
||||||
basicSetup,
|
basicSetup,
|
||||||
|
baseTheme,
|
||||||
ViewPlugin.fromClass(
|
ViewPlugin.fromClass(
|
||||||
class {
|
class {
|
||||||
update(update: ViewUpdate) {
|
update(update: ViewUpdate) {
|
||||||
|
|||||||
22
packages/hoppscotch-app/helpers/editor/themes/baseTheme.ts
Normal file
22
packages/hoppscotch-app/helpers/editor/themes/baseTheme.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { EditorView } from "@codemirror/view"
|
||||||
|
|
||||||
|
const baseTheme = EditorView.theme({
|
||||||
|
"&": {
|
||||||
|
fontSize: "var(--body-font-size)",
|
||||||
|
},
|
||||||
|
".cm-content": {
|
||||||
|
fontFamily: "var(--font-mono)",
|
||||||
|
backgroundColor: "var(--primary-color)",
|
||||||
|
},
|
||||||
|
".cm-gutters": {
|
||||||
|
fontFamily: "var(--font-mono)",
|
||||||
|
backgroundColor: "var(--primary-color)",
|
||||||
|
borderColor: "var(--divider-light-color)",
|
||||||
|
},
|
||||||
|
".cm-lineNumbers": {
|
||||||
|
minWidth: "3em",
|
||||||
|
color: "var(--secondary-light-color)",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export default baseTheme
|
||||||
Reference in New Issue
Block a user