如题。
意思是说如何只引用kendo.editor.min.js而不是kendo.all.min.js,你们懂得all文件太大1.8M呢!
注意不使用requirejs的方式,因为还是想使用kendoUI的mvc扩展方法的方式使用,如下
@(Html.Kendo().EditorFor(model => model.Content) .HtmlAttributes(attr3) .Tools(tools => tools .Clear() .Bold().Italic().Underline().Strikethrough() .JustifyLeft().JustifyCenter().JustifyRight().JustifyFull() .InsertUnorderedList().InsertOrderedList() .Outdent().Indent() .CreateLink().Unlink() .InsertImage() .SubScript() .SuperScript() .TableEditing().FontColor().BackColor() .ViewHtml() .Formatting() .FontName() .FontSize() ) .Value(@<text></text>) .ImageBrowser(imageBrowser => imageBrowser .Image("~/Content/UserFiles/Images/{0}") .Read("Read", "ImageBrowser") .Create("Create", "ImageBrowser") .Destroy("Destroy", "ImageBrowser") .Upload("Upload", "ImageBrowser") .Thumbnail("Thumbnail", "ImageBrowser") ) )
而不是js的方式
<script type ="text/javascript"> requirejs.config({ paths: { kp: "../../kendo-ui/scripts" } }); require(["kp/kendo.editor.min"], initApp); function initApp() { jQuery(function () { jQuery("#editor").kendoEditor({ "tools": [{ "name": "bold" }, { "name": "italic" }, { "name": "underline" }, { "name": "strikethrough" }, { "name": "justifyLeft" }, { "name": "justifyCenter" }, { "name": "justifyRight" }, { "name": "justifyFull" }, { "name": "insertUnorderedList" }, { "name": "insertOrderedList" }, { "name": "outdent" }, { "name": "indent" }, { "name": "createLink" }, { "name": "unlink" }, { "name": "insertImage" }, { "name": "subscript" }, { "name": "superscript" }, { "name": "createTable" }, { "name": "addColumnLeft" }, { "name": "addColumnRight" }, { "name": "addRowAbove" }, { "name": "addRowBelow" }, { "name": "deleteRow" }, { "name": "deleteColumn" }, { "name": "foreColor" }, { "name": "backColor" }, { "name": "viewHtml" }, { "name": "formatting" }, { "name": "fontName" }, { "name": "fontSize"}], "imageBrowser": { "transport": { "read": { "url": "/imagebrowser/read" }, "type": "imagebrowser-aspnetmvc", "thumbnailUrl": "/imagebrowser/thumbnail", "uploadUrl": "/imagebrowser/upload", "destroy": { "url": "/imagebrowser/destroy" }, "create": { "url": "/imagebrowser/create" }, "imageUrl": "/Content/UserFiles/Images/{0}"}} }); }); } </script>
只引入kendo.editor.min.js编辑器出不来
不引用不出来就说明必须要引用,无解的,你倒是可以把那个文件压缩一下减少体积
非也,使用requirejs的方式是可以出来的(文中js部分是可以的),只是使用这种方式不知道如何使用kendoUI的mvc扩展方法???毕竟扩展方式很友好,好维护。
@njl_041x: 那你就吧小文件的文件名改成大的那个名称不就可以了