ASP.NET MVC富文本编辑器不显示按钮

时间:2010-06-15 18:54:24

标签: asp.net asp.net-mvc tinymce

我在实现Rich Text Editor时遇到了问题(我尝试过的所有内容,例如TinyMCE)。我尝试过很多教程和文章,但都是一样的。当我尝试这样做时,我得到的最好的是IE(8)中的工作编辑器,但其他浏览器不是(Opera,FF,Chrome)。我下载的样本在所有浏览器中都可以正常工作 我正在使用VS2010 ASP.NET MVC2,例如我试过这个http://www.billsternberger.net/asp-net-mvc/tinymce-samples-with-asp-net-mvc/ 谢谢你的帮助

2 个答案:

答案 0 :(得分:1)

查找图片可能会遇到问题。

找到您的主题css并编辑所有背景:url以显示您放置img的路径。

background:url(img/button_bg.png)

例如,在您使用TinyMCE的每个页面中,必须找到img / button_bg.png。

如果你在 /MyDir/MyPage.aspx
该文件位于 /themes/advanced/skin/default/img/buttons.png

无法通过代码网址找到我页面上的按钮(img / button_bg.png)

答案 1 :(得分:1)

我使用了以下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目录 / LANGS /插件 /主题 / utils的

将其包含在我的网页上:

<% Html.RenderPartial("Editor"); %>
<%= Html.TextAreaFor(model => model.Draft.Body, new { name = "content", @class = "text", id = "articleBody", style = "width:100%" })%>          

您可以将TextArea放在您认为合适的页面上的任何位置,并记住它会扩展到您包含的总按钮的宽度或100%的包装div