1. I miss a "Autopostback" property as available for other controls. When user leaves focus I want to fire "TextChanged" event. Did I oversee something?
2. The "AccessKey" property is not working. If I press "Alt+AccessKey" the cursor will not set into the input area of the radeditor. Happens on an easy project seem to be bug for me?
3. Normal you use Tab key to move between controls on page. If there is a radEditor on the page the tab key is used to enter a tabstop. Is it possible to change this behavior or can I set another key to move focus to next control when cursor is inside the radeditor?
2. The "AccessKey" property is not working. If I press "Alt+AccessKey" the cursor will not set into the input area of the radeditor. Happens on an easy project seem to be bug for me?
3. Normal you use Tab key to move between controls on page. If there is a radEditor on the page the tab key is used to enter a tabstop. Is it possible to change this behavior or can I set another key to move focus to next control when cursor is inside the radeditor?
4 Answers, 1 is accepted
0
Hi Markus,
Straight to the points:
Greetings,
Rumen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Straight to the points:
- Could you please, provide more information about your scenario and what you would like to achieve. RadEditor is not a autopostback control. but you can write your own code that will postback the page when the editor's blur event is executed. Here is an example how to fire the blur event of RadEditor "Prometheus" when the focus leaves the editor's content area.
<script type="text/javascript">
function OnClientLoad(editor, args)
{
$telerik.addExternalHandler(editor.get_document().body, "blur", function ()
{
alert("blur was fired");
});
};
</script>
<telerik:RadEditor ID="RadEditor1" runat="server" StripFormattingOptions="NoneSupressCleanMessage" OnClientLoad="OnClientLoad"></telerik:RadEditor>
The blur event is fired when the editor loses focus. - Here is how to attach an accessKey with a shortcut Alt+A to RadEditor:
<script type="text/javascript">
function OnClientLoad(editor, args)
{
var contentArea = editor.get_contentArea(); //get a reference to the content area
contentArea.accessKey = "A";
}
</script>
<telerik:radeditor runat="server" OnClientLoad="OnClientLoad" ID="RadEditor1"></telerik:radeditor> - Here is a workaround that will prevent editor tools and content area from
being recognized as tabstops by the browser:
<script type="text/javascript">
function OnClientLoad(editor, args)
{
var contentArea = editor.get_contentArea(); //get a reference to the content area
contentArea.tabIndex = "-1";
contentArea.tabStop = false;
var buttonsHolder = $get(editor.get_id() + "Top");
var buttons = buttonsHolder.getElementsByTagName("A");
for (var i=0; i< buttons.length; i++)
{
var a = buttons[i];
a.tabIndex = -1;
a.tabStop = false;
}
}
</script>
<asp:Button ID="Button1" runat="server" Text="Button" />
<telerik:radeditor runat="server" OnClientLoad="OnClientLoad" ID="RadEditor1"></telerik:radeditor>
<asp:Button ID="Button2" runat="server" Text="Button" />
Greetings,
Rumen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 1
answered on 14 Apr 2008, 09:11 AM
Hello Rumen,
1. On text change I need to save the content directly to database and do some tother things, so the "AutoPostback" would be exactly the thing I need. Because of database I need server side event.
2. This is working, but I would like to assign the accesskey dynamically on server side. Also possible? By the way I just wonder why there is a proberty and it is not working?
3. This is not what I need, maybe my explanation was no so good. Your code prevents the Editor to get the focus. In my case this is required, but when I press now "Tab" key when the focus is currently on the radEditor content area no tab should be inserted as text, instead I want that cursor moves to next control as ususal for controls.
1. On text change I need to save the content directly to database and do some tother things, so the "AutoPostback" would be exactly the thing I need. Because of database I need server side event.
2. This is working, but I would like to assign the accesskey dynamically on server side. Also possible? By the way I just wonder why there is a proberty and it is not working?
3. This is not what I need, maybe my explanation was no so good. Your code prevents the Editor to get the focus. In my case this is required, but when I press now "Tab" key when the focus is currently on the radEditor content area no tab should be inserted as text, instead I want that cursor moves to next control as ususal for controls.
0
Accepted
Hi Markus,
Straight to the points:
Greetings,
Rumen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Straight to the points:
- As a I wrote in my earlier reply, the editor is not an autopostback control. You should implement your own saving mechanism when the blur event of RadEditor is fired. You can use the provided solution in the editor's Auto Save with Ajax example as a base to achieve your scenario.
- RadEditor is a composite control and the accessKey property is inherited from the base control and it does not apply an accessKey attribute to the editor's content area. For that reason, I provided the javascript solution that applies the accesKey attribute to the content area.
I logged your request in our ToDo list and we will try to implement the accessKey property in one of the upcoming editor's versions. - Thank you for the additional explanation. Please, try the following code:
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<script type="text/javascript">
function OnClientLoad(editor, args)
{
var buttonsHolder = $get(editor.get_id() + "Top");
var buttons = buttonsHolder.getElementsByTagName("A");
for (var i=0; i< buttons.length; i++)
{
var a = buttons[i];
a.tabIndex = -1;
a.tabStop = false;
}
editor.attachEventHandler("onkeydown", function(e)
{
if(e.keyCode == '9')
{
var nextElement = $get('textbox1');
//editor.get_document().body.blur()
window.setTimeout(function()
{
nextElement.focus();
}, 10);
if (!document.all)
{
e.preventDefault();
e.preventBubble();
e.stopPropagation();
}
else
{
e.returnValue = false;
e.cancelBubble = true;
}
}
});
}
</script>
<asp:Button ID="Button1" runat="server" Text="Button" />
<telerik:radeditor runat="server" OnClientLoad="OnClientLoad" ID="RadEditor1"></telerik:radeditor>
<input type="text" id="textbox1" />
<input type="text" id="text1" />
Greetings,
Rumen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 1
answered on 21 Apr 2008, 09:11 AM
Thanks for help, point 3 is now work!
