1+ # ' @rdname srv_editor_block
12# ' @export
23ui_editor_block <- function (id , value ) {
34 UseMethod(" ui_editor_block" , value )
45}
56
7+ # ' UI and Server functions for editing report document blocks
8+ # '
9+ # ' These functions provide a user interface and server logic for editing and extending
10+ # ' the editor functionality to support new data types.
11+ # ' @param id (`character(1)`) A unique identifier for the module.
12+ # ' @param value The content of the block to be edited. It can be a character string or other types.
13+ # ' @export
614# ' @export
715srv_editor_block <- function (id , value ) {
816 UseMethod(" srv_editor_block" , value )
@@ -12,7 +20,7 @@ srv_editor_block <- function(id, value) {
1220ui_editor_block.default <- function (id , value ) {
1321 shiny :: tags $ div(
1422 shiny :: tags $ h6(
15- tags $ span(
23+ shiny :: tags $ span(
1624 class = " fa-stack small text-muted" ,
1725 # style = "width: 2em;", # necessary to avoid extra space after icon
1826 shiny :: icon(" pencil" , class = " fa-stack-1x" ),
@@ -40,7 +48,7 @@ ui_editor_block.character <- function(id, value) {
4048
4149# ' @export
4250srv_editor_block.character <- function (id , value ) {
43- shiny :: moduleServer(id , function (input , output , session ) reactive(input $ content ))
51+ shiny :: moduleServer(id , function (input , output , session ) shiny :: reactive(input $ content ))
4452}
4553
4654ui_report_document_editor <- function (id , value ) {
@@ -75,7 +83,7 @@ srv_report_document_editor <- function(id, card_r) {
7583
7684 if (! block_name %in% names(card_r())) { # Only adds UI if not already rendered
7785 new_block_ui <- ui_editor_block(session $ ns(new_block_id ), value = block_content )
78- insertUI(sprintf(" #%s" , session $ ns(" blocks" )), where = " beforeEnd" , ui = new_block_ui )
86+ shiny :: insertUI(sprintf(" #%s" , session $ ns(" blocks" )), where = " beforeEnd" , ui = new_block_ui )
7987 }
8088 })
8189 })
@@ -109,7 +117,7 @@ ui_previewer_card_actions <- function(id) {
109117}
110118
111119srv_previewer_card_actions <- function (id , card_r , card_id , reporter ) {
112- moduleServer(id , function (input , output , session ) {
120+ shiny :: moduleServer(id , function (input , output , session ) {
113121 new_card_rv <- shiny :: reactiveVal()
114122
115123 shiny :: observeEvent(input $ edit_action , {
@@ -119,18 +127,18 @@ srv_previewer_card_actions <- function(id, card_r, card_id, reporter) {
119127 title <- metadata(template_card , " title" )
120128
121129 if (isFALSE(nzchar(title ))) {
122- title <- tags $ span(class = " text-muted" , " (empty title)" )
130+ title <- shiny :: tags $ span(class = " text-muted" , " (empty title)" )
123131 }
124132
125133 shiny :: showModal(
126134 shiny :: modalDialog(
127- title = tags $ span(
135+ title = shiny :: tags $ span(
128136 class = " edit_title_container" ,
129137 " Editing Card:" ,
130138 shiny :: tags $ span(id = session $ ns(" static_title" ), title ),
131139 shiny :: actionButton(
132140 session $ ns(" edit_title" ),
133- label = tags $ span(shiny :: icon(" pen-to-square" ), " edit title" ),
141+ label = shiny :: tags $ span(shiny :: icon(" pen-to-square" ), " edit title" ),
134142 class = " fs-6" ,
135143 title = " Edit title"
136144 ),
@@ -157,7 +165,7 @@ srv_previewer_card_actions <- function(id, card_r, card_id, reporter) {
157165
158166 block_input_names_rvs <- srv_report_document_editor(" editor" , new_card_rv )
159167
160- observeEvent(input $ edit_title , {
168+ shiny :: observeEvent(input $ edit_title , {
161169 shinyjs :: hide(" edit_title" )
162170 shinyjs :: hide(" static_title" )
163171 shinyjs :: show(" new_title" )
@@ -169,7 +177,7 @@ srv_previewer_card_actions <- function(id, card_r, card_id, reporter) {
169177 new_card <- new_card_rv()
170178 input_r <- Filter(Negate(is.null ), shiny :: reactiveValuesToList(block_input_names_rvs ))
171179 for (name in names(input_r )) {
172- new_card [[name ]] <- isolate(input_r [[name ]]())
180+ new_card [[name ]] <- shiny :: isolate(input_r [[name ]]())
173181 }
174182 if (isFALSE(is.null(input $ new_title ))) {
175183 metadata(new_card , " title" ) <- input $ new_title
@@ -202,7 +210,7 @@ srv_previewer_card_actions <- function(id, card_r, card_id, reporter) {
202210 # Handle remove button
203211 shiny :: observeEvent(input $ remove_action , reporter $ remove_cards(ids = card_id ))
204212
205- observeEvent( # Hide button for deprecated objects
213+ shiny :: observeEvent( # Hide button for deprecated objects
206214 card_r(),
207215 once = TRUE ,
208216 handlerExpr = {
0 commit comments