-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(plugin-tab): defensively call addPanels
- Loading branch information
1 parent
c100bbc
commit b82bd12
Showing
1 changed file
with
21 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
/* global Panels */ | ||
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', | ||
}); | ||
} | ||
|
||
window.patternlab.panels.add({ | ||
id: 'sg-panel-<<type>>', | ||
name: '<<typeUC>>', | ||
default: false, | ||
templateID: 'pl-panel-template-code', | ||
httpRequest: true, | ||
httpRequestReplace: '.<<type>>', | ||
httpRequestCompleted: false, | ||
prismHighlight: true, | ||
language: '<<type>>', | ||
keyCombo: 'ctrl+shift+z', | ||
}); | ||
if (window.patternlab && window.patternlab.panels) { | ||
console.log('pl already ready'); | ||
addPanels(); | ||
} else { | ||
console.log('waiting for PL to be ready'); | ||
document.addEventListener('patternLab.pageLoad', addPanels); | ||
} |