I'm running into an issue when I am saving开发者_高级运维 the context of textarea using the wmd-editor it keeps wanting to save it as html. I have the following code:
The input elements...
<p>
<%= this.Html.TextArea("Body", topic.Body, new { @class = "big" })%>
</p>
The script to make the out put markdown...
<script type="text/javascript">
wmd_options = {
output: "Markdown"
};
</script>
The controller code...
[Authorize]
[ValidateInput(false)]
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(FormCollection collection)
{
var topic = WikiService.TopicNew();
topic.Name = collection["Name"];
topic.Body = collection["Body"];
// Just saving the contents
}
Am I missing something? Any idea why it would not return the markdown version of the textarea?
I figured it out ... I had my javascript to pull in the wmd.js at the top of the page and not at the bottom ... of course, right where the instructions said to put it. My bad!
Not used this editor myself but I'd be trying, at the controller end, to html en/decrypt.
That, at least, will give you safe html to save to a db.
精彩评论