We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用react-codemirror作日志展示,如果固定显示最后一行。 我现在是这么做的
const { height, clientHeight } = textareaRef?.current?.editor?.getScrollInfo() || {} ... textareaRef?.current?.editor?.scrollTo(0, height)
这有个问题,value重新设置的时候,会跳回到顶部,然后再scrollTo到底部,导致出现闪动,怎么解决这个问题。。。
The text was updated successfully, but these errors were encountered:
@WLyKan 啊,忘记了这个 issue。 https://codesandbox.io/s/react-codemirror-example-codemirror-6-114-9kwk8?file=/src/App.js:0-2184
import React, { useEffect, useRef } from "react"; import CodeMirror, { EditorView } from "@uiw/react-codemirror"; import { javascript } from "@codemirror/lang-javascript"; export default function App() { const cmRef = useRef(); useEffect(() => { setTimeout(() => { cmRef.current.view.dispatch({ effects: EditorView.scrollIntoView( cmRef.current.view.state.doc.line(20).from, { y: "start", yMargin: 0 } ) }); // Vim.handleKey((view as any).cm, "<Esc>"); }, 3000); }, []); return ( <CodeMirror ref={cmRef} value={new Array(4000).fill("Initial contents ".repeat(4)).join("\n")} height="200px" extensions={[javascript({ jsx: true })]} onChange={(value, viewUpdate) => { console.log("value:", value); }} /> ); }
Sorry, something went wrong.
No branches or pull requests
使用react-codemirror作日志展示,如果固定显示最后一行。
我现在是这么做的
这有个问题,value重新设置的时候,会跳回到顶部,然后再scrollTo到底部,导致出现闪动,怎么解决这个问题。。。
The text was updated successfully, but these errors were encountered: