Skip to content

Commit cba3ab4

Browse files
committed
Fix: add support for tab in the Client.
1 parent 938b38c commit cba3ab4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

client/src/CodeMirror-integration.mts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@
5050
//
5151
// ### Third-party
5252
import { basicSetup } from "codemirror";
53+
import { indentWithTab } from "@codemirror/commands";
5354
import {
5455
EditorView,
5556
Decoration,
5657
DecorationSet,
58+
keymap,
5759
ViewUpdate,
5860
ViewPlugin,
5961
WidgetType,
@@ -99,8 +101,8 @@ let tinymce_singleton: Editor | undefined;
99101
// When true, don't update on the next call to `on_dirty`. See that function for
100102
// more info.
101103
let ignore_next_dirty = false;
102-
// True to ignore the next text selection change, since updates to the
103-
// cursor or scroll position from the Client trigged this change.
104+
// True to ignore the next text selection change, since updates to the cursor or
105+
// scroll position from the Client trigged this change.
104106
let ignore_selection_change = false;
105107

106108
// Options used when creating a `Decoration`.
@@ -984,6 +986,10 @@ export const CodeMirror_load = async (
984986
basicSetup,
985987
EditorView.lineWrapping,
986988
autosaveExtension,
989+
// Make tab an indent per the
990+
// [docs](https://codemirror.net/examples/tab/). TODO:
991+
// document a way to escape the tab key per the same docs.
992+
keymap.of([indentWithTab]),
987993
...extensions,
988994
],
989995
},

0 commit comments

Comments
 (0)