Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Robert J. Bullock 386 posts 405 karma points
    Feb 02, 2010 @ 23:46
    Robert J. Bullock
    1

    Use Umbraco TinyMCE Editor in Custom Page

    How can I use the Umbraco TinyMCE editor in my own custom asp.net page? I can't see to get it to work. 

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Feb 03, 2010 @ 00:00
    Jan Skovgaard
    0

    Hi

    You need to download the tinymce script from here http://tinymce.moxiecode.com/

    You can see examples on how to set it up here: http://tinymce.moxiecode.com/examples/full.php

    Hope this is what you're looking for.

    /Jan

  • Robert J. Bullock 386 posts 405 karma points
    Feb 03, 2010 @ 02:27
    Robert J. Bullock
    0

    Jan, well, I know I can do that. I mean use the Umbraco UI control specifically rather than duplicate functionality that's already there.

  • Rik Helsen 670 posts 873 karma points
    Feb 03, 2010 @ 15:39
    Rik Helsen
    0

    please elaborate ?

    create a datatype with the tinymce editor associated, then a document type that uses it, then a page template for the document type, and there you have a "custom" page that holds an editor ?

  • Robert J. Bullock 386 posts 405 karma points
    Feb 03, 2010 @ 16:55
    Robert J. Bullock
    1

    Rik, by "custom page", I mean an asp.net page I'm adding to Umbraco. Anyway, I kind of figured it out:

    <%@ Register TagPrefix="umb1" Namespace="umbraco.editorControls.tinyMCE3.webcontrol" Assembly="umbraco.editorControls" %>

    ....

    <umb1:TinyMCEWebControl runat="server" ID="tinymce1" Rows="8" Columns="50" Height="300"  Text='<%# Bind("description") %>'  />

    The only thing is the toolbar shows up below the text field and I'm not sure how to configure the buttons...

  • Miguel Feliciano 1 post 22 karma points
    Mar 12, 2010 @ 17:45
    Miguel Feliciano
    1

    Robert,

    I've added the control just you have it in your post and the control is not rendering in the custom edit page.  On the code-behind I set the Text property to the data in the DB and still nothing.

    Can you provide some code on how you added the control and what the code is on the cs file?

     

    I just got the custom section working and I need to have the ability to edit html so that I can consume the html from various pages.  This html needs to be content managed so that the end user can make the changes.  I don't want to use an XSLT b/c the end user should not have access to the XSLT.

     

    Any other solution would be appreciated.

  • Daniel Draper 36 posts 57 karma points
    Apr 23, 2010 @ 04:04
    Daniel Draper
    0

    I would like to re-open this thread. There doesn't seem to be a solution to using TinyMCE in a custom administration section as it would be seen in the content section.

    The toolbar ends up underneath the editor. Has anyone resolved this?

  • Daniel Draper 36 posts 57 karma points
    Apr 25, 2010 @ 12:33
    Daniel Draper
    0

    So no one has implemented TinyMCE adding the toolbar to the top of the page? Seems like no one has actually intergrated anything useful into umbraco on a large scale?

  • Marc Love (uSkinned.net) 431 posts 1669 karma points
    May 10, 2010 @ 12:58
    Marc Love (uSkinned.net)
    0

    Hi Daniel,

    Have you found a solution to this? I have created a custom Company Database and I am trying to integrate tinymce into the edit company interface. I have managed to add the standard tinymce as shown in this screenshot but it would be better if I could use the Umbraco version so that I can have access to the Umbraco Media Library.

    http://www.marclove.co.uk/stuff/SupplierDatabase.png

     

    Cheers,

     

    Marc

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    May 10, 2010 @ 13:24
    Jeroen Breuer
    0

    Hi Daniel and Marc,

    Check my last post on this topic: http://our.umbraco.org/forum/developers/extending-umbraco/6863-Datatype-on-normal-page-or-UserControl. Here I explain how the TinyMCE editor can be used on a custom page. It's a bit tricky but it works!

    Jeroen

  • Marc Love (uSkinned.net) 431 posts 1669 karma points
    May 10, 2010 @ 13:58
    Marc Love (uSkinned.net)
    0

    Cheers Jeroen, I will give this a go.

  • Aximili 177 posts 278 karma points
    Oct 04, 2011 @ 08:02
    Aximili
    0

    I was struggling with this too. I couldn't find any straightforward and simple answer. The solution is only a simple function. Here it is.

    In .ascx file:

    <asp:PlaceHolder ID="phLongDesc" runat="server"></asp:PlaceHolder>

    In .cs file:

    using umbraco.uicontrols;
    using umbraco.editorControls.tinyMCE3;
      private TinyMCE txtLongDesc;

      protected void Page_Init(object sender, EventArgs e)
      {
        TabPage tabProducts = (TabPage)Web.FindControlRecursive(this.Page.Master, "dashboardTabs_tab01layer"); // The tab in Umbraco custom section
        PutTinyMce(ref txtLongDesc, "txtLongDesc", phLongDesc, tabProducts);
      }

      /// <summary>
      /// Adds/puts a TinyMCE control onto the page.
      /// </summary>
      /// <param name="control">The Umbraco TinyMCE control</param>
      /// <param name="controlId">Whatever you want to name it (eg. txtDescription)</param>
      /// <param name="placeHolder">The PlaceHolder control, in which you want to put this TinyMCE</param>
      /// <param name="tab">The Umbraco tab (custom section) in which menu bar you want to put the TinyMCE controls</param>
      private static void PutTinyMce(ref TinyMCE control, string controlId, PlaceHolder placeHolder, TabPage tab)
      {
        DataTypeDefinition d = DataTypeDefinition.GetDataTypeDefinition(-87); // TinyMCE DataType (could be your own datatype)

        control = (umbraco.editorControls.tinyMCE3.TinyMCE)d.DataType.DataEditor;
        control.ID = controlId;
        placeHolder.Controls.Add(control);
        tab.Menu.NewElement("div", "umbTinymceMenu_" + control.ClientID, "tinymceMenuBar", 0); // Add TinyMCE controls to menu bar
      }

    Hope it helps someone.

  • trfletch 598 posts 604 karma points
    Jan 19, 2012 @ 10:22
    trfletch
    0

    Hi,

    Sorry I know this is an old post but I am trying to do this myself. I have an Umbraco 4.7.1.1 website and I have copied the code above but I am getting and error with the following line:

    TabPage tabProducts = (TabPage)Web.FindControlRecursive(this.Page.Master, "dashboardTabs_tab01layer"); // The tab in Umbraco custom section

    The error is "The name 'Web' does not exist in the current context"

    I have the following references in my code:

    using umbraco.uicontrols;
    using
    umbraco.editorControls.tinyMCE3;
    using
    umbraco.BusinessLogic;
    using
    umbraco.cms.businesslogic;
    using
    umbraco.cms.businesslogic.datatype;

    Does anyone know what I am missing or doing wrong? Would really appreciate any help

    Regards
    Tony

  • Aximili 177 posts 278 karma points
    Jan 19, 2012 @ 23:46
    Aximili
    1

    Hi Tony,

    Sorry that's just a helper function I wrote to find the tab control. Here is the code

      /// <summary>
    /// Finds a Control recursively. Returns the first control that matches, or null if not found.
    /// </summary>
    /// <param name="root">eg. this.Master</param>
    /// <param name="controlId">eg. "txtName"</param>
    /// <returns></returns>
    public static Control FindControlRecursive(Control root, string controlId)
    {
    if (root.ID == controlId)
    return root;

    foreach (Control c in root.Controls)
    {
    Control foundCtrl = FindControlRecursive(c, controlId);
    if (foundCtrl != null)
    return foundCtrl;
    }

    return null;
    }

  • trfletch 598 posts 604 karma points
    Jan 20, 2012 @ 00:32
    trfletch
    0

    Thanks Hardi,

    I have now got this working although I have one other question that I am hoping you or someone else may be able to answer. Is it possible for me to add extra plugins to this Rich Text Editor but not affect the default Rich Text Editors in the rest of the site? For example if I wanted to use the legacyoutput plugin just for this one control?

    I tried adding the following into the code but it doesn't seem to have had any effect, when I look at the source of the RTE in Umbraco it just shows all the plugins that Umbraco adds and does not add my extra one to it. Any ideas?

    This is what I tried adding just before control.ID = controlid:

    control.Plugins = legacyoutput";

     

  • trfletch 598 posts 604 karma points
    Jan 20, 2012 @ 00:41
    trfletch
    0

    Another thing that I might like to be able to do is remove plugins, for example remove the Styles dropdown from the toolbar which I assume is related to the umbracocss plugin?

  • Aximili 177 posts 278 karma points
    Jan 20, 2012 @ 01:20
    Aximili
    0

    I'm not quite sure... have you tried creating a new DataType?

  • trfletch 598 posts 604 karma points
    Jan 20, 2012 @ 10:22
    trfletch
    0

    Hi Hardi,

    I haven't tried creating a new Datatype but although doing that may allow me to turn on and off some features it would not allow me to add plugin's like legacyoutput which are not listed as options for the Rich Text Editor in the Umbraco datatypes section. Maybe I need to start a new post on the forum to see if anyone has any ideas about this one.

  • Markus Johansson 1911 posts 5735 karma points MVP c-trib
    Mar 05, 2012 @ 10:02
    Markus Johansson
    0

    Anyone knows how to do this in V5?

  • BJ Patel 80 posts 206 karma points
    Jul 13, 2021 @ 09:55
    BJ Patel
    0

    How Can we do the same in V8 with MVC?

Please Sign in or register to post replies

Write your reply to:

Draft