似乎无法使用 wmd-editor 保存文本的标记版本
当我使用 wmd 编辑器保存 textarea 的上下文时,我遇到了一个问题,它一直想将其保存为 html。我有以下代码:
输入元素...
<p>
<%= this.Html.TextArea("Body", topic.Body, new { @class = "big" })%>
</p>
制作输出 markdown 的脚本...
<script type="text/javascript">
wmd_options = {
output: "Markdown"
};
</script>
控制器代码...
[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
}
我错过了什么吗?知道为什么它不会返回文本区域的降价版本吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想通了......我有我的javascript来将wmd.js拉入页面顶部而不是底部......当然,就在说明所说的地方。我的坏!
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!
我自己没有使用过这个编辑器,但我会尝试在控制器端进行 html 加密/解密。
这至少会给你安全的 html 来保存到数据库。
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.