Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix search replace issues

ammarahm-ed22748f7b4eb1
diff --git a/apps/mobile/src/provider/stores.ts b/apps/mobile/src/provider/stores.ts
index dafe27cc0..91f09f06e 100644
--- a/apps/mobile/src/provider/stores.ts
+++ b/apps/mobile/src/provider/stores.ts
@@ -296,7 +296,7 @@ export const useEditorStore = create<EditorStore>((set, get) => ({
let func = (value: string) => {
eUnSubscribeEvent('selectionvalue', func);
console.log('setSearchReplace:', value, value.length);
- if ((!value || value.trim() === '') && get().searchReplace) {
+ if (!value && get().searchReplace) {
endSearch();
return;
}
diff --git a/apps/mobile/src/views/Editor/tiny/tiny.js b/apps/mobile/src/views/Editor/tiny/tiny.js
index 05451cd4c..7d24f2ea2 100644
--- a/apps/mobile/src/views/Editor/tiny/tiny.js
+++ b/apps/mobile/src/views/Editor/tiny/tiny.js
@@ -202,19 +202,11 @@ export function safeKeyboardDismiss() {
}
const undo = `
-
tinymce.activeEditor.undoManager.undo();
-
-`;
-const redo = `
-
-tinymce.activeEditor.undoManager.redo();
-
`;
+const redo = `tinymce.activeEditor.undoManager.redo();`;
-const clearHistory = `
-tinymce.activeEditor.undoManager.clear();
-`;
+const clearHistory = `tinymce.activeEditor.undoManager.clear();`;
const onKeyboardShow = () => {
if (!editing.movedAway) {
diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js b/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js
index 35b57a15b..a9f0c9cdf 100644
--- a/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js
+++ b/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js
@@ -4,11 +4,9 @@ import { Button } from '../../../../components/Button';
import Input from '../../../../components/Input';
import { useTracked } from '../../../../provider';
import { useEditorStore, useSettingStore } from '../../../../provider/stores';
-import { eSubscribeEvent, eUnSubscribeEvent } from '../../../../services/EventManager';
import { showTooltip, TOOLTIP_POSITIONS } from '../../../../utils';
import layoutmanager from '../../../../utils/layout-manager';
import { SIZE } from '../../../../utils/SizeUtils';
-import { sleep } from '../../../../utils/TimeUtils';
import { EditorWebView } from '../../Functions';
import tiny from '../tiny';
import { endSearch } from './commands';
@@ -70,6 +68,10 @@ const SearcReplace = () => {
tinymce.activeEditor.plugins.searchreplace.replace("${values.current?.replace}",true${
all ? ',true' : ''
});
+ setTimeout(function() {
+ tinymce.activeEditor.fire("input");
+ },100)
+
});
`
);