library(blockr.dag)library(blockr.dag)The toolbar provides quick access to common graph operations.
The toolbar includes several default operations:
Toolbar items are declared via new_toolbar_item():
# Toolbar item
item <- new_toolbar_item(
id = "custom_tool",
icon = "icon-custom",
js = "console.log('Custom tool clicked')",
action = function(board, update, ...) {
# Server-side logic
}
)js can be a string representing a JavaScript function or an R function that takes the namespace ns as input and returns a string:
function(ns) {
sprintf(
"(value, target, current) => {
Shiny.setInputValue('%s', true, {priority: 'event'});
}",
ns("add_block")
)
}Any new item has to go inside toolbar_items.dag_extension for registration:
toolbar_items.dag_extension <- function(x) {
list(
item
)