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

getData() onClick rather than onChange #489

Open
maggie-chintaro opened this issue Jul 2, 2024 · 1 comment
Open

getData() onClick rather than onChange #489

maggie-chintaro opened this issue Jul 2, 2024 · 1 comment

Comments

@maggie-chintaro
Copy link

I am using the decoupled editor to import and edit complex word documents. The performance drops significantly when I extract the data using

onChange={ ( e, editor ) => {
const data = editor.getData();
console.log( { data } );
}}

Is there a way to extract data onClick only? TIA

@Mati365
Copy link
Member

Mati365 commented Jul 5, 2024

@maggie-chintaro It'd suggest debouncing onChange callback passed to your Component using custom React hook. Something like that:

const onDebouncedChange = useDebounce(( e, editor ) => {
  const data = editor.getData();
  console.log( { data } );
});

...

<CKEditor onChange={onDebouncedChange} ... />

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