CKeditor adding <p> &nbsp;</p>

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
2/28/2011 4:45:21 AM
Gravatar
Total Posts 19

CKeditor adding <p> &nbsp;</p>

Hello. My problem looks like that:  http://drupal.org/node/669114

Does anyone have this problem? I have set "config.htmlEncodeOutput = true;" because there was an issue with ASP.NET described here: http://simonbartlett.co.uk/2010/05/ckeditor-and-asp-net/  and i think this is related to my problem.

I think a different workaround is used here since the default setting for the editor shipped with mojoportal has not html encoding enabled. How is this ckeditor i am posting setup? I could always revert to the good old textbox but the editor is used also in html content module so i have a problem there. Thanks in advance.

2/28/2011 9:39:31 AM
Gravatar
Total Posts 18439

Re: CKeditor adding <p> &nbsp;</p>

Hi,

I am not seeing this problem that you linked to in mojoPortal. The drupal problem was that the editor posts extra <p>&nbsp;</p> after every paragraph that the user enters, that is not happening in mojoPortal as far as I know, it did not happn in the post you just made nor in my posts. If you can produce th eproblem on demo.mojoportal.com then I will look at it but right now I do not believe we have this problem. In a new content instance that has no content yet, CKeditor does put an ampty paragraph like <p>&nbsp;</p> but that goes away when you start editing and fill in the paragraph.

I do not recommend enabling htmlencoding on the editor because there is no code that is decoding it on the server, we have that requestValidation disabled to prevent postback errors though we use other means of validating and defending against malicious content from untrusted users in places like the forums and the comments, but in main features only trusted users are expected and we give them a lot of power including the ability to add javascript to html. Users not in trusted roles cannot post to the page because it will check for edit roles, therefore even if malicious content is posted it will be ignored and not saved. So the solution in the article by simon bartlett is not used nor needed here, though it is an interesting article and I've saved it for further consideration.

Best,

Joe

2/28/2011 10:11:09 AM
Gravatar
Total Posts 19

Re: CKeditor adding <p> &nbsp;</p>

Thanks for your time. I will just disable that validation too.

3/15/2011 5:03:49 PM
Gravatar
Total Posts 19

Re: CKeditor adding <p> &nbsp;</p>

Just wanted to share what I found about my problem. The editor wraps  whatever you write with <p>...</p> .

Just upgraded to last stable version from a past November's one.(feels faster here , my first impression.)

Just made some HtmlContent instances and the corresponding table in my database contains these:

<p>   Welcome to <strong>mojoPortal</strong>, this is sample data, you can edit this content to get started....</p>  

<p>   Welcome text.</p>  

<p>   Welcome text.</p>  

Now in another table on which I use AntiXSS library to encode the user supplied description for something it looks like this:

&lt;p&gt;&#13;&#10;&#9;hi&lt;/p&gt;&#13;&#10;

and rendered like this:  <p> hi </p>

I will just deal with these <p> </p>. Just mentioning it for someone who encounters something like this. Thanks.

3/16/2011 1:00:49 PM
Gravatar
Total Posts 18439

Re: CKeditor adding <p> &nbsp;</p>

It looks like in your custom feature you are html encoding the content before putting it in the database. I can't think of a good reason for doing that.

In mojoPortal features we store raw markup in the database, and for untrusted content entered by untrusted users we filter it before rendering it on the page.

This tutorial video talks about how we do it using NeatHtml for anti-xss: Securing Untrusted Content. The video is part of the series about developing custom features for the mojoPortal content system.

You can also find examples of using NeatHtml in the source code for the forums and blog comments, which are both places where untrusted users can enter content.

Best,

Joe

3/16/2011 4:08:56 PM
Gravatar
Total Posts 19

Re: CKeditor adding <p> &nbsp;</p>

Hello. I had not seen that video when I wrote my feature. I get how the input is treated now. I am just not so comfortable having anything sitting in my database.  Maybe I am too obsessed with it. I have solved this minor issue anyway by removing the tag. Thanks for the advice. 

You must sign in to post in the forums. This thread is closed to new posts.