rstudio/rstudio — pull request #105 by jmcphers (2014-04-30 16:33:52+00:00)
Title: Preserve scroll positions in Shiny documents

This change gives Shiny documents the same scroll preservation behavior as other R Markdown documents. It works as follows:

1. An independent script, `rsiframe.js`, broadcasts a frame's scroll position and anchors to its parent as they change, and accepts commands to change the scroll position and anchor.
2. RStudio injects `rsiframe.js` when running a Shiny document, using the `extra_dependencies` argument.
3. When viewing a Shiny document, RStudio interacts with `rsiframe.js` instead of attempting to access the protected content of the document itself.

Note that while this fixes scroll preservation, it does not fix slide navigation. We have some work to do there since the data we need to build the navigation needs to be built into a new client event (it is not available when the Shiny document starts since there hasn't yet been a completed render at that point).