Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

117
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!