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

@ckeditor/ckeditor5-word-count

Package Overview
Dependencies
Maintainers
1
Versions
744
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-word-count

Word and character count feature for CKEditor 5.

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

Version published
Weekly downloads
279K
increased by14.29%
Maintainers
1
Weekly downloads
 
Created

What is @ckeditor/ckeditor5-word-count?

@ckeditor/ckeditor5-word-count is a plugin for CKEditor 5 that provides word and character count functionality. It is useful for applications where tracking the length of the text is important, such as content management systems, blogging platforms, and educational tools.

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

Basic Word Count

This code demonstrates how to integrate the WordCount plugin into a CKEditor 5 instance and access the current word count.

const WordCount = require('@ckeditor/ckeditor5-word-count/src/wordcount');

ClassicEditor
    .create(document.querySelector('#editor'), {
        plugins: [ WordCount, ... ],
        toolbar: [ 'wordCount', ... ]
    })
    .then(editor => {
        const wordCountPlugin = editor.plugins.get('WordCount');
        console.log(wordCountPlugin.words); // Outputs the current word count
    })
    .catch(error => {
        console.error(error);
    });

Character Count

This code demonstrates how to integrate the WordCount plugin into a CKEditor 5 instance and access the current character count.

const WordCount = require('@ckeditor/ckeditor5-word-count/src/wordcount');

ClassicEditor
    .create(document.querySelector('#editor'), {
        plugins: [ WordCount, ... ],
        toolbar: [ 'wordCount', ... ]
    })
    .then(editor => {
        const wordCountPlugin = editor.plugins.get('WordCount');
        console.log(wordCountPlugin.characters); // Outputs the current character count
    })
    .catch(error => {
        console.error(error);
    });

Customizing Word Count Display

This code demonstrates how to customize the display of the word count by specifying a container element where the word count will be displayed.

const WordCount = require('@ckeditor/ckeditor5-word-count/src/wordcount');

ClassicEditor
    .create(document.querySelector('#editor'), {
        plugins: [ WordCount, ... ],
        toolbar: [ 'wordCount', ... ],
        wordCount: {
            container: document.querySelector('#word-count-container')
        }
    })
    .then(editor => {
        const wordCountPlugin = editor.plugins.get('WordCount');
        console.log(wordCountPlugin.words); // Outputs the current word count
    })
    .catch(error => {
        console.error(error);
    });

Other packages similar to @ckeditor/ckeditor5-word-count

Keywords

FAQs

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