Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
electric-el committed May 26, 2022
2 parents b70752f + 27c0653 commit e600840
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
25 changes: 12 additions & 13 deletions scripts/classes/code-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,19 +621,18 @@ export default class CodeViewer {
if (this.$orgs['#sg-code-panel-feplet'].length) {
this.$orgs['#sg-code-panel-feplet'][0]
.contentWindow.location.replace(`/mustache-browser?partial=${this.patternPartial}`);
this.$orgs['#sg-code-panel-feplet'][0]
.addEventListener('load', () => {
const height =
this.$orgs['#sg-code-panel-feplet'][0].contentWindow.document.documentElement.offsetHeight;

/* istanbul ignore if */
if (height > 150) {
this.$orgs['#sg-code-panel-feplet'].dispatchAction('css', {height: `${height}px`, visibility: ''});
}
else {
this.$orgs['#sg-code-panel-feplet'].dispatchAction('css', {height: '', visibility: ''});
}
});
this.$orgs['#sg-code-panel-feplet'].on('load', () => {
const height =
this.$orgs['#sg-code-panel-feplet'][0].contentWindow.document.documentElement.offsetHeight;

/* istanbul ignore if */
if (height > 150) {
this.$orgs['#sg-code-panel-feplet'].dispatchAction('css', {height: `${height}px`, visibility: ''});
}
else {
this.$orgs['#sg-code-panel-feplet'].dispatchAction('css', {height: '', visibility: ''});
}
});
}
// DEPRECATED: Here for backward-compatibility. Will be removed.
else {
Expand Down
4 changes: 3 additions & 1 deletion scripts/listeners/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export default class Listeners {
this.#fepperUi.dataSaver.findValue('lastViewer') === 'annotations'
) {
// Open annotations viewer if last opened viewer was annotations.
this.#fepperUi.annotationsViewer.openAnnotations();
this.$orgs['#sg-viewport'].on('load', () => {
this.#fepperUi.annotationsViewer.openAnnotations();
});
}
else {
// Open code viewer by default.
Expand Down

0 comments on commit e600840

Please sign in to comment.