mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
editor: fix search decorations not cleared on search end
This commit is contained in:
@@ -384,6 +384,7 @@ export const SearchReplace = Extension.create<SearchOptions, SearchStorage>({
|
||||
tr.getMeta("selectedIndex") ?? value.selectedIndex;
|
||||
const shouldResearch =
|
||||
docChanged ||
|
||||
(isSearching !== value.isSearching && isSearching) ||
|
||||
searchTerm !== value.searchTerm ||
|
||||
matchCase !== value.matchCase ||
|
||||
matchWholeWord !== value.matchWholeWord ||
|
||||
|
||||
@@ -30,7 +30,8 @@ export function SearchReplaceFloatingMenu(props: FloatingMenuProps) {
|
||||
|
||||
useLayoutEffect(() => {
|
||||
const { searchTerm, ...options } = useEditorSearchStore.getState();
|
||||
editor.commands.search(searchTerm, options);
|
||||
if (!options.isSearching) editor.commands.endSearch();
|
||||
else editor.commands.search(searchTerm, options);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -38,7 +39,6 @@ export function SearchReplaceFloatingMenu(props: FloatingMenuProps) {
|
||||
mobile="sheet"
|
||||
desktop="popup"
|
||||
isOpen={isSearching}
|
||||
container={document.body}
|
||||
onClose={() => editor.commands.endSearch()}
|
||||
position={{
|
||||
target: editor.isEditable ? getToolbarElement() : getEditorContainer(),
|
||||
|
||||
Reference in New Issue
Block a user