Future fix Froala: Copying to text editor duplicates line-breaks

Steffen

Well-known member
Affected version
2.0.7
XenForo uses Froala's default Enter option $.FroalaEditor.ENTER_P (https://www.froala.com/wysiwyg-editor/examples/enter, https://www.froala.com/wysiwyg-editor/docs/options#enter) but sets the margin of "p" elements to 0.

Therefore, when copying text from XenForo's Froala to a text editor (Notepad, Sublime Text, ...), all line-breaks are duplicated. I guess that's because the text editor sees the "p" elements and thinks that for an appropriate representation of paragraphs as plaintext it should separate them with two line-breaks instead of a single line-break (because usually "p" elements have a margin, only XenForo sets the margin to 0 to "emulate" $.FroalaEditor.ENTER_BR).

So if you copy & paste the following lines from XenForo's Froala editor to a text editor application:

Line 1
Line 2
Line 3

This is the result:

Screenshot from 2018-06-05 16-18-18.webp

Maybe $.FroalaEditor.ENTER_BR would be more appropriate for XenForo?
 
Last edited:
One of our users has noticed another consequence of XenForo's usage of $.FroalaEditor.ENTER_P.

Consider this BB code:
Code:
[quote][url=https://www.xenforo.com/]Line 1
Line 2
Line 3
Line 4
Line 5[/url][/quote]

Now let the editor convert this BB code into HTML:

HTML:
<blockquote>
<p><a href="https://www.xenforo.com/" target="_blank">Line 1</a></p>
<p><a href="https://www.xenforo.com/" target="_blank">Line 2</a></p>
<p><a href="https://www.xenforo.com/" target="_blank">Line 3</a></p>
<p><a href="https://www.xenforo.com/" target="_blank">Line 4</a></p>
<p><a href="https://www.xenforo.com/" target="_blank">Line 5</a></p>
</blockquote>

As you can see, the link is split into 5 links, one per line. Since <a> elements cannot contain <p> elements (which XenForo uses to represent line-breaks), XenForo had no choice but to split the link up in this way. But this is not what the user expected to happen. :)
 
As you can see, the link is split into 5 links, one per line. Since <a> elements cannot contain <p> elements (which XenForo uses to represent line-breaks), XenForo had no choice but to split the link up in this way. But this is not what the user expected to happen. :)
XF has a post-processing step which merges some tags which close/newline/open, but the process isn't complex enough to handle bb-code with arguments.

The indent tag also causes a similar issue
 
I don't see the point in future fixes existing or being present, because it seems that future will never happen.

For instance - bug report from 2012 - last reply 2013. What's the point? Either fix it or get rid. It might even be that certain posts aren't relevant anymore but my OCD mind hurts seeing them being there for no reason.
 
Top Bottom