Editor generates target and re_target properties in links

17 posts, 0 answers
  1. Jamie
    Jamie avatar
    12 posts
    Member since:
    Aug 2010

    Posted 07 Apr 2011 Link to this post

    I'm working with the rad editor and have found that a link such as this:
    <a href="#Download">Download Source</a>

    will sometimes get changed to this:
    <a target="_blank" re_target="null" href="#Download">Download Source</a>

    I have no idea what is causing this to happen, but we work with the rad editor extensively and have found that about one out of every hundred documents containing links will randomly generate the above target and re_target properties. This causes all of the links to open in new windows.

    I want to know if anyone has insight on this issue or even knows what causes it. This error is seemingly random and I have NOT been able to replicate it with hundreds of attempts. We create a large amount of different documents with the SAME links and some of them get these values generated for them.

    One thing I did notice is that when switching from HTML view with the generated properties to PREVIEW and then back to HTML would most of the time clear the properties as if they were never there.

    Any help is appreciated, thanks.
  2. Jamie
    Jamie avatar
    12 posts
    Member since:
    Aug 2010

    Posted 08 Apr 2011 Link to this post

    Bump.
    Anyone?
  3. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 11 Apr 2011 Link to this post

    Hi Jamie,

    We are not aware of this problem and you are the first one to report it. I tried to reproduce it locally but to no avail. To able to provide assistance on this issue we will need to be able to observe and debug it locally. Could you please provide more detailed information on the specific scenario?
    • Which version of RadControls for ASP.NET AJAX and .NET Framework are used in the application?
    • Under which browser and its version the problem occurs?
    • Could you please provide the exact RadEditor's configuration with all the customizations applied to it so we can examine it further?

    On a side note, re_target attribute is used to store the original target attribute's value when switching to preview mode.

    All the best,
    Dobromir
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  4. Jamie
    Jamie avatar
    12 posts
    Member since:
    Aug 2010

    Posted 11 Apr 2011 Link to this post

    I am currently using version 2010.3.1317.0 of Telerik with .NET 4.0. The error seems to have occurred in the following browsers: Firefox 3.5, Google Chrome, IE 8 which leads me to believe that it is not browser specific.

    Our rad editor looks like this:
    <telerik:RadEditor ID="ContentEditor" runat="server" EnableResize="True" Height="500px"
        Width="100%" AllowScripts="False" ToolsFile="/_Config/ContentProductionEditorTools.xml"
        TemplateManager-ViewPaths="/Templates" TemplateManager-UploadPaths="/Templates">
        <CssFiles>
            <telerik:EditorCssFile Value="/_Styles/CodeBox.css" />
        </CssFiles>
     
        <Content>
        </Content>
        <ImageManager MaxUploadFileSize="20971520" />
        <DocumentManager MaxUploadFileSize="20971520" />
        <FlashManager MaxUploadFileSize="20971520" />
        <TemplateManager UploadPaths="/Templates" ViewPaths="/Templates" />
    </telerik:RadEditor>
    

    The tools file config looks like this:
    <root>
     
     <tools name="MainToolbar" dockable="true" enabled="true" DockingZone="Left">
      <tool name="ImageManager" />
      <tool name="DocumentManager" />
      <tool name="TemplateManager" />
      <tool name="FormatCodeBlock" />
      
     </tools>
     
     <tools>
      <tool name="LinkManager" ShortCut="CTRL+K" />
      <tool name="Unlink" ShortCut="CTRL+SHIFT+K" />
      <tool separator="true"/>
      <tool name="AjaxSpellCheck" />
      <tool name="FormatStripper" />
      <tool name="XhtmlValidator" />
      <tool name="FindAndReplace" ShortCut="CTRL+F" />
      <tool name="SelectAll" ShortCut="CTRL+A" />
      <tool name="Cut" />
      <tool name="Copy" ShortCut="CTRL+C" />
      <tool name="Paste" ShortCut="CTRL+V" />
      <tool name="PasteStrip" />
      <tool separator="true"/>
      <tool name="Undo" ShortCut="CTRL+Z" />
      <tool name="Redo" ShortCut="CTRL+Y" />
     </tools>
     
     <tools>
      <tool name="InsertTableLight" ShortCut="CTRL+ALT+T" />
      <tool name="InsertFormElement" />
      <tool name="InsertSymbol" />
      <tool name="InsertSnippet" />
      
     </tools>
     
     <tools name="FormatToolbar" dockable="true" enabled="true">
      <tool name="ApplyClass" />
      <tool name="Bold" ShortCut="CTRL+B" />
      <tool name="Italic" ShortCut="CTRL+I" />
      <tool name="Underline" ShortCut="CTRL+U" />
      <tool name="StrikeThrough" />
      <tool separator="true"/>
      <tool name="FormatBlock" />
      <tool separator="true"/>
      <tool name="JustifyLeft" />
      <tool name="JustifyCenter" />
      <tool name="JustifyRight" />
      <tool name="JustifyFull" />
      <tool name="JustifyNone" />
      <tool separator="true"/>
      <tool name="Indent" />
      <tool name="Outdent" />
      <tool separator="true"/>
      <tool name="InsertOrderedList" />
      <tool name="InsertUnorderedList" />
      <tool separator="true"/>
      <tool name="ModuleManager" />
      <tool name="ToggleScreenMode" />
      <tool name="Zoom" />
     </tools>
     
     <modules>
      <module name="RadEditorStatistics" Visible="false" Enabled="true" />
      <module name="RadEditorDomInspector" Visible="false" Enabled="true" />
      <module name="RadEditorNodeInspector" Visible="false" Enabled="true" />
      <module name="RadEditorHtmlInspector" Visible="false" Enabled="true" />
     </modules>
     
     <snippets>
     
      <!--<snippet name="Tutorial Outline">
       <![CDATA[
     
        ]]>
      </snippet>-->
     
     </snippets>
     
    </root>

    We have some snippets in our rad editor config but I have removed them in the above code snippet due to security reasons. As I have said, the error seems very hard to replicate but it definitely occurs. I will be working to replicate this as well and post any of my findings here.

    Thanks for the feedback so far,

    -Jamie
  5. Jamie
    Jamie avatar
    12 posts
    Member since:
    Aug 2010

    Posted 13 Apr 2011 Link to this post

    bump
  6. Jamie
    Jamie avatar
    12 posts
    Member since:
    Aug 2010

    Posted 13 Apr 2011 Link to this post

    Another interesting thought about this issue. You mentioned that the preview button could cause some of these values to be changed. It just occurred to me that we are actually taking the content of the radeditor and saving it into a database while in preview mode in some cases. Then, we take the value in the database and load it back into the rad editor. I immediately thought that this could be causing it, but upon a closer inspection I was still unable to reproduce the error. Even when the editor is in preview mode I still cannot cause these targets to be generated =/

    Just another thought, I hope that I can reproduce this error soon. Until then any input is appreciated.

    Thanks,

    Jamie
  7. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 14 Apr 2011 Link to this post

    Hi Jamie,

    The provided RadEditor's configuration looks OK. To be able to provide more-to-the-point answer we will need reliable steps to reproduce the problem.

    In addition, do you apply any modifications to the content (server- or client-side) before saving it?

    Regards,
    Dobromir
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  8. Jamie
    Jamie avatar
    12 posts
    Member since:
    Aug 2010

    Posted 14 Apr 2011 Link to this post

    We do not do anything to the content before saving it. We use this code:
    string strContentBody = ContentEditor.Content;
    
    to get the content, then insert strContentBody into our database. Is there any more insight you can give me as to how the re_target property is actually generated?

    Edit: Forgot to mention that I have still not been able to replicate this, but I strongly believe it has something to do with storing the content of the editor in the database while in preview mode.
  9. Dan Ehrmann
    Dan Ehrmann avatar
    165 posts
    Member since:
    Jul 2004

    Posted 15 Apr 2011 Link to this post

    Jamie -

    thought you may be interested - I also saw some 're-target' properties while researching a different problem - started a new thread - http://www.telerik.com/community/forums/aspnet-ajax/editor/anchors-and-preview-mode.aspx
  10. Jamie
    Jamie avatar
    2 posts
    Member since:
    Apr 2011

    Posted 15 Apr 2011 Link to this post

    Thanks, I'll post anything I find on here as well. But still can't replicate the bug =/
    However, we did notice that content with this code could sometimes be cleaned up simply by going to html -> preview -> html and then being saved again. It seems that this is not always the case as sometimes I have to manually clear out all of the target properties though.
  11. Dan Ehrmann
    Dan Ehrmann avatar
    165 posts
    Member since:
    Jul 2004

    Posted 16 Apr 2011 Link to this post

    I was able to reproduce the 're_target' problem by saving to the db while in preview mode
  12. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 18 Apr 2011 Link to this post

    Hi guys,

    Are you able to reproduce the problem on the live demos? If so, could you please provide the exact steps that need to be executed, if not could you try to upgrade to the latest version of RadControls for ASP.NET AJAX (currently Q1 2011 SP1) and see if the problem still occurs?

    Regarding the re_target attribute, this attribute is applied to the links when RadEditor is set to preview mode. When RadEditor's mode is changed to preview, the control applies to all the link in the content target attribute with value _blank to ensure that clicking on the link will open it in a new window. The original value of the target attribute is stored in the re_target attribute.

    All the best,
    Dobromir
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  13. Jamie
    Jamie avatar
    2 posts
    Member since:
    Apr 2011

    Posted 18 Apr 2011 Link to this post

    Dan,

    I was trying to get this re_target to generate and have been going to HTML, adding the following link:
    <a href="#Download">Download Source</a>

    Then, switching to preview mode. I have a button when clicked that grabs the content from the radeditor and stores it in a string. However, the string is always the same as my links. I was just wondering how exactly you were able to replicate it because I cannot seem to find a point where the re_targets get added.


    Dobromir,

    I believe that is exactly what is causing this issue. While in preview mode the changed links are getting stored into our DB, and then when reloaded from the DB are never cleared or fixed. However, as I have said before I still haven't been able to actually find a point when the content of the rad editor is returning links with the target properties. It seems that it doesn't always happen, i.e. sometimes while in preview mode the links are exactly the way they should be when I grab the 'Content' property of the rad editor.
  14. Dan Ehrmann
    Dan Ehrmann avatar
    165 posts
    Member since:
    Jul 2004

    Posted 18 Apr 2011 Link to this post

    I didn't do anything other than click my save button while in preview mode
  15. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 21 Apr 2011 Link to this post

    Hi guys,

    Could you please verify that you are using the latest version of RadControls for ASP.NET AJAX. If so, could you please provide a a video demonstrating the exact steps reproducing this problem along with the sample page.

    We are still unable to reproduce this problem locally, and in order to be able to pinpoint the source of the issue we will need to examine it and debug it on our side.

    At this point, the only possible workaround for this issue that I can suggest is to disable the Preview Mode. You can do this by setting the RadEditor's EditModes to Design and Html only, e.g.:
    <telerik:RadEditor id="RadEditor1" runat="server" EditModes="Design,Html">
    </telerik:RadEditor>


    Greetings,
    Dobromir
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  16. Dan Ehrmann
    Dan Ehrmann avatar
    165 posts
    Member since:
    Jul 2004

    Posted 21 Apr 2011 Link to this post

    In my thread, Rumen posted a script which seems to have resolved my problem - I think it applies here  as well
  17. Laird Rixford
    Laird Rixford avatar
    5 posts
    Member since:
    Aug 2005

    Posted 18 Jan 2013 Link to this post

    Solved this by switching off of Preview Mode right before the save:
    <script type="text/javascript">
        function clearPreviewMode() {
            var editor = $find("<%=RadEditor1.ClientID%>");
            if (editor.get_mode() == 4) {
                editor.set_mode(2);
            }
        }
    </script>

    And wiring up to the OnClientClick event of the save button.
    <asp:button id="btnSave" runat="server" Text="Save Content" OnClientClick="clearPreviewMode();"></asp:button
Back to Top