Reply to thread

[USER=11388]@Chris D[/USER]


The issue ends up being this code;

[CODE="javascript"]var $markers = ed.$el.find('.fr-marker');

$markers.first().before(XF.htmlspecialchars(before));

$markers.last().after(XF.htmlspecialchars(after));[/CODE]

This skips using ed.html.insert which skips a number of auto-formatting bits which are useful for block-bbcode.


This patch appears to fix the above issue.

[CODE="javascript"]XF.EditorHelpers.wrapSelectionText = function (ed, before, after, save, inline) {


        if (save) {

            ed.selection.save();

        }

        ed.undo.saveStep();

        var html, selectedHtml = ed.html.getSelected();


        var $markers = ed.$el.find('.fr-marker');

        var $wrapper = $('<div></div>');

        $wrapper.append($markers.last().get(0));


        html =

            XF.htmlspecialchars(before)

            + selectedHtml

            + $wrapper.html()

            + XF.htmlspecialchars(after)


        if (!inline) {

            html = '<p>' + html + '</p>';

        }

        ed.html.insert(html);


        ed.selection.restore();

        ed.placeholder.hide();

        ed.undo.saveStep();

        XF.EditorHelpers.normalizeAfterInsert(ed);

    }

}[/CODE]

It adds a new "inline" argument which ispoiler/icode should be updated to use. This flag allows block bb-code break out of the existing formatting preventing nested formatting causing issues.


It is inline rather than block as this allows saner defaults for block-like bb-code which are added by 3rd parties.


Back
Top Bottom