Sitefinity ASP.NET CMS - Content Management System

Support Forum Thread

Home >  Support >  Forums home > Sitefinity 3.x > Bugs & Issues > Insert Link Text Overwrites Existing Selected Content

Reply
JenF, 7/22/2008 4:28:59 PM
When inserting hyperlinks or document links, we generally type all our content in the Generic Editor and then highlight the text that we want to be used as link text and then click on the hyperlink or document manager buttons.

In version 3.2, however, I have noticed that the insert link dialog boxes have a field for Link Text and this seems to default to either the page title or document filename.

The field does NOT pickup the text that was highlighted before clicking on the link manager button and anything that is placed in that field (either intentionally or more likely, unintentionally) will overwrite the previously highlighted content.

It is disruptive to interrupt the flow of content creation to insert link text with the link manager so we prefer to type all content first before inserting links.

How can we modify the link and document manager buttons so that if text is selected in the content editor, it will automatically be displayed in the link text field? Failing that, how do we stop that field from automatically generating link text based on page titles or doc names so that the selected text will not be overwritten?

Thanks,
Jennifer

Reply
, 7/24/2008 9:17:31 AM
Hi Jen,

Thank you for contacting us.

I tested this behavior on Sitefinity 3.2. SP2 Hotfix 1616 and I could not reproduce it. I highlighted some text, then I clicked the link manager and the highlighted text appeared in the dialog. If you are not using our latest release with the hotfix, I would urge you to upgrade your project.

On the other hand, is this behavior on a specific browser, or can you replicate it with all browsers?

You may also consider returning the original RadEditor's Link Manager dialog, in case you use version 3.2SP1 or above. To do this, delete these lines of code from the template where you use the editor:

Telerik.Web.UI.Editor.CommandList["LinkManager"] = 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"
            editor.get_Document().replaceChild(editorArgs, args); 
        else 
        { 
            var cloned = args.cloneNode(true); 
            var div = args.ownerDocument.createElement("DIV"); 
            div.appendChild(cloned); 
            editorArgs.pasteHtml(div.innerHTML); 
        } 
   } 
   editor.showExternalDialog( 
   '<%= Page.ResolveUrl("~/Sitefinity/UserControls/Dialogs/LinksDialog.aspx") %>'
   editorArgs,  
   750,  
   600,  
   myCallbackFunction,  
   null,  
   'ImageLibraryDialog',  
   false,  
   Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,  
   false,  
   false
}; 
 
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"
            editor.get_Document().replaceChild(editorArgs, args); 
        else 
        { 
            var cloned = args.cloneNode(true); 
            var div = args.ownerDocument.createElement("DIV"); 
            div.appendChild(cloned); 
            editorArgs.pasteHtml(div.innerHTML); 
        } 
   } 
   editor.showExternalDialog( 
   '<%= Page.ResolveUrl("~/Sitefinity/UserControls/Dialogs/LinksDialog.aspx") %>'
   editorArgs,  
   750,  
   600,  
   myCallbackFunction,  
   null,  
   'ImageLibraryDialog',  
   false,  
   Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,  
   false,  
   false
}; 
 

Such a template is, for example, ControlPanelInsert.ascx, located in \[YourProject]\Sitefinity\Admin\ControlTemplates\Generic_Content. This template is used in Generic Content, when you create new items. The same could be done for the rest of the modules that use the RadEditor.

All the best,
Georgi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center

Reply
JenF, 7/29/2008 12:17:44 PM

Hello,

Thanks for the followup.

I confirmed that we are using Sitefinity 3.2 SP 2 Hotfix 1616.

It does appear to be browser-specific as I am experiencing the problem with Internet Explorer 6.0 SP2. However, it is NOT an issue with Firefox 2 or 3.

I welcome any suggestion you may have to resolve this issue in IE6. (Please note that IE6 is our corporate standard so upgrading to IE7 is not currently an option.)

Thank you,
Jennifer


Reply
, 7/31/2008 5:36:36 AM
Hello JenF,

Actually this is a known issue. It is already fixed and will be available for the next release. In case you need it now you can find in the attachment an archive with all the templates which need changes. Note that you will have to overwrite all the templates which are using the RadEditor in order to overcome the issue. You would also need to overwrite the template for the links manager template which is located under ~/Sitefinity/Admin/ControlTemplates/Pages/Dialogs - LinksEditorDialog.ascx.

Hope it helps.

Kind regards,
Vassil Daskalov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.