Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Nick Armitage on Oct 24, 2008 05:20
open dhtmlx forum
dhtmlxEditor - Carriage Return

With the new editor control, when I press the Return key in the firefox browser, it moves the cursor to the next line.
In Internet Explorer, it moves it two rows down (ie there is a line gap).
I think it's to do with <P> tags in the HTML "source" of the editor but could not find my own solution to this problem in the js file.

It would be nice to be able to work in either mode (Paragraph mode or put Text mode) but to be consistent across browsers.
I've used other editor controls that specify the action to take when pressing the Return key and it is consistent between IE and FF so I know it's possible.
Answer posted by Support on Oct 24, 2008 06:49
Thank you for the remark.
It is a logical idea.
Possibly we will implement it in the next version.
Answer posted by Nick Armitage on Nov 03, 2008 03:26
It's a similar question but is it possible to suppress the Carriage Return key in any way?
I cannot use the editor control as is because the Carriage Return behaves differently in Firefox and Internet Explorer (as explained above - the "paragraph" modes).
In actual fact, if I could suppress the Carriage Return (Enter) key from firing at all, that would solve my immediate problem.
I'm using the editor control as input for a load of email addresses and as such, I really don't want the user from hitting the return key at all to produce a line break (it doesn't make sense for them to do this so I want to stop them).
I've looked at the dhtmlxEditor.js file and tried to find a place to suppress the key from firing but I think the actual input is occurring at a much lower level in the code.
Answer posted by Support on Nov 03, 2008 06:20
If you want to suppress the enter key, you can try to use the following approach:

var editor = new dhtmlXEditor(...);
  ...   
dhtmlxEvent(editor.edDoc, "keypress", function(e){
        var ev = e||event;
        var key = ev.keyCode;
        if(key==13){
            if(!_isIE) ev.preventDefault();
            return false
        }
})
Answer posted by Nick Armitage on Nov 03, 2008 06:50
Thank you so much.
Yep, that's exactly what I wanted.
Another satisfied customer.