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

@ckeditor/ckeditor5-utils

Package Overview
Dependencies
Maintainers
1
Versions
781
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-utils

Miscellaneous utilities used by CKEditor 5.

  • 0.0.0-nightly-20241219.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
901K
decreased by-16.18%
Maintainers
1
Weekly downloads
 
Created

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

Keywords

FAQs

Package last updated on 19 Dec 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