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
html refresh does not work (for reveal js only?) #7552
Comments
I looked into this a bit. The refresh logic is here: jupyterlab/packages/htmlviewer/src/index.tsx Lines 86 to 96 in 00b17fc
What it is doing is asking the iframe to reset its source to the current source available. This is more about resetting the source to the source it was originally set as (refreshing form values, etc.), and not about reloading the source from disk. To reload source from disk, use the File > Reload HTML file from Disk men option. In order to get the file to reload from disk when clicking that refresh button, the above code could be changed to something like: this.toolbar.addItem(
'refresh',
new ToolbarButton({
iconClassName: 'jp-RefreshIcon',
onClick: async () => {
if (!this.context.model.dirty) {
await this.context.revert();
this.update();
}
},
tooltip: 'Rerender HTML Document'
})
); I put the dirty check to cover the case where you actually have the html file open in an editor as well and are changing it. In general, we support live preview of HTML files, i.e., you can have the html file open in an editor and the viewer, and the viewer reflects the changes from the editor, regardless of whether those changes are saved. If you want that refresh button to reload the file from disk, then it also reverts the editor, which may be surprising to a user. |
Putting as a good first issue for whoever would like to follow up on this and push it forward to completion. Another thing that could be done is refactoring the "Reload from disk" logic at jupyterlab/packages/docmanager-extension/src/index.ts Lines 453 to 475 in 00b17fc
Right now, it always pops up a dialog asking for confirmation. Perhaps we should only ask for confirmation if the file model is dirty, i.e., there are unsaved changes. If the model is not dirty, we should just reload without asking any questions. Then we could take out the dirty check in the above code snippet. |
I would like to work on this. |
Fixed by #7824 |
html tabs have a (theoretically) useful button to refresh that does not seem to work. Open a notebook with a python (or other) kernel to reproduce this problem. First create this and run:
Now open the slideshow that is created, and click "Trust HTML" to display the content. Then, change the original notebook, e.g.:
Now, return to the html file and refresh. There are no change. Only after reopening the file is the new content displayed.
I am running Ubuntu 18.04, and Jupyter Lab 1.2.3
The text was updated successfully, but these errors were encountered: