From d74032abfaaf89eb201189b49f4149cd979eec7e Mon Sep 17 00:00:00 2001 From: MiguelMich Date: Sun, 10 Jul 2016 00:08:19 -0500 Subject: [PATCH 1/2] Added buttonSize option to set general buttons size --- js/bootstrap-markdown.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/js/bootstrap-markdown.js b/js/bootstrap-markdown.js index aca37d9..617a2e5 100644 --- a/js/bootstrap-markdown.js +++ b/js/bootstrap-markdown.js @@ -95,9 +95,29 @@ __buildButtons: function(buttonsArray, container) { var i, ns = this.$ns, + buttonSize = this.$options.buttonSize, handler = this.$handler, callback = this.$callback; + if( typeof buttonSize !== 'undefined') { + switch(buttonSize){ + case 'large': + buttonSize = ' btn-lg'; + break; + case 'normal': + buttonSize = ''; + break; + case 'small': + buttonSize = ' btn-sm'; + break; + default: + buttonSize = ' btn-sm'; + break; + } + }else{ + buttonSize = ' btn-sm'; + } + for (i = 0; i < buttonsArray.length; i++) { // Build each group container var y, btnGroups = buttonsArray[i]; @@ -122,7 +142,7 @@ // Construct the button object buttonContainer = $(''); - buttonContainer.text(' ' + this.__localize(btnText)).addClass('btn-default btn-sm').addClass(btnClass); + buttonContainer.text(' ' + this.__localize(btnText)).addClass('btn-default' + buttonSize).addClass(btnClass); if (btnClass.match(/btn\-(primary|success|info|warning|danger|link)/)) { buttonContainer.removeClass('btn-default'); } @@ -1378,7 +1398,7 @@ hotkey: 'Ctrl+P', title: 'Preview', btnText: 'Preview', - btnClass: 'btn btn-primary btn-sm', + btnClass: 'btn btn-primary', icon: { glyph: 'glyphicon glyphicon-search', fa: 'fa fa-search', From 7e2175554a944e7e3e3ab0eb18727fe01ffef71a Mon Sep 17 00:00:00 2001 From: MiguelMich Date: Mon, 11 Jul 2016 11:37:15 -0500 Subject: [PATCH 2/2] Manage button size by btn-group-* default bootstrap sizing --- js/bootstrap-markdown.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/bootstrap-markdown.js b/js/bootstrap-markdown.js index 617a2e5..8f4470c 100644 --- a/js/bootstrap-markdown.js +++ b/js/bootstrap-markdown.js @@ -102,20 +102,20 @@ if( typeof buttonSize !== 'undefined') { switch(buttonSize){ case 'large': - buttonSize = ' btn-lg'; + buttonSize = ' btn-group-lg'; break; case 'normal': buttonSize = ''; break; case 'small': - buttonSize = ' btn-sm'; + buttonSize = ' btn-group-sm'; break; default: - buttonSize = ' btn-sm'; + buttonSize = ' btn-group-sm'; break; } }else{ - buttonSize = ' btn-sm'; + buttonSize = ' btn-group-sm'; } for (i = 0; i < buttonsArray.length; i++) { @@ -126,7 +126,7 @@ var z, buttons = btnGroups[y].data, btnGroupContainer = $('
', { - 'class': 'btn-group' + 'class': 'btn-group' + buttonSize }); for (z = 0; z < buttons.length; z++) { @@ -142,7 +142,7 @@ // Construct the button object buttonContainer = $(''); - buttonContainer.text(' ' + this.__localize(btnText)).addClass('btn-default' + buttonSize).addClass(btnClass); + buttonContainer.text(' ' + this.__localize(btnText)).addClass('btn-default').addClass(btnClass); if (btnClass.match(/btn\-(primary|success|info|warning|danger|link)/)) { buttonContainer.removeClass('btn-default'); }