@innovastudio/contentbox 1.5.46 → 1.5.48

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/contentbox",
3
3
  "type": "module",
4
- "version": "1.5.46",
4
+ "version": "1.5.48",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "files": [
@@ -46,6 +46,7 @@
46
46
  "webpack-dev-server": "^4.0.0"
47
47
  },
48
48
  "dependencies": {
49
+ "@innovastudio/contentbuilder": "^1.4.38",
49
50
  "js-beautify": "^1.14.0"
50
51
  }
51
52
  }
@@ -19403,6 +19403,7 @@ class Util$1 {
19403
19403
  // Render custom code block
19404
19404
  html = decodeURIComponent(block.getAttribute('data-html'));
19405
19405
  html = html.replace(/{id}/g, this.makeId());
19406
+ html = html.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
19406
19407
 
19407
19408
  for (var i = 1; i <= 20; i++) {
19408
19409
  html = html.replace('[%HTML' + i + '%]', block.getAttribute('data-html-' + i) === undefined ? '' : decodeURIComponent(block.getAttribute('data-html-' + i))); //render editable area
@@ -21360,7 +21361,7 @@ class Util$1 {
21360
21361
  ${this.getFontPreview()}
21361
21362
  </ul>
21362
21363
 
21363
- <script>
21364
+ <script${this.builder.nonce ? ` nonce="${this.builder.nonce}"` : ''}>
21364
21365
 
21365
21366
  const close = () => {
21366
21367
  parent.focus();
@@ -31242,7 +31243,7 @@ class Snippets {
31242
31243
  <ul class="is-design-list" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
31243
31244
  </ul>
31244
31245
 
31245
- <script>
31246
+ <script${this.builder.nonce ? ` nonce="${this.builder.nonce}"` : ''}>
31246
31247
 
31247
31248
  var snippetPath = '${snippetPath}';
31248
31249
  var snippetCategories = ${snippetCategoriesString};
@@ -68622,6 +68623,7 @@ class Module {
68622
68623
  const iframe = moduleModal.querySelector('iframe');
68623
68624
  let result = await fetch(this.builder.opts.modulePath + modulename + '.html');
68624
68625
  result = await result.text();
68626
+ result = result.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
68625
68627
  let doc = iframe.contentWindow.document;
68626
68628
  doc.open();
68627
68629
  doc.write(result);
@@ -68643,6 +68645,7 @@ class Module {
68643
68645
 
68644
68646
  let html = this.builderStuff.querySelector('#hidContentModuleCode').value;
68645
68647
  html = html.replace(/{id}/g, this.util.makeId());
68648
+ html = html.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
68646
68649
  /* OLD
68647
68650
  for(var i=1;i<=20;i++){ // OLD
68648
68651
  html = html.replace('[%HTML'+i+'%]', (module.getAttribute('data-html-'+i) === undefined ? '' : decodeURIComponent(module.getAttribute('data-html-'+i))));//render editable area
@@ -68819,6 +68822,7 @@ class Code {
68819
68822
  });
68820
68823
  let html = decodeURIComponent(codeblock.getAttribute('data-html')); //html = html.replace(/{id}/g, this.util.makeId());
68821
68824
 
68825
+ html = html.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
68822
68826
  tmpbuilder.parentNode.removeChild(tmpbuilder); // Use existing modal
68823
68827
 
68824
68828
  let viewhtml;
@@ -87845,7 +87849,7 @@ class Rte {
87845
87849
  ${this.getIcons()}
87846
87850
  </div>
87847
87851
 
87848
- <script>
87852
+ <script${this.builder.nonce ? ` nonce="${this.builder.nonce}"` : ''}>
87849
87853
  const setValue = (elm) => {
87850
87854
  if(!elm.className) elm = elm.childNodes[0];
87851
87855
  parent._cb.addIcon(elm.className);
@@ -91951,7 +91955,10 @@ class LivePreview {
91951
91955
  if (!container) container = iframeDocument.querySelector('.is-container');
91952
91956
 
91953
91957
  if (container) {
91954
- container.innerHTML = html;
91958
+ // container.innerHTML = html;
91959
+ let range = this.builder.doc.createRange();
91960
+ container.innerHTML = '';
91961
+ container.appendChild(range.createContextualFragment(html));
91955
91962
  } else {
91956
91963
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
91957
91964
  }
@@ -91992,8 +91999,11 @@ class LivePreview {
91992
91999
  } else {
91993
92000
  // sync. html
91994
92001
  let html = localStorage.getItem('preview-html');
91995
- let wrapper = iframeDocument.querySelector('.is-wrapper');
91996
- wrapper.innerHTML = html; // sync. styles
92002
+ let wrapper = iframeDocument.querySelector('.is-wrapper'); // wrapper.innerHTML = html;
92003
+
92004
+ let range = this.builder.doc.createRange();
92005
+ wrapper.innerHTML = '';
92006
+ wrapper.appendChild(range.createContextualFragment(html)); // sync. styles
91997
92007
  // let mainCss = localStorage.getItem('preview-maincss');
91998
92008
  // let sectionCss = localStorage.getItem('preview-sectioncss');
91999
92009
 
@@ -93772,6 +93782,7 @@ class ContentBuilder {
93772
93782
  // Render custom code block
93773
93783
  html = decodeURIComponent(block.getAttribute('data-html'));
93774
93784
  html = html.replace(/{id}/g, util.makeId());
93785
+ html = html.replace(/<script>/g, `${this.nonce ? `<script nonce="${this.nonce}">` : '<script>'}`);
93775
93786
 
93776
93787
  for (var i = 1; i <= 20; i++) {
93777
93788
  html = html.replace('[%HTML' + i + '%]', block.getAttribute('data-html-' + i) === undefined ? '' : decodeURIComponent(block.getAttribute('data-html-' + i))); //render editable area
@@ -96400,6 +96411,7 @@ class ContentBuilder {
96400
96411
  // Render custom code block
96401
96412
  html = decodeURIComponent(block.getAttribute('data-html'));
96402
96413
  html = html.replace(/{id}/g, this.util.makeId());
96414
+ html = html.replace(/<script>/g, `${this.nonce ? `<script nonce="${this.nonce}">` : '<script>'}`);
96403
96415
 
96404
96416
  for (var i = 1; i <= 20; i++) {
96405
96417
  html = html.replace('[%HTML' + i + '%]', block.getAttribute('data-html-' + i) === undefined ? '' : decodeURIComponent(block.getAttribute('data-html-' + i))); //render editable area