📅  最后修改于: 2022-03-11 14:55:17.944000             🧑  作者: Mango
/*
You have to pass 3 steps:
1. copy the ckeditor5-custom build to root dir
âââ ckeditor5
â âââ build
â âââ sample
â âââ src
â âââ ...
â âââ package.json
â âââ webpack.config.js
âââ node_modules
âââ public
âââ src
âââ ...
âââ package.json
2. run 'yarn add file ./ckeditor5'
3. use code below...
*/
import React, { Component } from 'react';
import Editor from 'ckeditor5-custom-build/build/ckeditor';
import { CKEditor } from '@ckeditor/ckeditor5-react'
const editorConfiguration = {
toolbar: [ 'bold', 'italic' ]
};
class App extends Component {
render() {
return (
Using CKEditor 5 from online builder in React
{
// You can store the "editor" and use when it is needed.
console.log( 'Editor is ready to use!', editor );
} }
onChange={ ( event, editor ) => {
const data = editor.getData();
console.log( { event, editor, data } );
} }
onBlur={ ( event, editor ) => {
console.log( 'Blur.', editor );
} }
onFocus={ ( event, editor ) => {
console.log( 'Focus.', editor );
} }
/>
);
}
}
export default App;