widgets: scoped css: add comments
This commit is contained in:
parent
369a0cc812
commit
8939c3089f
1 changed files with 3 additions and 1 deletions
|
|
@ -180,10 +180,11 @@ module.exports.widgets = function(data,parent) {
|
|||
|
||||
|
||||
|
||||
// parse scoped css
|
||||
var css = ';' + widgetData.css,
|
||||
scopedCss = ''
|
||||
|
||||
css.replace(/[;\}]*([^\;\{]*\{[^\}]*\})/g, (m)=>{
|
||||
css = css.replace(/[;\}]*([^\;\{]*\{[^\}]*\})/g, (m)=>{
|
||||
if (m[0]==';') m = m.substr(1,m.length)
|
||||
scopedCss += '${id}' + m
|
||||
return ''
|
||||
|
|
@ -209,6 +210,7 @@ module.exports.widgets = function(data,parent) {
|
|||
|
||||
widgetManager.addWidget(widgetInner)
|
||||
|
||||
// apply scoped css
|
||||
if (scopedCss.length) {
|
||||
widgetContainer.attr('id', 'widget-' + widgetInner.hash)
|
||||
scopedCss = scopedCss.split('${id}').join('#widget-' + widgetInner.hash + ' ')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue