| input$picker_type, | input$picker_type, | ||||
| "unicode" = input$emoji$emoji, | "unicode" = input$emoji$emoji, | ||||
| "html" = input$emoji$html, | "html" = input$emoji$html, | ||||
| "emo_ji" = { | |||||
| tryCatch({ | |||||
| emo::ji(input$emoji$name) | |||||
| paste0('emo::ji("', input$emoji$name, '")') | |||||
| }, | |||||
| error = function(e) { | |||||
| session$sendCustomMessage("bad_emo_ji", input$emoji$name) | |||||
| message("{emo} doesn't know the emoji ", shQuote(input$emoji$name)) | |||||
| NULL | |||||
| } | |||||
| ) | |||||
| } | |||||
| "emo_ji" = try_emo_ji(input$emoji$name, session = session) | |||||
| ) | ) | ||||
| if (!is.null(emoji)) { | if (!is.null(emoji)) { | ||||
| rstudioapi::insertText( | rstudioapi::insertText( | ||||
| }) | }) | ||||
| } | } | ||||
| } | } | ||||
| try_emo_ji <- function(name, session = shiny::getDefaultReactiveDomain()) { | |||||
| emo_ji <- tryCatch({ | |||||
| emo::ji(input$emoji$name) | |||||
| paste0('emo::ji("', input$emoji$name, '")') | |||||
| }, | |||||
| error = function(e) { | |||||
| NULL | |||||
| } | |||||
| ) | |||||
| if (!is.null(emo_ji)) return(emo_ji) | |||||
| name_no_space <- gsub(" ", "_", name) | |||||
| tryCatch({ | |||||
| emo::ji(name_no_space) | |||||
| paste0('emo::ji("', name_no_space, '")') | |||||
| }, | |||||
| error = function(e) { | |||||
| session$sendCustomMessage("bad_emo_ji", name) | |||||
| message("{emo} doesn't know the emoji ", shQuote(name)) | |||||
| NULL | |||||
| } | |||||
| ) | |||||
| } |