Skip to content

How to save the editor's content with delay? #2871

Discussion options

You must be logged in to vote

This works for me:

import { useDebounce } from 'use-debounce';

const Editor = () => {
  // create editor instance and other stuff
  const [debouncedEditor] = useDebounce(editor?.state.doc.content, 2000);

  useEffect(() => {
    if (debouncedEditor) {
      // save
    }
  }, [debouncedEditor]);
}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Iischeese
Comment options

@nperez0111
Comment options

@Iischeese
Comment options

Answer selected by amirhhashemi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants