WordPress.org

Make WordPress Core

Ticket #26183: dynamic-quicktags.26183.diff

File dynamic-quicktags.26183.diff, 660 bytes (added by helgatheviking, 8 years ago)

add an addInstance() method to quicktags

  • src/wp-includes/js/quicktags.js

    diff --git src/wp-includes/js/quicktags.js src/wp-includes/js/quicktags.js
    index 9fc9c69..c820ff4 100644
    function edButton(id, display, tagStart, tagEnd, access) { 
    230230
    231231                qt.instances[id] = t;
    232232
    233                 if ( !qt.instances[0] ) {
    234                         qt.instances[0] = qt.instances[id];
     233                if ( qt.instances[id] ) {
    235234                        _domReady( function(){ qt._buttonsInit(); } );
    236235                }
    237236        };
    238237
    239238        qt.instances = {};
    240239
     240        qt.addInstance = function(settings) {
     241                if( 'id' in settings )
     242                        return qt.instances[settings.id] = settings;
     243        };
     244
    241245        qt.getInstance = function(id) {
    242246                return qt.instances[id];
    243247        };