Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit 88fec9f

Browse files
committed
make sure annotation open auto-closes code view
1 parent 1b6dc44 commit 88fec9f

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

public/styleguide/js/annotations-viewer.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ var annotationsViewer = {
2323

2424
e.preventDefault();
2525

26-
// make sure the code view overlay is off before showing the annotations view
27-
$('#sg-t-code').removeClass('active');
28-
codeViewer.codeActive = false;
29-
var obj = JSON.stringify({ "codeToggle": "off" });
30-
document.getElementById('sg-viewport').contentWindow.postMessage(obj,annotationsViewer.targetOrigin);
31-
codeViewer.slideCode(999);
32-
3326
// remove the class from the "eye" nav item
3427
$('#sg-t-toggle').removeClass('active');
3528

@@ -60,9 +53,20 @@ var annotationsViewer = {
6053
* open the annotations panel
6154
*/
6255
openComments: function() {
63-
annotationsViewer.commentsActive = true;
56+
57+
// make sure the code view overlay is off before showing the annotations view
58+
$('#sg-t-code').removeClass('active');
59+
codeViewer.codeActive = false;
60+
var obj = JSON.stringify({ "codeToggle": "off" });
61+
document.getElementById('sg-viewport').contentWindow.postMessage(obj,annotationsViewer.targetOrigin);
62+
codeViewer.slideCode(999);
63+
64+
// tell the iframe annotation view has been turned on
6465
var obj = JSON.stringify({ "commentToggle": "on" });
6566
document.getElementById('sg-viewport').contentWindow.postMessage(obj,annotationsViewer.targetOrigin);
67+
68+
// note that it's turned on in the viewer
69+
annotationsViewer.commentsActive = true;
6670
$('#sg-t-annotations').addClass('active');
6771
},
6872

0 commit comments

Comments
 (0)