Skip to content

Commit

Permalink
fix #699: focus on gitbook content when the page is loaded outside RS…
Browse files Browse the repository at this point in the history
…tudio Viewer; also close #691 accordingly

the fix cbe9f10 for #165 was incomplete: it didn't consider the case outside RStudio Viewer, hence the content loses focus when a page is loaded in a normal web browser
  • Loading branch information
yihui committed May 1, 2019
1 parent 4eb6da3 commit ff6cd68
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: bookdown
Type: Package
Title: Authoring Books and Technical Documents with R Markdown
Version: 0.9.3
Version: 0.9.4
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")),
person("JJ", "Allaire", role = "ctb"),
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

- Split reference sections in `gitbook` ignored the sorting definition of the citation style (thanks @GegznaV #661, @crsh #674).

- For the `gitbook` output format, the content doesn't get the focus when the page is loaded, which makes it fail to respond to keystrokes such as PageUp/PageDown/Up/Down (thanks, @darshanbaral #691, @aronatkins #699).

# CHANGES IN bookdown VERSION 0.9

## BUG FIXES
Expand Down
2 changes: 1 addition & 1 deletion inst/resources/gitbook/js/plugin-bookdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ gitbook.require(["gitbook", "lodash", "jQuery"], function(gitbook, _, $) {
if (pos.body !== 0) bookBody.scrollTop(pos.body);
if (pos.inner !== 0) bookInner.scrollTop(pos.inner);
}
if (pos.focused) bookInner.find('.page-wrapper').focus();
}
if ((pos && pos.focused) || !inIFrame()) bookInner.find('.page-wrapper').focus();
// clear book body scroll position
gs.remove('bodyScrollTop');
});
Expand Down

0 comments on commit ff6cd68

Please sign in to comment.