@movable/studio-framework 3.4.1 → 3.5.0-canary.0

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
@@ -1612,6 +1612,7 @@ class StudioTool extends React.Component {
1612
1612
 
1613
1613
  function trimTextOverflow(element) {
1614
1614
  const parentElement = element.parentElement;
1615
+ parentElement.style.overflowWrap = 'break-word';
1615
1616
  const parentBox = parentElement.getBoundingClientRect(); // It fits already; no need to resize.
1616
1617
 
1617
1618
  if (!overflowsParent$1(element, parentBox)) {
@@ -1681,8 +1682,7 @@ function findOverlappingElement(element, parentBox) {
1681
1682
 
1682
1683
  function overflowsParent$1(element, parentBox) {
1683
1684
  const selfBox = element.getBoundingClientRect();
1684
- const isOutside = !(selfBox.left >= parentBox.left && selfBox.right <= parentBox.right && selfBox.bottom <= parentBox.bottom && element.scrollHeight <= parentBox.height && element.scrollWidth <= parentBox.width);
1685
- return isOutside;
1685
+ return selfBox.bottom > parentBox.bottom;
1686
1686
  }
1687
1687
 
1688
1688
  const {
@@ -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) {