react-froala-wysiwyg icon indicating copy to clipboard operation
react-froala-wysiwyg copied to clipboard

Froala get code content without switching back to code view

Open kavya-granicus opened this issue 3 years ago • 2 comments

Is there a way to get the content on change inside code editor rather than switching back to code view. Please help

I want to get the content inside the code editor while adding the html code. image

kavya-granicus avatar Nov 15 '22 12:11 kavya-granicus

You can read the content from onModelChange prop on the FroalaEditorComponent, by calling a function. I'll leave you an example below.

Example:

const readData = (content) => {
    console.log(content)
}

return (
    <FroalaEditorComponent onModelChange={readData}/>
)

leny32 avatar Dec 21 '22 14:12 leny32

@leny32 this seems to allow us to sync what is in the editor with our component state. How do we do the reverse, set an initial state for the code/markdown plug in?

commandcenterio avatar Jan 14 '23 15:01 commandcenterio