Desktop: Fixes #5850: Editor loses cursor focus when Ctrl+F search is closed (#5919)

pull/5928/head
Kenichi Kobayashi 2021-12-28 19:26:33 +09:00 committed by GitHub
parent 46438a5888
commit b98e64c881
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -64,7 +64,7 @@ export default function useEditorSearch(CodeMirror: any) {
}
if (match) {
if (scrollTo) cm.scrollIntoView(match);
if (scrollTo) cm.setSelection(match.from, match.to);
return cm.markText(match.from, match.to, { className: 'cm-search-marker-selected' });
}

View File

@ -1,6 +1,7 @@
import { useState, useCallback } from 'react';
import Logger from '@joplin/lib/Logger';
import { SearchMarkers } from './useSearchMarkers';
const CommandService = require('@joplin/lib/services/CommandService').default;
const logger = Logger.create('useNoteSearchBar');
@ -70,6 +71,7 @@ export default function useNoteSearchBar() {
const onClose = useCallback(() => {
setShowLocalSearch(false);
setLocalSearch(defaultLocalSearch());
void CommandService.instance().execute('focusElementNoteBody');
}, []);
const setResultCount = useCallback((count: number) => {