Commit 3666f738 by hannes

Merge branch 'fix/queetbox-behavior' into 'master'

Fix queetbox behavior (especially in Firefox)

See merge request !101
parents a9e3c718 444cce2c
......@@ -2848,10 +2848,13 @@ $('body').on('click', '.queet-toolbar button',function () {
var queetBoxID = queetBox.attr('id');
// jquery's .text() function is not consistent in converting <br>:s to \n:s,
// so we do this detour to make sure line breaks are preserved
queetBox.html(queetBox.html().replace(/<br>/g, '{{{lb}}}'));
// so we do this detour to make sure line breaks are preserved.
// In firefox (and maybe some other browsers), queetBox.html() may have <div>s
// and may or may not have <br> in them.
// To deal with this, remove any <br>s right before </div> and then add ones.
queetBox.html(queetBox.html().replace(/(<br>)*<\/div>/g, '<br></div>').replace(/({|})/g, '!$1').replace(/<br>/g, '{{{lb}}}'));
var queetText = $.trim(queetBox.text().replace(/^\s+|\s+$/g, '').replace(/\n/g, ''));
queetText = queetText.replace(/{{{lb}}}/g, "\n");
queetText = queetText.replace(/{{{lb}}}/g, "\n").replace(/!({|})/g, '$1');
var queetTempText = replaceHtmlSpecialChars(queetText.replace(/\n/g,'<br>')); // no xss
queetTempText = queetTempText.replace(/&lt;br&gt;/g,'<br>'); // but preserve line breaks
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment