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

Forums / Set-up & Installation / RadEditor re-writting code

RadEditor re-writting code

7 posts, 0 answered
  1. mexner
    mexner avatar
    98 posts
    Registered:
    06 Apr 2006
    04 Dec 2007
    Link to this post
    Hello, I'm trying to use past some classic ASP code into the generic content control. In the code view, if I type any classic ASP code like: <% some code here %>, it renders the <% as it's html equivalent, & lt ; %.

    I thought by updating the EditorConfigFile, AllowScripts=true would fix the problem, but it is not.

    I know I can make a .net control containing this code, but the client has requested the ability to write their own classic ASP code.

    Any ideas?


    I've made the following changes to the rad-editor....

    ~/Sitefinity/Admin/ControlTemplates/Generic_Content/EditorTemplate.ascx
    1 
    2<radE:RadEditor runat="server" ID="RadEditor1" 
    3    ConfigFile="~/Sitefinity/Admin/ControlTemplates/EditorConfigFile.xml"  
    4    ToolsFile="~/Sitefinity/Admin/ControlTemplates/EditorToolsFile.xml"  
    5    SkinsPath="~/Sitefinity/Admin/Themes/Default/Skins/Editor/" 
    6    Height="460px"  
    7    Width="98%" 
    8    CssFiles="~/css/default.css,~/css/screen.css">  
    9</radE:RadEditor> 
    10 


    ~/Sitefinity/Admin/ControlTemplates/EditorConfigFile.xml
        <property name="ToolsFile">~/Sitefinity/Admin/ControlTemplates/EditorToolsFile.xml</property> 
        <property name="SkinsPath">~/Sitefinity/Admin/Themes/Default/Skins/Editor/</property> 
        <property name="Skin">Sitefinity</property> 
        <property name="AllowCustomColors">true</property> 
        <property name="SaveAsXhtml">false</property> 
        <property name="Width">630px</property> 
        <property name="Height">400px</property> 
        <property name="ToolsHeight">70px</property> 
        <property name="StripAbsoluteImagesPaths">true</property> 
        <property name="StripAbsoluteAnchorPaths">true</property> 
        <property name="ConvertFontToSpan">false</property> 
        <property name="FocusOnLoad">false</property> 
        <property name="AllowThumbGeneration">false</property> 
        <property name="ThumbSuffix">Thumbnail</property> 
        <property name="SaveInFile">false</property> 
        <property name="CausesValidation">true</property> 
        <property name="Editable">true</property> 
        <property name="HasPermission">true</property> 
        <property name="MaxImageSize">204800</property> 
        <property name="MaxFlashSize">102400</property> 
        <property name="MaxMediaSize">5242880</property> 
        <property name="MaxDocumentSize">512000</property> 
        <property name="MaxTemplateSize">204800</property> 
        <property name="ShowHtmlMode">true</property> 
        <property name="ShowPreviewMode">true</property> 
        <property name="ShowSubmitCancelButtons">false</property> 
        <property name="FileEncoding">65001</property> 
        <property name="NewLineBr">true</property> 
        <property name="Language">en-US</property> 
        <property name="AllowScripts">true</property> 
        <property name="CookieExpirationTime">40</property> 
        <property name="UseClassicDialogs">false</property> 
        <property name="EnableHtmlIndentation">true</property> 
        <property name="EnableEnhancedEdit">true</property> 
        <property name="EnableContextMenus">true</property> 
        <property name="EnableClientSerialize">true</property> 
        <property name="EnableTab">true</property> 
        <property name="EnableDocking">false</property> 
        <property name="ConvertTagsToLower">true</property> 
        <property name="ConvertToXhtml">false</property> 
        <property name="StripFormattingOnPaste">None</property> 
        <property name="AnchorPathToStrip"></property> 
        <property name="ImagesPathToStrip"></property> 
        <property name="RadSpellTypeName">Telerik.WebControls.RadSpell, RadSpell.Net2</property> 
        <property name="DialogParametersMode">Javascript</property> 
        <property name="EnableServerSideRendering">true</property> 
        <property name="RenderAsTextArea">false</property> 
        <property name="ToolbarMode">Default</property> 





  2. Rumen
    Rumen avatar
    26 posts
    Registered:
    09 Dec 2016
    04 Dec 2007
    Link to this post
    Hello CHRIS,

    This is an expected behavior. The browser encodes the < and > symbols to their entities, because in other case they will be treated as parts of a tag. You can reproduce the same behavior by pasting the same content in Design view of Visual Studio. After switching to Source view you will see that the < and > symbols are encoded to &lt;and &gt;. This is the only way to display these symbols in design mode by using entities. In other case the browser will treat them as parts of a tag.

    Bes regards,
    Rumen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. mexner
    mexner avatar
    98 posts
    Registered:
    06 Apr 2006
    04 Dec 2007
    Link to this post
    Rumen, thank you for the quick reply.  However, I was writing the code in the 'code-view'.

    Is it possible to write classic ASP code using the generic content editor?
  4. Rumen
    Rumen avatar
    26 posts
    Registered:
    09 Dec 2016
    05 Dec 2007
    Link to this post
    Hi,

    Please, excuse me for my omission!

    Please note that RadEditor is not able to display server controls in Design mode as this is not supported by the browser's Rich Text Editing engine, which RadEditor uses. You can edit only pure HTML, XHTML, Text content and visualize \ render it in Design mode.

    In addition, I tried to reproduce the reported issue with the converted < symbol to &lt; but unfortunately to no avail. I made a test by using the default example of RadEditor by putting the following server tag in Html mode:
    <% some code here %>. I switched to Design and back to Html mode after that and saw that the content is not changed. Could you please provide steps how to reproduce this issue?

    Please also set the ConvertToXhtml property to true and see whether the problem still persist.


    Best regards,
    Rumen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. mexner
    mexner avatar
    98 posts
    Registered:
    06 Apr 2006
    05 Dec 2007
    Link to this post
    Hi Rumen, thanks for the reply. I was not able to reproduce what you are doing. I went to the default example at telerik.com from the link you provided. I clicked on the default radio button for the tools file.

    I then switched to code view by clicking the icon '<>'.  I typed this, " <% my code %>".  I then switched to the design mode by clicking the pencil icon in the lower right hand corner.  It rendered the <% and %>, which I would not expect. I then switched back to the code view, and see that it has convered my <% to &lt;.

    I just need to know if it is possible to write classic ASP in the code view of the Rad Editor. It doesn't appear so with my configuration and the default configuration supplied by the example at telerik.com.

    Thanks,
  6. mexner
    mexner avatar
    98 posts
    Registered:
    06 Apr 2006
    07 Dec 2007
    Link to this post
    bump, hello?
  7. Rumen
    Rumen avatar
    26 posts
    Registered:
    09 Dec 2016
    09 Dec 2007
    Link to this post
    Hi Chris,

    I believe that you are testing the Default Example under Firefox. Am I correct?

    Please, note that RadEditor uses  the rich text editing (RTE) engine of the browser under which it operates. The RTE engine of Internet Explorer does not display the encodes the < and > symbols in the <% my code %> string and the tag is not rendered in this browser.

    However, the RTE engine of Firefox, encodes the < and > symbols and to their HTML entities &lt; and &gt; and the browser renders the server tag in Design mode. You can reproduce this behavior with the Mozilla's demo editor:

    http://www.mozilla.org/editor/midasdemo/

    as well as with our competitor's editors in Firefox.

    If you would like, you can use a content filter that will convert the &lt; and &gt; entities to < and > symbols when the content is submitted your users switch to Html mode in Firefox. Thus the server tags will be saved properly.

    <script type="text/javascript">
    function RadEditorCustomFilter()

        if(!document.all) //if Firefox
        {
           this.GetHtmlContent = function (content)
           { 
              re = /&lt;/gi
              re1 = /&gt;/gi
              newContent = content.replace(re,"<").replace(re1,">");
              return newContent;
           };     
        }
    }
    /* Use the editor onload function to register the filter with the FiltersManager */
    function OnClientLoad (editor)
    {
        var customFilter = new RadEditorCustomFilter();
        editor.FiltersManager.Add(customFilter);
    }
    </script>
    <radE:RadEditor id="RadEditor1" OnClientLoad="OnClientLoad" Html="<% my code %>" Runat="server"></radE:RadEditor>


    All the best,
    Rumen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
7 posts, 0 answered