library(blockr.dag)The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
library(blockr.dag)The context menu provides actions based on what element is right-clicked in the graph.
| Target Element | Available Actions |
|---|---|
| Canvas | • Add block • Create stack |
| Node (block) | • Create link • Remove block • Append block |
| Edge (link) | • Remove link |
| Combo (stack) | • Remove stack • Edit stack: add/remove blocks and change color |
Context menu items are created with new_context_menu_entry():
# Context menu entry
entry <- new_context_menu_entry(
name = "Custom Action",
js = function(ns) "alert('Custom action')",
action = function(board, update, ...) {
# Server-side logic
},
condition = function(board, target) {
target$type == "node"
}
)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")
)
}condition is an either a boolean or an R function that takes the board and target (the clicked element) as input and returns TRUE or FALSE to determine if the entry should be shown.
Any new entry has to go inside context_menu_items.dag_extension for registration:
# Add custom context menu items to an extension
context_menu_items.dag_extension <- function(x) {
list(
new_context_menu_entry(
name = "My Action",
js = function(ns) {
sprintf("Shiny.setInputValue('%s', true)", ns("my_action"))
},
action = my_custom_action("my_action"),
condition = function(board, target) TRUE
)
)
}These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.