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

More accurate toolbar button construction #102

Merged
merged 2 commits into from
Sep 10, 2014
Merged
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
52 changes: 25 additions & 27 deletions js/bootstrap-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

for (z=0;z<buttons.length;z++) {
var button = buttons[z],
buttonToggle = '',
buttonContainer, buttonIconContainer,
buttonHandler = ns+'-'+button.name,
buttonIcon = this.__getIcon(button.icon),
btnText = button.btnText ? button.btnText : '',
Expand All @@ -92,43 +92,41 @@
hotkey = typeof button.hotkey !== 'undefined' ? button.hotkey : '',
hotkeyCaption = typeof jQuery.hotkeys !== 'undefined' && hotkey !== '' ? ' ('+hotkey+')' : ''

if (button.toggle == true) {
buttonToggle = ' data-toggle="button"'
// Construct the button object
buttonContainer = $('<button></button>');
buttonContainer.text(' ' + this.__localize(btnText)).addClass('btn-default btn-sm').addClass(btnClass);
if(btnClass.match(/btn\-(primary|success|info|warning|danger|link)/)){
buttonContainer.removeClass('btn-default');
}
buttonContainer.attr({
'type': 'button',
'title': this.__localize(button.title) + hotkeyCaption,
'tabindex': tabIndex,
'data-provider': ns,
'data-handler': buttonHandler,
'data-hotkey': hotkey
});
if (button.toggle == true){
buttonContainer.attr('data-toggle', 'button');
}
buttonIconContainer = $('<span/>');
buttonIconContainer.addClass(buttonIcon);
buttonIconContainer.prependTo(buttonContainer);

// Attach the button object
btnGroupContainer.append('<button type="button" class="'
+btnClass
+' btn-default btn-sm" title="'
+this.__localize(button.title)
+hotkeyCaption
+'" tabindex="'
+tabIndex
+'" data-provider="'
+ns
+'" data-handler="'
+buttonHandler
+'" data-hotkey="'
+hotkey
+'"'
+buttonToggle
+'><span class="'
+buttonIcon
+'"></span> '
+this.__localize(btnText)
+'</button>')
btnGroupContainer.append(buttonContainer);

// Register handler and callback
handler.push(buttonHandler)
callback.push(button.callback)
handler.push(buttonHandler);
callback.push(button.callback);
}

// Attach the button group into container dom
container.append(btnGroupContainer)
container.append(btnGroupContainer);
}
}

return container
return container;
}
, __setListener: function() {
// Set size and resizable Properties
Expand Down