Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
451 views
in Q2A Core by
Some comments on my site managed to sneak some formatting in there, even though I only allow the basic editor for comments. It turns out to be ones where users originally posted an answer (using my Markdown editor) then it was converted into a comment.

The formatting persists in the comment, and when it is edited it shows the Markdown editor instead of the plain text editor.

What's the best way to fix this issue? Through Q2A, or in editor plugins?
by

Here is a test answer with some formatting.

Hello world.

by
Yep, so it works on the CKeditor on here, too.

2 Answers

0 votes
by
You may wanna force the comments to have a certain style so any possible formatting done by the user will be gone.

.entry-content p {

text-decoration: none !important;

font-weight: normal !important;

color: black !important;

font-style: normal !important;

}

It's nevertheless still a bug though.
+2 votes
by

Yes, this has been possible for a long time, and I could never decide about it.

On the one hand, it didn't seem appropriate to remove information just because an answer is converted to a comment. On the other hand it doesn't seem right to let people create formatted comments through the back door.

Anyway, if this is an issue on your site, the best solution is to create a plugin with an event module which listens out for the 'a_to_c' event. You can check if ($params['format']!='') in your module's process_event(...) function - if so, qa_post_content_to_text(...) and qa_post_set_content(...) in qa-app-posts.php should provide the functionality you need to perform the conversion.

If you happen to make this, I think other people might like it too!

by
+1 for retaining information, if answer gets converted to comment.
I have a lot of style information in answers and comments, as I use CKEditor in both (including image upload).
...