YAFLogo

BWG
  • BWG
  • 100% (Exalted)
  • YAF Lover Topic Starter
a month ago
Hi,

With SCEditor, the default behaviour when pressing Enter appears to be to add a br tag. Is there a setting (either in the UI or JavaScript source) to use a p tag instead?

Edit:  On this forum it appears the default behaviour is a p tag! 

Thanks

BWG

Sponsor
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
a month ago
This is not caused by the editor. this is done in the source code when bbcode is converted to html. It was requested in the past to change it to a br tag in the 3.x version.

I guess i need to make the enter mode as setting in the next update.

BWG
  • BWG
  • 100% (Exalted)
  • YAF Lover Topic Starter
a month ago

This is not caused by the editor. this is done in the source code when bbcode is converted to html. It was requested in the past to change it to a br tag in the 3.x version.

I guess i need to make the enter mode as setting in the next update.

Originally Posted by: tha_watcha 

Personally I think it's better to have the default Enter creating a p tag. 

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
a month ago

This is not caused by the editor. this is done in the source code when bbcode is converted to html. It was requested in the past to change it to a br tag in the 3.x version.

I guess i need to make the enter mode as setting in the next update.

Originally Posted by: BWG 

Personally I think it's better to have the default Enter creating a p tag. 

Originally Posted by: tha_watcha 

There is a new host setting to set the enter mode in 3.2.9/4.0.1. But the default is br. Br tags are for new lines and not empty p tags, for me this seems more logic.

BWG
  • BWG
  • 100% (Exalted)
  • YAF Lover Topic Starter
13 days ago
I've noticed in BBCode.cs there is a commented out rule:

​            ruleEngine.AddRule(isEditMode ? breakRule : new SingleRegexReplaceRule(@"\r\n", "<p>", Options));

If I re-enable and comment out the current one:

​ruleEngine.AddRule(horizontalLineRule);ruleEngine.AddRule(horizontalLineRule);

Para tags are rendered, except for the first line. For example: 

<div id="1589347" class="selectionQuoteable">L1<p>L2</p><p>L3
                            </p><hr><div id="1589347" class="selectionQuoteable">h1<p>h2</p><p>h3
                            </p><hr>......</div>

So L2 and L3 are in a para tags but L1 isn't. Have you handled this scenario in  3.2.9? (I don't think it's available yet so I can't check)

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
13 days ago
Yes thats an issue, thats not handled yet
BWG
  • BWG
  • 100% (Exalted)
  • YAF Lover Topic Starter
9 days ago

Yes thats an issue, thats not handled yet

Originally Posted by: tha_watcha 

As a quick fix I updated PostMessage.ascx.cs like this.

var messageText = this.forumEditor.Text;
var messageText = this.forumEditor.Text;

​ 

if (!string.IsNullOrWhiteSpace(messageText))
 {
     messageText = "\r\n" + messageText;
 }