我在 MVC 应用程序中使用 CKEditor。
我正在使用“ckeditor-full”(版本 4.4.2)包。
我已将“ckeditor\adapters\jquery.js”和“ckeditor\ckeditor.js”文件包含在 bundle 中,并在 _Layout.cshtml 文件中引用了这些 bundle 。
@Scripts.Render("~/bundles/Scripts/ckeditor")
@Scripts.Render("~/bundles/Scripts/ckeditor/adapters")
“Scripts/ckeditor”文件夹包含与包一起下载的所有 352 个文件。
以下是 config.js 文件(位于“Scripts/ckeditor”文件夹中。
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'] }
];
};
以下是我如何显示文本区域的 CKEditor:
$("#idBodyText").ckeditor();
问题是,如果在本地 IIS 上以 Debug模式运行,它在本地工作正常。但是,当使用发布配置部署在 IIS 上时,它不会显示 CKEditor。
知道可能的原因是什么以及如何解决这个问题吗?
非常感谢对此的任何帮助。
谢谢
最佳答案
作为一项解决方案,事实证明,在加载 bundle 之前,我必须在 View 中包含以下行 -
<script type="text/javascript">
CKEDITOR_BASEPATH = "@Url.Content("~/Scripts/ckeditor/")";
</script>
关于asp.net-mvc - 当站点部署在 IIS 上时,CKEditor 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24503284/