You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@ckeditor/ckeditor5-editor-multi-root

Package Overview
Dependencies
2
Maintainers
0
Versions
473
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-editor-multi-root

Multi-root editor implementation for CKEditor 5.


Version published
Weekly downloads
114K
decreased by-12.21%
Maintainers
0
Created
Weekly downloads
 

Package description

What is @ckeditor/ckeditor5-editor-multi-root?

@ckeditor/ckeditor5-editor-multi-root is a package that provides a multi-root editor implementation for CKEditor 5. This allows you to create an editor instance that can manage multiple editable areas (roots) within a single editor instance. This is particularly useful for complex applications where you need to manage multiple content areas simultaneously.

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

Creating a Multi-Root Editor

This code demonstrates how to create a multi-root editor instance with two editable areas: 'header' and 'content'. The editor is initialized with these two roots, allowing you to manage both areas within a single editor instance.

const MultiRootEditor = require('@ckeditor/ckeditor5-editor-multi-root/src/multirooteditor');
const ClassicEditor = require('@ckeditor/ckeditor5-editor-classic/src/classiceditor');

MultiRootEditor.create({
    header: document.querySelector('#header'),
    content: document.querySelector('#content')
}).then(editor => {
    console.log('Editor was initialized', editor);
}).catch(error => {
    console.error(error.stack);
});

Adding Plugins to Multi-Root Editor

This code sample shows how to add plugins to the multi-root editor. In this example, the Essentials, Paragraph, and Bold plugins are added, and the toolbar is configured to include the 'bold' button.

const MultiRootEditor = require('@ckeditor/ckeditor5-editor-multi-root/src/multirooteditor');
const Essentials = require('@ckeditor/ckeditor5-essentials/src/essentials');
const Paragraph = require('@ckeditor/ckeditor5-paragraph/src/paragraph');
const Bold = require('@ckeditor/ckeditor5-basic-styles/src/bold');

MultiRootEditor.create({
    header: document.querySelector('#header'),
    content: document.querySelector('#content')
}, {
    plugins: [ Essentials, Paragraph, Bold ],
    toolbar: [ 'bold' ]
}).then(editor => {
    console.log('Editor with plugins was initialized', editor);
}).catch(error => {
    console.error(error.stack);
});

Accessing and Modifying Editor Data

This code demonstrates how to access and modify the data in different roots of the multi-root editor. You can get the data from a specific root and set new data for a specific root.

const MultiRootEditor = require('@ckeditor/ckeditor5-editor-multi-root/src/multirooteditor');

MultiRootEditor.create({
    header: document.querySelector('#header'),
    content: document.querySelector('#content')
}).then(editor => {
    // Accessing data
    const headerData = editor.getData({ rootName: 'header' });
    const contentData = editor.getData({ rootName: 'content' });
    console.log('Header Data:', headerData);
    console.log('Content Data:', contentData);

    // Modifying data
    editor.setData('<p>New header content</p>', { rootName: 'header' });
    editor.setData('<p>New content area</p>', { rootName: 'content' });
}).catch(error => {
    console.error(error.stack);
});

Other packages similar to @ckeditor/ckeditor5-editor-multi-root

Readme

Source

CKEditor 5 multi-root editor implementation

npm version Coverage Status Build Status

The multi-root editor implementation for CKEditor 5. Read more about the multi-root editor build and see the demo.

This package contains the MultiRootEditor class. Follow there to learn more about this type of editor and how to initialize it.

This package contains the source version of the multi-root editor. Read more about CKEditor 5 predefined builds in the CKEditor 5 documentation.

Documentation

See the @ckeditor/ckeditor5-editor-multi-root package page in CKEditor 5 documentation.

Installation

npm install ckeditor5

License

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 or https://ckeditor.com/legal/ckeditor-oss-license.

Keywords

FAQs

Package last updated on 26 Jun 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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc