toopay/bootstrap-markdown — pull request #42 by emagnier (2014-03-06 07:23:56+00:00)
Title: Add an option to rearrange all the buttons and group buttons

This PR will fix this issue: https://github.com/toopay/bootstrap-markdown/issues/41

It give the possibility to:
* Rearrange all buttons & group buttons in whatever order;
* Remove any button that we don't need;
* And of course move the preview button after any additional buttons.

The new option `rearrangeButtons` take an array of values.
In this array we could add:
* A `string`: corresponding to an existing group-name;
* An `object`: containing a name (the object property) + an array of existing button-name (the object value).

Here a complete sample code:

```js
$("#target-editor-with-custom-buttons").markdown({
additionalButtons: [
[{
name: "groupCustom",
data: [{
name: "cmdBeer",
toggle: true,
title: "Beer",
icon: "glyphicon glyphicon-glass",
callback: function(e){}
},
{
name: 'cmdSave',
toggle: false,
title: 'Save',
icon: 'glyphicon glyphicon-floppy-disk',
callback: function () {}
},
{
name: 'cmdFullscreen',
toggle: false,
title: 'Fullscreen',
icon: 'glyphicon glyphicon-fullscreen',
callback: function () {}
}]
}]
],
rearrangeButtons: [
{
'groupBeer': [
'cmdBeer'
]
},
'groupFont',
'groupLink',
{
'groupMisc': [
'cmdList',
'cmdSave'
]
},
{
'groupUtil': [
'cmdFullscreen',
'cmdPreview'
]
}
]
})
```

Probably this weekend, I will send another PR to update the documentation on the website.