TinyMCE Spellchecker in ASP .NET MVC

依然范特西╮ 提交于 2019-11-30 15:48:18

Well its a bit hard to know what the problem is without knowing what the error you're getting is, but I'm guessing that its because you need to ignore the route to the spell checker in your MVC. Do this by adding something like this to your MVC route definitions:

//ignore just the TinyMCE spell checker service:
routes.IgnoreRoute("TinyMCE.ashx");
//or if you want to be more general & ignore all ashx's:
routes.IgnoreRoute("{resource}.ashx{*pathInfo}");

Without the above it would be interpreting the spellcheck request url (TinyMCE.ashx...) as an MVC route & try to find a matching Controller (& obviously fail).

If that's not the issue, I'd suggest posting some more info about the specific error you're seeing.

Brian

I'm pretty new to MVC (a little over a year) and was pretty interested in spell check for a specific page in my solution. The above options may work for some folks, but didn't work for me (I'm not very patient, and in all honesty didn't want to ignore any routes, or modify my the system.web section of my config for something that only 5% of my solution consumers are going to use, so I didn't spend a whole lot of time on those options).

So:

  1. I copied the Moxiecode.TinyMCE.dll file to a directory in my project so future contributors will have the dll without having to search google.
  2. I added a reference to the above dll to my project.
  3. I created a new controller called SpellCheckController.cs that contains the following:

    public void CheckSpelling()
    {
        SpellCheckerModule spellChecker = new SpellCheckerModule();
        spellChecker.ProcessRequest(System.Web.HttpContext.Current);
    }
    

(don't forget the using Moxiecode.TinyMCE.SpellChecker;)

and just referenced the controller like this in the setup options for TinyMCE in my view:

spellchecker_rpc_url: "@Url.Action("CheckSpelling","SpellCheck")/?module=SpellChecker"

I haven't ignored any routes. I haven't added another httphandler to the what I am assuming is a pretty long list of handlers for .net, and spell check works for me now.

I also have the ability to go with something different without changing too much (assuming I figure out what TinyMCE's spellchecker is doing with the http context.

P.S. Stack Overflow's rich text editor doesn't seem to have a spell check feature, so there are no guaranties on the above spelling :)

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