You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-08-10 22:11:50 +02:00
Mobile: Fixes #12844: Rich Text Editor: Make initial search behavior match the Markdown editor (#12878)
This commit is contained in:
@@ -84,6 +84,7 @@ const RichTextEditor: React.FC<EditorProps> = props => {
|
||||
initialText: props.initialText,
|
||||
noteId: props.noteId,
|
||||
settings: props.editorSettings,
|
||||
globalSearch: props.globalSearch,
|
||||
webviewRef,
|
||||
themeId: props.themeId,
|
||||
pluginStates: props.plugins,
|
||||
|
@@ -56,6 +56,7 @@ export const initialize = async ({
|
||||
initialText,
|
||||
initialNoteId,
|
||||
parentElementClassName,
|
||||
initialSearch,
|
||||
}: EditorProps) => {
|
||||
const messenger = new WebViewToRNMessenger<EditorProcessApi, MainProcessApi>('rich-text-editor', null);
|
||||
const parentElement = document.getElementsByClassName(parentElementClassName)[0];
|
||||
@@ -118,6 +119,7 @@ export const initialize = async ({
|
||||
}
|
||||
},
|
||||
});
|
||||
editor.setSearchState(initialSearch);
|
||||
|
||||
messenger.setLocalInterface({
|
||||
editor,
|
||||
|
@@ -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;
|
||||
|
@@ -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,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user