Can't seem to save the markup version of the text using wmd-editor

拜拜、爱过 提交于 2019-12-23 05:17:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!