-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inputID
containing a "-" fails to render UI editor
#8
Comments
Hi @jdtrat, is this package still actively maintained? Or should I give up on this issue? Thanks! Just want to temper my expectations. |
Hi @AARON-CLARK , ### Example 1
library(shiny)
library(shinymarkdown)
ui <- fluidPage(
useShinyMarkdownEditor(),
markdownEditorInput(inputId = "editor-1")
)
server <- function(input, output, session) {}
shinyApp(ui, server)
### Example 2
library(shinymarkdown)
library(shiny)
modUI <- function(id) {
markdownEditorInput(inputId = NS(id, "editor"))
}
modServer <- function(id) {
moduleServer(id, function(input, output, session) {
observe({print(input$editor)})
})
}
ui <- fluidPage(
useShinyMarkdownEditor(),
modUI ("my_namespace")
)
server <- function(input, output, session) {
modServer ("my_namespace")
}
shinyApp(ui, server)
### Example 3
library(shinymarkdown)
library(shiny)
modUI <- function(id) {
tagList(
actionButton(NS(id, "reset"), "Reset"),
markdownEditorInput(inputId = NS(id, "editor"))
)
}
modServer <- function(id) {
moduleServer(id, function(input, output, session) {
observeEvent(input$reset, updateMarkdownEditorInput(session, session$ns("editor"), ""))
observe({print(input$editor)})
})
}
ui <- fluidPage(
useShinyMarkdownEditor(),
modUI ("my_namespace"),
modUI ("my_namespace_2")
)
server <- function(input, output, session) {
modServer ("my_namespace")
modServer ("my_namespace_2")
}
shinyApp(ui, server) @jdtrat , please let me know if you want me to create a PR from my fork to your original repo, or if it is OK for me to keep working on my fork. |
Awesome! I will check it out. I know it's not my place, but please keep working on your fork! 🤣 |
@jcrodriguez1989, Do you have any plans to push your package to CRAN? Not a requirement, but would be helpful & more accessible to more R users. |
Hi, nice package! I was looking to include your pkg's markdown editor in my shiny app which leverages shiny modules, but it won't render because
mdInput()
seems to be quite sensitive to hyphens. This is problematic because modules leverage hyphens a ton for namespacing purposes.Here is a minimal example:
Nothing renders.
Here is a shiny modules example:
Note,
NS()
just concatenates theid
arg onto theinputID
text string, separated by a hypen. So in this case, it should create an input called "my_namespace-editor".The text was updated successfully, but these errors were encountered: