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

Delete doesn't fire OnClientSelectionChange

3 Answers 87 Views
Editor
This is a migrated thread and some comments may be shown as answers.
QualiWareUA
Top achievements
Rank 1
QualiWareUA asked on 30 Jul 2008, 08:42 AM
I'm using OnClientSelectionChange event to enable/disable custom tool buttons. It works fine with one exception: when I select some piece of text in editor and press "Delete" key - selected text is deleted but OnClientSelectionChange event is not fired. The same is with "Backspace" key.

Described behaviour can be reproduced using http://soforealproductions.se/ajax/Editor/Examples/ClientsideEvents/DefaultVB.aspx sample. Select some text, press "Delete" and inspect the content of The current selection is field which is updated by OnClientSelectionChange event handler.

P.S. My browser is IE7.

3 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 30 Jul 2008, 01:47 PM
Hi Valeriy,

I was not able to reproduce the reported problem. I just replaced the getSelectionHtml method with get_html(true) in the OnClientSelectionChange function

function OnClientSelectionChange(editor, args)
{
   contentViewer.innerHTML = editor.get_html(true);
}

and I verified that the Delete and BackSpace keys events are fired when the OnClientSelectionChange event is executed. You can see my test in the attached video. Am I missing something?

Kind regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
QualiWareUA
Top achievements
Rank 1
answered on 31 Jul 2008, 07:35 AM
Hi Rumen,

Thank you for quick reply.
You are right, Delete and Backspace keys fires OnClientSelectionChange events but only when there is no text selected. If I select some text and then press Delete, Backspace or other key generating printable character (i.e. that replace selected text with some character) - event is not fired.

I'll try to use OnKeyDown event to track selection changes more precisely in addition to OnClientSelectionChange.
0
QualiWareUA
Top achievements
Rank 1
answered on 31 Jul 2008, 01:47 PM
Solved my problem using OnKeyUp event. OnKeyDown turned out to be not suitable because it occurs before selection changes in editor.
In addition I used editor.get_toolAdapter().get_toolbarHolder().set_show method to register event handler that updates toolbar button state when editor gets focus because toolbar mode is set to "ShowOnFocus" and toolbar is created when editor gets focus for the first time.
Tags
Editor
Asked by
QualiWareUA
Top achievements
Rank 1
Answers by
Rumen
Telerik team
QualiWareUA
Top achievements
Rank 1
Share this question
or