refactor: component props [no ci]

This commit is contained in:
Aman Harwara
2023-07-30 12:43:43 +05:30
parent 50452ff6ca
commit f24e0b0e50
2 changed files with 4 additions and 4 deletions

View File

@@ -3,13 +3,13 @@ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext
import { Platform } from '@standardnotes/snjs'
import { useEffect, useState } from 'react'
export default function AutoFocusPlugin({ isTemplateNote }: { isTemplateNote: boolean }) {
export default function AutoFocusPlugin({ isEnabled }: { isEnabled: boolean }) {
const application = useApplication()
const [editor] = useLexicalComposerContext()
const [didInitialFocus, setDidInitialFocus] = useState(false)
useEffect(() => {
if (!isTemplateNote) {
if (!isEnabled) {
return
}
if (application.platform !== Platform.Ios) {
@@ -27,7 +27,7 @@ export default function AutoFocusPlugin({ isTemplateNote }: { isTemplateNote: bo
rootElement.focus()
setDidInitialFocus(true)
})
}, [application.platform, didInitialFocus, editor, isTemplateNote])
}, [application.platform, didInitialFocus, editor, isEnabled])
return null
}

View File

@@ -242,7 +242,7 @@ export const SuperEditor: FunctionComponent<Props> = ({
<NodeObserverPlugin nodeType={FileNode} onRemove={handleBubbleRemove} />
<ExportPlugin />
<ReadonlyPlugin note={note.current} />
<AutoFocusPlugin isTemplateNote={controller.isTemplateNote} />
<AutoFocusPlugin isEnabled={controller.isTemplateNote} />
<SuperSearchContextProvider>
<SearchPlugin />
</SuperSearchContextProvider>