Skip to content

Commit

Permalink
Merge pull request #7824 from ggbhat/htmlviewer-refresh-issue
Browse files Browse the repository at this point in the history
Fixed refresh issue for html viewer(slides)-7552
  • Loading branch information
Steven Silvester committed Jan 28, 2020
2 parents 3cb64ca + 83b3eca commit 6433521
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
23 changes: 16 additions & 7 deletions packages/docmanager-extension/src/index.ts
Expand Up @@ -486,16 +486,25 @@ function addCommands(
buttons: [Dialog.okButton()]
});
}
return showDialog({
title: `Reload ${type} from Disk`,
body: `Are you sure you want to reload
if (context.model.dirty) {
return showDialog({
title: `Reload ${type} from Disk`,
body: `Are you sure you want to reload
the ${type} from the disk?`,
buttons: [Dialog.cancelButton(), Dialog.warnButton({ label: 'Reload' })]
}).then(result => {
if (result.button.accept && !context.isDisposed) {
buttons: [
Dialog.cancelButton(),
Dialog.warnButton({ label: 'Reload' })
]
}).then(result => {
if (result.button.accept && !context.isDisposed) {
return context.revert();
}
});
} else {
if (!context.isDisposed) {
return context.revert();
}
});
}
}
});

Expand Down
7 changes: 5 additions & 2 deletions packages/htmlviewer/src/index.tsx
Expand Up @@ -90,8 +90,11 @@ export class HTMLViewer extends DocumentWidget<IFrame>
'refresh',
new ToolbarButton({
iconRenderer: refreshIcon,
onClick: () => {
this.content.url = this.content.url;
onClick: async () => {
if (!this.context.model.dirty) {
await this.context.revert();
this.update();
}
},
tooltip: 'Rerender HTML Document'
})
Expand Down

0 comments on commit 6433521

Please sign in to comment.