2009-12-10 6 views
1

ASP.NET MVC 2 베타 앱 (MVC 1과 동일한 문제)에서 tinyMCE에 대해 매우 이상한 동작이 나타납니다. 사용자가 엔터티를 만들거나 편집하려고 할 때 호출되는 "edit.aspx"라는 뷰가 있습니다. 이 뷰는 jquery를 사용하여 tinyMCE를로드하고 텍스트 영역을 찾습니다. 여기 ASP.NET MVC 및 tinyMCE

은 모두

public ActionResult Create() 
{ 
    return View("Edit", new FutureEvent()); 
} 

[HttpGet] 
public ActionResult Edit(int id) 
{ 

     FutureEvent futureEvent = (from fe in adminGalleryRepository.FutureEvents 
          where fe.ID == id 
          select fe).FirstOrDefault(); 

     return View("Edit", futureEvent); 

} 

은 "Edit.aspx"보기보기 같은 "edit.aspx '이라고 내 2 액션 방법은 다음과 같습니다

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<DomainModel.Entities.FutureEvent>" %> 

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> 
    Future event 
</asp:Content> 

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> 

    <script type="text/javascript">   

     $(function() { 
      $("#tabs").tabs(); 
      $('textarea').tinymce({ 
       script_url: '../../Scripts/tiny_mce/tiny_mce.js', 
       theme: "advanced", 
       plugins: "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", 

       // Theme options 
       theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", 
       theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", 
       theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", 
       theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak", 
       theme_advanced_toolbar_location: "top", 
       theme_advanced_toolbar_align: "left", 
       theme_advanced_statusbar_location: "bottom", 
       theme_advanced_resizing: true 
      }); 
     }); 

    </script>  


    <h2>Future event</h2> 

    <%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %> 

    <% using (Html.BeginForm("Edit", "FutureEvents")) {%> 


      <div id="tabs"> 

        <ul> 
         <li><a href="#tabs-1">Future event</a></li> 
        </ul>    

        <div id="tabs-1"> 

         <%= Html.Hidden("ID") %> 

         <label class="formLabel" for="Title">Title: 
          <%= Html.ValidationMessage("Title", "*") %> 
          <%= Html.TextBox("Title", Model.Title, new { size = "40px" })%> 
         </label> 

         <label class="formLabel" for="Info">Info: 
         <br /> 
          <%= Html.TextArea("Info", Model.Info, 15, 130, null) %> 
         </label> 

         <br /> 
         <label class="formLabel" for="WebSite">Web site address: 
          <%= Html.TextBox("WebSite", Model.WebSite, new { size = "40px" })%> 
         </label> 

        </div> 

      </div> 

      <div class="clear" ></div> 
      <div id="footer" style="text-align: left">  
       <input type="submit" value="Save" /> 
       <%=Html.ActionLink("Back to List", "List") %>  
      </div> 

    <% } %> 



</asp:Content> 

이상한 점은 만드는 것입니다 메서드는 "편집"보기를 렌더링하고 tinyMCE 편집이 올바르게 나타납니다. 그러나 편집 작업 메서드가 "편집"보기를 렌더링 할 때보기는 예상대로 나타나지만 없이 tinyMCE 편집기가 나타납니다.

FireBug에 오류가 나타나지 않아서 IE에서 똑같은 동작을합니다.

$ ("# tabs"). tabs() 줄을 제거하려고 시도했지만 아무런 차이가 없습니다.

답변

1

그것은이 라인에 관련이있을 수 있습니다 : 문제가 편집보기에

script_url: '../../Scripts/tiny_mce/tiny_mce.js', 

때문에, 어쩌면 여분의 매개 변수는 폴더 구조로 한 단계를 추가합니다.

왜 시도하지 않습니다 속임수를 썼는지

script_url: '/Scripts/tiny_mce/tiny_mce.js', 
+0

감사 에두아르도. –