1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Generic Content to remain in Edit Mode?

Generic Content to remain in Edit Mode?

3 posts, 0 answered
  1. Scott Harrington
    Scott Harrington avatar
    28 posts
    Registered:
    21 Sep 2009
    16 Oct 2009
    Link to this post
    Ok, this would be absolutely awesome if the Generic Content Control could remain in edit mode, even when the page is NOT in edit mode.  This would be kind of a high level editor for our admins to use.  I suppose it doesn't have to be a Generic Content Control, but we need the capabilities to add both images, videos, and text formating so the GC Control is kind of fitting.  Any ideas on how to accomplish this with any controls or with the Generic Content Control.  Thanks - as always!
  2. Scott Harrington
    Scott Harrington avatar
    28 posts
    Registered:
    21 Sep 2009
    16 Oct 2009
    Link to this post
    I figured this one out, just use the RadEditor and use the following configurations:

                    <telerik:RadEditor AllowScripts="true" EditModes="All" StripFormattingOnPaste="None" 
                        runat="server" ContentAreaCssFile="~/Sitefinity/Admin/Themes/Default/AjaxControlsSkins/Sitefinity/EditorContentArea.css" 
                        ToolsFile="~/Sitefinity/Admin/ControlTemplates/EditorToolsFile.xml" Skin="WebBlue" 
                        Width="631px">  
                        <Content> 
                                    <b>Setting inline properties</b> 
                        </Content> 
                        <CssFiles> 
                            <telerik:EditorCssFile Value="~/Sitefinity/Admin/Themes/Default/AjaxControlsSkins/Sitefinity/EditorCssFile.css" /> 
                        </CssFiles> 
                    </telerik:RadEditor> 

    Now my question is how to wire up the ImageManager, DocumentManager, and VideoManager to the sitefinity Database.  I know there are settings for these, but I don't know what to set them too? Thanks
  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    17 Oct 2009
    Link to this post
    Hi Scott Harrington,

    You can use the logic below:

    <telerik:RadEditor
               runat="server"
               ID="editor"
               ToolsFile="YOUR PATH HERE"
               EnableEmbeddedSkins="True"
               Skin="Default"
               DialogsCssFile ="~/Sitefinity/Admin/Themes/Default/AjaxControlsSkins/Sitefinity/EditorDialogs.css"
               Width="95%"
               EditModes="Design,Html">  
               <CssFiles>
                   <telerik:EditorCssFile Value="YOUR CSS PATH HERE" />
               </CssFiles>                         
           </telerik:RadEditor>
    <script type="text/javascript">
    Telerik.Web.UI.Editor.CommandList["LibraryImageManager"] = function(commandName, editor, args)
        {
           var editorArgs = editor.getSelectedElement();
           if (!editorArgs.nodeName || typeof(editorArgs.nodeName) == "undefined" || editorArgs.nodeName != "A")
                editorArgs = editor.getSelection();
          
           var myCallbackFunction = function(sender, args)
           {
                if (typeof(editorArgs.nodeName) != "undefined" && editorArgs.nodeName == "IMG")
                    args.parentNode.replaceChild(editorArgs, args);
                else
                {
                    var cloned = args.cloneNode(true);
                    var div = args.ownerDocument.createElement("DIV");
                    div.appendChild(cloned);
                    editorArgs.pasteHtml(div.innerHTML);
                }
           }
           editor.showExternalDialog(
           '<%= ((Telerik.Cms.Web.CmsPageBase)Page).ResolveCmsUrl("~/Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx") %>',
           editorArgs,
           750,
           600,
           myCallbackFunction,
           null,
           'ImageLibraryDialog',
           true,
           Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
           false,
           true)
        };
       
        Telerik.Web.UI.Editor.CommandList["LibraryDocumentManager"] = function(commandName, editor, args)
        {
           var editorArgs = editor.getSelectedElement();
           if (!editorArgs.nodeName || typeof(editorArgs.nodeName) == "undefined" || editorArgs.nodeName != "A")
                editorArgs = editor.getSelection();
          
           var myCallbackFunction = function(sender, args)
           {
                if (typeof(editorArgs.nodeName) != "undefined" && editorArgs.nodeName == "A")
                    args.parentNode.replaceChild(editorArgs, args);
                else
                {
                    var cloned = args.cloneNode(true);
                    var div = args.ownerDocument.createElement("DIV");
                    div.appendChild(cloned);
                    editorArgs.pasteHtml(div.innerHTML);
                }
           }
           editor.showExternalDialog(
           '<%= ((Telerik.Cms.Web.CmsPageBase)Page).ResolveCmsUrl("~/Sitefinity/UserControls/Dialogs/DocumentEditorDialog.aspx") %>',
           editorArgs,
           750,
           600,
           myCallbackFunction,
           null,
           'ImageLibraryDialog',
           false,
           Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
           false,
           true)
        };

        Telerik.Web.UI.Editor.CommandList["LinkManager"] = function(commandName, editor, args)
        {
           var editorArgs = editor.getSelectedElement();
           if (!editorArgs.nodeName || typeof(editorArgs.nodeName) == "undefined" || editorArgs.nodeName != "A")
           {                                                                  
                var sel = editor.getSelection(); 
                editorArgs = sel;
                editorArgs.Html = sel.getHtml();
                editorArgs.Text = sel.getText();                                   
           }
          
           var myCallbackFunction = function(sender, args)
           {
                if (typeof(editorArgs.nodeName) != "undefined" && editorArgs.nodeName == "A")
                    args.parentNode.replaceChild(editorArgs, args);
                else
                {
                    var cloned = args.cloneNode(true);
                    var div = args.ownerDocument.createElement("DIV");
                    div.appendChild(cloned);
                    editorArgs.pasteHtml(div.innerHTML);
                }
           }
           editor.showExternalDialog(
           '<%= ((Telerik.Cms.Web.CmsPageBase)Page).ResolveCmsUrl("~/Sitefinity/UserControls/Dialogs/LinksDialog.aspx") %>',
           editorArgs,
           750,
           600,
           myCallbackFunction,
           null,
           'ImageLibraryDialog',
           false,
           Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
           false,
           true)
        };
       
        Telerik.Web.UI.Editor.CommandList["SetLinkProperties"] = function(commandName, editor, args)
        {
           var editorArgs = editor.getSelectedElement();
           if (!editorArgs.nodeName || typeof(editorArgs.nodeName) == "undefined" || editorArgs.nodeName != "A")
                editorArgs = editor.getSelection();
          
           var myCallbackFunction = function(sender, args)
           {
                if (typeof(editorArgs.nodeName) != "undefined" && editorArgs.nodeName == "A")
                    args.parentNode.replaceChild(editorArgs, args);
                else
                {
                    var cloned = args.cloneNode(true);
                    var div = args.ownerDocument.createElement("DIV");
                    div.appendChild(cloned);
                    editorArgs.pasteHtml(div.innerHTML);
                }
           }
           editor.showExternalDialog(
           '<%= ((Telerik.Cms.Web.CmsPageBase)Page).ResolveCmsUrl("~/Sitefinity/UserControls/Dialogs/LinksDialog.aspx") %>',
           editorArgs,
           750,
           600,
           myCallbackFunction,
           null,
           'ImageLibraryDialog',
           false,
           Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
           false,
           true)
        };
        var oldFunction = Telerik.Web.UI.Editor.CommandList["ToggleScreenMode"]; //save the original Paste function
    </script>



    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
3 posts, 0 answered