Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@ckeditor/ckeditor5-react
Advanced tools
Official React component for CKEditor 5 – the best browser-based rich text editor.
@ckeditor/ckeditor5-react is a React component that integrates CKEditor 5, a modern JavaScript rich text editor, into React applications. It provides a rich set of features for creating and editing content, including text formatting, image and media embedding, and collaborative editing.
Basic Usage
This code demonstrates the basic usage of the @ckeditor/ckeditor5-react package. It imports the CKEditor component and the ClassicEditor build, then renders the editor with some initial data and event handlers for ready, change, blur, and focus events.
import React from 'react';
import { CKEditor } from '@ckeditor/ckeditor5-react';
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
function App() {
return (
<div className="App">
<h2>Using CKEditor 5 with React</h2>
<CKEditor
editor={ ClassicEditor }
data="<p>Hello from CKEditor 5!</p>"
onReady={ editor => {
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 );
} }
/>
</div>
);
}
export default App;
Custom Configuration
This code demonstrates how to use a custom configuration with the CKEditor component. The editorConfiguration object specifies a custom toolbar and heading options, which are then passed to the CKEditor component via the config prop.
import React from 'react';
import { CKEditor } from '@ckeditor/ckeditor5-react';
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
function App() {
const editorConfiguration = {
toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote' ],
heading: {
options: [
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
{ model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
{ model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' }
]
}
};
return (
<div className="App">
<h2>Using CKEditor 5 with Custom Configuration</h2>
<CKEditor
editor={ ClassicEditor }
config={ editorConfiguration }
data="<p>Custom configuration example.</p>"
/>
</div>
);
}
export default App;
Using Plugins
This code demonstrates how to use plugins with the CKEditor component. The Alignment plugin is imported and added to the ClassicEditor build. The editorConfiguration object includes the alignment options, which are then passed to the CKEditor component via the config prop.
import React from 'react';
import { CKEditor } from '@ckeditor/ckeditor5-react';
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment';
ClassicEditor.builtinPlugins.push( Alignment );
function App() {
const editorConfiguration = {
toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'alignment', 'bulletedList', 'numberedList', 'blockQuote' ],
alignment: {
options: [ 'left', 'center', 'right', 'justify' ]
}
};
return (
<div className="App">
<h2>Using CKEditor 5 with Plugins</h2>
<CKEditor
editor={ ClassicEditor }
config={ editorConfiguration }
data="<p>Plugin example with text alignment.</p>"
/>
</div>
);
}
export default App;
React-Quill is a React component for Quill, a powerful rich text editor. It offers a similar set of features to CKEditor, including text formatting, image embedding, and custom themes. However, Quill's API and customization options differ from CKEditor, and it may have a different set of plugins and extensions.
Draft.js is a JavaScript rich text editor framework developed by Facebook. It provides a set of tools for building rich text editors with React. Unlike CKEditor, Draft.js is more of a low-level framework, offering more control and customization options but requiring more effort to implement common features.
Slate is a completely customizable framework for building rich text editors. It provides a set of tools and plugins for creating complex editors with React. Slate offers more flexibility and control compared to CKEditor, but it also requires more effort to set up and configure.
Official CKEditor 5 rich text editor component for React.
See the "Rich text editor component for React" guide in the CKEditor 5 documentation to learn more:
After cloning this repository, install necessary dependencies:
npm install
You can also use Yarn.
To manually test the editor integration with different versions of React, you can start the development server using one of the commands below:
npm run dev:16 # Open the demo projects using React 16.
npm run dev:18 # Open the demo projects using React 18.
npm run dev:19 # Open the demo projects using React 19.
To test the editor integration against a set of automated tests, run the following command:
npm run test
If you want to run the tests in watch mode, use the following command:
npm run test:watch
To build the package that is ready to publish, use the following command:
npm run build
CircleCI automates the release process and can release both channels: stable (X.Y.Z
) and pre-releases (X.Y.Z-alpha.X
, etc.).
Before you start, you need to prepare the changelog entries.
#master
branch is up-to-date: git fetch && git checkout master && git pull
.git checkout -b release-[YYYYMMDD]
where YYYYMMDD
is the current day.yarn run changelog --branch release-[YYYYMMDD] [--from [GIT_TAG]]
.
By default, the changelog generator uses the latest published tag as a starting point for collecting commits to process.
The --from
modifier option allows overriding the default behavior. It is required when preparing the changelog entries for the next stable release while the previous one was marked as a prerelease, e.g., @alpha
.
Example: Let's assume that the v40.5.0-alpha.0
tag is our latest and that we want to release it on a stable channel. The --from
modifier should be equal to --from v40.4.0
.
This task checks what changed in each package and bumps the version accordingly. It won't create a new changelog entry if nothing changes at all. If changes were irrelevant (e.g., only dependencies), it would make an "internal changes" entry.
Scan the logs printed by the tool to search for errors (incorrect changelog entries). Incorrect entries (e.g., ones without the type) should be addressed. You may need to create entries for them manually. This is done directly in CHANGELOG.md (in the root directory). Make sure to verify the proposed version after you modify the changelog.
#master
branch.@ckeditor/ckeditor-5-devops
team to review the pull request and trigger the release process.Licensed under the terms of GNU General Public License Version 2 or later. For full details about the license, please check the LICENSE.md file.
9.4.0 (2024-11-25)
onChangeInitializedEditors
on startup of CKEditorContext
if there are ready editors. (commit)FAQs
Official React component for CKEditor 5 – the best browser-based rich text editor.
The npm package @ckeditor/ckeditor5-react receives a total of 256,069 weekly downloads. As such, @ckeditor/ckeditor5-react popularity was classified as popular.
We found that @ckeditor/ckeditor5-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.