@innovastudio/contentbuilder 1.5.21 → 1.5.23

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.5.21",
4
+ "version": "1.5.23",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -17685,6 +17685,7 @@ const renderSnippetPanel = (builder, snippetOpen) => {
17685
17685
  obj.destroy();
17686
17686
  }
17687
17687
  });
17688
+ builder.sortableOnCanvas = [];
17688
17689
  }
17689
17690
  if (builder.sortableOnPage) builder.sortableOnPage.destroy();
17690
17691
  let dummies = builder.doc.querySelectorAll('.block-dummy');
@@ -74091,7 +74092,6 @@ class ContentStuff {
74091
74092
  display:flex;
74092
74093
  }
74093
74094
 
74094
-
74095
74095
  .row-outline .is-rowadd-tool,
74096
74096
  .row-active .is-rowadd-tool {
74097
74097
  display:block;
@@ -74500,6 +74500,12 @@ class ContentStuff {
74500
74500
  /*padding: 0 2px 4px !important;*/
74501
74501
  z-index: 1 !important;
74502
74502
  }
74503
+
74504
+ /* Row Lock will hide row tool */
74505
+ .row-lock .is-row-tool,
74506
+ .row-lock .is-rowadd-tool {
74507
+ display: none !important;
74508
+ }
74503
74509
 
74504
74510
  div[data-html] {
74505
74511
  min-height: 70px;
@@ -83214,6 +83220,8 @@ class Resizable {
83214
83220
  this.doc.addEventListener('mouseup', this.handleResizeEnd);
83215
83221
  this.doc.addEventListener('touchmove', this.handleResizeMove);
83216
83222
  this.doc.addEventListener('touchend', this.handleResizeEnd);
83223
+ document.addEventListener('mouseup', this.handleResizeEnd); // in iframe, mouseup can be triggered outside the iframe (during resizing)
83224
+ document.addEventListener('touchend', this.handleResizeEnd);
83217
83225
  }
83218
83226
  handleResizeMove(event) {
83219
83227
  if (this.isResizing) {
@@ -83264,6 +83272,8 @@ class Resizable {
83264
83272
  this.doc.removeEventListener('mouseup', this.handleResizeEnd);
83265
83273
  this.doc.removeEventListener('touchmove', this.handleResizeMove);
83266
83274
  this.doc.removeEventListener('touchend', this.handleResizeEnd);
83275
+ document.removeEventListener('mouseup', this.handleResizeEnd); // in iframe, mouseup can be triggered outside the iframe (during resizing)
83276
+ document.removeEventListener('touchend', this.handleResizeEnd);
83267
83277
  this.ruler.hideRulers();
83268
83278
  }
83269
83279
  resizeTopLeft(deltaX, deltaY) {
@@ -88088,6 +88098,59 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
88088
88098
  }
88089
88099
  });
88090
88100
 
88101
+ // Canvas Mode
88102
+ const copyBlock = e => {
88103
+ const docContainer = this.doc.querySelector(this.docContainer);
88104
+ if ((e.ctrlKey || e.metaKey) && e.which === 67) {
88105
+ //CTRL-C
88106
+ const activeBlock = docContainer.querySelector('.is-block.active'); // always get .cloned
88107
+ if (activeBlock) {
88108
+ this.copyBlock = activeBlock;
88109
+ }
88110
+ }
88111
+ };
88112
+ const pasteBlock = e => {
88113
+ const docContainer = this.doc.querySelector(this.docContainer);
88114
+ if ((e.ctrlKey || e.metaKey) && e.which === 86) {
88115
+ //CTRL-V
88116
+
88117
+ const box = docContainer.querySelector('.is-box.box-select'); // always get .cloned
88118
+ let block = this.copyBlock;
88119
+ if (box && block) {
88120
+ if (document.querySelector('.is-modal.active:not(.is-modal-content)')) return;
88121
+ const focusedElement = e.target;
88122
+ const isEditable = focusedElement.tagName === 'INPUT' || focusedElement.tagName === 'TEXTAREA' || focusedElement.hasAttribute('contenteditable');
88123
+ if (isEditable) return;
88124
+ this.uo.saveForUndo();
88125
+ let block = this.copyBlock;
88126
+ const builder = block.querySelector(this.container);
88127
+ let html = '';
88128
+ if (builder) {
88129
+ html = this.readHtml(builder);
88130
+ }
88131
+ let clonedDiv = block.cloneNode(true);
88132
+ clonedDiv.style.top = '20%';
88133
+ clonedDiv.style.left = '20%';
88134
+ if (builder) {
88135
+ const cloneBuilder = clonedDiv.querySelector(this.container);
88136
+ cloneBuilder.innerHTML = '';
88137
+ box.appendChild(clonedDiv);
88138
+ const range = document.createRange();
88139
+ cloneBuilder.appendChild(range.createContextualFragment(html));
88140
+ this.applyBehaviorOn(cloneBuilder);
88141
+ cloneBuilder.click();
88142
+ } else {
88143
+ block.parentNode.appendChild(clonedDiv);
88144
+ }
88145
+ block.classList.remove('active');
88146
+ this.doc.querySelectorAll('.clone').forEach(elm => elm.parentNode.removeChild(elm));
88147
+ this.doc.querySelectorAll('.cloned').forEach(elm => elm.classList.remove('cloned'));
88148
+ this.eb.refresh();
88149
+ this.opts.onChange();
88150
+ }
88151
+ }
88152
+ };
88153
+
88091
88154
  // SHIFT + Right Clidk to Zoom In
88092
88155
  if (this.canvas && !this.isContentBox && this.docContainer && !this.iframe) {
88093
88156
  //--- see loadHtml ---
@@ -88159,52 +88222,40 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
88159
88222
  document.addEventListener('keydown', e => {
88160
88223
  if ((e.ctrlKey || e.metaKey) && e.which === 67) {
88161
88224
  //CTRL-C
88162
- const activeBlock = docContainer.querySelector('.is-block.active'); // always get .cloned
88163
- if (activeBlock) {
88164
- this.copyBlock = activeBlock;
88165
- }
88225
+ copyBlock(e);
88166
88226
  }
88167
88227
  });
88168
88228
  document.addEventListener('keydown', e => {
88169
88229
  if ((e.ctrlKey || e.metaKey) && e.which === 86) {
88170
88230
  //CTRL-V
88171
-
88172
- const box = docContainer.querySelector('.is-box.box-select'); // always get .cloned
88173
- let block = this.copyBlock;
88174
- if (box && block) {
88175
- if (document.querySelector('.is-modal.active:not(.is-modal-content)')) return;
88176
- const focusedElement = e.target;
88177
- const isEditable = focusedElement.tagName === 'INPUT' || focusedElement.tagName === 'TEXTAREA' || focusedElement.hasAttribute('contenteditable');
88178
- if (isEditable) return;
88179
- this.uo.saveForUndo();
88180
- let block = this.copyBlock;
88181
- const builder = block.querySelector(this.container);
88182
- let html = '';
88183
- if (builder) {
88184
- html = this.readHtml(builder);
88185
- }
88186
- let clonedDiv = block.cloneNode(true);
88187
- clonedDiv.style.top = '20%';
88188
- clonedDiv.style.left = '20%';
88189
- if (builder) {
88190
- const cloneBuilder = clonedDiv.querySelector(this.container);
88191
- cloneBuilder.innerHTML = '';
88192
- box.appendChild(clonedDiv);
88193
- const range = document.createRange();
88194
- cloneBuilder.appendChild(range.createContextualFragment(html));
88195
- this.applyBehaviorOn(cloneBuilder);
88196
- cloneBuilder.click();
88197
- } else {
88198
- block.parentNode.appendChild(clonedDiv);
88199
- }
88200
- block.classList.remove('active');
88201
- this.doc.querySelectorAll('.clone').forEach(elm => elm.parentNode.removeChild(elm));
88202
- this.doc.querySelectorAll('.cloned').forEach(elm => elm.classList.remove('cloned'));
88203
- this.eb.refresh();
88204
- this.opts.onChange();
88205
- }
88231
+ pasteBlock(e);
88232
+ }
88233
+ });
88234
+ }
88235
+ if (this.canvas && this.isContentBox) {
88236
+ // Copy & Paste Block
88237
+ document.addEventListener('keydown', e => {
88238
+ if ((e.ctrlKey || e.metaKey) && e.which === 67) {
88239
+ copyBlock(e);
88240
+ }
88241
+ });
88242
+ document.addEventListener('keydown', e => {
88243
+ if ((e.ctrlKey || e.metaKey) && e.which === 86) {
88244
+ pasteBlock(e);
88206
88245
  }
88207
88246
  });
88247
+ if (this.iframe) {
88248
+ this.doc.addEventListener('keydown', e => {
88249
+ if ((e.ctrlKey || e.metaKey) && e.which === 67) {
88250
+ copyBlock(e);
88251
+ }
88252
+ });
88253
+ this.doc.addEventListener('keydown', e => {
88254
+ if ((e.ctrlKey || e.metaKey) && e.which === 86) {
88255
+ pasteBlock(e);
88256
+ }
88257
+ });
88258
+ }
88208
88259
  }
88209
88260
  let previousWidth = this.win.innerWidth;
88210
88261
  let timer;
@@ -92717,6 +92768,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
92717
92768
  });
92718
92769
  let dummies = this.doc.querySelectorAll('.block-dummy');
92719
92770
  dummies.forEach(elm => elm.parentNode.removeChild(elm));
92771
+ this.sortableOnCanvas = [];
92720
92772
  }
92721
92773
  if (this.sortableOnPage) this.sortableOnPage.destroy();
92722
92774
  }
@@ -92934,6 +92986,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
92934
92986
  });
92935
92987
  let dummies = this.doc.querySelectorAll('.block-dummy');
92936
92988
  dummies.forEach(elm => elm.parentNode.removeChild(elm));
92989
+ this.sortableOnCanvas = [];
92937
92990
  }
92938
92991
  if (this.sortableOnPage) this.sortableOnPage.destroy();
92939
92992
  }