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

Commit 72678a9

Browse files
committed
fixing code view to suppprt CSS view
1 parent 1b76602 commit 72678a9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

public/styleguide/js/code-viewer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ var codeViewer = {
5555
codeContainerInit: function() {
5656

5757
if (document.getElementById("sg-code-container") == undefined) {
58-
$('<div id="sg-code-container" style="display: none;"></div>').html('<a href="#" id="sg-code-close-btn">Close</a><div id="sg-code-lineage" style="display: none;"><h2>Lineage</h2><p>This pattern contains the following patterns: <span id="sg-code-lineage-fill"></span></p></div><div id="sg-code-html"><h2>HTML</h2><pre><code id="sg-code-html-fill" class="language-markup"></code></pre></div>').appendTo('body').css('bottom',-$(document).outerHeight());
58+
$('<div id="sg-code-container" style="display: none;"></div>').html('<a href="#" id="sg-code-close-btn">Close</a><div id="sg-code-lineage" style="display: none;"><h2>Lineage</h2><p>This pattern contains the following patterns: <span id="sg-code-lineage-fill"></span></p></div><div id="sg-code-html"><h2>HTML</h2><pre><code id="sg-code-html-fill" class="language-markup"></code></pre></div><div id="sg-code-css" class="with-css" style="display: none;"><h2>CSS</h2><pre><code id="sg-code-css-fill" class="language-css"></code></pre></div>').appendTo('body').css('bottom',-$(document).outerHeight());
5959
}
6060

6161
if (codeViewer.sw < codeViewer.breakpoint) {
@@ -111,6 +111,7 @@ var codeViewer = {
111111

112112
// draw CSS
113113
if (css.indexOf("{{ patternCSS }}") == -1) {
114+
$("#sg-code-html").addClass("with-css");
114115
$("#sg-code-css").css("display","block");
115116
$("#sg-code-css-fill").text(css);
116117
Prism.highlightElement(document.getElementById("sg-code-css-fill"));

0 commit comments

Comments
 (0)