@movable/studio-framework 3.4.1 → 3.4.2

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/dist/index.es.js CHANGED
@@ -2443,37 +2443,40 @@ function getDocumentNode(node) {
2443
2443
  }
2444
2444
 
2445
2445
  const BASE_STYLE = 'margin: 0px;';
2446
- function cleanHTML(element) {
2446
+ function cleanHTML(element, format) {
2447
2447
  const doc = getDocumentNode(element);
2448
- const body = doc.body;
2449
- const html = doc.children[0];
2450
2448
  const analytics = doc.querySelector('#mi-data');
2451
2449
  const analyticsLength = analytics ? (analytics.getAttribute('data-mi-data') || '').length : 0;
2452
- const imageRedirect = doc.querySelector('#mi-redirect-image');
2453
- const newBody = doc.createElement('body');
2454
- newBody.style.cssText = BASE_STYLE;
2455
- newBody.appendChild(element);
2456
2450
 
2457
2451
  if (analyticsLength > 500) {
2458
2452
  analytics.setAttribute('data-mi-data', '{}');
2459
2453
  console.log('extraData trying to be set exceeds 500 characters, setting extraData to be empty to avoid breaking crops');
2460
2454
  }
2461
2455
 
2462
- if (analytics) {
2463
- analytics.style.display = 'none';
2464
- newBody.appendChild(analytics);
2465
- }
2456
+ if (format === 'html') {
2457
+ const body = doc.body;
2458
+ const html = doc.children[0];
2459
+ const imageRedirect = doc.querySelector('#mi-redirect-image');
2460
+ const newBody = doc.createElement('body');
2461
+ newBody.style.cssText = BASE_STYLE;
2462
+ newBody.appendChild(element);
2466
2463
 
2467
- if (imageRedirect) {
2468
- imageRedirect.style.display = 'none';
2469
- newBody.appendChild(imageRedirect);
2470
- }
2464
+ if (analytics) {
2465
+ analytics.style.display = 'none';
2466
+ newBody.appendChild(analytics);
2467
+ }
2471
2468
 
2472
- html.replaceChild(newBody, body);
2473
- const scripts = doc.querySelectorAll('script');
2469
+ if (imageRedirect) {
2470
+ imageRedirect.style.display = 'none';
2471
+ newBody.appendChild(imageRedirect);
2472
+ }
2474
2473
 
2475
- for (let index = 0; index < scripts.length; index++) {
2476
- scripts[index].remove();
2474
+ html.replaceChild(newBody, body);
2475
+ const scripts = doc.querySelectorAll('script');
2476
+
2477
+ for (let index = 0; index < scripts.length; index++) {
2478
+ scripts[index].remove();
2479
+ }
2477
2480
  }
2478
2481
  }
2479
2482
 
@@ -3099,8 +3102,9 @@ class StudioFramework {
3099
3102
  }
3100
3103
  }
3101
3104
 
3105
+ cleanHTML(targetElement, format);
3106
+
3102
3107
  if (format === 'html') {
3103
- cleanHTML(targetElement);
3104
3108
  addBrowserContent(targetElement);
3105
3109
  }
3106
3110
  } catch (e) {
package/dist/index.js CHANGED
@@ -2453,37 +2453,40 @@ function getDocumentNode(node) {
2453
2453
  }
2454
2454
 
2455
2455
  const BASE_STYLE = 'margin: 0px;';
2456
- function cleanHTML(element) {
2456
+ function cleanHTML(element, format) {
2457
2457
  const doc = getDocumentNode(element);
2458
- const body = doc.body;
2459
- const html = doc.children[0];
2460
2458
  const analytics = doc.querySelector('#mi-data');
2461
2459
  const analyticsLength = analytics ? (analytics.getAttribute('data-mi-data') || '').length : 0;
2462
- const imageRedirect = doc.querySelector('#mi-redirect-image');
2463
- const newBody = doc.createElement('body');
2464
- newBody.style.cssText = BASE_STYLE;
2465
- newBody.appendChild(element);
2466
2460
 
2467
2461
  if (analyticsLength > 500) {
2468
2462
  analytics.setAttribute('data-mi-data', '{}');
2469
2463
  console.log('extraData trying to be set exceeds 500 characters, setting extraData to be empty to avoid breaking crops');
2470
2464
  }
2471
2465
 
2472
- if (analytics) {
2473
- analytics.style.display = 'none';
2474
- newBody.appendChild(analytics);
2475
- }
2466
+ if (format === 'html') {
2467
+ const body = doc.body;
2468
+ const html = doc.children[0];
2469
+ const imageRedirect = doc.querySelector('#mi-redirect-image');
2470
+ const newBody = doc.createElement('body');
2471
+ newBody.style.cssText = BASE_STYLE;
2472
+ newBody.appendChild(element);
2476
2473
 
2477
- if (imageRedirect) {
2478
- imageRedirect.style.display = 'none';
2479
- newBody.appendChild(imageRedirect);
2480
- }
2474
+ if (analytics) {
2475
+ analytics.style.display = 'none';
2476
+ newBody.appendChild(analytics);
2477
+ }
2481
2478
 
2482
- html.replaceChild(newBody, body);
2483
- const scripts = doc.querySelectorAll('script');
2479
+ if (imageRedirect) {
2480
+ imageRedirect.style.display = 'none';
2481
+ newBody.appendChild(imageRedirect);
2482
+ }
2484
2483
 
2485
- for (let index = 0; index < scripts.length; index++) {
2486
- scripts[index].remove();
2484
+ html.replaceChild(newBody, body);
2485
+ const scripts = doc.querySelectorAll('script');
2486
+
2487
+ for (let index = 0; index < scripts.length; index++) {
2488
+ scripts[index].remove();
2489
+ }
2487
2490
  }
2488
2491
  }
2489
2492
 
@@ -3109,8 +3112,9 @@ class StudioFramework {
3109
3112
  }
3110
3113
  }
3111
3114
 
3115
+ cleanHTML(targetElement, format);
3116
+
3112
3117
  if (format === 'html') {
3113
- cleanHTML(targetElement);
3114
3118
  addBrowserContent(targetElement);
3115
3119
  }
3116
3120
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movable/studio-framework",
3
- "version": "3.4.1",
3
+ "version": "3.4.2",
4
4
  "description": "A Component library for reactive Studio apps.",
5
5
  "author": "Movable Ink",
6
6
  "repository": "movableink/studio-framework",
@@ -31,8 +31,8 @@
31
31
  "@babel/preset-react": "^7.14.5",
32
32
  "@babel/preset-typescript": "^7.13.0",
33
33
  "@movable/eslint-config-react": "^1.0.1",
34
- "@movable/framework-types": "^3.4.1",
35
- "@movable/studio-framework-test-helpers": "^3.4.1",
34
+ "@movable/framework-types": "^3.4.2",
35
+ "@movable/studio-framework-test-helpers": "^3.4.2",
36
36
  "@types/qunit": "^2.11.1",
37
37
  "@types/qunit-dom": "^0.7.0",
38
38
  "@types/react": "^17.0.6",
@@ -64,5 +64,5 @@
64
64
  "volta": {
65
65
  "extends": "../../package.json"
66
66
  },
67
- "gitHead": "aff3e903d9e302b90bbf80f583b108008a0717b4"
67
+ "gitHead": "7b7c0cd166ace6b4ab6bd0331180fce1176fbdd6"
68
68
  }