Skip to content

Instantly share code, notes, and snippets.

@witzig
Created March 4, 2017 00:29
Show Gist options
  • Save witzig/e22b65ff047b573e7d612ab0a9ca41c8 to your computer and use it in GitHub Desktop.
Save witzig/e22b65ff047b573e7d612ab0a9ca41c8 to your computer and use it in GitHub Desktop.
plugins.push(function(viewModel) {
var addMyButton = function() {
var $toobarRightButtons = $('#toolbar .rightButtons');
if (!$toobarRightButtons.length) {
setTimeout(addMyButton, 50);
return;
}
$('<a title="Hello" class="ui-button ui-corner-all ui-widget" role="button">\
<span class="ui-button-icon ui-icon fa fa-fw fa-times-circle"></span>\
<span class="ui-button-icon-space"></span>Hello\
</a>')
.appendTo($toobarRightButtons)
.css('color', 'white', '!important')
.on('click', function() {
alert('Yay!');
});
};
addMyButton();
});
@losttheplot
Copy link

If anyone is new to mosaico and node, like me, and is reading this wondering where to add this code, I've just added it to line 27 of /html/editor.html underneath plugins = [function(vm) {window.viewModel = vm;}]; (uncomment this line), and it works just fine :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment