question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Removing br tags in Semantic Mode

See original GitHub issue

The semantic mode is pretty sweet, but it was removing all the br tags, I added a function to replace the br tags with p tags.

sementicCode: function(force){
    this.syncCode(force);

    if(this.o.semantic){
        this.sementicTag('b', 'strong');
        this.sementicTag('i', 'em');
        this.sementicTag('strike', 'del');

        this.paragraphTag(); // Added this function
        this.removeTag('br');

        this.$e.val(this.$editor.html());
    }
},
paragraphTag: function() {
    this.$editor.contents().filter(function() {
        return this.nodeType == 3;  // Only text nodes
    }).wrap('<p></p>');
},

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
AdamHesscommented, Jun 7, 2016

remove the p tag. dont wrap the tag in anything.

0reactions
Alex-Dcommented, Feb 6, 2014

Nop, the semantic function wrap text node into p and remove br tags. And, at the init, all   are removed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable <br> tags inside <div> by css? - Stack Overflow
It is not possible to remove just <p> tags without removing content inside. It is not possible to hide <br> directly by divs...
Read more >
Silently destroying <br> tags is a 'gotcha' and is destructive ...
Describe the issue/behavior that seems buggy Using highlight.js with default options and otherwise following recommended usage/happy path ...
Read more >
Why Drupal adds tags to markup entered in "Full HTML" view?
I have created a custom block which contains the following markup: <dl id="links"> <dt class="first">Users</dt> <dd class="first"> <a ...
Read more >
#205 (IE: <br> removed from the end of paragraphs) – CKEditor
The bug was caused by duplicated bogus BR removal logic in fckxhtml.js which removes both the invisible BR tag at the end of...
Read more >
how to stop removing br tags - Kentico DevNet
I'm doing it in the code, but it only seems to remove certain ones. If have a couple divs that is floating right...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found