mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-27 10:32:58 +02:00
18 lines
509 B
TypeScript
18 lines
509 B
TypeScript
import { EditorState } from '@codemirror/state';
|
|
import { SearchState } from '../../types';
|
|
import { getSearchQuery, searchPanelOpen } from '@codemirror/search';
|
|
|
|
const getSearchState = (state: EditorState) => {
|
|
const query = getSearchQuery(state);
|
|
const searchState: SearchState = {
|
|
searchText: query.search,
|
|
replaceText: query.replace,
|
|
useRegex: query.regexp,
|
|
caseSensitive: query.caseSensitive,
|
|
dialogVisible: searchPanelOpen(state),
|
|
};
|
|
return searchState;
|
|
};
|
|
|
|
export default getSearchState;
|