Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added buttonSize option to set general buttons size #254

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions js/bootstrap-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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-group-lg';
break;
case 'normal':
buttonSize = '';
break;
case 'small':
buttonSize = ' btn-group-sm';
break;
default:
buttonSize = ' btn-group-sm';
break;
}
}else{
buttonSize = ' btn-group-sm';
}

for (i = 0; i < buttonsArray.length; i++) {
// Build each group container
var y, btnGroups = buttonsArray[i];
Expand All @@ -106,7 +126,7 @@
var z,
buttons = btnGroups[y].data,
btnGroupContainer = $('<div/>', {
'class': 'btn-group'
'class': 'btn-group' + buttonSize
});

for (z = 0; z < buttons.length; z++) {
Expand All @@ -122,7 +142,7 @@

// Construct the button object
buttonContainer = $('<button></button>');
buttonContainer.text(' ' + this.__localize(btnText)).addClass('btn-default btn-sm').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');
}
Expand Down Expand Up @@ -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',
Expand Down