1. #11
    Sencha User emredagli's Avatar
    Join Date
    Jun 2008
    Posts
    296
    Vote Rating
    0
    emredagli is on a distinguished road

      0  

    Default editarea clear undo redo history

    editarea clear undo redo history


    Hii,
    Have you tried to clear undo redo history of editarea?
    I could not find any documentation about it?

    Thanks a lot.

  2. #12
    Sencha User emredagli's Avatar
    Join Date
    Jun 2008
    Posts
    296
    Vote Rating
    0
    emredagli is on a distinguished road

      0  

    Default


    Not elegant but works for me...
    Code:
        resetHistory: function(index){
            var editAreaFrameThis = frames["frame_"+this.eaid];
            if (!editAreaFrameThis) {return false;}
            if (!index) {
                if (editAreaFrameThis.editArea.previous.clear){
                    editAreaFrameThis.editArea.previous.clear();
                } else {
                    var val = editAreaLoader.getValue(this.eaid);
                    editAreaFrameThis.editArea.previous = [{
                        selEnd: val.length,
                        selStart: val.length,
                        text: val
                    }];
                }
            }
            else {
                if (editAreaFrameThis && editAreaFrameThis.editArea && editAreaFrameThis.editArea.previous[index]){
                    editAreaFrameThis.editArea.previous = [editAreaFrameThis.editArea.previous[index]];
                }    
            }
            editAreaFrameThis.editArea.check_redo();
            editAreaFrameThis.editArea.check_undo();
            return true;
        },
        setValue: function(v) {
            Ext.ux.form.EditAreaModified.superclass.setValue.apply(this, arguments);
            editAreaLoader.setValue(this.eaid, v);
            var editAreaFrameThis = frames["frame_"+this.eaid];
            if (editAreaFrameThis){
                editAreaFrameThis.editArea.check_redo();
                editAreaFrameThis.editArea.check_undo();        
            }
        },

  3. #13
    Sencha User
    Join Date
    Feb 2009
    Location
    India
    Posts
    11
    Vote Rating
    0
    sandeepan is on a distinguished road

      0  

    Default Another implementation approach

    Another implementation approach


    I implemented in a little different approach which works for both grid editors and forms .

    i have disabled the toolbars for my use, which can be enabled by passign config options to contructior and then using the same in afterRender method while calling init method of
    Code:
    /*
    * @Author: Sandeepan Kundu
    * @File: ux.HighlightedCode.js
    * @Class: Ext.ux.HighlightedCode
    * @email: sandeepan[dot]kundu[at]gmail[dot]com
    *
    * Dependency : edit_area_full.js, ref: http://www.cdolivet.com/editarea/
    */
    Ext.ux.HighlightedCode = Ext.extend(Ext.form.TextArea, {
        constructor: function (config) {
            //set ingrid property to true  in config when used as editor in grid
            if (!config.hasOwnProperty('ingrid')) {
                config.ingrid = false;
            }
            Ext.ux.HighlightedCode.superclass.constructor.call(this, config);
        },
        setValue: function (v) {
            Ext.ux.HighlightedCode.superclass.setValue.call(this, v);
            if (!this.hasOwnProperty('_setValue')) {
                this._setValue = true;
                editAreaLoader.setValue(this.autoEl.id, v);
                delete this._setValue;
            }
        },
        focus: function () {
            Ext.ux.HighlightedCode.superclass.focus.call(this);
            if (!this.hasOwnProperty('_focus')) {
                this._focus = true;
                editAreaLoader.execCommand(this.autoEl.id, "focus");
                delete this._focus;
            }
        },
        onTAFocus: function (v) {
            if (this.ingrid) {
                if (!this.hasOwnProperty('_hidedisabled')) {
                    this._hidedisabled = true;
                    var that = this;
                    var fn = function () {
                        that._hidedisabled = false;
                    };
                    Ext.defer(fn, 500, this);
                }
            }
        },
        onTABlur: function (v) {
            if (this.ingrid) {
                if (!this.hasOwnProperty('_hidedisabled')) {
                    this.hide();
                }
                else {
                    if (this._hidedisabled == false) {
                        this.hide();
                    }
                }
            }
        },
        show: function () {
            Ext.ux.HighlightedCode.superclass.show.call(this);
            if (editAreaLoader) {
                editAreaLoader.show(this.autoEl.id);
            }
            return this;
        },
        hide: function () {
            Ext.ux.HighlightedCode.superclass.hide.call(this);
            if (editAreaLoader) {
                editAreaLoader.hide(this.autoEl.id);
                if (this.hasOwnProperty('gridEditor')) {
                    if (Ext.isFunction(this.gridEditor.completeEdit)) {
                        this.gridEditor.completeEdit();
                    }
                }
            }
            return this;
        },
        afterRender: function () {
            Ext.ux.HighlightedCode.superclass.afterRender.call(this);
            if (editAreaLoader) {
                editAreaLoader.init({
                    id: this.autoEl.id        // textarea id
                    , syntax: "sql"            // syntax to be uses for highlighting, refer folder reg_syntax //"js","css","sql", "tsql", "xml", "vb", "html",etc
                    , start_highlight: true        // to display with highlight mode on start-up
                    , allow_toggle: !this.initialConfig.ingrid //true
                    , allow_resize: false
                    , is_editable: !this.disabled
                    , show_line_colors: true
                    , display: 'onload' //later
                    , toolbar: 'return'
                    , word_wrap: true
                    , change_callback: "Ext.ux.HighlightedCode.change_callback"
                    , focus_callback: "Ext.ux.HighlightedCode.focus_callback"
                    , blur_callback: "Ext.ux.HighlightedCode.blur_callback"
                    , blur_callback: "Ext.ux.HighlightedCode.blur_callback"
                });
            }
    
    
        }
    });
    Ext.ux.HighlightedCode.change_callback = function (id) {
        var cmp = Ext.getCmp(id);
        if (cmp) {
            cmp.setValue(editAreaLoader.getValue(id));
        }
    };
    Ext.ux.HighlightedCode.focus_callback = function (id) {
        var cmp = Ext.getCmp(id);
        if (cmp) {
            cmp.onTAFocus(editAreaLoader.getValue(id));
        }
    };
    Ext.ux.HighlightedCode.blur_callback = function (id) {
        var cmp = Ext.getCmp(id);
        if (cmp) {
            cmp.setValue(editAreaLoader.getValue(id));
            cmp.onTABlur(editAreaLoader.getValue(id));
        }
    };
    Ext.reg('highlightedcode', Ext.ux.HighlightedCode);
    Override editor control
    Code:
    Ext.override(Ext.Editor, {
        completeEdit: function (remainVisible) {
    if (this.field.getXType() == 'highlightedcode' && this.field.hasOwnProperty('_hidedisabled') && this.field._hidedisabled == true) { return; }
    // Assert combo values first if (this.field.assertValue) { this.field.assertValue(); } var v = this.getValue(); if (!this.field.isValid()) { if (this.revertInvalid !== false) { this.cancelEdit(remainVisible); } return; } if (String(v) === String(this.startValue) && this.ignoreNoChange) { this.hideEdit(remainVisible); return; } if (this.fireEvent("beforecomplete", this, v, this.startValue) !== false) { v = this.getValue(); if (this.updateEl && this.boundEl) { this.boundEl.update(v); } this.hideEdit(remainVisible); this.fireEvent("complete", this, v, this.startValue); } }
    and you need to change the line

    Code:
    editAreaLoader.template = "......"
    in edit_area_full.js to the following code

    Code:
    editAreaLoader.template = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" > <head> <title>EditArea</title> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /> <meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE7\"/> [__CSSRULES__] [__JSCODE__] </head> <body> <div id='editor'> <div class='area_toolbar' id='toolbar_1'>[__TOOLBAR__]</div> <div class='area_toolbar' id='tab_browsing_area'><ul id='tab_browsing_list' class='menu'> <li> </li> </ul></div> <div id='result'> <div id='no_file_selected'></div> <div id='container'> <div id='cursor_pos' class='edit_area_cursor'>&nbsp;</div> <div id='end_bracket' class='edit_area_cursor'>&nbsp;</div> <div id='selection_field'></div> <div id='line_number' selec='none'></div> <div id='content_highlight'></div> <div id='test_font_size'></div> <div id='selection_field_text'></div> <textarea id='textarea' wrap='off' onkeypress='editArea.execCommand(\"onkeypress\");' onchange='editArea.execCommand(\"onchange\");' onfocus='editArea.execCommand(\"onfocus\");' onblur='editArea.execCommand(\"onblur\");'> </textarea> </div> </div> <div class='area_toolbar' id='toolbar_2'> <table class='statusbar' cellspacing='0' cellpadding='0'> <tr> <td class='total' selec='none'>{$position}:</td> <td class='infos' selec='none'> {$line_abbr} <span  id='linePos'>0</span>, {$char_abbr} <span id='currPos'>0</span> </td> <td class='total' selec='none'>{$total}:</td> <td class='infos' selec='none'> {$line_abbr} <span id='nbLine'>0</span>, {$char_abbr} <span id='nbChar'>0</span> </td> <td class='resize'> <span id='resize_area'><img src='[__BASEURL__]images/statusbar_resize.gif' alt='resize' selec='none'></span> </td> </tr> </table> </div> </div> <div id='processing'> <div id='processing_text'> {$processing} </div> </div> <div id='area_search_replace' class='editarea_popup'> <table cellspacing='2' cellpadding='0' style='width: 100%'> <tr> <td selec='none'>{$search}</td> <td><input type='text' id='area_search' /></td> <td id='close_area_search_replace'> <a onclick='Javascript:editArea.execCommand(\"hidden_search\")'><img selec='none' src='[__BASEURL__]images/close.gif' alt='{$close_popup}' title='{$close_popup}' /></a><br /> </tr><tr> <td selec='none'>{$replace}</td> <td><input type='text' id='area_replace' /></td> <td><img id='move_area_search_replace' onmousedown='return parent.start_move_element(event,\"area_search_replace\", parent.frames[\"frame_\"+editArea.id]);'  src='[__BASEURL__]images/move.gif' alt='{$move_popup}' title='{$move_popup}' /></td> </tr> </table> <div class='button'> <input type='checkbox' id='area_search_match_case' /><label for='area_search_match_case' selec='none'>{$match_case}</label> <input type='checkbox' id='area_search_reg_exp' /><label for='area_search_reg_exp' selec='none'>{$reg_exp}</label> <br /> <a onclick='Javascript:editArea.execCommand(\"area_search\")' selec='none'>{$find_next}</a> <a onclick='Javascript:editArea.execCommand(\"area_replace\")' selec='none'>{$replace}</a> <a onclick='Javascript:editArea.execCommand(\"area_replace_all\")' selec='none'>{$replace_all}</a><br /> </div> <div id='area_search_msg' selec='none'></div> </div> <div id='edit_area_help' class='editarea_popup'> <div class='close_popup'> <a onclick='Javascript:editArea.execCommand(\"close_all_inline_popup\")'><img src='[__BASEURL__]images/close.gif' alt='{$close_popup}' title='{$close_popup}' /></a> </div> <div><h2>Editarea [__EA_VERSION__]</h2><br /> <h3>{$shortcuts}:</h3> {$tab}: {$add_tab}<br /> {$shift}+{$tab}: {$remove_tab}<br /> {$ctrl}+f: {$search_command}<br /> {$ctrl}+r: {$replace_command}<br /> {$ctrl}+h: {$highlight}<br /> {$ctrl}+g: {$go_to_line}<br /> {$ctrl}+z: {$undo}<br /> {$ctrl}+y: {$redo}<br /> {$ctrl}+e: {$help}<br /> {$ctrl}+q, {$esc}: {$close_popup}<br /> {$accesskey} E: {$toggle}<br /> <br /> <em>{$about_notice}</em> <br /><div class='copyright'>&copy; Christophe Dolivet 2007-2010</div> </div> </div> </body> </html> ";

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