plugins/highlight/trumbowyg.highlight.js
function buildButtonDef(trumbowyg) {
        return {
            fn: function () {
                var $modal = trumbowyg.openModal('Code', [
                    '<div class="' + trumbowyg.o.prefix + 'highlight-form-group">',
                    '   <select class="' + trumbowyg.o.prefix + 'highlight-form-control language">',
                    (function () {
                        var options = '';

                        for (var lang in Prism.languages) {
                            if (Prism.languages.hasOwnProperty(lang)) {
                                options += '<option value="' + lang + '">' + lang + '</option>';
                            }
                        }

                        return options;
                    })(),
                    '   </select>',
                    '</div>',
                    '<div class="' + trumbowyg.o.prefix + 'highlight-form-group">',
                    '   <textarea class="' + trumbowyg.o.prefix + 'highlight-form-control code"></textarea>',
                    '</div>',
                ].join('\n')),
                $language = $modal.find('.language'),
                $code = $modal.find('.code');

                // Listen clicks on modal box buttons
                $modal.on('tbwconfirm', function () {
                    trumbowyg.restoreRange();
                    trumbowyg.execCmd('insertHTML', highlightIt($code.val(), $language.val()));
                    trumbowyg.execCmd('insertHTML', '<p><br></p>');

                    trumbowyg.closeModal();
                });

                $modal.on('tbwcancel', function () {
                    trumbowyg.closeModal();
                });
            }
        };
    }
function buildButtonDef(trumbowyg) {
        return {
            fn: function () {
                var $modal = trumbowyg.openModal('Code', [
                    '<div class="' + trumbowyg.o.prefix + 'highlight-form-group">',
                    '   <select class="' + trumbowyg.o.prefix + 'highlight-form-control language">',
                    (function () {
                        var options = '';

                        for (var lang in Prism.languages) {
                            if (Prism.languages.hasOwnProperty(lang)) {
                                options += '<option value="' + lang + '">' + lang + '</option>';
                            }
                        }

                        return options;
                    })(),
                    '   </select>',
                    '</div>',
                    '<div class="' + trumbowyg.o.prefix + 'highlight-form-group">',
                    '   <textarea class="' + trumbowyg.o.prefix + 'highlight-form-control code"></textarea>',
                    '</div>',
                ].join('\n')),
                $language = $modal.find('.language'),
                $code = $modal.find('.code');

                // Listen clicks on modal box buttons
                $modal.on('tbwconfirm', function () {
                    trumbowyg.restoreRange();
                    trumbowyg.execCmd('insertHTML', highlightIt($code.val(), $language.val()));
                    trumbowyg.execCmd('insertHTML', '<p><br></p>');

                    trumbowyg.closeModal();
                });

                $modal.on('tbwcancel', function () {
                    trumbowyg.closeModal();
                });
            }
        };
    }
function buildButtonDef ( trumbowyg ) { return { fn : function ( ) { var $modal = trumbowyg . openModal ( 'Code' , [ '<div class="' + trumbowyg . o . prefix + 'highlight-form-group">' , '   <select class="' + trumbowyg . o . prefix + 'highlight-form-control language">' , ( function ( ) { var options = '' ; for ( var lang in Prism . languages ) { if ( Prism . languages . hasOwnProperty ( lang ) ) { options += '<option value="' + lang + '">' + lang + '</option>' ; } } return options ; } ) ( ) , '   </select>' , '</div>' , '<div class="' + trumbowyg . o . prefix + 'highlight-form-group">' , '   <textarea class="' + trumbowyg . o . prefix + 'highlight-form-control code"></textarea>' , '</div>' , ] . join ( '\n' ) ) , $language = $modal . find ( '.language' ) , $code = $modal . find ( '.code' ) ; // Listen clicks on modal box buttons $modal . on ( 'tbwconfirm' , function ( ) { trumbowyg . restoreRange ( ) ; trumbowyg . execCmd ( 'insertHTML' , highlightIt ( $code . val ( ) , $language . val ( ) ) ) ; trumbowyg . execCmd ( 'insertHTML' , '<p><br></p>' ) ; trumbowyg . closeModal ( ) ; } ) ; $modal . on ( 'tbwcancel' , function ( ) { trumbowyg . closeModal ( ) ; } ) ; } } ; }
If my plugin is a button
If my plugin is a button