e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
321 stars 214 forks source link

question - what is different or what needs to be set - <br> vs \n #3240

Closed Jimmi08 closed 1 year ago

Jimmi08 commented 6 years ago

I have v1 site with this disclaimer: image each line is displayed on new line.

But the same content in version 2 is displayed in one line, no new line. To get the same result, I needed to add
tags after each line. Is this correct behaviour?

Thank you

SimSync commented 6 years ago

Yes, if you use TinyMCE on your new site and bbcode or just a textbox on your old site. TinyMCE is a html editor and html doesn't know the new line charater that is used by bbcode or a plan textbox. So you need to add the new line tag <br/> manually.

Jimmi08 commented 6 years ago

Oh, settings are the same, they do everything to have exact copy of v1 site. I can check this at the evening (all sets are in Text rendering option, aren't?). I will ask them for screenshot from old site, I have access only to new one.

SimSync commented 6 years ago

Your screenshot shows bbcode. If you didn't change it, it was bbcode in v1 too.

Jimmi08 commented 6 years ago

yes, but parsing of this field was probably changed. Or I don't know... I notice somewhere setting to replace /n by
but it was in tinymce I think. When I know that it should work the same way, I will try to find what is different.

SimSync commented 6 years ago

From what i see in the v1 source, there is no special handling for \n (like conversion to <br/>) in case you load a post in the wysiwyg editor, that was originally written using bbcode. What is done when you save a post from the wysiwyg editor is, that it will be surrounded by the [html] [/html] tags, to make sure it will be parsed as html when displaying on the website.

Jimmi08 commented 6 years ago

This is setting from new site: Tinymce is not installed either.

image

What I know - they just CTRL-C text from version 1 and copy it to sitedisclaimer field. Originally it was updated, but result was the same.

This is happened with forum posts too.

Jimmi08 commented 6 years ago

original setting from version 1:

image

SimSync commented 6 years ago

Just did some tests with the site disclaimer on my install here. As long as the disclaimer doesn't contain any html tags, the \n where translated to <br/>. Once i added a html tag (<i> in that case), the \n wasn't translated anymore and all was on one line.

That behaviour is definitely different against v1. Maybe @CaMer0n can say if this is a bug or a feature ...

Jimmi08 commented 6 years ago

The updated forum (this is original of forum post, just bbcodes used) http://www.outlawsracing.com/e107_plugins/forum/forum_viewtopic.php?4293.last image

to version 2 (no WYSIWYG): http://www.outlawsracing.xyz/e107_plugins/forum/forum_viewtopic.php?4293.last

image

image

CaMer0n commented 6 years ago

I'd need to see the bbcode data (directly from the database), before and after upgrade, so I can test with it.

Jimmi08 commented 6 years ago

@CaMer0n Probably no problem, they say you did update. They will contact you soon.

Jimmi08 commented 6 years ago

I was able to narrow problem. I inserted bbcodes from version 2 to some my old forum and result is displayed correctly: image

Example of data:

[center]<b><a href=&quot;http://www.teamviewer.com/en/download/windows.aspx&quot;title=&quot;DOWNLOAD TEAMVIEWER&quot; target=&quot;_self&quot;>[img]{e_IMAGE}custom/teamviewerblacksmall.png[/img]</a></b>[/center]

[color=#00ff00][size=22]rF2 Game[/size][/color]
[link=http://rfactor.net/web/rf2/rf2dl/][size=14]RFactor2 Main Website Link For Downloads Here[/size][/link]

[color=#00ff00][size=22]Outlaws Racing rF2 Event Packages [/size][/color] 
[link=https://mega.nz/#F!dBNl3IZJ!3Q8AxxylYFtLEswY6SbS7g][size=14]AM_FIAGT3_2012_0935[/size][/link]
[link=https://mega.co.nz/#F!8IFwyACL!rLVp8xU0g8h83pnDVgelsA][size=14]BTCC[/size][/link]
[link=https://mega.co.nz/#!RV1zHLiD!gQGmqjLX-Fqx8Ln7M4hT7FCKPVzTZV_g9OkhPqGpN4Y][size=14]BMWE90[/size][/link]
[link=https://mega.nz/#!VN9xybaD!M1X5GAoQ5cpLioeSjYflOw27BTR5930qmQ0zPgLH9HQ][size=14](Camaro)ISI_Chevrolet_CamaroGT3_2012_v1.61[/size][/link]
[link=https://mega.nz/#!QFUlTASa!Lt5RuNuxXImO8oxjUjSnHmDTfyXhm-3yV7KkMfygv2U][size=14]Celica_GTO v2.00[/size][/link]
[link=https://mega.nz/#!cEsACQZY!jfHb6goEwsN91WEah61p7wWMHkHFkfcNqGv8jFU4-eQ][size=14](Covette)ISI_Corvette_C6RGT2_2009_v1.62[/size][/link] *^(/)
[link=https://mega.co.nz/#F!QBUH1aqQ!bAE1cL6rWTQwR5IBiZ828g][size=14]DTM T5s[/size][/link]
[link=https://mega.nz/#!QIVimAgD!ksTiwI-OoJfiJEgpBC72Omavzjsop1KPYhMW5jXz4lM][size=14]Endurance Series[/size][/link]    

I think that something is going wrong because this: [center]

CaMer0n commented 6 years ago

This is helpful, thank you @Jimmi08

CaMer0n commented 6 years ago

@Jimmi08 You have HTML mixed with BBCODEs. I believe this is your problem.

[center]<b><a href=..
Jimmi08 commented 6 years ago

@CaMer0n there are over 7000 forum posts, why this wasn't problem before?

CaMer0n commented 6 years ago

@Jimmi08 Because there was a security hole in earlier versions which has since been patched.

Jimmi08 commented 6 years ago

@CaMer0n

This is just display, data are already saved. I get this check when you post data. But if you forbid html mixed with bbcodes, what is purpose of this preference?

image

SimSync commented 6 years ago

In my memory, I remember a post with just bbcode will translate newline to br. A HTML or HTML mixed with bbcode (or the other way around) has ignored the newline and you had to manually add br to it. But my v1 days are already a long time ago and I may be wrong...

Jimmi08 commented 6 years ago

@SimSync I have no idea. I just can't tell somebody with 7000 posts to rewrite them manually. They will stick with version 1 because this.

br tags are missing at all if you have mixed content.

V1: 2x br tag if you use html, 1x br after [link] image

v2: no br tags image

I thought that something was wrong with update but it's not this case.

If I remove that html part, links works correctly [links] is replaced with <br>. So why it messes all content not only that html part?

And this is reason why I can't switch from tinymce to bbcodes (to set wysiwyg off) - all newlines are ignored and text is messed then. And I am sure that there is setting for tinymce - convert newlines to br.

Jimmi08 commented 6 years ago

I found reason:

        if($this->isHtml($text)) //BC FIx for when HTML is saved without [html][/html]
        {
            $opts['nobreak'] = true;
            $text = trim($text);
        }

and then:

        if(preg_match('#(?<=<)\w+(?=[^<]*?>)#', $text))
        {
            return true;
        }

It removes lines if I put html code inside<code> tag too.

Jimmi08 commented 6 years ago

@wrxxy

Jimmi08 commented 5 years ago

https://github.com/e107inc/e107/issues/3793

Jimmi08 commented 1 year ago

There is no point to have this issue opened, it is too old. I am not able to check if this is still issue and no similar problem was reported. And tinymce4 had many updates from that time. Thanks