2010-06-15 69 views
0

我在實現富文本編輯器(我嘗試過的所有東西,例如TinyMCE)時遇到問題。我嘗試了很多教程和文章,但都一樣。當我試圖做到最好的是我在IE(8)工作編輯器,但其他瀏覽器不(歌劇,FF,鉻)。我下載的樣本在所有瀏覽器中都能正常工作。 我使用的是VS2010 ASP.NET MVC2,例如我試過這個http://www.billsternberger.net/asp-net-mvc/tinymce-samples-with-asp-net-mvc/ 感謝您的幫助ASP.NET MVC富文本編輯器不顯示按鈕

回答

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> 

注:S中的cripts /沒有與源tiny_mce目錄 /LANGS /插件 /主題 /utils的

把它列入我的網頁上:

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

你將使你的文本區域,無論你在頁面上看看是否合適,並記住它會擴展到包含的全部按鈕的寬度或100%的包裝div

+0

也可以考慮使用像http://wmd-editor.com/這樣的降價編輯器 – 2010-11-18 15:40:58

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

沒有辦法找到從我的頁面代碼URL(IMG/button_bg.png)按鈕