[ticket/10620] Add more whitespace to long quotes in JS

PHPBB3-10620
This commit is contained in:
JoshyPHP 2015-06-24 22:41:58 +02:00
parent 4c9507e20a
commit 5a55ce3f68

View file

@ -241,6 +241,7 @@ function addquote(post_id, username, l_wrote, attributes) {
* @return {!string} Quote block to be used in a new post/text * @return {!string} Quote block to be used in a new post/text
*/ */
function generateQuote(text, attributes) { function generateQuote(text, attributes) {
text = text.replace(/^\s+/, '').replace(/\s+$/, '');
var quote = '[quote'; var quote = '[quote';
if (attributes.author) { if (attributes.author) {
// Add the author as the BBCode's default attribute // Add the author as the BBCode's default attribute
@ -253,7 +254,9 @@ function generateQuote(text, attributes) {
quote += ' ' + name + '=' + formatAttributeValue(value.toString()); quote += ' ' + name + '=' + formatAttributeValue(value.toString());
} }
} }
quote += ']' + text + '[/quote]'; quote += ']';
var newline = ((quote + text + '[/quote]').length > 80 || text.indexOf('\n') > -1) ? '\n' : '';
quote += newline + text + newline + '[/quote]';
return quote; return quote;
} }