index.js 603 B

1234567891011121314151617181920212223
  1. import React, { Component } from 'react';
  2. import './index.less';
  3. export default class Editor extends Component {
  4. componentWillMount() {
  5. const { onChange } = this.props;
  6. setTimeout(() => {
  7. const editor = CKEDITOR.replace('editor', {
  8. skin: 'moono',
  9. toolbarGroups: [{ name: 'clipboard', groups: ['undo', 'clipboard'] }],
  10. removePlugins: 'pastetext,pastefromword',
  11. language: 'en',
  12. });
  13. editor.on('change', () => {
  14. if (onChange) onChange(editor.getData());
  15. });
  16. }, 1);
  17. }
  18. render() {
  19. return <textarea name="editor" />;
  20. }
  21. }