Re: Error with images

  •  09-28-2012, 2:30 AM

    Re: Error with images

    Sent you a PM where you can test. If you compare the html of the two pages you'll see that they are identical. Latest RTE is used, downloaded it yesterday.

    The code behind looks like this:

    1. [Authorize(Roles = "Administratör,Redaktör,Resultat redaktör")]  
    2. public ActionResult NewsAdd()  
    3. {  
    4.     Editor Editor1 = new Editor(System.Web.HttpContext.Current, "Editor1");  
    5.     Editor1.LoadFormData("Skriv här...");  
    6.     Editor1.MvcInit();  
    7.     ViewBag.Editor = Editor1.MvcGetString();   
    8.     return View();  
    9. }  
    10.   
    11. [Authorize(Roles = "Administratör,Redaktör,Resultat redaktör")]  
    12. public ActionResult TestAdd()  
    13. {  
    14.     Editor Editor1 = new Editor(System.Web.HttpContext.Current, "Editor1");  
    15.     Editor1.LoadFormData("Skriv här...");  
    16.     Editor1.MvcInit();  
    17.     ViewBag.Editor = Editor1.MvcGetString();   
    18.   
    19.     return View();  
    20. }  
     

     

    Other issues:

    1. The design, this is a problem in Cute Editor for ASP.NET as well. It's sensitive to other CSS in the page. I use Zurb Foundation and if I add the editor to page containing that framework all icons get messed up:

     

    2. TinyMCE does a great job integrating with MVC (in all other ways it sucks :)

    You just add this: [UIHint("tinymce_jquery_full"), System.Web.Mvc.AllowHtml] to the "variable" in your class, like this:

    1. [Required]  
    2. Display(Name = "Message")]  
    3. [UIHint("tinymce_jquery_full"), System.Web.Mvc.AllowHtml]  
    4. public string Message { getset; }  
    and in your view:

    1. @Html.EditorFor(m => m.Message)
    and there you have a wysiwyg editor that works like any textfield, you don't have to do anything additional in the code behind to manage the result:

    1. [HttpPost]  
    2.  public ActionResult Edit(News news)  
    3.  {  
    4.      if (ModelState.IsValid)  
    5.      {  
    6.          db.Entry(news).State = EntityState.Modified;  
    7.          db.SaveChanges();  
    8.          return RedirectToAction("Index");  
    9.      }  
    10.      return View(news);  
    11.  }  
    This is something that I would like to see for Rich Text Editor.

View Complete Thread