A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
editor: fix search options not respected
Abdullah Attaadf961fa0890
diff --git a/packages/editor/src/extensions/search-replace/search-replace.ts b/packages/editor/src/extensions/search-replace/search-replace.tsindex 44c63a4bc..d98014c73 100644--- a/packages/editor/src/extensions/search-replace/search-replace.ts+++ b/packages/editor/src/extensions/search-replace/search-replace.ts@@ -261,7 +261,7 @@ export const SearchReplace = Extension.create<SearchOptions, SearchStorage>({},endSearch:() =>- ({ state, dispatch, editor }) => {+ ({ state, dispatch }) => {state.tr.setMeta("isSearching", false);if (dispatch) updateView(state, dispatch);return this.options.onEndSearch();@@ -271,9 +271,9 @@ export const SearchReplace = Extension.create<SearchOptions, SearchStorage>({({ state, dispatch }) => {state.tr.setMeta("isSearching", true);state.tr.setMeta("searchTerm", term);- if (options?.enableRegex) state.tr.setMeta("enableRegex", true);- if (options?.matchCase) state.tr.setMeta("matchCase", true);- if (options?.matchWholeWord) state.tr.setMeta("matchWholeWord", true);+ state.tr.setMeta("enableRegex", options?.enableRegex);+ state.tr.setMeta("matchCase", options?.matchCase);+ state.tr.setMeta("matchWholeWord", options?.matchWholeWord);if (dispatch) updateView(state, dispatch);return true;diff --git a/packages/editor/src/toolbar/popups/search-replace.tsx b/packages/editor/src/toolbar/popups/search-replace.tsxindex deea08400..8df1bd197 100644--- a/packages/editor/src/toolbar/popups/search-replace.tsx+++ b/packages/editor/src/toolbar/popups/search-replace.tsx@@ -44,13 +44,9 @@ export function SearchReplacePopup(props: SearchReplacePopupProps) {const search = useCallback((term: string) => {- editor.commands.search(term, {- matchCase,- enableRegex,- matchWholeWord- });+ editor.commands.search(term, useEditorSearchStore.getState());},- [editor.commands, matchCase, enableRegex, matchWholeWord]+ [editor.commands]);useEffect(() => {