1. #1
    Ext User
    Join Date
    Apr 2007
    Posts
    19
    Vote Rating
    0
    lummie is on a distinguished road

      0  

    Default HtmlEditor with text change event

    HtmlEditor with text change event


    Below is a HtmlEditor subclass that raises the 'change' event when the text in the editor is changed, not on blur.

    I have not managed to get the change event to happen when in 'source edit mode'so if you can work out how please let me know.

    However, if the text does change whilst in source edit mode then the event will be raised when the editor is switched back to wysiwyg.

    Tested in chromium / firefox 3.6.3 & ext 3.2

    Comments / improvements please let me know as I'm just starting out with ext.

    Matt

    Code:
    Noodles.Editor = Ext.extend(Ext.form.HtmlEditor, {
        lastValue : '', // used to track the last value otherwise multiple events are fired for a single change
        fireChangeIfNeeded : function(){
            var currentValue = this.sourceEditMode ? this.getEditorBody().innerHTML : Ext.form.HtmlEditor.superclass.getValue.call(this);
            if((currentValue != this.originalValue) && (currentValue != this.lastValue)){
                this.lastValue = currentValue;
                this.fireEvent('change', this);
            }
        },
        initComponent: function() {
            Noodles.Editor.superclass.initComponent.call(this);
    
            this.on('sync', this.fireChangeIfNeeded, this, {buffer:1000});
            this.on('editmodechange', this.fireChangeIfNeeded, this);
    
        },
        setValue : function(v){
            Noodles.Editor.superclass.setValue.call(this, v);
            this.lastValue = Ext.form.HtmlEditor.superclass.getValue.call(this);
            return this;
        }
    });
    Ext.reg('noodles-editor', Noodles.Editor);

  2. #2
    Ext JS Premium Member Bobrovnik's Avatar
    Join Date
    Jul 2009
    Posts
    74
    Vote Rating
    0
    Bobrovnik is on a distinguished road

      0  

    Default


    Why not just use "sync" event. It fires every time when the textarea is updated with content from the editor iframe
    Stanislav Golovenko.

    My extentions:
    Slider Button
    Desktop Icon Manager

  3. #3
    Ext JS Premium Member Bobrovnik's Avatar
    Join Date
    Jul 2009
    Posts
    74
    Vote Rating
    0
    Bobrovnik is on a distinguished road

      0  

    Default


    Why not just use "sync" event? It fires every time when the textarea is updated with content from the editor iframe
    Stanislav Golovenko.

    My extentions:
    Slider Button
    Desktop Icon Manager

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi