Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

126
Vistas
Replace with self closing html tags in ckeditor5

When I copy pasted the below lines from notepad to ckeditor5 in Angular 10. I am getting the output with
tag for the second line.

 Ex:
    This is the first line.
    This is the second line.

Output:
<p>This is the first line.<br>This is the second line.</p>

I tried clipboardInput, conversion and transformation etc but all are failed. Approach 1:

  editingView.document.on('clipboardInput', (evt, data) => {
      const dataTransfer = data.dataTransfer;
      console.log('data..', dataTransfer.getData('text/plain'));
      let content = plainTextToHtml(dataTransfer.getData('text/plain'));
      content = content.replace('\n', '<br />');
      content = content.replace('<br>', '<br />');
       data.content = editor.data.htmlProcessor.toView(content);
    });

Approach 2:

editingView.document.on('clipboardInput', (evt, data) => {
       editor.conversion
        .for('downcast')
        .elementToElement({ model: '<br>', view: '<br />' }); 
    });

is there any way we can configure
as
when copy-paste for new line. Are any plugins available?

There is one hack. Once I get the output I will replace
with
in the data but I want to achieve in plugins level.

about 4 years ago · Juan Pablo Isaza
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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda