Integrate Markitup text editor to ASP.NET MVC project

末鹿安然 提交于 2019-12-19 19:42:32

问题


I'm trying to add markitup text editor with markdownsharp http://markitup.jaysalvat.com/home/ to my MVC ASP project and kindof confused how to go about it. I added a class from markdownsharp and tested the function. that is working fine but confused how to embed the editor in my view. Using Visual Studia 2010. Please guide regarding the same.


回答1:


The documentation contains many examples.




回答2:


@user488652:

As MarkItUp uses jQuery to transform a DIV into a complex editor, I am having similar issue binding the TextArea to the Model in my view.

There is one option I thought of, and it may be a better option, all things considered: make the form an AJAX-style form.

You would use jQuery to handle the Click on the Submit Button. When submitted, your handler would gather the model data and the MarkItUp editor data and fire it off to a controller action in JSON format via $.ajax().

Your controller then would receive the JSON, parse it into your objects, and use the MarkdownSharp library to do whatever logic you need, then send off the objects to your data layer for persistence.

The result may actually be better than the traditional MVC Form binding.

Good solution?



来源:https://stackoverflow.com/questions/4588923/integrate-markitup-text-editor-to-asp-net-mvc-project

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