Font Size
This commit is contained in:
@ -1,46 +1,32 @@
|
||||
import { javascript } from "@codemirror/lang-javascript"
|
||||
import { javascript } from "@codemirror/lang-javascript";
|
||||
import {
|
||||
keymap,
|
||||
highlightSpecialChars,
|
||||
drawSelection,
|
||||
highlightActiveLine,
|
||||
dropCursor,
|
||||
rectangularSelection,
|
||||
lineNumbers,
|
||||
crosshairCursor,
|
||||
highlightActiveLineGutter
|
||||
} from "@codemirror/view"
|
||||
keymap,
|
||||
highlightSpecialChars,
|
||||
drawSelection,
|
||||
highlightActiveLine,
|
||||
dropCursor,
|
||||
rectangularSelection,
|
||||
lineNumbers,
|
||||
crosshairCursor,
|
||||
highlightActiveLineGutter,
|
||||
} from "@codemirror/view";
|
||||
import { Extension, EditorState } from "@codemirror/state";
|
||||
import {
|
||||
Extension,
|
||||
EditorState
|
||||
} from "@codemirror/state"
|
||||
defaultHighlightStyle,
|
||||
syntaxHighlighting,
|
||||
indentOnInput,
|
||||
bracketMatching,
|
||||
foldKeymap,
|
||||
} from "@codemirror/language";
|
||||
import { defaultKeymap, historyKeymap, history } from "@codemirror/commands";
|
||||
import { searchKeymap, highlightSelectionMatches } from "@codemirror/search";
|
||||
import {
|
||||
defaultHighlightStyle,
|
||||
syntaxHighlighting,
|
||||
indentOnInput,
|
||||
bracketMatching,
|
||||
foldKeymap
|
||||
} from "@codemirror/language"
|
||||
import {
|
||||
defaultKeymap,
|
||||
historyKeymap,
|
||||
history,
|
||||
} from "@codemirror/commands"
|
||||
import {
|
||||
searchKeymap,
|
||||
highlightSelectionMatches
|
||||
} from "@codemirror/search"
|
||||
import {
|
||||
autocompletion,
|
||||
completionKeymap,
|
||||
closeBrackets,
|
||||
closeBracketsKeymap
|
||||
} from "@codemirror/autocomplete"
|
||||
import {
|
||||
lintKeymap
|
||||
} from "@codemirror/lint"
|
||||
|
||||
import { materialDark } from "./themes/materialDark"
|
||||
autocompletion,
|
||||
completionKeymap,
|
||||
closeBrackets,
|
||||
closeBracketsKeymap,
|
||||
} from "@codemirror/autocomplete";
|
||||
import { lintKeymap } from "@codemirror/lint";
|
||||
|
||||
// (The superfluous function calls around the list of extensions work
|
||||
// around current limitations in tree-shaking software.)
|
||||
@ -82,31 +68,30 @@ import { materialDark } from "./themes/materialDark"
|
||||
/// as desired.
|
||||
|
||||
export const editorSetup: Extension = (() => [
|
||||
materialDark,
|
||||
lineNumbers(),
|
||||
javascript(),
|
||||
highlightActiveLineGutter(),
|
||||
highlightSpecialChars(),
|
||||
history(),
|
||||
// foldGutter(),
|
||||
drawSelection(),
|
||||
dropCursor(),
|
||||
EditorState.allowMultipleSelections.of(true),
|
||||
indentOnInput(),
|
||||
syntaxHighlighting(defaultHighlightStyle, {fallback: true}),
|
||||
bracketMatching(),
|
||||
closeBrackets(),
|
||||
autocompletion(),
|
||||
rectangularSelection(),
|
||||
crosshairCursor(),
|
||||
highlightActiveLine(),
|
||||
highlightSelectionMatches(),
|
||||
keymap.of([
|
||||
...closeBracketsKeymap,
|
||||
...defaultKeymap,
|
||||
...historyKeymap,
|
||||
...foldKeymap,
|
||||
...completionKeymap,
|
||||
...lintKeymap
|
||||
])
|
||||
])()
|
||||
lineNumbers(),
|
||||
javascript(),
|
||||
highlightActiveLineGutter(),
|
||||
highlightSpecialChars(),
|
||||
history(),
|
||||
// foldGutter(),
|
||||
drawSelection(),
|
||||
dropCursor(),
|
||||
EditorState.allowMultipleSelections.of(true),
|
||||
indentOnInput(),
|
||||
syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
|
||||
bracketMatching(),
|
||||
closeBrackets(),
|
||||
autocompletion(),
|
||||
rectangularSelection(),
|
||||
crosshairCursor(),
|
||||
highlightActiveLine(),
|
||||
highlightSelectionMatches(),
|
||||
keymap.of([
|
||||
...closeBracketsKeymap,
|
||||
...defaultKeymap,
|
||||
...historyKeymap,
|
||||
...foldKeymap,
|
||||
...completionKeymap,
|
||||
...lintKeymap,
|
||||
]),
|
||||
])();
|
||||
|
||||
11
src/main.ts
11
src/main.ts
@ -21,6 +21,15 @@ import {
|
||||
template_universes,
|
||||
} from "./AppSettings";
|
||||
import { tryEvaluate } from "./Evaluator";
|
||||
import { materialDark } from "./themes/materialDark";
|
||||
import { oneDark } from "@codemirror/theme-one-dark";
|
||||
|
||||
export const fontSizeModif = EditorView.theme(
|
||||
{
|
||||
"&": { fontSize: "22px", }
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
export class Editor {
|
||||
// Data structures for editor text management
|
||||
@ -114,7 +123,9 @@ export class Editor {
|
||||
this.userPlugins = this.settings.vimMode ? [] : [vim()];
|
||||
|
||||
this.editorExtensions = [
|
||||
fontSizeModif,
|
||||
editorSetup,
|
||||
oneDark,
|
||||
rangeHighlighting(),
|
||||
javascript(),
|
||||
EditorView.updateListener.of((v: ViewUpdate) => {
|
||||
|
||||
Reference in New Issue
Block a user