Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

118
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda