ckeditor5-react icon indicating copy to clipboard operation
ckeditor5-react copied to clipboard

getData() onClick rather than onChange

Open maggie-chintaro opened this issue 1 year ago • 1 comments

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

maggie-chintaro avatar Jul 02 '24 02:07 maggie-chintaro

@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} ... />

Mati365 avatar Jul 05 '24 05:07 Mati365