소스 검색

ermoji addin

tags/v0.1.1
Garrick Aden-Buie 8 년 전
부모
커밋
a576419132
14개의 변경된 파일274개의 추가작업 그리고 0개의 파일을 삭제
  1. +3
    -0
      .Rbuildignore
  2. +4
    -0
      .gitignore
  3. +3
    -0
      NAMESPACE
  4. +104
    -0
      R/ermoji_gadget.R
  5. +65
    -0
      README.Rmd
  6. +55
    -0
      README.md
  7. +21
    -0
      ermoji.Rproj
  8. BIN
      inst/addins-list.png
  9. BIN
      inst/example-browse.png
  10. BIN
      inst/example-column-search.png
  11. BIN
      inst/example-emoji-search.png
  12. BIN
      inst/example-global-search.png
  13. +4
    -0
      inst/rstudio/addins.dcf
  14. +15
    -0
      man/ermoji_gadget.Rd

+ 3
- 0
.Rbuildignore 파일 보기

@@ -0,0 +1,3 @@
^ermoji\.Rproj$
^\.Rproj\.user$
^README\.Rmd$

+ 4
- 0
.gitignore 파일 보기

@@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata

+ 3
- 0
NAMESPACE 파일 보기

@@ -0,0 +1,3 @@
# Generated by roxygen2: do not edit by hand

export(ermoji_gadget)

+ 104
- 0
R/ermoji_gadget.R 파일 보기

@@ -0,0 +1,104 @@
#' 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))
}


+ 65
- 0
README.Rmd 파일 보기

@@ -0,0 +1,65 @@
---
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">

+ 55
- 0
README.md 파일 보기

@@ -0,0 +1,55 @@

<!-- 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">

+ 21
- 0
ermoji.Rproj 파일 보기

@@ -0,0 +1,21 @@
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

BIN
inst/addins-list.png 파일 보기

Before After
Width: 540  |  Height: 165  |  Size: 6.9KB

BIN
inst/example-browse.png 파일 보기

Before After
Width: 1648  |  Height: 1353  |  Size: 166KB

BIN
inst/example-column-search.png 파일 보기

Before After
Width: 1648  |  Height: 1353  |  Size: 139KB

BIN
inst/example-emoji-search.png 파일 보기

Before After
Width: 1648  |  Height: 1353  |  Size: 61KB

BIN
inst/example-global-search.png 파일 보기

Before After
Width: 1648  |  Height: 1353  |  Size: 80KB

+ 4
- 0
inst/rstudio/addins.dcf 파일 보기

@@ -0,0 +1,4 @@
Name: Search and Copy Emoji
Description: Search for emoji and copy name, unicode, or gliph.
Binding: ermoji_gadget
Interactive: true

+ 15
- 0
man/ermoji_gadget.Rd 파일 보기

@@ -0,0 +1,15 @@
% 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.
}

Loading…
취소
저장