问题
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?
回答1:
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!
回答2:
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.
来源:https://stackoverflow.com/questions/2097917/cant-seem-to-save-the-markup-version-of-the-text-using-wmd-editor