Socket
Socket
Sign inDemoInstall

@ckeditor/ckeditor5-utils

Package Overview
Dependencies
1
Maintainers
0
Versions
512
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-utils


Version published
Weekly downloads
621K
increased by8.67%
Maintainers
0
Created
Weekly downloads
 

Package description

What is @ckeditor/ckeditor5-utils?

@ckeditor/ckeditor5-utils is a utility library for CKEditor 5 that provides a variety of helper functions and classes to facilitate common tasks such as DOM manipulation, event handling, and data structures.

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

Event Handling

The EmitterMixin class allows you to add event handling capabilities to your classes. In this example, we create a class that extends EmitterMixin, instantiate it, and then set up an event listener for 'myEvent'. When 'myEvent' is fired, the listener logs a message to the console.

const { EmitterMixin } = require('@ckeditor/ckeditor5-utils');

class MyClass extends EmitterMixin() {}

const myInstance = new MyClass();

myInstance.on('myEvent', () => {
  console.log('myEvent was fired!');
});

myInstance.fire('myEvent');

DOM Manipulation

The createElement function simplifies the process of creating and configuring DOM elements. In this example, we create a <div> element with a class and id, and then append it to the document body.

const { createElement } = require('@ckeditor/ckeditor5-utils');

const div = createElement(document, 'div', {
  class: 'my-class',
  id: 'my-id'
});

document.body.appendChild(div);

Data Structures

The Collection class provides a way to manage a collection of items. In this example, we create a new collection, add items to it, and then retrieve an item by its id.

const { Collection } = require('@ckeditor/ckeditor5-utils');

const collection = new Collection();

collection.add({ id: 1, name: 'Item 1' });
collection.add({ id: 2, name: 'Item 2' });

console.log(collection.get(1)); // { id: 1, name: 'Item 1' }

Other packages similar to @ckeditor/ckeditor5-utils

Readme

Source

CKEditor 5 utilities

npm version Coverage Status Build Status

Various utilities used by CKEditor 5 and its features. This is a sort of CKEditor 5's standard library.

Documentation

See the @ckeditor/ckeditor5-utils 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

Last updated on 27 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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc