@veloceapps/sdk 8.0.0-171 → 8.0.0-173

Sign up to get free protection for your applications and to get access to all the features.
@@ -1558,9 +1558,13 @@ class ResourcesService {
1558
1558
  }
1559
1559
  return this.loaded$.pipe(filter(() => this.scripts.get(url) === true), take(1));
1560
1560
  }
1561
- loadStyles(url) {
1562
- const previewEl = document.querySelector('vl-cms-preview');
1563
- const rootEl = previewEl?.shadowRoot ?? previewEl ?? document.body;
1561
+ loadStyles(first, second) {
1562
+ const url = typeof first === 'string' ? first : typeof second === 'string' ? second : '';
1563
+ const host = typeof first !== 'string' ? first : null;
1564
+ let el = host?.injector.get(ElementRef)?.nativeElement ?? document.body;
1565
+ while (el.parentNode) {
1566
+ el = el.parentNode;
1567
+ }
1564
1568
  return new Observable(subscriber => {
1565
1569
  const link = document.createElement('link');
1566
1570
  link.rel = 'stylesheet';
@@ -1571,7 +1575,7 @@ class ResourcesService {
1571
1575
  subscriber.next();
1572
1576
  subscriber.complete();
1573
1577
  };
1574
- rootEl.appendChild(link);
1578
+ el.appendChild(link);
1575
1579
  });
1576
1580
  }
1577
1581
  persistAMDLoader() {