@innovastudio/contentbuilder 1.4.116 → 1.4.117

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.4.116",
4
+ "version": "1.4.117",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -5539,10 +5539,32 @@ div[data-html] {
5539
5539
  height: 844px;
5540
5540
  }
5541
5541
 
5542
- @media all and (min-width: 2030px) {
5542
+ @media all and (min-width: 1620px) {
5543
5543
  .is-content-view.desktop {
5544
- width: 1560px;
5545
- height: 974px;
5544
+ width: 1420px;
5545
+ height: 887px;
5546
+ }
5547
+
5548
+ .is-content-view.tablet-landscape {
5549
+ width: 1280px;
5550
+ height: 960px;
5551
+ }
5552
+ }
5553
+ @media all and (min-width: 1720px) {
5554
+ .is-content-view.desktop {
5555
+ width: 1520px;
5556
+ height: 949px;
5557
+ }
5558
+
5559
+ .is-content-view.tablet-landscape {
5560
+ width: 1280px;
5561
+ height: 960px;
5562
+ }
5563
+ }
5564
+ @media all and (min-width: 1820px) {
5565
+ .is-content-view.desktop {
5566
+ width: 1620px;
5567
+ height: 1012px;
5546
5568
  }
5547
5569
 
5548
5570
  .is-content-view.tablet-landscape {
@@ -5196,6 +5196,54 @@ class Util {
5196
5196
  this.builder.rte.positionToolbar();
5197
5197
  }
5198
5198
  }
5199
+ clearPops() {
5200
+ // Simplified version of clearControls(), used only on window resize
5201
+
5202
+ const dom = this.dom;
5203
+ const builderStuff = this.builder.builderStuff;
5204
+ if (!builderStuff) return; // in case the builder is destroyed
5205
+
5206
+ if (builderStuff.getAttribute('preventDevault')) {
5207
+ setTimeout(() => {
5208
+ builderStuff.removeAttribute('preventDevault');
5209
+ }, 30);
5210
+ return;
5211
+ }
5212
+ let tools = builderStuff.querySelectorAll('.is-tool');
5213
+ Array.prototype.forEach.call(tools, tool => {
5214
+ tool.style.display = '';
5215
+ dom.removeClass(tool, 'active');
5216
+ });
5217
+ if (this.builder.iframe) {
5218
+ tools = this.builder.contentStuff.querySelectorAll('.is-tool');
5219
+ Array.prototype.forEach.call(tools, tool => {
5220
+ tool.style.display = '';
5221
+ dom.removeClass(tool, 'active');
5222
+ });
5223
+ }
5224
+ this.builder.moveable.updateRect();
5225
+ document.querySelector('.moveable-control-box').style.display = 'none';
5226
+
5227
+ // show iframe overlay to make it clickable
5228
+ let ovls = this.builder.doc.querySelectorAll('.ovl');
5229
+ Array.prototype.forEach.call(ovls, ovl => {
5230
+ ovl.style.display = 'block';
5231
+ });
5232
+ let pops = builderStuff.querySelectorAll('.is-pop');
5233
+ Array.prototype.forEach.call(pops, pop => {
5234
+ pop.style.display = '';
5235
+ dom.removeClass(pop, 'active');
5236
+ pop.setAttribute('aria-hidden', true);
5237
+ });
5238
+ this.builder.colTool.lockIndicator.style.display = '';
5239
+ if (this.builder.resize) {
5240
+ this.builder.resize.destroy(); // destroy previous instance
5241
+ }
5242
+
5243
+ // Clear resizable images
5244
+ // this.builder.element.image.clearImageResizer();
5245
+ }
5246
+
5199
5247
  clearControls() {
5200
5248
  const dom = this.dom;
5201
5249
  const builderStuff = this.builder.builderStuff;
@@ -71115,28 +71163,39 @@ class Rte {
71115
71163
  }, true);
71116
71164
  }
71117
71165
  applyClassFontSize(elm, num) {
71166
+ let prefix = '';
71167
+ let screenMode = this.builder.screenMode;
71168
+ if (screenMode === 'desktop') {
71169
+ prefix = '';
71170
+ } else if (screenMode === 'tablet-landscape') {
71171
+ prefix = 'md-';
71172
+ } else if (screenMode === 'tablet') {
71173
+ prefix = 'sm-';
71174
+ } else if (screenMode === 'mobile') {
71175
+ prefix = 'xs-';
71176
+ }
71118
71177
  const dom = this.dom;
71119
71178
  let currentFontSize = Number(window.getComputedStyle(elm).getPropertyValue('font-size').match(/\d+/)[0]);
71120
71179
  let classname = '';
71121
- if (num === '+' || num === '-' || num === '') classname = num;else classname = 'size-' + num;
71180
+ if (num === '+' || num === '-' || num === '') classname = num;else classname = prefix + 'size-' + num;
71122
71181
  const arrSizes = this.builder.opts.fontSizeClassValues;
71123
71182
 
71124
71183
  // Get current class size & remove all class size from the element
71125
71184
  var currentClassSize = '';
71126
71185
  for (var i = 0; i <= arrSizes.length - 1; i++) {
71127
- if (dom.hasClass(elm, 'size-' + arrSizes[i])) {
71128
- currentClassSize = 'size-' + arrSizes[i];
71186
+ if (dom.hasClass(elm, prefix + 'size-' + arrSizes[i])) {
71187
+ currentClassSize = prefix + 'size-' + arrSizes[i];
71129
71188
  /** mod by Jack */
71130
71189
  //dom.removeClass(elm, 'size-'+arrSizes[i]);
71131
71190
  let n = arrSizes[i];
71132
71191
  dom.doFunction(elm, theEl => {
71133
- dom.removeClass(theEl, 'size-' + n);
71192
+ dom.removeClass(theEl, prefix + 'size-' + n);
71134
71193
  }, true);
71135
71194
  } else {
71136
71195
  /** mod by Jack */
71137
71196
  let n = arrSizes[i];
71138
71197
  dom.doFunction(elm, theEl => {
71139
- dom.removeClass(theEl, 'size-' + n);
71198
+ dom.removeClass(theEl, prefix + 'size-' + n);
71140
71199
  }, true);
71141
71200
  }
71142
71201
  }
@@ -71145,15 +71204,15 @@ class Rte {
71145
71204
  if (currentClassSize === '' && (classname === '+' || classname === '-')) {
71146
71205
  for (i = 0; i <= arrSizes.length - 1; i++) {
71147
71206
  if (currentFontSize >= arrSizes[i] & currentFontSize < arrSizes[i + 1]) {
71148
- currentClassSize = 'size-' + arrSizes[i];
71207
+ currentClassSize = prefix + 'size-' + arrSizes[i];
71149
71208
  }
71150
71209
  }
71151
71210
  }
71152
71211
  if (classname === '+') {
71153
- i = currentClassSize.replace('size-', '') * 1;
71212
+ i = currentClassSize.replace(prefix + 'size-', '') * 1;
71154
71213
  var idx = arrSizes.indexOf(i);
71155
71214
  if (idx < arrSizes.length - 1) {
71156
- currentClassSize = 'size-' + arrSizes[idx + 1];
71215
+ currentClassSize = prefix + 'size-' + arrSizes[idx + 1];
71157
71216
  }
71158
71217
  /** mod by Jack */
71159
71218
  //dom.addClass(elm, currentClassSize);
@@ -71161,10 +71220,10 @@ class Rte {
71161
71220
  dom.addClass(theEl, currentClassSize);
71162
71221
  }, true);
71163
71222
  } else if (classname === '-') {
71164
- i = currentClassSize.replace('size-', '') * 1;
71223
+ i = currentClassSize.replace(prefix + 'size-', '') * 1;
71165
71224
  idx = arrSizes.indexOf(i);
71166
71225
  if (idx >= 1) {
71167
- currentClassSize = 'size-' + arrSizes[idx - 1];
71226
+ currentClassSize = prefix + 'size-' + arrSizes[idx - 1];
71168
71227
  }
71169
71228
  /** mod by Jack */
71170
71229
  //dom.addClass(elm, currentClassSize);
@@ -71502,6 +71561,17 @@ class Rte {
71502
71561
  }
71503
71562
  }
71504
71563
  getTextSettingsState() {
71564
+ let prefix = '';
71565
+ let screenMode = this.builder.screenMode;
71566
+ if (screenMode === 'desktop') {
71567
+ prefix = '';
71568
+ } else if (screenMode === 'tablet-landscape') {
71569
+ prefix = 'md-';
71570
+ } else if (screenMode === 'tablet') {
71571
+ prefix = 'sm-';
71572
+ } else if (screenMode === 'mobile') {
71573
+ prefix = 'xs-';
71574
+ }
71505
71575
  const dom = this.dom;
71506
71576
  const pop = this.rteTextSettingOptions;
71507
71577
 
@@ -71520,9 +71590,13 @@ class Rte {
71520
71590
 
71521
71591
  if (container) {
71522
71592
  const arrSizes = this.builder.opts.fontSizeClassValues;
71523
- for (let i = 0; i <= arrSizes.length - 1; i++) {
71524
- if (dom.hasClass(container, 'size-' + arrSizes[i])) {
71593
+ let found = false;
71594
+ // Check if size is defined for specific screenMode
71595
+ if (prefix !== '') for (let i = 0; i <= arrSizes.length - 1; i++) {
71596
+ if (dom.hasClass(container, prefix + 'size-' + arrSizes[i])) {
71525
71597
  // Get current class
71598
+
71599
+ found = true;
71526
71600
  const btns = pop.querySelectorAll('.rte-fontsize-options button');
71527
71601
  Array.prototype.forEach.call(btns, btn => {
71528
71602
  let num = btn.getAttribute('data-value');
@@ -71532,6 +71606,21 @@ class Rte {
71532
71606
  });
71533
71607
  }
71534
71608
  }
71609
+ if (!found) {
71610
+ // Use default (desktop) defined size
71611
+ for (let i = 0; i <= arrSizes.length - 1; i++) {
71612
+ if (dom.hasClass(container, 'size-' + arrSizes[i])) {
71613
+ // Get current class
71614
+ const btns = pop.querySelectorAll('.rte-fontsize-options button');
71615
+ Array.prototype.forEach.call(btns, btn => {
71616
+ let num = btn.getAttribute('data-value');
71617
+ if (parseInt(num) === arrSizes[i]) {
71618
+ btn.classList.add('on');
71619
+ }
71620
+ });
71621
+ }
71622
+ }
71623
+ }
71535
71624
  }
71536
71625
  btns = pop.querySelectorAll('.rte-fontweight-options button');
71537
71626
  Array.prototype.forEach.call(btns, btn => {
@@ -79041,6 +79130,7 @@ class ContentBuilder {
79041
79130
  snippetJSON: {
79042
79131
  'snippets': []
79043
79132
  },
79133
+ screenMode: 'desktop',
79044
79134
  // Live Preview
79045
79135
  // previewURL: 'preview.html',
79046
79136
  onPreviewOpen: () => {
@@ -80197,7 +80287,8 @@ class ContentBuilder {
80197
80287
  });
80198
80288
  this.win.addEventListener('resize', this.doWindowResize = () => {
80199
80289
  // this.util.clearActiveCell();
80200
- this.util.clearControls();
80290
+ // this.util.clearControls();
80291
+ this.util.clearPops();
80201
80292
 
80202
80293
  // Disable on mobile
80203
80294
  const viewportWidth = this.doc.body.clientWidth;