| ^ermoji\.Rproj$ | |||||
| ^\.Rproj\.user$ | |||||
| ^README\.Rmd$ |
| .Rproj.user | |||||
| .Rhistory | |||||
| .RData | |||||
| .Ruserdata |
| # Generated by roxygen2: do not edit by hand | |||||
| export(ermoji_gadget) |
| #' The ermoji emoji gadget | |||||
| #' | |||||
| #' Opens a miniUI based Shiny gadget in the RStudio Viewer pane with a | |||||
| #' searchable table of emoji. Select a row and click the copy button. | |||||
| #' | |||||
| #' @return nothing | |||||
| #' @export | |||||
| ermoji_gadget <- function() { | |||||
| require(shiny) | |||||
| require(miniUI) | |||||
| ui <- miniPage( | |||||
| gadgetTitleBar("ermoji"), | |||||
| miniContentPanel( | |||||
| padding = 10, | |||||
| DT::dataTableOutput('emojis', height = "100%", width = "98%") | |||||
| ), | |||||
| miniButtonBlock( | |||||
| actionButton("copy_name", "Copy :emoji_name:", class = "btn-success"), | |||||
| actionButton("copy_utf", "Copy Unicode", class = "btn-warning"), | |||||
| actionButton("copy_gliph", "Copy Emoji", class = "btn-primary") | |||||
| ) | |||||
| ) | |||||
| server <- function(input, output, session) { | |||||
| output$emojis <- DT::renderDataTable({ | |||||
| emojis <- emo::jis | |||||
| emojis <- emojis[, c('emoji', 'name', "group", "keywords", "aliases")] | |||||
| emojis$keywords <- purrr::map_chr(emojis$keywords, ~ paste(., collapse = ", ")) | |||||
| emojis$aliases <- purrr::map_chr(emojis$aliases, ~ paste(., collapse = ", ")) | |||||
| DT::datatable( | |||||
| emojis, | |||||
| rownames = FALSE, | |||||
| colnames = c("Emoji", "Name", "Group", "Keywords", "Aliases"), | |||||
| filter = "top", | |||||
| selection = "single", | |||||
| fillContainer = TRUE, | |||||
| # style = 'bootstrap', | |||||
| class = 'compact stripe nowrap hover', | |||||
| options = list( | |||||
| searchHighlight = TRUE, | |||||
| search = list(regex = TRUE, caseInsensitive = FALSE), | |||||
| columnDefs = list(list( | |||||
| className = "dt-center", targets = 0 | |||||
| )), | |||||
| pageLength = 10, | |||||
| lengthMenu = c(4, 5, 10) | |||||
| ) | |||||
| ) | |||||
| }) | |||||
| this_emoji <- reactive({ | |||||
| req(input$emojis_rows_selected) | |||||
| as.list(emo::jis[input$emojis_rows_selected, ]) | |||||
| }) | |||||
| this_emoji_name <- reactive({ | |||||
| name <- this_emoji()$name | |||||
| if (grepl(":", name)) name <- this_emoji()$aliases[[1]][1] | |||||
| paste0(":", gsub(" ", "_", name), ":") | |||||
| }) | |||||
| this_emoji_uni <- reactive({ | |||||
| uni <- paste0("\\U", this_emoji()$runes) | |||||
| gsub(" ", "\\\\U", uni) | |||||
| }) | |||||
| this_emoji_uni_trunc <- reactive({ | |||||
| uni <- this_emoji()$runes | |||||
| uni <- sub(" .+", "...", uni) | |||||
| paste0("\\U", uni) | |||||
| }) | |||||
| observeEvent(input$emojis_rows_selected, { | |||||
| if (!isTruthy(input$emojis_rows_selected)) { | |||||
| updateActionButton(session, "copy_name", "Copy :emoji_name:") | |||||
| updateActionButton(session, "copy_utf", "Copy Unicode") | |||||
| updateActionButton(session, "copy_gliph", "Copy Emoji") | |||||
| } else { | |||||
| updateActionButton(session, "copy_name", paste0("Copy <code>", this_emoji_name(), "</code>")) | |||||
| updateActionButton(session, "copy_utf", paste("Copy <code>", this_emoji_uni_trunc(), "</code>")) | |||||
| updateActionButton(session, "copy_gliph", paste("Copy", this_emoji()$emoji)) | |||||
| } | |||||
| }) | |||||
| observeEvent(input$copy_name, { | |||||
| clipr::write_clip(this_emoji_name()) | |||||
| }) | |||||
| observeEvent(input$copy_utf, { | |||||
| clipr::write_clip(this_emoji_uni()) | |||||
| }) | |||||
| observeEvent(input$copy_gliph, { | |||||
| clipr::write_clip(this_emoji()$emoji) | |||||
| }) | |||||
| observeEvent(input$done, { | |||||
| stopApp(invisible()) | |||||
| }) | |||||
| observeEvent(input$cancel, { | |||||
| stopApp(invisible()) | |||||
| }) | |||||
| } | |||||
| runGadget(ui, server, viewer = paneViewer(500)) | |||||
| } | |||||
| --- | |||||
| output: github_document | |||||
| --- | |||||
| <!-- README.md is generated from README.Rmd. Please edit that file --> | |||||
| ```{r setup, include = FALSE} | |||||
| knitr::opts_chunk$set( | |||||
| collapse = TRUE, | |||||
| comment = "#>", | |||||
| fig.path = "man/figures/README-", | |||||
| out.width = "100%" | |||||
| ) | |||||
| ``` | |||||
| [emo]: https://github.com/hadley/emo | |||||
| [DT]: https://rstudio.github.io/DT | |||||
| [clipr]: https://github.com/mdlincoln/clipr | |||||
| [devtools]: https://github.com/r-lib/devtools | |||||
| [miniUI]: http://shiny.rstudio.com/articles/gadget-ui.html | |||||
| # ermoji | |||||
| Search, find and copy emojis inside RStudio. | |||||
| Basically a [DT] + [clipr] + [miniUI] wrapper around [hadley/emo][emo]. | |||||
| **Why?** Because 🤓. But also because I wanted an easy way to find the Unicode strings for emoji. | |||||
| ## Installation | |||||
| Install **ermoji** with [devtools] | |||||
| ``` r | |||||
| devtools::install_github("gadenbuie/ermoji") | |||||
| ``` | |||||
| ## Usage | |||||
| Open *Search and Copy Emoji* from the RStudio Addins dropdown. | |||||
| <img src="inst/addins-list.png" width="200px"> | |||||
| Pick your emoji and use the "Copy" buttons to copy the emoji to your clipboard. | |||||
| ### Browse the Emoji List | |||||
| <img src="inst/example-browse.png" width="400px" style="border: solid 1px black"> | |||||
| ### Search for Emoji | |||||
| You can use regular expressions to search for any text in the table of emoji. | |||||
| <img src="inst/example-global-search.png" width="400px" style="border: solid 1px black"> | |||||
| ### Search *by Emoji* | |||||
| You can even search *by emoji* by pasting your emoji into the search field. | |||||
| <img src="inst/example-emoji-search.png" width="400px" style="border: solid 1px black"> | |||||
| ### Search in Specific Columns | |||||
| Search inside individual columns for more specific emoji finding. | |||||
| <img src="inst/example-column-search.png" width="400px" style="border: solid 1px black"> |
| <!-- README.md is generated from README.Rmd. Please edit that file --> | |||||
| # ermoji | |||||
| Search, find and copy emojis inside RStudio. Basically a | |||||
| [DT](https://rstudio.github.io/DT) + | |||||
| [clipr](https://github.com/mdlincoln/clipr) + | |||||
| [miniUI](http://shiny.rstudio.com/articles/gadget-ui.html) wrapper | |||||
| around [hadley/emo](https://github.com/hadley/emo). | |||||
| **Why?** Because 🤓. But also because I wanted an easy way to find the | |||||
| Unicode strings for emoji. | |||||
| ## Installation | |||||
| Install **ermoji** with [devtools](https://github.com/r-lib/devtools) | |||||
| ``` r | |||||
| devtools::install_github("gadenbuie/ermoji") | |||||
| ``` | |||||
| ## Usage | |||||
| Open *Search and Copy Emoji* from the RStudio Addins dropdown. | |||||
| <img src="inst/addins-list.png" width="200px"> | |||||
| Pick your emoji and use the “Copy” buttons to copy the emoji to your | |||||
| clipboard. | |||||
| ### Browse the Emoji List | |||||
| <img src="inst/example-browse.png" width="400px" style="border: solid 1px black"> | |||||
| ### Search for Emoji | |||||
| You can use regular expressions to search for any text in the table of | |||||
| emoji. | |||||
| <img src="inst/example-global-search.png" width="400px" style="border: solid 1px black"> | |||||
| ### Search *by Emoji* | |||||
| You can even search *by emoji* by pasting your emoji into the search | |||||
| field. | |||||
| <img src="inst/example-emoji-search.png" width="400px" style="border: solid 1px black"> | |||||
| ### Search in Specific Columns | |||||
| Search inside individual columns for more specific emoji | |||||
| finding. | |||||
| <img src="inst/example-column-search.png" width="400px" style="border: solid 1px black"> |
| Version: 1.0 | |||||
| RestoreWorkspace: No | |||||
| SaveWorkspace: No | |||||
| AlwaysSaveHistory: Default | |||||
| EnableCodeIndexing: Yes | |||||
| UseSpacesForTab: Yes | |||||
| NumSpacesForTab: 2 | |||||
| Encoding: UTF-8 | |||||
| RnwWeave: Sweave | |||||
| LaTeX: XeLaTeX | |||||
| AutoAppendNewline: Yes | |||||
| StripTrailingWhitespace: Yes | |||||
| BuildType: Package | |||||
| PackageUseDevtools: Yes | |||||
| PackageInstallArgs: --no-multiarch --with-keep.source | |||||
| PackageRoxygenize: rd,collate,namespace |
| Name: Search and Copy Emoji | |||||
| Description: Search for emoji and copy name, unicode, or gliph. | |||||
| Binding: ermoji_gadget | |||||
| Interactive: true |
| % Generated by roxygen2: do not edit by hand | |||||
| % Please edit documentation in R/ermoji_gadget.R | |||||
| \name{ermoji_gadget} | |||||
| \alias{ermoji_gadget} | |||||
| \title{The ermoji emoji gadget} | |||||
| \usage{ | |||||
| ermoji_gadget() | |||||
| } | |||||
| \value{ | |||||
| nothing | |||||
| } | |||||
| \description{ | |||||
| Opens a miniUI based Shiny gadget in the RStudio Viewer pane with a | |||||
| searchable table of emoji. Select a row and click the copy button. | |||||
| } |