Skip to content
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

Add shortcut and cursor listeners #16

Merged
merged 3 commits into from
Oct 23, 2014
Merged

Add shortcut and cursor listeners #16

merged 3 commits into from
Oct 23, 2014

Conversation

skranz
Copy link
Contributor

@skranz skranz commented Oct 7, 2014

Hi Jeff,

here is my pull request related to issue #14. You see that a shortcut event returns a quite detailed list with editorId, selection and so on. I found this detailed return very convenient, in particular when developing apps with multiple dynamically created Ace editor widgets.

It also returns a random number. This is makes it easier to check in R whether indeed a key has been pressed or an observer was just called by Shiny without a new key being pressed. (Shiny has the tendency to call observers too often when working with dynamic UI elements).

I updated the version so that different shortcuts for Windows and Mac can be defined but have not tested it on the Mac yet.

Of course you can remove my name from the description file. That is only for my own documentation.

Best wishes,
Sebastian

@vnijs
Copy link
Collaborator

vnijs commented Oct 13, 2014

I would be happy to test on Mac. I will wait until the pull request has been merged

Author: Trestle Technology, LLC.
Maintainer: Jeff Allen <jeff@trestletech.com>
Description: Ace editor bindings to enable a rich text editing environment
within Shiny.
within Shiny. (Extension by Sebastian Kranz: add listeners for keys and cursor changes)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know that CRAN would like this here. Can you remove that line and either add a contributors section to the README or I can after we merge?

@trestletech
Copy link
Owner

Great! Thanks for contributing.

I've gone through the code with a few concerns/questions. Whenever you have a chance to go through them I'd love to get your thoughts.

Thanks again.
Jeff

visible changes:
renamed keyId to hotkeys
@skranz
Copy link
Contributor Author

skranz commented Oct 15, 2014

Hi Jeff,

thanks for your good suggestions. I should have implemented all of them with the new commit (if I have not overlooked anything). I also liked "hotkeys" very much as parameter name.

@trestletech trestletech merged commit bd026f5 into trestletech:master Oct 23, 2014
trestletech added a commit that referenced this pull request Oct 23, 2014
@trestletech
Copy link
Owner

Thanks again for the code! I had a chance to sit down and really play with it this evening and I agree that it will be a really useful feature to expose to users.

I merged it in and added a commit to clean up a couple of minor things and add an example in the inst/examples directory.

Keep the code coming! :)

@trestletech
Copy link
Owner

Oh, and I added a Contributors section to the README. Let me know if you have a different URL you'd prefer I use for you there.

@vnijs
Copy link
Collaborator

vnijs commented Oct 24, 2014

Just tested the new hotkeys function. Nice! Any idea if it would be possible to select the current line for runkey and then move the cursor down one line?

To use runkey and also an action button (evalRmd) to, for example, run knitr I adapted Jeff's example as shown below.

valsRmd <- reactiveValues(knit = 0)

observe({
input$runKeyRmd
if(!is.null(input$evalRmd)) isolate(valsRmd$knit <- valsRmd$knit + 1)
})

output$rmd_knitDoc <- renderUI({
if(valsRmd$knit == 1) return()

...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants