@innovastudio/contentbox 1.6.190 → 1.6.191
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -162717,18 +162717,33 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
|
|
|
162717
162717
|
section.classList.forEach(item => {
|
|
162718
162718
|
if (item.indexOf('type-') !== -1) {
|
|
162719
162719
|
const contentClass = item;
|
|
162720
|
-
const contentCss = item + '.css'; //
|
|
162720
|
+
const contentCss = item + '.css'; // Check if it's an inline style or external CSS file
|
|
162721
162721
|
|
|
162722
|
-
|
|
162723
|
-
let links = this.doc.getElementsByTagName('link');
|
|
162722
|
+
const cssText = this.getInlineTypographyStyle && this.getInlineTypographyStyle(contentClass);
|
|
162724
162723
|
|
|
162725
|
-
|
|
162726
|
-
|
|
162727
|
-
|
|
162728
|
-
}
|
|
162724
|
+
if (cssText) {
|
|
162725
|
+
// Add inline style
|
|
162726
|
+
const styleExists = [...this.doc.querySelectorAll('style[data-class]')].some(style => style.dataset.class === contentClass);
|
|
162729
162727
|
|
|
162730
|
-
|
|
162731
|
-
|
|
162728
|
+
if (!styleExists) {
|
|
162729
|
+
const styleEl = this.doc.createElement('style');
|
|
162730
|
+
styleEl.dataset.class = contentClass;
|
|
162731
|
+
styleEl.textContent = cssText;
|
|
162732
|
+
this.doc.head.appendChild(styleEl);
|
|
162733
|
+
}
|
|
162734
|
+
} else {
|
|
162735
|
+
// Add external CSS file
|
|
162736
|
+
let exist = false;
|
|
162737
|
+
let links = this.doc.getElementsByTagName('link');
|
|
162738
|
+
|
|
162739
|
+
for (let i = 0; i < links.length; i++) {
|
|
162740
|
+
let src = links[i].href.toLowerCase();
|
|
162741
|
+
if (src.indexOf(contentCss.toLowerCase()) !== -1) exist = true;
|
|
162742
|
+
}
|
|
162743
|
+
|
|
162744
|
+
if (!exist) {
|
|
162745
|
+
this.wrapperEl.insertAdjacentHTML('beforeend', '<link data-name="contentstyle" data-class="' + contentClass + '" href="' + contentStylePath + contentCss + '" rel="stylesheet">');
|
|
162746
|
+
}
|
|
162732
162747
|
}
|
|
162733
162748
|
}
|
|
162734
162749
|
}); // Code Blocks Handling
|