Skip to content
New issue

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

Fix cursor not following to new node when using a react node view #3331

Commits on Oct 20, 2022

  1. Configuration menu
    Copy the full SHA
    0d56804 View commit details
    Browse the repository at this point in the history
  2. Refactor: avoid using a mutable ES6 Map in React component state

    The React docs recommend treating the `state` as immutable. See e.g.:
    https://reactjs.org/docs/react-component.html#state
    ruipserra committed Oct 20, 2022
    Configuration menu
    Copy the full SHA
    893c48d View commit details
    Browse the repository at this point in the history
  3. Fix: flush EditorContent state changes immediately once initialized

    This fixes the cursor problem described in tiptap#3200
    
    Node views need to be rendered immediately when they're created so that
    the editor can correctly position the cursor. That's achieved using
    `flushSync` whenever a new node view renderer is added.
    
    However, `flushSync` cannot be used from inside a React component
    lifecycle method.
    
    By keeping an instance variable to determine if initialization has
    happened, we can avoid using `flushSync` from inside the `componentDidMount`
    and `componentDidUpdate` methods, and still call it whenever a new node view
    is created afterwards.
    ruipserra committed Oct 20, 2022
    Configuration menu
    Copy the full SHA
    c602f72 View commit details
    Browse the repository at this point in the history