0

The way I'm using ckeditor is like this:

<CKEditor
    config={{
      removeButtons: ['Cut','Copy','Paste','PasteText','PasteFromWord','Print', 
                      'SpellChecker', 'Scayt','Undo','Redo','-','Find','Replace',
                      '- ','SelectAll','RemoveFormat','Link','Unlink','Anchor',
                      'Strike','Image','Flash','Table','HorizontalRule','Smiley',
                      'SpecialChar','PageBreak','Maximize','ShowBlocks','','About',
                      'Source','Subscript','Superscript','NumberedList','BulletedList', 
                      'Outdent','Indent','Blockquote','Styles','Format', 'BGColor'],
      removePlugins: ['image', 'elementspath'],
      extraPlugins: ['font', 'colorbutton','justify'],
    }}
    initData={pageState.printHeaderText}
    onChange={changeHeaderText}
 />

And in onChange handler:

const changeHeaderText = (value) => {
   console.log("editor = ", value)
}

But nowhere in value that I see the text area content.

Thamjith Thaha
  • 45
  • 2
  • 13

1 Answers1

0

Found the solution.

const changeHeaderText = (value) => {
    console.log(value.editor.getData())
    setPageState((prev)=>{
        return {
            ...prev,
            printHeaderText: value.editor.getData()
        }
    })
}
Thamjith Thaha
  • 45
  • 2
  • 13