From 211202bc0cc8230a8891a2b2d083973b276f424d Mon Sep 17 00:00:00 2001 From: Calvin Lee Date: Wed, 20 Sep 2023 19:22:11 +0000 Subject: [PATCH] fix: [code-886]: tmp fix for scrollintoviewifneeded (#585) --- .../MarkdownEditorWithPreview/MarkdownEditorWithPreview.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/src/components/MarkdownEditorWithPreview/MarkdownEditorWithPreview.tsx b/web/src/components/MarkdownEditorWithPreview/MarkdownEditorWithPreview.tsx index 709149b06..92419e07d 100644 --- a/web/src/components/MarkdownEditorWithPreview/MarkdownEditorWithPreview.tsx +++ b/web/src/components/MarkdownEditorWithPreview/MarkdownEditorWithPreview.tsx @@ -38,7 +38,7 @@ const toolbar: ToolbarItem[] = [ ] interface MarkdownEditorWithPreviewProps { - className?: string, + className?: string value?: string onChange?: (value: string) => void onSave?: (value: string) => void @@ -311,8 +311,8 @@ function scrollToAndSetCursorToEnd( if (!dom) { return } - - dom.scrollIntoViewIfNeeded() + // TODO: polyfill scrollintviewifneeded for other browsers besides chrome for scroll + dom?.scrollIntoViewIfNeeded?.() if (moveCursorToEnd) { viewRef.current?.dispatch({ selection: { anchor: content.length, head: content.length } })