Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ckeditor/ckeditor5-editor-decoupled

Package Overview
Dependencies
Maintainers
1
Versions
712
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-editor-decoupled

Decoupled editor implementation for CKEditor 5.

  • 43.2.0-alpha.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
235K
decreased by-2.26%
Maintainers
1
Weekly downloads
 
Created

What is @ckeditor/ckeditor5-editor-decoupled?

@ckeditor/ckeditor5-editor-decoupled is a decoupled editor build for CKEditor 5. It allows you to create a rich text editor with a customizable toolbar that can be placed anywhere in your application. This package is particularly useful for applications that require a flexible and highly customizable text editing experience.

What are @ckeditor/ckeditor5-editor-decoupled's main functionalities?

Basic Initialization

This code demonstrates how to initialize a decoupled editor and attach its toolbar to a separate container. This allows for greater flexibility in placing the toolbar anywhere in your application.

const DecoupledEditor = require('@ckeditor/ckeditor5-editor-decoupled/src/decouplededitor');
const ClassicEditor = require('@ckeditor/ckeditor5-build-classic');

DecoupledEditor.create(document.querySelector('#editor'))
    .then(editor => {
        const toolbarContainer = document.querySelector('#toolbar-container');

        toolbarContainer.appendChild(editor.ui.view.toolbar.element);
    })
    .catch(error => {
        console.error(error);
    });

Customizing the Toolbar

This code sample shows how to customize the toolbar by specifying which tools should be included. In this example, only 'bold', 'italic', and 'link' buttons are added to the toolbar.

DecoupledEditor.create(document.querySelector('#editor'), {
    toolbar: [ 'bold', 'italic', 'link' ]
})
.then(editor => {
    const toolbarContainer = document.querySelector('#toolbar-container');

    toolbarContainer.appendChild(editor.ui.view.toolbar.element);
})
.catch(error => {
    console.error(error);
});

Handling Editor Data

This code demonstrates how to get and set data in the decoupled editor. This is useful for dynamically updating the content of the editor or retrieving the content for further processing.

DecoupledEditor.create(document.querySelector('#editor'))
    .then(editor => {
        const toolbarContainer = document.querySelector('#toolbar-container');

        toolbarContainer.appendChild(editor.ui.view.toolbar.element);

        // Get editor data
        const data = editor.getData();
        console.log(data);

        // Set editor data
        editor.setData('<p>Hello, world!</p>');
    })
    .catch(error => {
        console.error(error);
    });

Other packages similar to @ckeditor/ckeditor5-editor-decoupled

Keywords

FAQs

Package last updated on 27 Sep 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc