web: prevent scroll jump when toggling focus mode

This commit is contained in:
Abdullah Atta
2023-08-02 14:59:13 +05:00
committed by Abdullah Atta
parent a747bafa69
commit 3b363a1b20
2 changed files with 8 additions and 2 deletions

View File

@@ -410,7 +410,10 @@ function Portal(props: PropsWithChildren<{ containerId?: string }>) {
function toIEditor(editor: Editor): IEditor {
return {
focus: () => editor.current?.commands.focus("start"),
focus: ({ position, scrollIntoView } = {}) =>
editor.current?.commands.focus(position, {
scrollIntoView
}),
undo: () => editor.current?.commands.undo(),
redo: () => editor.current?.commands.redo(),
getMediaHashes: () => {

View File

@@ -27,7 +27,10 @@ export type NoteStatistics = {
};
export interface IEditor {
focus: () => void;
focus: (options?: {
position?: "start" | "end";
scrollIntoView?: boolean;
}) => void;
undo: () => void;
redo: () => void;
getMediaHashes: () => string[];