Skip to content

Commit bb5e817

Browse files
author
Maximilian Franzke
committed
fix(plugintabs): enabling multiple file formats #1163
1 parent 0eacc13 commit bb5e817

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
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 fields
12+
keyCombo: 'ctrl+shift+z',*/
13+
});

0 commit comments

Comments
 (0)