From 9e8762296646000ffcf623738bbb4c0d1253a36e Mon Sep 17 00:00:00 2001 From: electric-el Date: Thu, 26 May 2022 17:35:15 -0400 Subject: [PATCH 1/2] waiting for pattern to load before loading annnotations in halfMode --- scripts/listeners/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/listeners/index.js b/scripts/listeners/index.js index 990fb4d..99ed3f6 100644 --- a/scripts/listeners/index.js +++ b/scripts/listeners/index.js @@ -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. From 27c06530a7f1c06c3e83f1c35815a92307365211 Mon Sep 17 00:00:00 2001 From: electric-el Date: Thu, 26 May 2022 17:55:30 -0400 Subject: [PATCH 2/2] replaced .addEventListener with jQuery .on() for consistency --- scripts/classes/code-viewer.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/scripts/classes/code-viewer.js b/scripts/classes/code-viewer.js index e499af4..9b78c6a 100644 --- a/scripts/classes/code-viewer.js +++ b/scripts/classes/code-viewer.js @@ -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 {