diff --git a/packages/app-mobile/components/NoteEditor/RichTextEditor.tsx b/packages/app-mobile/components/NoteEditor/RichTextEditor.tsx index d019d50d6b..10671ccb3f 100644 --- a/packages/app-mobile/components/NoteEditor/RichTextEditor.tsx +++ b/packages/app-mobile/components/NoteEditor/RichTextEditor.tsx @@ -84,6 +84,7 @@ const RichTextEditor: React.FC = props => { initialText: props.initialText, noteId: props.noteId, settings: props.editorSettings, + globalSearch: props.globalSearch, webviewRef, themeId: props.themeId, pluginStates: props.plugins, diff --git a/packages/app-mobile/contentScripts/richTextEditorBundle/contentScript/index.ts b/packages/app-mobile/contentScripts/richTextEditorBundle/contentScript/index.ts index ec183a4ec3..9a72c03fd7 100644 --- a/packages/app-mobile/contentScripts/richTextEditorBundle/contentScript/index.ts +++ b/packages/app-mobile/contentScripts/richTextEditorBundle/contentScript/index.ts @@ -56,6 +56,7 @@ export const initialize = async ({ initialText, initialNoteId, parentElementClassName, + initialSearch, }: EditorProps) => { const messenger = new WebViewToRNMessenger('rich-text-editor', null); const parentElement = document.getElementsByClassName(parentElementClassName)[0]; @@ -118,6 +119,7 @@ export const initialize = async ({ } }, }); + editor.setSearchState(initialSearch); messenger.setLocalInterface({ editor, diff --git a/packages/app-mobile/contentScripts/richTextEditorBundle/types.ts b/packages/app-mobile/contentScripts/richTextEditorBundle/types.ts index 4697244212..db3d50ff3c 100644 --- a/packages/app-mobile/contentScripts/richTextEditorBundle/types.ts +++ b/packages/app-mobile/contentScripts/richTextEditorBundle/types.ts @@ -1,10 +1,11 @@ import { EditorEvent } from '@joplin/editor/events'; -import { EditorControl, EditorSettings } from '@joplin/editor/types'; +import { EditorControl, EditorSettings, SearchState } from '@joplin/editor/types'; import { MarkupRecord, RendererControl } from '../rendererBundle/types'; import { RenderResult } from '@joplin/renderer/types'; export interface EditorProps { initialText: string; + initialSearch: SearchState; initialNoteId: string; parentElementClassName: string; settings: EditorSettings; diff --git a/packages/app-mobile/contentScripts/richTextEditorBundle/useWebViewSetup.ts b/packages/app-mobile/contentScripts/richTextEditorBundle/useWebViewSetup.ts index d00cf84161..98b5a2e717 100644 --- a/packages/app-mobile/contentScripts/richTextEditorBundle/useWebViewSetup.ts +++ b/packages/app-mobile/contentScripts/richTextEditorBundle/useWebViewSetup.ts @@ -11,6 +11,7 @@ import shim from '@joplin/lib/shim'; import { PluginStates } from '@joplin/lib/services/plugins/reducer'; import { RendererControl, RenderOptions } from '../rendererBundle/types'; import { ResourceInfos } from '@joplin/renderer/types'; +import { defaultSearchState } from '../../components/NoteEditor/SearchPanel'; const logger = Logger.create('useWebViewSetup'); @@ -19,6 +20,7 @@ interface Props { noteId: string; settings: EditorSettings; parentElementClassName: string; + globalSearch: string; themeId: number; pluginStates: PluginStates; noteResources: ResourceInfos; @@ -100,6 +102,10 @@ const useSource = (props: UseSourceProps) => { parentElementClassName: propsRef.current.parentElementClassName, initialText: propsRef.current.initialText, initialNoteId: propsRef.current.noteId, + initialSearch: { + ...defaultSearchState, + searchText: propsRef.current.globalSearch, + }, settings: propsRef.current.settings, };