Skip to content

Commit

Permalink
fix(plugintabs): enabling multiple file formats #1163
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximilian Franzke committed Apr 28, 2020
1 parent 0eacc13 commit bb5e817
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
11 changes: 10 additions & 1 deletion packages/plugin-tab/dist/js/@pattern-lab-plugin-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ window.PluginTab = {
init: function() {
//placeholder that will be replaced during configuation
//most plugins could probably just implement logic here instead.
/*SNIPPETS*/
function addPanels() {
/*SNIPPETS*/
}

// workaround to try recovering from load order race conditions
if (window.patternlab && window.patternlab.panels) {
addPanels();
} else {
document.addEventListener('patternLab.pageLoad', addPanels);
}
},
};
34 changes: 13 additions & 21 deletions packages/plugin-tab/src/snippet.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
function addPanels() {
window.patternlab.panels.add({
id: 'sg-panel-scss',
name: 'SCSS',
default: false,
templateID: 'pl-panel-template-code',
httpRequest: true,
httpRequestReplace: '.scss',
httpRequestCompleted: false,
prismHighlight: true,
language: 'scss',
keyCombo: 'ctrl+shift+z',
});
}

// workaround to try recovering from load order race conditions
if (window.patternlab && window.patternlab.panels) {
addPanels();
} else {
document.addEventListener('patternLab.pageLoad', addPanels);
}
window.patternlab.panels.add({
id: 'sg-panel-<<type>>',
name: '<<typeUC>>',
default: window.config.defaultPatternInfoPanelCode && window.config.defaultPatternInfoPanelCode === "<<type>>",
templateID: 'pl-panel-template-code',
httpRequest: true,
httpRequestReplace: '.<<type>>',
httpRequestCompleted: false,
prismHighlight: true,
language: '<<type>>'//,
/* TODO: We would need to find a way to enable keyCombo for multiple fields
keyCombo: 'ctrl+shift+z',*/
});

0 comments on commit bb5e817

Please sign in to comment.