1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +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;