Update keymap configuration in App.tsx

This commit is contained in:
2026-02-01 04:11:09 +01:00
parent 2265ae70b5
commit f4baeeca3d

View File

@@ -8,7 +8,7 @@ import { getCurrentWindow } from "@tauri-apps/api/window";
import { appDataDir } from "@tauri-apps/api/path"; import { appDataDir } from "@tauri-apps/api/path";
import { listen } from "@tauri-apps/api/event"; import { listen } from "@tauri-apps/api/event";
import { invoke } from "@tauri-apps/api/core"; import { invoke } from "@tauri-apps/api/core";
import { Compartment, EditorState, Transaction } from "@codemirror/state"; import { Compartment, EditorState, Transaction, Prec } from "@codemirror/state";
import { import {
EditorView, EditorView,
keymap, keymap,
@@ -397,7 +397,8 @@ export default function App() {
useEffect(() => { useEffect(() => {
const view = editorViewRef.current; const view = editorViewRef.current;
if (!view) return; if (!view) return;
const keys = keymap.of([ const keys = Prec.high(
keymap.of([
{ {
key: "Tab", key: "Tab",
run: () => { run: () => {
@@ -414,7 +415,8 @@ export default function App() {
return true; return true;
} }
} }
]); ])
);
view.dispatch({ view.dispatch({
effects: tabKeymapCompartmentRef.current.reconfigure(keys) effects: tabKeymapCompartmentRef.current.reconfigure(keys)
}); });