This commit is contained in:
Zef Hemel
2022-12-16 12:44:04 +01:00
parent be83f305dd
commit 88cc80cd1a
8 changed files with 50 additions and 10 deletions
+11 -8
View File
@@ -128,6 +128,7 @@ export class Editor {
openPages = new Map<string, PageState>();
editorView?: EditorView;
viewState: AppViewState;
// deno-lint-ignore ban-types
viewDispatch: Function;
space: Space;
pageNavigator: PathPageNavigator;
@@ -142,7 +143,10 @@ export class Editor {
private mdExtensions: MDExt[] = [];
urlPrefix: string;
indexPage: string;
// Runtime state (that doesn't make sense in viewState)
collabState?: CollabState;
enableVimMode = false;
constructor(
space: Space,
@@ -455,13 +459,7 @@ export class Editor {
doc: this.collabState ? this.collabState.ytext.toString() : text,
extensions: [
// Enable vim mode, or not
[
...this.builtinSettings.vimMode
? [vim({
status: true,
})]
: [],
],
[...this.enableVimMode ? [vim({ status: true })] : []],
// The uber markdown mode
markdown({
base: buildMarkdown(this.mdExtensions),
@@ -497,7 +495,7 @@ export class Editor {
highlightSpecialChars(),
history(),
// Enable vim mode
[...this.builtinSettings.vimMode ? [vim()] : []],
[...this.enableVimMode ? [vim()] : []],
drawSelection(),
dropCursor(),
indentOnInput(),
@@ -987,4 +985,9 @@ export class Editor {
});
this.rebuildEditorState();
}
setVimMode(vimMode: boolean) {
this.enableVimMode = vimMode;
this.rebuildEditorState();
}
}