Valamas
Valamas

Reputation: 24759

What web admin wysiwyg preview options are available?

I have a web admin where there is a wysiwyg editor when a user edits information.

There is also a view only template.The user views the information before clicking an edit action.

Currently the view template results in one line for the saved field value.

<p><b>Hello</b></p><p>there</p>

What options do I have to al least make the a little more readable when the user is "viewing"?

Options I can think of are:

With any of the above, i may place it in a scrollable div.

(I had trouble tagging this question. Feel free to retag).

Upvotes: 2

Views: 191

Answers (2)

Adam Tuliper
Adam Tuliper

Reputation: 30152

Also ensure that any editor you support encoded data before sending to the server. Do not turn off request validation. Use the [AllowHtml] attribute on a model property if necessary. Also use the Anti-xss library from Microsoft - specifically the HTML sanitizer to help remove evil script and help protect against cross site scripting.

Upvotes: 1

Mitchel Sellers
Mitchel Sellers

Reputation: 63136

Typically when you are working with editors you are going to eventually be presenting the HTML live on the site anyway, so encoding shouldn't be a big concern as you are already trusting them.

Now, what I've done in the past is with using editors, such as ckeditor, etc, they cleanup the content which would fix the issue with your concern about unclosed tag.

so I would go with option 3 on your list.

Upvotes: 1

Related Questions