Integrate Markitup text editor to ASP.NET MVC proj

2019-02-23 00:56发布

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.

2条回答
小情绪 Triste *
2楼-- · 2019-02-23 01:15

The documentation contains many examples.

查看更多
我命由我不由天
3楼-- · 2019-02-23 01:19

@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?

查看更多
登录 后发表回答