Removing br tags in Semantic Mode
See original GitHub issueThe 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:
- Created 10 years ago
- Comments:5 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
remove the p tag. dont wrap the tag in anything.
Nop, the semantic function wrap text node into p and remove br tags. And, at the init, all are removed.