Nutrient Web SDK

ReferenceSetDocumentEditorToolbarFunction

Type Alias SetDocumentEditorToolbarFunction

This callback can be used in the setDocumentEditorToolbarItems() method to do atomic updates to the document editor toolbar items.

Type Alias
Type Signature
type SetDocumentEditorToolbarFunction = (currentState: DocumentEditorToolbarItem[]) => DocumentEditorToolbarItem[]

Example

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;
});

Type Declaration

Parameters

The current document editor toolbar items.

Returns

The new document editor toolbar items.