Browse Source

Remove under one empty line at the beginning and end of the content

Similar to the behavior of the Parserus parser.
Visman 2 years ago
parent
commit
2e4941b857
1 changed files with 3 additions and 0 deletions
  1. 3 0
      public/js/sc/formats/bbcode.js

+ 3 - 0
public/js/sc/formats/bbcode.js

@@ -1783,6 +1783,9 @@
 							content += '<br />';
 						}
 
+						 // Visman - удалить под одной пустой строке в начале и конце содержимого
+						content = content.replace(/^\x20*<br \/>/, '').replace(/<br \/>\x20*$/, '');
+
 						if (!isFunction(bbcode.html)) {
 							token.attrs['0'] = content;
 							html = formatBBCodeString(