1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-27 10:32:58 +02:00
joplin/packages/editor/CodeMirror/utils/getSearchState.ts

18 lines
509 B
TypeScript
Raw Normal View History

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;