Behavior of editor

Status
Not open for further replies.

Robert9

Well-known member
Affected version
Newest
The issues happen on different PC and Tablets.
The way the editor behaves now, when I use the back-key is different.
Empty lines are deleted!

This is a big problem for all people who write a lot now because again, and again they have to add empty lines that are deleted automatically.


Please, please, please stop this behavior!'
There are also issues now with own bbCodes used with buttons in the editor.
Normally, I mark text, then click the bbCode, result was like [lala]text[/lala];

now the result is:

[lala]

text

[/lala]
 
Last edited:
There are also issues now with own bbCodes used with buttons in the editor.
Normally, I mark text, then click the bbCode, result was like [lala]text[/lala];

now the result is:

[lala]

text

[/lala]
I see this now, too. Not sure it's a big deal for us since I am one of the few people on the site who even knows what code view does. Most would never go there so wouldn't see the codes anyhow. Can't speak to other sites. Personally, I don't have a problem with this. It's more readable in some cases and it does not seem to affect the actual display for things like formatting codes.

I do find Froala a bit flakier than in the past though I haven't seen your first issue specifically. I will watch for it now.
 
Agreed. Froala has been sucktastic lately to the point that I usually just need to disable it and go into straight BBCode edit mode to work around all it's problems.
Which works fine for a developer like you or an IT geek and occasional website admin like me, not so much for my highly non-technical userbase. I hope there's some kind of a resolution down the road.
 
I've used word processors for decades. The one bug that annoys me is that using the keyboard shortcuts Ctrl-I and Ctrl-B work to turn italics and bold on, but take some trickery to turn them off again. (Aside from going into the BBCode view and fixing it manually, which is time-consuming when writing long articles or posts as I often do--the only way I can create a lot of writing is to keep my hands on the keyboard, not fiddling around with a mouse or touchscreen.) It's the editor, as every XenForo forum I use has the same problem.

Fingers crossed Froala fixes these bugs...
 
So, this is an external problem? Then we may go back to the last version of this external software?

We have to write hundreds of post every day. Finally, we have started to write our texts now in another software and copy them to the forum. Another solution is now to use a small php-script, just with one text-area and some own regex to have headlines, b, i and u.

Maybe most people don't remark it because they don't write a lot. But think about forums, where you fight for every single user who can write and does write a lot. Now we punish them for their good work and make them writing less.
 
The way the editor behaves now, when I use the back-key is different.
Empty lines are deleted!
I noticed this too, and it's extremely annoying xD
Unfortunately it's not a xenforo issue, it's an issue with the 3rd party editor tool it uses, froala.
I have a paid version of froala I use on one of my custom sites. It doesn't have this kind of behavior.
Although, mind you, I haven't updated it to the latest version yet either though as I don't mind the version I'm currently using.
 
XenForo is currently using Froala 4.0.14, and from the changelog, it does look like some of the annoying things I run into on XenForo have been fixed (newest version is 4.0.17).

So hopefully we'll get an update soon.

  • Fixed, the increase and decrease indent is not working with Ordered List.
  • Fixed, BackSpace removes extra BR from editor content.
  • Fixed, pasted rich content in safari does not work as expected
  • Fixed, toggling the OL and UL list buttons creates additional list items
  • Fixed, extra leading and trailing spaces are added to pasted text
  • Fixed, the cursor moves when toggling between formatting
  • Fixed, issues with Froala BR removal and insertions on empty paragraphs
  • Fixed, back space doesn't work on IOS devices
 
@Chris D I missed the behavior when a full-line of text was selected and a tag injected. I'm not sure if this was Froala version dependant, or just an oversight.

The fix is kinda anoying since, but I think to fixes the identifed bug without causing additional issues but probably requires additional testing.
JavaScript:
XF.EditorHelpers.wrapSelectionText = function (ed, before, after, save, inline) {

    if (save) {
        ed.selection.save();
    }
    ed.undo.saveStep();

    var $wrapper = $('<div></div>'),
        $markers = ed.$el.find('.fr-marker'),
        html = null,
        selectedHtml = '';
    if (!ed.selection.isCollapsed()) {
        // markers may be touched by getSelected
        $wrapper.append($markers.last().get(0));

        selectedHtml = ed.html.getSelected();
        if (/<p>/i.test(selectedHtml)) {
            // avoid injecting additional new-lines when selected spans new-lines
            if (inline) {
                var $frag = $('<div />').html(selectedHtml);
                var $p = $frag.find('p');
                $p.first().prepend(XF.htmlspecialchars(before));
                $p.last().append($wrapper.children());
                $p.last().append(XF.htmlspecialchars(after));
                html = $frag.html();
            } else {
                selectedHtml = selectedHtml + $wrapper.html();
                inline = true;
            }
        } else {
            selectedHtml = selectedHtml + $wrapper.html();
        }
    } else {
        $wrapper.append($markers.first().get(0));
        $wrapper.append($markers.last().get(0));
        selectedHtml = $wrapper.html();
    }

    if (html === null) {
        html = XF.htmlspecialchars(before)
            + selectedHtml
            + 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);
}

Agreed. Froala has been sucktastic lately to the point that I usually just need to disable it and go into straight BBCode edit mode to work around all it's problems.
The [indent] tag (and other alignement tags for that matter) interacts really horribly with non-editor aware bb-code. There are some bug reports around to missmatch between a line-based editor like Froala and XF's document-based rendering of html to bb-code.

Because of Froala or because of Froala embedded in XenForo ?
This kind of bugs are solved by XF team or Froala team ?
Froala's API lacks a 'wrap this selected text in some formated values' function, which means XF needs to emulate it. This has ended up being buggy depending on Froala version, and now XF version.
 
I don't think it's happening soon (not this side of 2.3 anyway) but I want Froala gone in the future. I haven't had enough time to research it fully but lexical looks interesting.
Lexical looks good, but don’t have good features like “auto link converter to image”, “suitable link editing box”.
What about Imperavi? Quill.js?
 
Lexical also appears to lack robust copy&paste support from Word and other popular document editors. Writing those from scratch is something of a nightmare.
 
Status
Not open for further replies.
Back
Top Bottom