【问题标题】:ASP.NET MVC Rich Text Editor not showing buttonsASP.NET MVC 富文本编辑器不显示按钮
【发布时间】:2013-02-26 07:10:41
【问题描述】:

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

【问题讨论】:

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


    【解决方案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 目录,其中包含源代码 /语言 /插件 /主题 /工具

    要将其包含在我的页面中:

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

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

    【讨论】:

      【解决方案2】:

      查找图片可能有问题。

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

      background:url(img/button_bg.png)
      

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

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

      无法使用代码 url(img/button_bg.png) 从我的页面中找到按钮

      【讨论】:

        猜你喜欢
        • 2010-11-06
        • 2014-08-18
        • 1970-01-01
        • 2011-04-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-11-26
        • 1970-01-01
        相关资源
        最近更新 更多