Skip to content

Commit af950f9

Browse files
Merge pull request #1166 from mfranzke/fix-plugintabs-enabling-multiple-file-formats
Fix plugin-tabs enabling multiple file formats #1163
2 parents 123427a + 2b60488 commit af950f9

File tree

3 files changed

+26
-23
lines changed

3 files changed

+26
-23
lines changed

packages/plugin-tab/dist/js/@pattern-lab-plugin-tab.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ window.PluginTab = {
66
init: function() {
77
//placeholder that will be replaced during configuation
88
//most plugins could probably just implement logic here instead.
9-
/*SNIPPETS*/
9+
function addPanels() {
10+
/*SNIPPETS*/
11+
}
12+
13+
// workaround to try recovering from load order race conditions
14+
if (window.patternlab && window.patternlab.panels) {
15+
addPanels();
16+
} else {
17+
document.addEventListener('patternLab.pageLoad', addPanels);
18+
}
1019
},
1120
};

packages/plugin-tab/src/snippet.js

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
function addPanels() {
2-
window.patternlab.panels.add({
3-
id: 'sg-panel-scss',
4-
name: 'SCSS',
5-
default: false,
6-
templateID: 'pl-panel-template-code',
7-
httpRequest: true,
8-
httpRequestReplace: '.scss',
9-
httpRequestCompleted: false,
10-
prismHighlight: true,
11-
language: 'scss',
12-
keyCombo: 'ctrl+shift+z',
13-
});
14-
}
15-
16-
// workaround to try recovering from load order race conditions
17-
if (window.patternlab && window.patternlab.panels) {
18-
addPanels();
19-
} else {
20-
document.addEventListener('patternLab.pageLoad', addPanels);
21-
}
1+
window.patternlab.panels.add({
2+
id: 'sg-panel-<<type>>',
3+
name: '<<typeUC>>',
4+
default: window.config.defaultPatternInfoPanelCode && window.config.defaultPatternInfoPanelCode === "<<type>>",
5+
templateID: 'pl-panel-template-code',
6+
httpRequest: true,
7+
httpRequestReplace: '.<<type>>',
8+
httpRequestCompleted: false,
9+
prismHighlight: true,
10+
language: '<<type>>'//,
11+
/* TODO: We would need to find a way to enable keyCombo for multiple panels
12+
keyCombo: 'ctrl+shift+z',*/
13+
});

packages/uikit-workshop/src/scripts/components/panels.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ function init(event) {
6868
Panels.add({
6969
id: 'pl-panel-pattern',
7070
name: window.config.patternExtension.toUpperCase(),
71-
default: true,
71+
default: !window.config.defaultPatternInfoPanelCode ||
72+
window.config.defaultPatternInfoPanelCode ===
73+
window.config.patternExtension,
7274
templateID: 'pl-panel-template-code',
7375
httpRequest: true,
7476
httpRequestReplace: fileSuffixPattern,

0 commit comments

Comments
 (0)