The current document editor toolbar items.
The new document editor toolbar items.
Use ES2015 arrow functions and the update callback to reduce boilerplate
instance.setDocumentEditorToolbarItems(items => {
const button = instance.contentDocument.createElement('div');
button.innerText = "Do something"
items.push({
type: "custom",
node: button,
onPress(){
alert("Do Something");
}
});
return items;
});
This callback can be used in the setDocumentEditorToolbarItems() method to do atomic updates to the document editor toolbar items.