Skip to content

Commit

Permalink
feat: let user choose where to manually focus
Browse files Browse the repository at this point in the history
  • Loading branch information
GentikSolm committed Aug 31, 2023
1 parent 66ac10d commit a231f0a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/MDXEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export interface MDXEditorMethods {
/**
* Sets focus on input
*/
focus: () => void
focus: (defaultSelection?: 'rootStart' | 'rootEnd') => void
}

const RenderRecurisveWrappers: React.FC<{ wrappers: React.ComponentType<{ children: React.ReactNode }>[]; children: React.ReactNode }> = ({
Expand Down Expand Up @@ -191,8 +191,8 @@ const Methods: React.FC<{ mdxRef: React.ForwardedRef<MDXEditorMethods> }> = ({ m
setMarkdown: (markdown) => {
realm.pubKey('setMarkdown', markdown)
},
focus: () => {
realm.getKeyValue('rootEditor')?.focus()
focus: (defaultSelection?: 'rootStart' | 'rootEnd') => {
realm.getKeyValue('rootEditor')?.focus(undefined, { defaultSelection })
}
}
},
Expand Down

0 comments on commit a231f0a

Please sign in to comment.