- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2
Open
Description
Reprex @nbenn:
library(shiny)
library(bslib)
library(shinyAce)
editorUI <- function(id) {
  ns <- NS(id)
  fluidRow(
    shiny::column(width = 4,
      shinyAce::aceEditor(
        ns("code"),
        mode = "r",
        height = "200px",
        autoComplete = "live",
        autoCompleters = "rlang",
        hotkeys = list(
          runKey=list(
            win = "Ctrl-Enter",
            mac = "CMD-ENTER"
          )
        )
      )
    ), # column
    shiny::column(width = 8,
      tags$div(
        style = "overflow-y:scroll; max-height: 300px;",
        verbatimTextOutput(ns("codeOutput"))
      )
    ) # column
  ) # row
}
editorSERVER <- function(id) {
  moduleServer(id, function(input, output, session) {
    ns <- session$ns
    shinyAce::aceAutocomplete("code")
    tmpFile <- tempfile()
    output$codeOutput <- renderPrint({
      val <- input$code_runKey
      if(is.null(val)) {
        return(
          "Execute [R] chunks with Ctrl/Cmd-Enter"
        )
      }
      selectionLocal <- val$selection
      lineLocal <- val$line
      if(val$selection != "") {
        toExecute <- selectionLocal
      } else {
        shiny::validate(
          need(!is.null(lineLocal), "Unable to find execution text")
        )
        toExecute <- lineLocal
      }
      writeLines(toExecute, con = tmpFile)
      return(source(tmpFile, echo = TRUE, local = TRUE))
    })
  })
}
ui <- page_fluid(
  dockViewOutput("dock")
)
server <- function(input, output, session) {
  output$dock <- renderDockView({
    dock_view(
      panels = list(
        panel(
          id = "editor",
          title = "Editor",
          content = editorUI("termone")
        )
      )
    )
  })
  editorSERVER("termone")
}
shinyApp(ui, server)The issue is the way dependencies are managed in shinyAce. Basically, when you call htmltools::findDependencies on an shinyAce::aceEditor you get NULL. There is nothin dockViewR can do.
Just keeping it there so everyone knows.
Metadata
Metadata
Assignees
Labels
No labels