@innovastudio/contentbuilder 1.4.35 → 1.4.37

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.4.35",
4
+ "version": "1.4.37",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -4974,6 +4974,7 @@ class Util {
4974
4974
  // Render custom code block
4975
4975
  html = decodeURIComponent(block.getAttribute('data-html'));
4976
4976
  html = html.replace(/{id}/g, this.makeId());
4977
+ html = html.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
4977
4978
 
4978
4979
  for (var i = 1; i <= 20; i++) {
4979
4980
  html = html.replace('[%HTML' + i + '%]', block.getAttribute('data-html-' + i) === undefined ? '' : decodeURIComponent(block.getAttribute('data-html-' + i))); //render editable area
@@ -54193,6 +54194,7 @@ class Module {
54193
54194
  const iframe = moduleModal.querySelector('iframe');
54194
54195
  let result = await fetch(this.builder.opts.modulePath + modulename + '.html');
54195
54196
  result = await result.text();
54197
+ result = result.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
54196
54198
  let doc = iframe.contentWindow.document;
54197
54199
  doc.open();
54198
54200
  doc.write(result);
@@ -54214,6 +54216,7 @@ class Module {
54214
54216
 
54215
54217
  let html = this.builderStuff.querySelector('#hidContentModuleCode').value;
54216
54218
  html = html.replace(/{id}/g, this.util.makeId());
54219
+ html = html.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
54217
54220
  /* OLD
54218
54221
  for(var i=1;i<=20;i++){ // OLD
54219
54222
  html = html.replace('[%HTML'+i+'%]', (module.getAttribute('data-html-'+i) === undefined ? '' : decodeURIComponent(module.getAttribute('data-html-'+i))));//render editable area
@@ -54390,6 +54393,7 @@ class Code {
54390
54393
  });
54391
54394
  let html = decodeURIComponent(codeblock.getAttribute('data-html')); //html = html.replace(/{id}/g, this.util.makeId());
54392
54395
 
54396
+ html = html.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
54393
54397
  tmpbuilder.parentNode.removeChild(tmpbuilder); // Use existing modal
54394
54398
 
54395
54399
  let viewhtml;
@@ -77522,7 +77526,10 @@ class LivePreview {
77522
77526
  if (!container) container = iframeDocument.querySelector('.is-container');
77523
77527
 
77524
77528
  if (container) {
77525
- container.innerHTML = html;
77529
+ // container.innerHTML = html;
77530
+ let range = this.doc.createRange();
77531
+ container.innerHTML = '';
77532
+ container.appendChild(range.createContextualFragment(html));
77526
77533
  } else {
77527
77534
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77528
77535
  }
@@ -77563,8 +77570,11 @@ class LivePreview {
77563
77570
  } else {
77564
77571
  // sync. html
77565
77572
  let html = localStorage.getItem('preview-html');
77566
- let wrapper = iframeDocument.querySelector('.is-wrapper');
77567
- wrapper.innerHTML = html; // sync. styles
77573
+ let wrapper = iframeDocument.querySelector('.is-wrapper'); // wrapper.innerHTML = html;
77574
+
77575
+ let range = this.doc.createRange();
77576
+ wrapper.innerHTML = '';
77577
+ wrapper.appendChild(range.createContextualFragment(html)); // sync. styles
77568
77578
  // let mainCss = localStorage.getItem('preview-maincss');
77569
77579
  // let sectionCss = localStorage.getItem('preview-sectioncss');
77570
77580
 
@@ -79343,6 +79353,7 @@ class ContentBuilder {
79343
79353
  // Render custom code block
79344
79354
  html = decodeURIComponent(block.getAttribute('data-html'));
79345
79355
  html = html.replace(/{id}/g, util.makeId());
79356
+ html = html.replace(/<script>/g, `${this.nonce ? `<script nonce="${this.nonce}">` : '<script>'}`);
79346
79357
 
79347
79358
  for (var i = 1; i <= 20; i++) {
79348
79359
  html = html.replace('[%HTML' + i + '%]', block.getAttribute('data-html-' + i) === undefined ? '' : decodeURIComponent(block.getAttribute('data-html-' + i))); //render editable area
@@ -81971,6 +81982,7 @@ class ContentBuilder {
81971
81982
  // Render custom code block
81972
81983
  html = decodeURIComponent(block.getAttribute('data-html'));
81973
81984
  html = html.replace(/{id}/g, this.util.makeId());
81985
+ html = html.replace(/<script>/g, `${this.nonce ? `<script nonce="${this.nonce}">` : '<script>'}`);
81974
81986
 
81975
81987
  for (var i = 1; i <= 20; i++) {
81976
81988
  html = html.replace('[%HTML' + i + '%]', block.getAttribute('data-html-' + i) === undefined ? '' : decodeURIComponent(block.getAttribute('data-html-' + i))); //render editable area