-1

i also install ckeditor npm install ckeditor4-react this package is standard version. i want to use ckeditor full package in reactjs. i also download full package of ckeditorckeditor_4.14.1_full.zip . but i don't know how can i install this package in reactjs...? can anybody please tell me how can i install this full package in reactjs?

createForm.js

import React, { Component } from 'react';
import CKEditor from 'ckeditor4-react';

class App extends Component {
    render() {
        return (
            <div className="App">
                <h2>Using CKEditor 4 in React</h2>
                <CKEditor
                    data="<p>Hello from CKEditor 4!</p>"
                />
            </div>
        );
    }
}

export default App;
2
  • This question has already been answered: stackoverflow.com/a/57045679/6421664 Commented Aug 22, 2020 at 21:47
  • yeah its already define but config={{ editorUrl: '../assets/ckeditor/ckeditor.js' }} editor url is not working Commented Aug 23, 2020 at 19:32

1 Answer 1

0

i have used ckeditor-5 dont worry 4 also work

import React, { Component } from 'react';
import CKEditor from "@ckeditor/ckeditor5-react";
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';          
import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import Clipboard from "@ckeditor/ckeditor5-clipboard/src/clipboard";
import LinkPlugin from '@ckeditor/ckeditor5-link/src/link';
import ListPlugin from '@ckeditor/ckeditor5-list/src/list';
import Table from '@ckeditor/ckeditor5-table/src/table';
import PasteFromOffice from '@ckeditor/ckeditor5-paste-from-office/src/pastefromoffice';
import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment';
import Indent from '@ckeditor/ckeditor5-indent/src/indent';
import Highlight from '@ckeditor/ckeditor5-highlight/src/highlight';
const editorConfig = {
  fontFamily: {
    options: [
      "default",
      "Ubuntu, Arial, sans-serif",
      "Ubuntu Mono, Courier New, Courier, monospace"
    ]
  },
  toolbar:{ 
  items: [
    "heading",
    "|",
    "bold",
    "italic",
    "underline",    
    "|",
    'alignment',
    "|",
    "link",
    "|",
    'outdent',
    'indent',
    "|",
    "undo",
    "redo",
    "|",    
    "bulletedList",
    "numberedList",
    "|",
    "highlight:yellowMarker",
    'removeHighlight'
    // "blockQuote",        
    // "undo",
    // "redo"
  ]},
  plugins: [ 
    Essentials, 
    Bold, 
    Italic, 
    Paragraph, 
    Underline, 
    Alignment, 
    Clipboard, 
    LinkPlugin, 
    ListPlugin,     
    Table, 
    PasteFromOffice,
    Highlight,
    Indent,
    // InlineHighlighters
  ],
  highlight: {
    options: [
      {
        model: 'yellowMarker',
        class: 'marker-yellow',
        title: 'Yellow marker',
        color: 'yellow',
        type: 'marker',
        styles: {
          'background-color': 'yellow'
        }
      },
      {
        model: 'redPen',
        class: 'pen-red',
        title: 'Red pen',
        color: 'red',
        type: 'pen',
        styles: {
          color: 'red'
        }
      }
  ]
},  
};
    class App extends Component {
     state={
    editorContent:""
    }
    
       getCKEditor(event, editor){
        this.setState this.setState({
          editorContent: this.editor.getData(),
        });

}
    render() {
        return (
            <div className="App">
                  <CKEditor
                      editor={ClassicEditor}
                      data={this.state.editorContent}
                      config={editorConfig}
                      onChange={(event, editor) => this.getCKEditor(event, editor)}
                    />
            </div>
        );
    }
}

export default App;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.