fix: [code-886]: tmp fix for scrollintoviewifneeded (#585)

This commit is contained in:
Calvin Lee 2023-09-20 19:22:11 +00:00 committed by Harness
parent 0fda028070
commit 211202bc0c

View File

@ -38,7 +38,7 @@ const toolbar: ToolbarItem[] = [
] ]
interface MarkdownEditorWithPreviewProps { interface MarkdownEditorWithPreviewProps {
className?: string, className?: string
value?: string value?: string
onChange?: (value: string) => void onChange?: (value: string) => void
onSave?: (value: string) => void onSave?: (value: string) => void
@ -311,8 +311,8 @@ function scrollToAndSetCursorToEnd(
if (!dom) { if (!dom) {
return return
} }
// TODO: polyfill scrollintviewifneeded for other browsers besides chrome for scroll
dom.scrollIntoViewIfNeeded() dom?.scrollIntoViewIfNeeded?.()
if (moveCursorToEnd) { if (moveCursorToEnd) {
viewRef.current?.dispatch({ selection: { anchor: content.length, head: content.length } }) viewRef.current?.dispatch({ selection: { anchor: content.length, head: content.length } })