@innovastudio/contentbox 1.0.47 → 1.0.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbox",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "description": "",
5
5
  "main": "public/contentbox/contentbox.esm.js",
6
6
  "files": [
@@ -8198,7 +8198,8 @@ class EditBox {
8198
8198
  if (val >= 2700) val = 2700;
8199
8199
  }
8200
8200
 
8201
- container.style.maxWidth = val + 'px'; // dom.addClass(container, 'is-content-' + val); //new
8201
+ container.style.maxWidth = val + 'px';
8202
+ dom$G.addClass(container, 'is-content-' + val); //new
8202
8203
 
8203
8204
  modalEditBox.querySelector('.inp-box-size').value = val; //Trigger Change event
8204
8205
 
@@ -8208,6 +8209,13 @@ class EditBox {
8208
8209
  const inpBoxSize = modalEditBox.querySelector('.inp-box-size');
8209
8210
  inpBoxSize.addEventListener('input', () => {
8210
8211
  this.builder.editor.saveForUndo();
8212
+ const arrMaxWidth = [];
8213
+ let n = 300;
8214
+
8215
+ while (n <= 2700) {
8216
+ arrMaxWidth.push(n);
8217
+ n = n + 20;
8218
+ }
8211
8219
 
8212
8220
  let activeBox = this.builder.activeBox;
8213
8221
  let container = activeBox.querySelector('.is-container');
@@ -8219,7 +8227,22 @@ class EditBox {
8219
8227
  let val = inpBoxSize.value;
8220
8228
 
8221
8229
  if (!isNaN(val) && val >= 300 && val <= 2700) {
8222
- container.style.maxWidth = val + 'px'; // dom.addClass(container, 'is-content-' + val); //new
8230
+ container.style.maxWidth = val + 'px';
8231
+ let maxWidth = parseInt(window.getComputedStyle(container, null).getPropertyValue('max-width'));
8232
+
8233
+ for (let n = 0; n <= 121; n++) {
8234
+ let mw = arrMaxWidth[n];
8235
+
8236
+ if (mw > maxWidth) {
8237
+ maxWidth = mw;
8238
+ break;
8239
+ }
8240
+ }
8241
+
8242
+ val = maxWidth;
8243
+ if (val <= 300) val = 300;
8244
+ if (val >= 2700) val = 2700;
8245
+ dom$G.addClass(container, 'is-content-' + val); //new
8223
8246
  } //Trigger Change event
8224
8247
 
8225
8248
 
@@ -10002,13 +10025,19 @@ class EditBox {
10002
10025
  } //end of added by jack
10003
10026
 
10004
10027
 
10005
- boxImage(url) {
10028
+ boxImage(url, err) {
10006
10029
  // Remove Waiting Indicator
10007
10030
  const builderStuff = this.builderStuff;
10008
10031
  const indicator = builderStuff.querySelector('.waiting-indicator');
10009
10032
  const indicatorOverlay = builderStuff.querySelector('.waiting-indicator-overlay');
10010
10033
  if (indicator) indicator.parentNode.removeChild(indicator);
10011
10034
  if (indicatorOverlay) indicatorOverlay.parentNode.removeChild(indicatorOverlay);
10035
+
10036
+ if (err) {
10037
+ alert(err);
10038
+ return;
10039
+ }
10040
+
10012
10041
  let activeBox;
10013
10042
 
10014
10043
  if (this.targetBox) {
@@ -74686,8 +74715,8 @@ class ContentBox {
74686
74715
  });
74687
74716
  }
74688
74717
 
74689
- boxImage(url) {
74690
- this.editbox.boxImage(url);
74718
+ boxImage(url, err) {
74719
+ this.editbox.boxImage(url, err);
74691
74720
  }
74692
74721
 
74693
74722
  mainCss() {