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

radEditor and Return key

4 Answers 89 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 1
Markus asked on 06 Feb 2009, 02:40 PM
Hello!

When user presses the return key, the focus should be set to the next control (as tab key does) instead of adding a new line. To enter a new line the user should press Shift+Return. How is this possible?

Thanks in advance and regards
Markus Weber

4 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 10 Feb 2009, 03:12 PM
Hi Markus,

I prepared for you and attached a sample example based on the RadEditor's Client Side API.
When pressing the TAB or Enter key you will set the focus on the next control. When pressing Shift+Enter you will insert a new line (a paragraph tag) in the editor.

Feel free to optimize the solution to fit your scenario and requirements.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Markus
Top achievements
Rank 1
answered on 11 Feb 2009, 09:59 AM
Hello Rumen,

thanks for the sample, but on Shift+Return nothing happens. The code will be executed, but this doesn't reault ni a new line. Any ideas?

Regards Markus
0
Rumen
Telerik team
answered on 16 Feb 2009, 08:37 AM
Hi Markus,

I examined the code and found that the reason for the problem is the following check:
if (range.pasteHTML).

To fix it delete the pasteHTML property and keep only the range object, e.g.

if (range)

For your convenience I have attached a video demonstrating my test.

Sincerely,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Markus
Top achievements
Rank 1
answered on 16 Feb 2009, 09:44 AM
Hello Rumen,

now I found the reasion why you can't redo the problem. It happens only if there is no text entered or if the cursor is at the beginning or at the end of a line. I those case no "<P>" will be added.

Regards Markus
Tags
Editor
Asked by
Markus
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Markus
Top achievements
Rank 1
Share this question
or