-
Hi Johan,
Would you please describe the issue you have encountered in greater detail? To help us determine the cause of this issue, clarify the following:
- What does the issue look like? Would you please make a detailed screencast that illustrates how to reproduce this issue from scratch? For example, use the Jing) tool for this purpose;
- If this issue is browser-specific, specify the browser family/version;
- If possible, prepare a working project that illustrates the issue in action. With a small example project, it is much easier for us to verify that the code that calls ours is valid and that the way our controls are being used is as recommended, so we can concentrate our resources on the problem area:
A request for simple example programsYour time and cooperation are greatly appreciated.
-
Hi Vasily,
My question was actually for two seperate problems and I can see how this can be confusing, so I will try to clarify:1. In your HTMLEditor contol, pressing Tab works like any other web control in that it focuses to the next available control on the page. I would like to know if there is a way to stop this from happening and instead insert a space at the current position inside the control (Like using Tab in a MS Word document)
2. If the EnterMode property of the control is set to BR, one can not center align a single line, the entire content is aligned to center. To fix this you can set the EnterMode to P and the Paragraph formatting to Normal (DIV). I would like to know if there is a way to default the contol to Normal (DIV).
Please Note: When pressing [Ctrl]+[A] on the keyboard and then pressing [Backspace], causes the control to default back to its original state (as on first load) and doesn't keep the settings specified by the user. For Example: Paragraph formatting = Normal (DIV) and Font-Style = Bold, resets to: Paragraph formatting = Normal and Font-Style = no longer bold.
1 Solution
Hi Johan,
In regard to Tab key handling, I looked at your workaround in ASPxHtmlEditor - How to handle Tab Key pressing and came up with a simpler solution, here's how it looks:
[ASPx]<ClientSideEvents Init="function(s, e) { var editor = s; var tabKeyCode = 9; var handler = function(evt) { if(evt.keyCode != tabKeyCode) return; editor.GetSelection().SetHtml(' '); return ASPxClientUtils.PreventEventAndBubble(evt); }; ASPxClientUtils.AttachEventToElement(editor.GetDesignViewDocument(), 'keydown', handler); }" />
Neither server-side code nor an additional aspx markup is needed. I tested it in IE, Chrome, Safari and Firefox.
Further, with regard to the separate line alignment with EnterMode="BR" in IE - we are aware of this issue and it's an IE specific behavior. To align text, the ASPxHtmlEditor calls a browser method document.execCommand('justifycenter' | 'justifyleft' | 'justifyright') and the behavior you observe is just the way IE applies this command. You can track the progress on this issue here - ASPxHtmlEditor - IE - Provide the capability to align text separately - line-by-line .
Finally, with regard to the formatting setting reset after you delete all content in the editor - the ASPxHtmlEditor keeps the state of all text formatting buttons and comboboxes synchronized with the currently selected content. So, when there's no content in the editor, buttons and comboboxes have nothing to synchronize with, therefore they are reset to the defaults.
I hope I was able to help you.
Thanks!
-
Thanks Sergey, the Tab solution works very well! :)
For the seperate line alignment I reverted back to using the default EnterMode and defaulted the paragraph formatting to Normal (DIV) by placing the following code in the ClientSideEvents Init as well as HtmlChanged (if html.GetHtml() == "" ):
HTMLEditor.ExecuteCommand('formatblock', 'div');
This stops the control from losing the set paragraph formatting even if all the html is deleted, thereby avoiding the EnterMode="BR" alignment issue.
-
Hi Johan,
If you need any further help with this subject, please feel free to reactivate this ticket.
-
Sergey, has this been tested in 12.2.5? I have tried to get it to work but when I hit the tab key nothing happens. Thanks.
-
Hi Paul,
We detected that you have posted the same question to ticket Q458405(ASPxHtmlEditor - Inserting Tab on Tab Key press).
We will post our answer in ticket Q458405(ASPxHtmlEditor - Inserting Tab on Tab Key press).
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.
Facebook
Twitter
Google+