Skip to content

Commit 116e630

Browse files
committed
chore: turn off console log
1 parent 89e84c0 commit 116e630

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/editor-mathfield/keyboard-input.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ import {
1515
import { moveAfterParent } from '../editor-model/commands-move';
1616
import { range } from '../editor-model/selection-utils';
1717

18-
import { removeSuggestion, updateAutocomplete } from './autocomplete';
18+
import {
19+
acceptCommandSuggestion,
20+
removeSuggestion,
21+
updateAutocomplete,
22+
} from './autocomplete';
1923
import { requestUpdate } from './render';
2024
import type { _Mathfield } from './mathfield-private';
2125
import { removeIsolatedSpace, smartMode } from './smartmode';
@@ -250,6 +254,18 @@ export function onKeystroke(
250254
// (the bias is reset when the selection changes)
251255
mathfield.styleBias = 'none';
252256

257+
// Check if there's an active autocomplete suggestion and accept it
258+
if (acceptCommandSuggestion(model)) {
259+
mathfield.snapshot('accept-suggestion');
260+
mathfield.dirty = true;
261+
mathfield.scrollIntoView();
262+
if (evt.preventDefault) {
263+
evt.preventDefault();
264+
evt.stopPropagation();
265+
}
266+
return false;
267+
}
268+
253269
// The space bar can be used to separate inline shortcuts
254270
mathfield.flushInlineShortcutBuffer();
255271

0 commit comments

Comments
 (0)