1. #1
    Sencha Premium Member
    Join Date
    May 2009
    Posts
    151
    Vote Rating
    9
    ZachG will become famous soon enough

      0  

    Default Creating Ext chat window and Ext.form.HtmlEditor - problem in IE after pressing enter

    Creating Ext chat window and Ext.form.HtmlEditor - problem in IE after pressing enter


    I'm trying to create a chat program using Ext.form.HtmlEditor as the editor where you type your text. To make things convenient, when you press enter it sends the text and clears out the editor. The code I'm using works correctly in Firefox, but in IE it adds a <BR> to the editor. Here's the code:

    Code:
    <SCRIPT type="text/javascript">
    
    Ext.onReady(function()    {
        new Ext.form.HtmlEditor({
            enableAlignments:false,
            enableSourceEdit:false,
            enableLists:false,
            renderTo: Ext.getBody(),
            width: 800,
            height: 300,
            id:"html-editor",
            listeners:{
                initialize:function(inEditor)    {
                    Ext.EventManager.on(inEditor.getDoc(), "keydown", function(event)    {
                        if (event.button == event.NUM_CENTER || event.browserEvent.keyCode == event.RETURN) {
                            Ext.MessageBox.alert("Message", "This is your message: " + inEditor.getValue());
                            inEditor.setValue(""); // Clear out the veditor
                            event.preventDefault(); // Prevent the default action from occuring
                            return true;
                        }
                    });
                }
            }
        })
    });
    
    </SCRIPT>
    I've traced it down to the functions Ext.form.HtmlEditor.fixKeys, used in IE, and Ext.form.HtmlEditor.applyCommand, used by FF. In initEditor, it does checking on the browser and assigns an Ext.EventManager.on to either keypress for FF or keydown for IE.

    When I do event.preventDefault(), I'm expecting that this will supress the event from adding in the BR. I see a reference in applyCommand to preventDefault, but not in fixKeys.

    I could just create a new class that extends Ext.form.HtmlEditor, but that seems a little messy just to fix this problem. What in this should I be doing differently?

  2. #2
    Sencha Premium Member
    Join Date
    May 2009
    Posts
    151
    Vote Rating
    9
    ZachG will become famous soon enough

      0  

    Default


    bump.

    Should I log this as a bug instead?

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar