• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

237
Vistas
How to set a character limit for the raw data output in ckeditor 5

I have a max length that I need editor.getData().length to be before I send it to my server. I have the word Count plugin working I just need to add some code to achieve this in the on update method. I want the editor to behave as an html input tag would behave with the "maxlength" attribute set, so it would disable any further typing when the dataCount reaches the specified limit(5000).

ClassicEditor
    .create( document.querySelector( '#editor' ),{
        
    })
    .then( editor => {      
        editor.plugins.get( 'WordCount' ).on( 'update', ( evt, stats ) => {
            const limit = 5000;
            const dataCount = editor.getData().length;
            //disable typing when dataCount >= limit
            //what code do I put here?   
        } );                                
    } )             
    .catch( error => {
        console.error( 'Oops, something went wrong!' );             
        console.error( error );
    } );
about 3 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda