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,
|
initialText: props.initialText,
|
||||||
noteId: props.noteId,
|
noteId: props.noteId,
|
||||||
settings: props.editorSettings,
|
settings: props.editorSettings,
|
||||||
|
globalSearch: props.globalSearch,
|
||||||
webviewRef,
|
webviewRef,
|
||||||
themeId: props.themeId,
|
themeId: props.themeId,
|
||||||
pluginStates: props.plugins,
|
pluginStates: props.plugins,
|
||||||
|
@@ -56,6 +56,7 @@ export const initialize = async ({
|
|||||||
initialText,
|
initialText,
|
||||||
initialNoteId,
|
initialNoteId,
|
||||||
parentElementClassName,
|
parentElementClassName,
|
||||||
|
initialSearch,
|
||||||
}: EditorProps) => {
|
}: EditorProps) => {
|
||||||
const messenger = new WebViewToRNMessenger<EditorProcessApi, MainProcessApi>('rich-text-editor', null);
|
const messenger = new WebViewToRNMessenger<EditorProcessApi, MainProcessApi>('rich-text-editor', null);
|
||||||
const parentElement = document.getElementsByClassName(parentElementClassName)[0];
|
const parentElement = document.getElementsByClassName(parentElementClassName)[0];
|
||||||
@@ -118,6 +119,7 @@ export const initialize = async ({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
editor.setSearchState(initialSearch);
|
||||||
|
|
||||||
messenger.setLocalInterface({
|
messenger.setLocalInterface({
|
||||||
editor,
|
editor,
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
import { EditorEvent } from '@joplin/editor/events';
|
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 { MarkupRecord, RendererControl } from '../rendererBundle/types';
|
||||||
import { RenderResult } from '@joplin/renderer/types';
|
import { RenderResult } from '@joplin/renderer/types';
|
||||||
|
|
||||||
export interface EditorProps {
|
export interface EditorProps {
|
||||||
initialText: string;
|
initialText: string;
|
||||||
|
initialSearch: SearchState;
|
||||||
initialNoteId: string;
|
initialNoteId: string;
|
||||||
parentElementClassName: string;
|
parentElementClassName: string;
|
||||||
settings: EditorSettings;
|
settings: EditorSettings;
|
||||||
|
@@ -11,6 +11,7 @@ import shim from '@joplin/lib/shim';
|
|||||||
import { PluginStates } from '@joplin/lib/services/plugins/reducer';
|
import { PluginStates } from '@joplin/lib/services/plugins/reducer';
|
||||||
import { RendererControl, RenderOptions } from '../rendererBundle/types';
|
import { RendererControl, RenderOptions } from '../rendererBundle/types';
|
||||||
import { ResourceInfos } from '@joplin/renderer/types';
|
import { ResourceInfos } from '@joplin/renderer/types';
|
||||||
|
import { defaultSearchState } from '../../components/NoteEditor/SearchPanel';
|
||||||
|
|
||||||
const logger = Logger.create('useWebViewSetup');
|
const logger = Logger.create('useWebViewSetup');
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ interface Props {
|
|||||||
noteId: string;
|
noteId: string;
|
||||||
settings: EditorSettings;
|
settings: EditorSettings;
|
||||||
parentElementClassName: string;
|
parentElementClassName: string;
|
||||||
|
globalSearch: string;
|
||||||
themeId: number;
|
themeId: number;
|
||||||
pluginStates: PluginStates;
|
pluginStates: PluginStates;
|
||||||
noteResources: ResourceInfos;
|
noteResources: ResourceInfos;
|
||||||
@@ -100,6 +102,10 @@ const useSource = (props: UseSourceProps) => {
|
|||||||
parentElementClassName: propsRef.current.parentElementClassName,
|
parentElementClassName: propsRef.current.parentElementClassName,
|
||||||
initialText: propsRef.current.initialText,
|
initialText: propsRef.current.initialText,
|
||||||
initialNoteId: propsRef.current.noteId,
|
initialNoteId: propsRef.current.noteId,
|
||||||
|
initialSearch: {
|
||||||
|
...defaultSearchState,
|
||||||
|
searchText: propsRef.current.globalSearch,
|
||||||
|
},
|
||||||
settings: propsRef.current.settings,
|
settings: propsRef.current.settings,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user