fix: codemirror enable searchKeymap, selectAll

This commit is contained in:
Benjamin Nussbaum 2026-01-05 14:43:30 +01:00
parent a3f792944c
commit 32dd4c3d08

View file

@ -1,8 +1,9 @@
import { EditorView, lineNumbers, keymap } from '@codemirror/view'; import { EditorView, lineNumbers, keymap } from '@codemirror/view';
import { ViewPlugin } from '@codemirror/view'; import { ViewPlugin } from '@codemirror/view';
import { indentWithTab } from '@codemirror/commands'; import { indentWithTab, selectAll } from '@codemirror/commands';
import { foldGutter, foldKeymap } from '@codemirror/language'; import { foldGutter, foldKeymap } from '@codemirror/language';
import { history, historyKeymap } from '@codemirror/commands'; import { history, historyKeymap } from '@codemirror/commands';
import { searchKeymap } from '@codemirror/search';
import { html } from '@codemirror/lang-html'; import { html } from '@codemirror/lang-html';
import { javascript } from '@codemirror/lang-javascript'; import { javascript } from '@codemirror/lang-javascript';
import { json } from '@codemirror/lang-json'; import { json } from '@codemirror/lang-json';
@ -154,7 +155,16 @@ export function createCodeMirror(element, options = {}) {
createResizePlugin(), createResizePlugin(),
...(Array.isArray(languageSupport) ? languageSupport : [languageSupport]), ...(Array.isArray(languageSupport) ? languageSupport : [languageSupport]),
...themeSupport, ...themeSupport,
keymap.of([indentWithTab, ...foldKeymap, ...historyKeymap]), keymap.of([
indentWithTab,
...foldKeymap,
...historyKeymap,
...searchKeymap,
{
key: 'Mod-a',
run: selectAll,
},
]),
EditorView.theme({ EditorView.theme({
'&': { '&': {
fontSize: '14px', fontSize: '14px',