UI and Server functions for editing report document blocks
Source:R/editor_block.R
srv_editor_block.Rd
These functions provide a user interface and server logic for editing and extending the editor functionality to support new data types.
Details
The methods for this S3 generic can be extended by the app developer to new classes
or even overwritten.
For this a function with the name srv_editor_block.<class>
and/or ui_editor_block.<class>
should be defined in the Global Environment, where <class>
is the class of
the object to be used in the method.
For example, to override the default behavior for character
class, you can use:
ui_editor_block.character <- function(id, value) {
# custom implementation
shiny::tagList(
shiny::tags$h6(shiny::icon("pencil", class = "text-muted"), "Editable CUSTOM markdown block"),
shiny::textAreaInput(ns("content"), label = NULL, value = value, width = "100%")
)
}
srv_editor_block.character <- function(id, value) {
# custom implementation
# ...
}
Alternatively, you can register the S3 method using
registerS3method("ui_editor_block", "<class>", fun)
and
registerS3method("srv_editor_block", "<class>", fun)
.