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

Reinitialize Issue #7

Open
Krak86 opened this issue Dec 1, 2023 · 1 comment
Open

Reinitialize Issue #7

Krak86 opened this issue Dec 1, 2023 · 1 comment

Comments

@Krak86
Copy link

Krak86 commented Dec 1, 2023

Hi, Can you please suggest how can I reinitialize incoming markdown data, actually I need to update visual data when incoming markdown data is changed. Now it's not updated.

Here is example what I mean: https://codesandbox.io/p/sandbox/test-yrcj88?file=%2Fsrc%2FApp.js%3A1%2C1

Maybe it's related to tiptap editor itself. Correct me if I am wrong. Thanks

@youking-lib
Copy link
Contributor

youking-lib commented Dec 11, 2023

Hi @Krak86 . In the latest version (0.0.9), you can use the ref to get a reference to the editor and directly call the setContent method to modify the content. Here is a code example:

function Editor() {
  const ref = useRef<ReactEditorRef>(null);

  useEffect(() => {
    ref.current.editor.setContent('# new markdown');
  }, []);

  return <ReactEditor ref={editorRef} />
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants