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

Selection is lost if custom toolbar button has showtext=true

6 Answers 76 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Truong Hong Thi
Top achievements
Rank 1
Truong Hong Thi asked on 10 Jun 2010, 06:12 AM
I use RadEditor list for MOSS2007, and add a custom button with showtext=true. This button open a custom dialog. However, every time the button is clicked, editor's selection is lost (focus returns to beginning of text). This does not happen if showtext is false.

Is there a way to show button text but keep selection intact when button is clicked?

6 Answers, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 10 Jun 2010, 11:19 AM
Hello Truong,

Could you confirm, which version of RadEditor for MOSS are you using? Is it the Lite version of RadEditor for MOSS 4.x or the Full ASP.NET AJAX (5.x) version of the control? In addition please provide me with the javascript code for the custom button.

Thank you.

Regards,
Stanimir
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Truong Hong Thi
Top achievements
Rank 1
answered on 10 Jun 2010, 01:36 PM
I use the lite (free) version.

ListToolsFile.xml
<tools name="EnhancedToolbar" dockable="false" enabled="true">
....
    <tool name="Attach File"
        shortcut ="CTRL+K"
        showtext="true"
        iconurl="/_wpresources/RadEditorSharePoint/4.5.6.0__1f131a624888eeed/RadControls/Editor/Skins/Default2006/buttons/DocumentManager.gif" />
....

MOSSEditorTools.js
RadEditorCommandList["Attach File"] = function(commandName, editor, oTool)
{
    Copy the whole stuff from MOSSImageManager function.
}

Steps:
1. From any list view, click "New" to create a new list item (NewForm.aspx)
2. Type some dummy text into the RadEditor
3. Use mouse to select some text
4. Click "Attach File" button. Please note that you should click on the text portion of the button, not the icon portion.
5. Drag the popup dialog away to see the RadEditor behind, notice that the selection is lost -> this makes the link always be inserted at the beginning of the RTE.
It does not happen if showtext is false (as it does not happen with MOSSLinkManager).
0
Stanimir
Telerik team
answered on 14 Jun 2010, 11:52 AM
Hi Truong,

Check if adding the following javascript code in the beginning of your method will solve the problem:

if (window.RadControlsNamespace.Browser.IsIE && document.documentMode) editor.SetFocus();



Kind regards,
Stanimir
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Truong Hong Thi
Top achievements
Rank 1
answered on 14 Jun 2010, 12:09 PM
No, I already tried it with no luck. This seems not an IE8 problem, nor a focusing one. It happens on IE6, IE7 as well.
As far as I can see, the selection is lost at the moment you click the text portion of the button, before any JavaScript is fired. As a result, there seems to be no easy way to restore the selection. The link is always inserted at the beginning of the text.

Seems that I should use an icon-only button.
0
Nate
Top achievements
Rank 1
answered on 21 Oct 2010, 11:18 PM
for me, I am using the full version of MOSS editor on a wss3 instance.
version:  5.8.0.0__1f131a624888eeed
this for example does not work.
<tool name="EmbedYouTubeVideo" iconurl="/_wpresources/RadEditorSharePoint/5.8.0.0__1f131a624888eeed/Resources/ToolImages/YTICON.gif" />
However, if I remove the iconurl property it does work. Meaning that with the iconurl property the js function for that menu item will not run but if I remove the iconurl property it works fine.

Any help would be great. Thanks.


0
Stanimir
Telerik team
answered on 22 Oct 2010, 11:54 AM
Hi Nate,

Remove the following property from the custom tool: iconurl="/_wpresources/RadEditorSharePoint/5.8.0.0__1f131a624888eeed/Resources/ToolImages/YTICON.gif"

Review the following online help article. There is explained how to set the icon for a custom button: http://www.telerik.com/help/aspnet-ajax/add_custom_buttons.html

All the best,
Stanimir
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
WebParts for SharePoint
Asked by
Truong Hong Thi
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Truong Hong Thi
Top achievements
Rank 1
Nate
Top achievements
Rank 1
Share this question
or