This is a migrated thread and some comments may be shown as answers.

Retaining selection and position in editor

1 Answer 47 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
frankju
Top achievements
Rank 1
frankju asked on 07 Feb 2008, 08:57 AM
Hi!

I have created a context menu for img elements to provide left and right alignment options for images. I need customized functionality for this because the images are surrounded by a div element (containing a caption), and the alignment shall actually apply to the div. My problem is that after my code has run, the selection of the image is lost, and the scroll position is moved to the top. How can I retain the selection and scroll position? This is my code:

RadEditorCommandList["WCWImageLeft"] = function(commandName, editor, oTool)
{
    var selection = editor.GetSelection();
    var selectedElement = selection.GetParentElement();

    if (selectedElement != null && selectedElement.tagName == "IMG")
    {
        var divElement = selectedElement.parentElement;
            
        if (divElement != null && divElement.tagName == "DIV")
        {
            divElement.className = "floatLeft";
        }
    }
};

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 15 Feb 2008, 02:30 PM
Hi Frank,

I tried to reproduce the reported problem but without success. You can see my test in the attached video. Am I missing something? I provided the test with the following HTML content:

<br /><br /><br /><br /><br /><br /><br />
    <div class="image">
<img src="http://www.telerik.com/demos/aspnet/Prometheus/Editor/Img/productLogo.gif">
<div>CAPTION TEXT</div>
</div>

Could you please open a support ticket and send your HTML content and steps to reproduce the problem so that we can replicate it on our side and try to provide a solution.

Kind regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
WebParts for SharePoint
Asked by
frankju
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or