use*_*b00 5 c# asp.net-mvc ckeditor5
为了隔离任何问题以便能够重现该问题,我在 VS 2017 中使用 ASP.NET MVC 模板 (.NET Framework 4.6.1) 开始了一个全新的项目。
我将最新的ckeditor5添加到/Scripts/ckeditor5/ckeditor.js
在 BundleConfig.cs 中,我添加了以下内容:
bundles.Add(new ScriptBundle("~/bundles/ckeditor").Include(
"~/Scripts/ckeditor5/ckeditor.js"));
Run Code Online (Sandbox Code Playgroud)
在 _layout.cshtml 中,我有这个:
@Scripts.Render("~/bundles/ckeditor")
Run Code Online (Sandbox Code Playgroud)
当我运行该应用程序时,它给出“System.NullReferenceException”错误。看来微软的Ajax解析不喜欢ckeditor5??
在 Microsoft.Ajax.Utilities.JSParser.ParseObjectLiteralProperty(Boolean isBindingPattern)\r\n 在 Microsoft.Ajax.Utilities.JSParser.ParseObjectLiteral(Boolean isBindingPattern)\r\n 在 Microsoft.Ajax.Utilities.JSParser.ParseLeftHandSideExpression(Boolean isMinus) \r\n 在 Microsoft.Ajax.Utilities.JSParser.ParseUnaryExpression(Boolean& isLeftHandSideExpr, Boolean isMinus)\r\n 在 Microsoft.Ajax.Utilities.JSParser.ParseVarDecl(JSToken inToken)\r\n
在 Microsoft.Ajax.Utilities。 JSParser.ParseVariableStatement()\r\n 在 Microsoft.Ajax.Utilities.JSParser.ParseFunctionBody(块体)\r\n
在 Microsoft.Ajax.Utilities.JSParser.ParseFunction(FunctionType functionType, Context fncCtx)\r\n 在 Microsoft .Ajax.Utilities.JSParser.ParseLeftHandSideExpression(Boolean isMinus)\r\n 在 Microsoft.Ajax.Utilities.JSParser.ParseUnaryExpression(Boolean& isLeftHandSideExpr, Boolean isMinus)\r\n 在 Microsoft.Ajax.Utilities.JSParser.ParseArrayLiteral(Boolean isBindingPattern )\r\n 于
如果我忘记了 Bundle 并且我在 _Layout.cshtml 上硬编码了这样的路径,它会起作用:
<script src="~/Scripts/ckeditor5/ckeditor.js"></script>
Run Code Online (Sandbox Code Playgroud)
知道如何使捆绑包适用于 ckeditor5 吗?
小智 2
这个问题很可能与 ScriptBundle 尝试缩小已经缩小的文件有关。在 Ckeditor5 的情况下,这会中断。
修复方法是在文件扩展名 .js 之前添加 .min。
这为我解决了这个问题。
| 归档时间: |
|
| 查看次数: |
3195 次 |
| 最近记录: |