Просмотр исходного кода

Clear placeholder when setting regex pattern from library

and restore when input$pattern is empty
tags/v0.2.0
Garrick Aden-Buie 8 лет назад
Родитель
Сommit
8c674d38a7
1 измененных файлов: 10 добавлений и 1 удалений
  1. +10
    -1
      R/regex_gadget.R

+ 10
- 1
R/regex_gadget.R Просмотреть файл

@@ -193,6 +193,8 @@ regex_gadget <- function(
# ---- Server - Tab - Regex ----
output$result <- renderUI({
if (is.null(rtext())) return(NULL)
delay <- getOption('regexplain.input_delay_ms', NULL)
if (!is.null(delay)) invalidateLater(delay, session)
if (pattern() == "") {
return(toHTML(paste('<p class="results">', escape_html(rtext()), "</p>", collapse = "")))
}
@@ -272,11 +274,18 @@ regex_gadget <- function(
})

observeEvent(input$library_apply_pattern, {
updateTextInput(session, "pattern", value = this_pattern()$regex)
updateTextInput(session, "pattern", value = this_pattern()$regex, placeholder = "")
updateSelectInput(session, "template", selected = "")
removeModal()
})

observe({
is_empty <- input$pattern == ""
if (is_empty) updateTextInput(
session, "pattern",
placeholder = "Standard RegEx, e.g. \\w+_\\d{2,4}\\s+")
})

# ---- Server - Tab - Output ----
regexFn_replacement_val <- NULL


Загрузка…
Отмена
Сохранить