我使用了下面的 ViewUserControl
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<script type="text/javascript">
// note that the editor text area must have an id of articleBody
tinyMCE.init({
elements: "articleBody",
theme: "advanced",
mode: "exact",
height: "300",
plugins: "safari,spellchecker,pagebreak,autosave,table,advimage,iespell,inlinepopups,paste,nonbreaking,template,fullscreen,paste",
theme_advanced_buttons1: "bold,italic,underline,forecolor,|,undo,redo,|,link,unlink,pastetext,|,justifyleft,justifycenter,justifyright,|,blockquote,bullist,numlist",
theme_advanced_buttons2: "",
theme_advanced_buttons3: "",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left"
});
</script>
注意:在 Scripts/ 中有一个 tiny_mce 目录,其中包含源代码
/语言
/插件
/主题
/工具
要将其包含在我的页面中:
<% Html.RenderPartial("Editor"); %>
<%= Html.TextAreaFor(model => model.Draft.Body, new { name = "content", @class = "text", id = "articleBody", style = "width:100%" })%>
您可以将 TextArea 放置在页面上您认为合适的任何位置,并记住它将扩展到您包含的总按钮的宽度或 100% 的包装 div