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: 2 comments 5 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
Comment options

You must be logged in to vote
2 replies
@Dari4sho
Comment options

@PROMCz11
Comment options

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