fix Ctrl+Enter default behavior
This commit is contained in:
16
src/main.ts
16
src/main.ts
@ -1,9 +1,9 @@
|
|||||||
import { EditorState, Compartment } from "@codemirror/state";
|
import { EditorState, Compartment } from "@codemirror/state";
|
||||||
import { ViewUpdate, lineNumbers } from "@codemirror/view";
|
import { ViewUpdate, lineNumbers, keymap } from "@codemirror/view";
|
||||||
import { javascript } from "@codemirror/lang-javascript";
|
import { javascript } from "@codemirror/lang-javascript";
|
||||||
import { oneDark } from "@codemirror/theme-one-dark";
|
import { oneDark } from "@codemirror/theme-one-dark";
|
||||||
import { markdown } from "@codemirror/lang-markdown";
|
import { markdown } from "@codemirror/lang-markdown";
|
||||||
import { Extension } from "@codemirror/state";
|
import { Extension, Prec } from "@codemirror/state";
|
||||||
import { vim } from "@replit/codemirror-vim";
|
import { vim } from "@replit/codemirror-vim";
|
||||||
import { AppSettings } from "./AppSettings";
|
import { AppSettings } from "./AppSettings";
|
||||||
import { editorSetup } from "./EditorSetup";
|
import { editorSetup } from "./EditorSetup";
|
||||||
@ -164,8 +164,10 @@ export class Editor {
|
|||||||
) as HTMLButtonElement;
|
) as HTMLButtonElement;
|
||||||
|
|
||||||
// Error line
|
// Error line
|
||||||
error_line: HTMLElement = document.getElementById("error_line") as HTMLElement
|
error_line: HTMLElement = document.getElementById(
|
||||||
show_error: boolean = false
|
"error_line"
|
||||||
|
) as HTMLElement;
|
||||||
|
show_error: boolean = false;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
// ================================================================================
|
// ================================================================================
|
||||||
@ -226,6 +228,9 @@ export class Editor {
|
|||||||
...this.editorExtensions,
|
...this.editorExtensions,
|
||||||
EditorView.lineWrapping,
|
EditorView.lineWrapping,
|
||||||
dynamicPlugins.of(this.userPlugins),
|
dynamicPlugins.of(this.userPlugins),
|
||||||
|
Prec.highest(keymap.of([
|
||||||
|
{ key:"Ctrl-Enter", run: ()=>{return true} }
|
||||||
|
])),
|
||||||
],
|
],
|
||||||
doc: this.universes[this.selected_universe].locals[this.local_index]
|
doc: this.universes[this.selected_universe].locals[this.local_index]
|
||||||
.candidate,
|
.candidate,
|
||||||
@ -527,8 +532,7 @@ export class Editor {
|
|||||||
"about",
|
"about",
|
||||||
].forEach((e) => {
|
].forEach((e) => {
|
||||||
let name = `docs_` + e;
|
let name = `docs_` + e;
|
||||||
document.getElementById(name)!
|
document.getElementById(name)!.addEventListener("click", () => {
|
||||||
.addEventListener("click", () => {
|
|
||||||
this.currentDocumentationPane = e;
|
this.currentDocumentationPane = e;
|
||||||
this.updateDocumentationContent();
|
this.updateDocumentationContent();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user