Socket
Socket
Sign inDemoInstall

@ckeditor/ckeditor5-utils

Package Overview
Dependencies
0
Maintainers
1
Versions
518
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-utils


Version published
Maintainers
1
Created

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 Utils

npm version Build Status Test Coverage Dependency Status devDependency Status

The utils for CKEditor 5 project. More information about the project can be found at the following url: https://github.com/ckeditor/ckeditor5.

License

Licensed under the GPL, LGPL and MPL licenses, at your choice. For full details about the license, please check the LICENSE.md file.

Keywords

FAQs

Last updated on 06 Mar 2017

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