17

I am using CKEditor in my MVC application.

I am using "ckeditor-full" (Version 4.4.2) package.

I have included "ckeditor\adapters\jquery.js", and "ckeditor\ckeditor.js" files in the bundle and referenced those bundles in the _Layout.cshtml file.

@Scripts.Render("~/bundles/Scripts/ckeditor")
@Scripts.Render("~/bundles/Scripts/ckeditor/adapters")

"Scripts/ckeditor" folder contains all 352 files that were downloaded with the package.

Following is config.js file (which is residing in "Scripts/ckeditor" folder.

CKEDITOR.editorConfig = function( config )
{
    // Define changes to default configuration here. For example:
    config.toolbar = 'Custom';
    config.disableNativeSpellChecker = false;
    config.browserContextMenuOnCtrl = true;
    config.forcePasteAsPlainText = true;

    config.toolbar_Custom = [
        { name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', '-', 'RemoveFormat'] },
        { name: 'paste', items: ['PasteText'] },
        { name: 'links', items: ['Link', 'Unlink'] }
    ];
};

Following is how I display CKEditor for textarea:

$("#idBodyText").ckeditor();

The issue is that, it works fine locally and if running on local IIS in debug mode. However, it doesn't display CKEditor when deployed on IIS with release config.

Any idea what could be the possible reason, and how to resolve this?

Any help on this much appreciated.

Thanks

2 Answers 2

37

As a resolution, it turned out that, I had to include following line in my view before loading the bundles -

<script type="text/javascript">
    CKEDITOR_BASEPATH = "@Url.Content("~/Scripts/ckeditor/")";
</script>
0
2

Check how your bundles generated stylesheet and scripts links in page source:

@Scripts.Render("~/bundles/Scripts/ckeditor")
@Scripts.Render("~/bundles/Scripts/ckeditor/adapters")

It could be a problem with HTTP Error 404 - File or Directory not found or 403.2 - Read access forbidden. - in that case, you should check if files are properly store on serwer (in correct location) and check permissions for that folder.

Also helpful for debugging will be Firebug. I strongly recommend it to use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.