Append a custom button to the toolbar at startup (the icon URL is relative to the editor.html document):
var marvinSketcherInstance;
var buttonAttributes;
$(document).ready(function handleDocumentReady (e) {
MarvinJSUtil.getEditor("#sketch").then(function (sketcherInstance) {
marvinSketcherInstance = sketcherInstance;
buttonAttributes = {
"name" : "custom",
"image-url" : "examples/images/custom-icon.png",
"toolbar" : "W"
};
marvinSketcherInstance.addButton(buttonAttributes, function() {
alert('The custom button has been pushed.');
});
}, function () {
alert("Cannot retrieve sketcher instance from iframe");
});
});