mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-18 09:35:20 +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;
|