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

Update save_notebook to use ottr_force_save_labextension hook #22

Merged
merged 5 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* Updated `ottr::export` so that notebook PDF generation failures do not prevent zip file creation [#766](https://github.com/ucbds-infra/otter-grader/issues/766)
* Added the `debug` argument to `ottr::export` to assist in debugging PDF generation failures
* Updated `ottr::export` force-save functionality to rely on [`ottr_force_save_labextension`](https://github.com/chrispyles/ottr-force-save-labextension) per [#767](https://github.com/ucbds-infra/otter-grader/issues/767)

**v1.4.0:**

Expand Down
6 changes: 4 additions & 2 deletions R/export.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ ext <- tools::file_ext(submission_path)
success <- save_notebook(submission_path)
if (!success) {
warning(paste0(
"Couldn't automatically save the notebook; we recommend using File > Save & ",
"Checkpoint and then re-running this cell. The zip file returned by this call ",
"Couldn't automatically save the notebook; ensure that you have ",
"ottr_force_save_labextension installed. If you have it installed and this issue keeps",
"reoccurring, you should use File > Save & ",
"Checkpoint and then rerun this cell. The zip file generated by this call ",
"will use the last saved version of this notebook."
))
}
Expand Down
5 changes: 2 additions & 3 deletions R/save_notebook.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ save_notebook <- function(nb_path, timeout = 10) {
IRdisplay::display_javascript("
if (typeof Jupyter !== 'undefined') {
Jupyter.notebook.save_checkpoint();
}
else {
document.querySelector('[data-command=\"docmanager:save\"]').click();
} else if ('__ottr_force_save_labextension_force_save' in window) {
window.__ottr_force_save_labextension_force_save();
}
")

Expand Down
Loading