src/trumbowyg.js
function (title, content) {
            var t = this,
                prefix = t.o.prefix;

            // No open a modal box when exist other modal box
            if ($('.' + prefix + 'modal-box', t.$box).length > 0) {
                return false;
            }
            if (t.o.autogrowOnEnter) {
                t.autogrowOnEnterDontClose = true;
            }

            t.saveRange();
            t.showOverlay();

            // Disable all btnPane btns
            t.$btnPane.addClass(prefix + 'disable');

            // Build out of ModalBox, it's the mask for animations
            var $modal = $('<div/>', {
                class: prefix + 'modal ' + prefix + 'fixed-top'
            }).css({
                top: t.$box.offset().top + t.$btnPane.height(),
                zIndex: 99999
            }).appendTo($(t.doc.body));

            // Click on overlay close modal by cancelling them
            t.$overlay.one('click', function () {
                $modal.trigger(CANCEL_EVENT);
                return false;
            });

            // Build the form
            var $form = $('<form/>', {
                action: '',
                html: content
            })
                .on('submit', function () {
                    $modal.trigger(CONFIRM_EVENT);
                    return false;
                })
                .on('reset', function () {
                    $modal.trigger(CANCEL_EVENT);
                    return false;
                })
                .on('submit reset', function () {
                    if (t.o.autogrowOnEnter) {
                        t.autogrowOnEnterDontClose = false;
                    }
                });


            // Build ModalBox and animate to show them
            var $box = $('<div/>', {
                class: prefix + 'modal-box',
                html: $form
            })
                .css({
                    top: '-' + t.$btnPane.outerHeight() + 'px',
                    opacity: 0
                })
                .appendTo($modal)
                .animate({
                    top: 0,
                    opacity: 1
                }, 100);


            // Append title
            $('<span/>', {
                text: title,
                class: prefix + 'modal-title'
            }).prependTo($box);

            $modal.height($box.outerHeight() + 10);


            // Focus in modal box
            $('input:first', $box).focus();


            // Append Confirm and Cancel buttons
            t.buildModalBtn('submit', $box);
            t.buildModalBtn('reset', $box);


            $(window).trigger('scroll');

            return $modal;
        }
function (title, content) {
            var t = this,
                prefix = t.o.prefix;

            // No open a modal box when exist other modal box
            if ($('.' + prefix + 'modal-box', t.$box).length > 0) {
                return false;
            }
            if (t.o.autogrowOnEnter) {
                t.autogrowOnEnterDontClose = true;
            }

            t.saveRange();
            t.showOverlay();

            // Disable all btnPane btns
            t.$btnPane.addClass(prefix + 'disable');

            // Build out of ModalBox, it's the mask for animations
            var $modal = $('<div/>', {
                class: prefix + 'modal ' + prefix + 'fixed-top'
            }).css({
                top: t.$box.offset().top + t.$btnPane.height(),
                zIndex: 99999
            }).appendTo($(t.doc.body));

            // Click on overlay close modal by cancelling them
            t.$overlay.one('click', function () {
                $modal.trigger(CANCEL_EVENT);
                return false;
            });

            // Build the form
            var $form = $('<form/>', {
                action: '',
                html: content
            })
                .on('submit', function () {
                    $modal.trigger(CONFIRM_EVENT);
                    return false;
                })
                .on('reset', function () {
                    $modal.trigger(CANCEL_EVENT);
                    return false;
                })
                .on('submit reset', function () {
                    if (t.o.autogrowOnEnter) {
                        t.autogrowOnEnterDontClose = false;
                    }
                });


            // Build ModalBox and animate to show them
            var $box = $('<div/>', {
                class: prefix + 'modal-box',
                html: $form
            })
                .css({
                    top: '-' + t.$btnPane.outerHeight() + 'px',
                    opacity: 0
                })
                .appendTo($modal)
                .animate({
                    top: 0,
                    opacity: 1
                }, 100);


            // Append title
            $('<span/>', {
                text: title,
                class: prefix + 'modal-title'
            }).prependTo($box);

            $modal.height($box.outerHeight() + 10);


            // Focus in modal box
            $('input:first', $box).focus();


            // Append Confirm and Cancel buttons
            t.buildModalBtn('submit', $box);
            t.buildModalBtn('reset', $box);


            $(window).trigger('scroll');

            return $modal;
        }
function ( title , content ) { var t = this , prefix = t . o . prefix ; // No open a modal box when exist other modal box if ( $ ( '.' + prefix + 'modal-box' , t . $box ) . length > 0 ) { return false ; } if ( t . o . autogrowOnEnter ) { t . autogrowOnEnterDontClose = true ; } t . saveRange ( ) ; t . showOverlay ( ) ; // Disable all btnPane btns t . $btnPane . addClass ( prefix + 'disable' ) ; // Build out of ModalBox, it's the mask for animations var $modal = $ ( '<div/>' , { class : prefix + 'modal ' + prefix + 'fixed-top' } ) . css ( { top : t . $box . offset ( ) . top + t . $btnPane . height ( ) , zIndex : 99999 } ) . appendTo ( $ ( t . doc . body ) ) ; // Click on overlay close modal by cancelling them t . $overlay . one ( 'click' , function ( ) { $modal . trigger ( CANCEL_EVENT ) ; return false ; } ) ; // Build the form var $form = $ ( '<form/>' , { action : '' , html : content } ) . on ( 'submit' , function ( ) { $modal . trigger ( CONFIRM_EVENT ) ; return false ; } ) . on ( 'reset' , function ( ) { $modal . trigger ( CANCEL_EVENT ) ; return false ; } ) . on ( 'submit reset' , function ( ) { if ( t . o . autogrowOnEnter ) { t . autogrowOnEnterDontClose = false ; } } ) ; // Build ModalBox and animate to show them var $box = $ ( '<div/>' , { class : prefix + 'modal-box' , html : $form } ) . css ( { top : '-' + t . $btnPane . outerHeight ( ) + 'px' , opacity : 0 } ) . appendTo ( $modal ) . animate ( { top : 0 , opacity : 1 } , 100 ) ; // Append title $ ( '<span/>' , { text : title , class : prefix + 'modal-title' } ) . prependTo ( $box ) ; $modal . height ( $box . outerHeight ( ) + 10 ) ; // Focus in modal box $ ( 'input:first' , $box ) . focus ( ) ; // Append Confirm and Cancel buttons t . buildModalBtn ( 'submit' , $box ) ; t . buildModalBtn ( 'reset' , $box ) ; $ ( window ) . trigger ( 'scroll' ) ; return $modal ; }
Open a modal box
Open a modal box