cYbercOsmOnauT / wysiwygsceditorphpbb

8 stars 11 forks source link

Lines disappear at press Code button (WYSIWYG to BBCode) #40

Open quimlc opened 6 years ago

quimlc commented 6 years ago

Hi! I think there is some problem with the programation because when I paste some text copied from a website in the WYSIWYG editor the text appears correctly, but when I press the Code button (CTRL+SHIFT+S) the lines dissappear and is needed add an extra line in every paragraph to solve it. Also if I publish the text without press the Code button anyway appears incorrectly. This is a pic about the problem (also attached):

http://i66.tinypic.com/10zctx2.jpg

In the top is when I paste the text in the WYSIWYG editor, in the middle when I press the Code button, and in the bottom when I press again the button to be back to the WYSIWYG editor.

I have been checking modifying the lines 1826 --> 1844 in the jquery.sceditor.bbcode.min.js file, chaging the "br" and "div" for some "p" or other "br" I got for example that when I press the button 2 times it appears with a line separation, but neither is correct because when there is 2 consecutive lines without separation also appears a line separation, so I not got put it correctly. I think here is the problem:

            for (q = function(a) {
                    return (!a || (a.isHtmlInline !== g ? a.isHtmlInline : a.isInline)) !== !1
                }; b.length > 0;)
                if (j = b.shift()) {
                    if (j.type === n.OPEN) r = j.children[j.children.length - 1] || {}, k = A.bbcodes[j.name], o = d && q(k), l = u(j.children, !1), k && k.html ? (q(k) || !q(A.bbcodes[r.name]) || k.isPreFormatted || k.skipLastLineBreak || i || (l += "<br />"), a.isFunction(k.html) ? m = k.html.call(A, j, j.attrs, l) : (j.attrs[0] = l, m = e.bbcode.formatBBCodeString(k.html, j.attrs))) : m = j.val + l + (j.closing ? j.closing.val : "");
                    else {
                        if (j.type === n.NEWLINE) {
                            if (!d) {
                                s.push("<br />");
                                continue
                            }
                            p || (s.push("<div>"), (h < 8 || c.documentMode && c.documentMode < 8) && s.push(" ")), i || s.push("<br />"), b.length || s.push("<br />"), s.push("</div>\n"), p = !1;
                            continue
                        }
                        o = d, m = f(j.val, !0)
                    }
                    o && !p ? (s.push("<div>"), p = !0) : !o && p && (s.push("</div>\n"), p = !1), s.push(m)
                }
            return p && s.push("</div>\n"), s.join("")

I'm using PHPBB v3.2.2 forum.

Anyway thanks for the mod. I will be waiting the answer =)

code