@innovastudio/contentbox 1.6.37 → 1.6.39
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 +2 -2
- package/public/contentbox/contentbox.esm.js +272 -104
- package/public/contentbox/contentbox.min.js +7 -7
- package/readme.txt +11 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@innovastudio/contentbox",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.39",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "public/contentbox/contentbox.esm.js",
|
|
7
7
|
"files": [
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"ws": "^8.13.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@innovastudio/contentbuilder": "^1.5.
|
|
55
|
+
"@innovastudio/contentbuilder": "^1.5.24",
|
|
56
56
|
"js-beautify": "^1.14.0"
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -43148,6 +43148,7 @@ const renderSnippetPanel = (builder, snippetOpen) => {
|
|
|
43148
43148
|
obj.destroy();
|
|
43149
43149
|
}
|
|
43150
43150
|
});
|
|
43151
|
+
builder.sortableOnCanvas = [];
|
|
43151
43152
|
}
|
|
43152
43153
|
if (builder.sortableOnPage) builder.sortableOnPage.destroy();
|
|
43153
43154
|
let dummies = builder.doc.querySelectorAll('.block-dummy');
|
|
@@ -78220,26 +78221,37 @@ class RowTool {
|
|
|
78220
78221
|
if (btnCellAdd) dom.addEventListener(btnCellAdd, 'click', () => {
|
|
78221
78222
|
let cell = util.cellSelected();
|
|
78222
78223
|
if (!cell) return;
|
|
78224
|
+
const viewportHeight = window.innerHeight;
|
|
78225
|
+
const newPos = util.getElementPosition(btnCellAdd);
|
|
78226
|
+
let top = newPos.top;
|
|
78227
|
+
let left = newPos.left;
|
|
78223
78228
|
renderQuickAdd(this.builder);
|
|
78224
78229
|
let quickadd = this.builder.builderStuff.querySelector('.is-pop.quickadd');
|
|
78225
78230
|
let tabs = quickadd.querySelector('.is-pop-tabs');
|
|
78226
78231
|
tabs.style.display = 'flex';
|
|
78227
|
-
const newPos = util.getElementPosition(btnCellAdd);
|
|
78228
|
-
let top = newPos.top + window.pageYOffset;
|
|
78229
|
-
let left = newPos.left + window.pageXOffset;
|
|
78230
|
-
if (this.builder.iframe) {
|
|
78231
|
-
left = left + 3;
|
|
78232
|
-
}
|
|
78233
78232
|
util.showPop(quickadd, false, btnCellAdd);
|
|
78234
|
-
|
|
78235
|
-
|
|
78236
|
-
|
|
78237
|
-
|
|
78238
|
-
|
|
78239
|
-
|
|
78240
|
-
|
|
78241
|
-
|
|
78242
|
-
|
|
78233
|
+
const h = quickadd.offsetHeight;
|
|
78234
|
+
if (viewportHeight - top > h) {
|
|
78235
|
+
// pop bottom
|
|
78236
|
+
quickadd.style.top = top + window.pageYOffset + 35 + 'px';
|
|
78237
|
+
quickadd.style.left = left + 'px';
|
|
78238
|
+
dom.removeClass(quickadd, 'arrow-bottom');
|
|
78239
|
+
dom.removeClass(quickadd, 'arrow-right');
|
|
78240
|
+
dom.removeClass(quickadd, 'arrow-left');
|
|
78241
|
+
dom.removeClass(quickadd, 'center');
|
|
78242
|
+
dom.addClass(quickadd, 'arrow-top');
|
|
78243
|
+
dom.addClass(quickadd, 'left');
|
|
78244
|
+
} else {
|
|
78245
|
+
// pop top
|
|
78246
|
+
quickadd.style.top = top + window.pageYOffset - h - 8 + 'px';
|
|
78247
|
+
quickadd.style.left = left + 'px';
|
|
78248
|
+
dom.removeClass(quickadd, 'arrow-top');
|
|
78249
|
+
dom.removeClass(quickadd, 'arrow-right');
|
|
78250
|
+
dom.removeClass(quickadd, 'arrow-left');
|
|
78251
|
+
dom.removeClass(quickadd, 'center');
|
|
78252
|
+
dom.addClass(quickadd, 'arrow-bottom');
|
|
78253
|
+
dom.addClass(quickadd, 'left');
|
|
78254
|
+
}
|
|
78243
78255
|
let val = quickadd.querySelector('.active').getAttribute('data-value');
|
|
78244
78256
|
if (val === 'left') {
|
|
78245
78257
|
quickadd.setAttribute('data-mode', 'cell-left');
|
|
@@ -78279,21 +78291,38 @@ class RowTool {
|
|
|
78279
78291
|
if (btnCellMore) dom.addEventListener(btnCellMore, 'click', () => {
|
|
78280
78292
|
let cell = util.cellSelected();
|
|
78281
78293
|
if (!cell) return;
|
|
78294
|
+
const viewportHeight = window.innerHeight;
|
|
78282
78295
|
const newPos = util.getElementPosition(btnCellMore);
|
|
78283
|
-
let top = newPos.top
|
|
78284
|
-
let left = newPos.left
|
|
78296
|
+
let top = newPos.top;
|
|
78297
|
+
let left = newPos.left;
|
|
78285
78298
|
this.builder.colTool.renderColMore();
|
|
78286
78299
|
const columnMore = builderStuff.querySelector('.columnmore');
|
|
78287
|
-
|
|
78288
|
-
|
|
78289
|
-
|
|
78290
|
-
|
|
78291
|
-
|
|
78292
|
-
|
|
78293
|
-
|
|
78294
|
-
|
|
78295
|
-
|
|
78296
|
-
|
|
78300
|
+
setTimeout(() => {
|
|
78301
|
+
// give delay after renderColMore()
|
|
78302
|
+
util.showPop(columnMore, false, btnCellMore);
|
|
78303
|
+
const h = columnMore.offsetHeight;
|
|
78304
|
+
if (viewportHeight - top > h) {
|
|
78305
|
+
columnMore.style.top = top + window.pageYOffset + 35 + 'px';
|
|
78306
|
+
columnMore.style.left = left - 7 + 'px';
|
|
78307
|
+
dom.removeClass(columnMore, 'arrow-bottom');
|
|
78308
|
+
dom.removeClass(columnMore, 'arrow-right');
|
|
78309
|
+
dom.removeClass(columnMore, 'arrow-left');
|
|
78310
|
+
dom.removeClass(columnMore, 'center');
|
|
78311
|
+
dom.removeClass(columnMore, 'right');
|
|
78312
|
+
dom.addClass(columnMore, 'arrow-top');
|
|
78313
|
+
dom.addClass(columnMore, 'left');
|
|
78314
|
+
} else {
|
|
78315
|
+
columnMore.style.top = top + window.pageYOffset - h - 8 + 'px';
|
|
78316
|
+
columnMore.style.left = left - 7 + 'px';
|
|
78317
|
+
dom.removeClass(columnMore, 'arrow-top');
|
|
78318
|
+
dom.removeClass(columnMore, 'arrow-right');
|
|
78319
|
+
dom.removeClass(columnMore, 'arrow-left');
|
|
78320
|
+
dom.removeClass(columnMore, 'center');
|
|
78321
|
+
dom.removeClass(columnMore, 'right');
|
|
78322
|
+
dom.addClass(columnMore, 'arrow-bottom');
|
|
78323
|
+
dom.addClass(columnMore, 'left');
|
|
78324
|
+
}
|
|
78325
|
+
}, 0);
|
|
78297
78326
|
const btnCellLocking = columnMore.querySelector('.cell-locking');
|
|
78298
78327
|
if (cell.hasAttribute('data-noedit')) {
|
|
78299
78328
|
dom.addClass(btnCellLocking, 'on');
|
|
@@ -78447,32 +78476,67 @@ class RowTool {
|
|
|
78447
78476
|
|
|
78448
78477
|
//Hide Column tool (new!)
|
|
78449
78478
|
util.hideColumnTool();
|
|
78479
|
+
|
|
78480
|
+
/*
|
|
78450
78481
|
const newPos = util.getElementPosition(btnMore);
|
|
78451
78482
|
let top = newPos.top + window.pageYOffset;
|
|
78452
78483
|
let left = newPos.left + window.pageXOffset;
|
|
78453
|
-
|
|
78484
|
+
this.renderRowMore();
|
|
78454
78485
|
const rowMore = this.rowMore;
|
|
78455
|
-
|
|
78456
|
-
// rowMore.style.display = 'flex';
|
|
78486
|
+
// rowMore.style.display = 'flex';
|
|
78457
78487
|
util.showPop(rowMore, false, btnMore);
|
|
78458
78488
|
//const w = rowMore.offsetWidth; //to get value, element must not hidden (display:none). So set display:flex before this.
|
|
78459
78489
|
//const h = rowMore.offsetHeight;
|
|
78460
|
-
rowMore.style.top = top - 8 + 'px';
|
|
78461
|
-
|
|
78462
|
-
dom.removeClass(rowMore,
|
|
78463
|
-
dom.removeClass(rowMore,
|
|
78464
|
-
dom.removeClass(rowMore,
|
|
78465
|
-
dom.removeClass(rowMore,
|
|
78466
|
-
dom.removeClass(rowMore,
|
|
78467
|
-
|
|
78468
|
-
|
|
78469
|
-
|
|
78470
|
-
|
|
78471
|
-
|
|
78472
|
-
|
|
78473
|
-
|
|
78474
|
-
|
|
78475
|
-
|
|
78490
|
+
rowMore.style.top = (top - 8) + 'px';
|
|
78491
|
+
dom.removeClass(rowMore,'arrow-bottom');
|
|
78492
|
+
dom.removeClass(rowMore,'arrow-left');
|
|
78493
|
+
dom.removeClass(rowMore,'arrow-right');
|
|
78494
|
+
dom.removeClass(rowMore,'center');
|
|
78495
|
+
dom.removeClass(rowMore,'right');
|
|
78496
|
+
dom.removeClass(rowMore,'left');
|
|
78497
|
+
if(this.builder.opts.rowTool === 'right') {
|
|
78498
|
+
|
|
78499
|
+
rowMore.style.left = (left - rowMore.offsetWidth - 10) + 'px';
|
|
78500
|
+
dom.addClass(rowMore,'arrow-right');
|
|
78501
|
+
dom.addClass(rowMore,'left');
|
|
78502
|
+
} else {
|
|
78503
|
+
rowMore.style.left = (left + 35) + 'px';
|
|
78504
|
+
dom.addClass(rowMore,'arrow-left');
|
|
78505
|
+
dom.addClass(rowMore,'left');
|
|
78506
|
+
}
|
|
78507
|
+
*/
|
|
78508
|
+
|
|
78509
|
+
const viewportHeight = window.innerHeight;
|
|
78510
|
+
const newPos = util.getElementPosition(btnMore);
|
|
78511
|
+
let top = newPos.top;
|
|
78512
|
+
let left = newPos.left;
|
|
78513
|
+
this.renderRowMore();
|
|
78514
|
+
const rowMore = this.rowMore;
|
|
78515
|
+
setTimeout(() => {
|
|
78516
|
+
// give delay after renderRowMore()
|
|
78517
|
+
util.showPop(rowMore, false, btnMore);
|
|
78518
|
+
const h = rowMore.offsetHeight;
|
|
78519
|
+
dom.removeClass(rowMore, 'arrow-bottom');
|
|
78520
|
+
dom.removeClass(rowMore, 'arrow-left');
|
|
78521
|
+
dom.removeClass(rowMore, 'arrow-right');
|
|
78522
|
+
dom.removeClass(rowMore, 'center');
|
|
78523
|
+
dom.removeClass(rowMore, 'right');
|
|
78524
|
+
dom.removeClass(rowMore, 'left');
|
|
78525
|
+
if (this.builder.opts.rowTool === 'right') {
|
|
78526
|
+
rowMore.style.left = left - rowMore.offsetWidth - 10 + 'px';
|
|
78527
|
+
dom.addClass(rowMore, 'arrow-right');
|
|
78528
|
+
dom.addClass(rowMore, 'left');
|
|
78529
|
+
} else {
|
|
78530
|
+
rowMore.style.left = left + 35 + 'px';
|
|
78531
|
+
dom.addClass(rowMore, 'arrow-left');
|
|
78532
|
+
dom.addClass(rowMore, 'left');
|
|
78533
|
+
}
|
|
78534
|
+
if (viewportHeight - top > h) {
|
|
78535
|
+
rowMore.style.top = top + window.pageYOffset - 8 + 'px';
|
|
78536
|
+
} else {
|
|
78537
|
+
rowMore.style.top = top + window.pageYOffset - h + btnMore.offsetHeight + 'px';
|
|
78538
|
+
}
|
|
78539
|
+
}, 0);
|
|
78476
78540
|
let btnRowHtml = rowMore.querySelector('.row-html');
|
|
78477
78541
|
let btnRowDuplicate = rowMore.querySelector('.row-duplicate');
|
|
78478
78542
|
if (row.querySelector('[data-html]')) {
|
|
@@ -91350,9 +91414,25 @@ class Rte {
|
|
|
91350
91414
|
// Reset Zoom
|
|
91351
91415
|
const btnResetZoom = builderStuff.querySelector('.reset-zoom');
|
|
91352
91416
|
btnResetZoom.addEventListener('click', () => {
|
|
91417
|
+
this.rteZoomSlider.value = 100;
|
|
91353
91418
|
this.builder.opts.zoom = 1;
|
|
91354
91419
|
localStorage.setItem('_zoom', 1); // Save
|
|
91355
91420
|
|
|
91421
|
+
// setZoomOnControl
|
|
91422
|
+
if (this.builder.isContentBox) {
|
|
91423
|
+
const wrapper = this.builder.doc.querySelector(this.builder.opts.page);
|
|
91424
|
+
this.builder.setZoomOnControl(wrapper);
|
|
91425
|
+
} else if (this.builder.canvas && !this.builder.isContentBox && this.builder.docContainer) {
|
|
91426
|
+
// freeform
|
|
91427
|
+
const docContainer = this.builder.doc.querySelector(this.builder.docContainer);
|
|
91428
|
+
this.builder.setZoomOnControl(docContainer);
|
|
91429
|
+
} else {
|
|
91430
|
+
const builders = this.builder.doc.querySelectorAll(this.builder.opts.container);
|
|
91431
|
+
builders.forEach(builder => {
|
|
91432
|
+
this.builder.setZoomOnControl(builder);
|
|
91433
|
+
});
|
|
91434
|
+
}
|
|
91435
|
+
|
|
91356
91436
|
// setZoomOnArea
|
|
91357
91437
|
this.builder.setZoomOnArea();
|
|
91358
91438
|
});
|
|
@@ -99475,7 +99555,6 @@ class ContentStuff$1 {
|
|
|
99475
99555
|
display:flex;
|
|
99476
99556
|
}
|
|
99477
99557
|
|
|
99478
|
-
|
|
99479
99558
|
.row-outline .is-rowadd-tool,
|
|
99480
99559
|
.row-active .is-rowadd-tool {
|
|
99481
99560
|
display:block;
|
|
@@ -99884,6 +99963,12 @@ class ContentStuff$1 {
|
|
|
99884
99963
|
/*padding: 0 2px 4px !important;*/
|
|
99885
99964
|
z-index: 1 !important;
|
|
99886
99965
|
}
|
|
99966
|
+
|
|
99967
|
+
/* Row Lock will hide row tool */
|
|
99968
|
+
.row-lock .is-row-tool,
|
|
99969
|
+
.row-lock .is-rowadd-tool {
|
|
99970
|
+
display: none !important;
|
|
99971
|
+
}
|
|
99887
99972
|
|
|
99888
99973
|
div[data-html] {
|
|
99889
99974
|
min-height: 70px;
|
|
@@ -107343,7 +107428,7 @@ class Common {
|
|
|
107343
107428
|
|
|
107344
107429
|
if (topTouched && bottomTouched) {
|
|
107345
107430
|
block.style.top = 0;
|
|
107346
|
-
block.style.bottom = 0;
|
|
107431
|
+
if (!block.classList.contains('height-auto')) block.style.bottom = 0; // height-auto should not have bottom=0
|
|
107347
107432
|
block.style.height = '';
|
|
107348
107433
|
}
|
|
107349
107434
|
if (leftTouched && rightTouched) {
|
|
@@ -107352,13 +107437,21 @@ class Common {
|
|
|
107352
107437
|
block.style.width = '';
|
|
107353
107438
|
}
|
|
107354
107439
|
if (bottomTouched && !topTouched) {
|
|
107355
|
-
block.style.bottom = 0;
|
|
107440
|
+
if (!block.classList.contains('height-auto')) block.style.bottom = 0; // height-auto should not have bottom=0
|
|
107356
107441
|
block.style.height = '';
|
|
107357
107442
|
}
|
|
107358
107443
|
if (rightTouched && !leftTouched) {
|
|
107359
107444
|
block.style.right = 0;
|
|
107360
107445
|
block.style.width = '';
|
|
107361
107446
|
}
|
|
107447
|
+
|
|
107448
|
+
// reset
|
|
107449
|
+
setTimeout(() => {
|
|
107450
|
+
this.horizontalRulerTop.removeAttribute('data-topTouched');
|
|
107451
|
+
this.horizontalRulerBottom.removeAttribute('data-bottomTouched');
|
|
107452
|
+
this.verticalRulerLeft.removeAttribute('data-leftTouched');
|
|
107453
|
+
this.verticalRulerRight.removeAttribute('data-rightTouched');
|
|
107454
|
+
}, 10);
|
|
107362
107455
|
}
|
|
107363
107456
|
applyPixels(block) {
|
|
107364
107457
|
const zoom = this.zoom;
|
|
@@ -108590,6 +108683,8 @@ class Resizable {
|
|
|
108590
108683
|
this.doc.addEventListener('mouseup', this.handleResizeEnd);
|
|
108591
108684
|
this.doc.addEventListener('touchmove', this.handleResizeMove);
|
|
108592
108685
|
this.doc.addEventListener('touchend', this.handleResizeEnd);
|
|
108686
|
+
document.addEventListener('mouseup', this.handleResizeEnd); // in iframe, mouseup can be triggered outside the iframe (during resizing)
|
|
108687
|
+
document.addEventListener('touchend', this.handleResizeEnd);
|
|
108593
108688
|
}
|
|
108594
108689
|
handleResizeMove(event) {
|
|
108595
108690
|
if (this.isResizing) {
|
|
@@ -108640,6 +108735,8 @@ class Resizable {
|
|
|
108640
108735
|
this.doc.removeEventListener('mouseup', this.handleResizeEnd);
|
|
108641
108736
|
this.doc.removeEventListener('touchmove', this.handleResizeMove);
|
|
108642
108737
|
this.doc.removeEventListener('touchend', this.handleResizeEnd);
|
|
108738
|
+
document.removeEventListener('mouseup', this.handleResizeEnd); // in iframe, mouseup can be triggered outside the iframe (during resizing)
|
|
108739
|
+
document.removeEventListener('touchend', this.handleResizeEnd);
|
|
108643
108740
|
this.ruler.hideRulers();
|
|
108644
108741
|
}
|
|
108645
108742
|
resizeTopLeft(deltaX, deltaY) {
|
|
@@ -109060,8 +109157,12 @@ class Draggable {
|
|
|
109060
109157
|
target.setAttribute('data-starty', y);
|
|
109061
109158
|
|
|
109062
109159
|
// reset (from applyPercentage bottomTouched)
|
|
109063
|
-
target.style.
|
|
109064
|
-
|
|
109160
|
+
if (target.style.bottom) {
|
|
109161
|
+
if (!target.classList.contains('height-auto')) {
|
|
109162
|
+
target.style.height = target.offsetHeight + 'px';
|
|
109163
|
+
}
|
|
109164
|
+
target.style.bottom = '';
|
|
109165
|
+
}
|
|
109065
109166
|
this.common.applyPixels(target);
|
|
109066
109167
|
});
|
|
109067
109168
|
this.clickedBlock = this.common.getSelectedBlock();
|
|
@@ -109184,6 +109285,15 @@ class Draggable {
|
|
|
109184
109285
|
if (this.onChange) this.onChange();
|
|
109185
109286
|
}
|
|
109186
109287
|
handleSelect(event) {
|
|
109288
|
+
if (!this.doc.querySelector(this.selector + '.active')) {
|
|
109289
|
+
// Make the current scrollbar state (visible or not) to stay during the block select (drag or resize)
|
|
109290
|
+
let scrollbar = this.doc.documentElement.scrollHeight > this.doc.documentElement.clientHeight;
|
|
109291
|
+
if (!scrollbar) {
|
|
109292
|
+
this.doc.body.style.overflowY = 'hidden';
|
|
109293
|
+
} else {
|
|
109294
|
+
this.doc.body.style.overflowY = 'scroll';
|
|
109295
|
+
}
|
|
109296
|
+
}
|
|
109187
109297
|
const element = event.target;
|
|
109188
109298
|
if (element.classList.contains('rotate-handle')) return;
|
|
109189
109299
|
const block = element.closest(this.selector);
|
|
@@ -109233,6 +109343,9 @@ class Draggable {
|
|
|
109233
109343
|
this.doc.querySelectorAll(this.selector + '.active').forEach(elm => elm.classList.remove('active'));
|
|
109234
109344
|
this.doc.querySelectorAll('.block-active').forEach(elm => elm.classList.remove('block-active'));
|
|
109235
109345
|
if (this.onSelectClear) this.onSelectClear();
|
|
109346
|
+
|
|
109347
|
+
// Return back the scrollbar state when clicking on page (not block)
|
|
109348
|
+
this.doc.body.style.overflowY = ''; // see handleSelect()
|
|
109236
109349
|
}
|
|
109237
109350
|
|
|
109238
109351
|
// Check if multiple selection occurs. If so, add 'multi' class to hide all the handles
|
|
@@ -113448,6 +113561,59 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
|
113448
113561
|
}
|
|
113449
113562
|
});
|
|
113450
113563
|
|
|
113564
|
+
// Canvas Mode
|
|
113565
|
+
const copyBlock = e => {
|
|
113566
|
+
const docContainer = this.doc.querySelector(this.docContainer);
|
|
113567
|
+
if ((e.ctrlKey || e.metaKey) && e.which === 67) {
|
|
113568
|
+
//CTRL-C
|
|
113569
|
+
const activeBlock = docContainer.querySelector('.is-block.active'); // always get .cloned
|
|
113570
|
+
if (activeBlock) {
|
|
113571
|
+
this.copyBlock = activeBlock;
|
|
113572
|
+
}
|
|
113573
|
+
}
|
|
113574
|
+
};
|
|
113575
|
+
const pasteBlock = e => {
|
|
113576
|
+
const docContainer = this.doc.querySelector(this.docContainer);
|
|
113577
|
+
if ((e.ctrlKey || e.metaKey) && e.which === 86) {
|
|
113578
|
+
//CTRL-V
|
|
113579
|
+
|
|
113580
|
+
const box = docContainer.querySelector('.is-box.box-select'); // always get .cloned
|
|
113581
|
+
let block = this.copyBlock;
|
|
113582
|
+
if (box && block) {
|
|
113583
|
+
if (document.querySelector('.is-modal.active:not(.is-modal-content)')) return;
|
|
113584
|
+
const focusedElement = e.target;
|
|
113585
|
+
const isEditable = focusedElement.tagName === 'INPUT' || focusedElement.tagName === 'TEXTAREA' || focusedElement.hasAttribute('contenteditable');
|
|
113586
|
+
if (isEditable) return;
|
|
113587
|
+
this.uo.saveForUndo();
|
|
113588
|
+
let block = this.copyBlock;
|
|
113589
|
+
const builder = block.querySelector(this.container);
|
|
113590
|
+
let html = '';
|
|
113591
|
+
if (builder) {
|
|
113592
|
+
html = this.readHtml(builder);
|
|
113593
|
+
}
|
|
113594
|
+
let clonedDiv = block.cloneNode(true);
|
|
113595
|
+
clonedDiv.style.top = '20%';
|
|
113596
|
+
clonedDiv.style.left = '20%';
|
|
113597
|
+
if (builder) {
|
|
113598
|
+
const cloneBuilder = clonedDiv.querySelector(this.container);
|
|
113599
|
+
cloneBuilder.innerHTML = '';
|
|
113600
|
+
box.appendChild(clonedDiv);
|
|
113601
|
+
const range = document.createRange();
|
|
113602
|
+
cloneBuilder.appendChild(range.createContextualFragment(html));
|
|
113603
|
+
this.applyBehaviorOn(cloneBuilder);
|
|
113604
|
+
cloneBuilder.click();
|
|
113605
|
+
} else {
|
|
113606
|
+
block.parentNode.appendChild(clonedDiv);
|
|
113607
|
+
}
|
|
113608
|
+
block.classList.remove('active');
|
|
113609
|
+
this.doc.querySelectorAll('.clone').forEach(elm => elm.parentNode.removeChild(elm));
|
|
113610
|
+
this.doc.querySelectorAll('.cloned').forEach(elm => elm.classList.remove('cloned'));
|
|
113611
|
+
this.eb.refresh();
|
|
113612
|
+
this.opts.onChange();
|
|
113613
|
+
}
|
|
113614
|
+
}
|
|
113615
|
+
};
|
|
113616
|
+
|
|
113451
113617
|
// SHIFT + Right Clidk to Zoom In
|
|
113452
113618
|
if (this.canvas && !this.isContentBox && this.docContainer && !this.iframe) {
|
|
113453
113619
|
//--- see loadHtml ---
|
|
@@ -113519,53 +113685,41 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
|
113519
113685
|
document.addEventListener('keydown', e => {
|
|
113520
113686
|
if ((e.ctrlKey || e.metaKey) && e.which === 67) {
|
|
113521
113687
|
//CTRL-C
|
|
113522
|
-
|
|
113523
|
-
if (activeBlock) {
|
|
113524
|
-
this.copyBlock = activeBlock;
|
|
113525
|
-
}
|
|
113688
|
+
copyBlock(e);
|
|
113526
113689
|
}
|
|
113527
113690
|
});
|
|
113528
113691
|
document.addEventListener('keydown', e => {
|
|
113529
113692
|
if ((e.ctrlKey || e.metaKey) && e.which === 86) {
|
|
113530
113693
|
//CTRL-V
|
|
113531
|
-
|
|
113532
|
-
const box = docContainer.querySelector('.is-box.box-select'); // always get .cloned
|
|
113533
|
-
let block = this.copyBlock;
|
|
113534
|
-
if (box && block) {
|
|
113535
|
-
if (document.querySelector('.is-modal.active:not(.is-modal-content)')) return;
|
|
113536
|
-
const focusedElement = e.target;
|
|
113537
|
-
const isEditable = focusedElement.tagName === 'INPUT' || focusedElement.tagName === 'TEXTAREA' || focusedElement.hasAttribute('contenteditable');
|
|
113538
|
-
if (isEditable) return;
|
|
113539
|
-
this.uo.saveForUndo();
|
|
113540
|
-
let block = this.copyBlock;
|
|
113541
|
-
const builder = block.querySelector(this.container);
|
|
113542
|
-
let html = '';
|
|
113543
|
-
if (builder) {
|
|
113544
|
-
html = this.readHtml(builder);
|
|
113545
|
-
}
|
|
113546
|
-
let clonedDiv = block.cloneNode(true);
|
|
113547
|
-
clonedDiv.style.top = '20%';
|
|
113548
|
-
clonedDiv.style.left = '20%';
|
|
113549
|
-
if (builder) {
|
|
113550
|
-
const cloneBuilder = clonedDiv.querySelector(this.container);
|
|
113551
|
-
cloneBuilder.innerHTML = '';
|
|
113552
|
-
box.appendChild(clonedDiv);
|
|
113553
|
-
const range = document.createRange();
|
|
113554
|
-
cloneBuilder.appendChild(range.createContextualFragment(html));
|
|
113555
|
-
this.applyBehaviorOn(cloneBuilder);
|
|
113556
|
-
cloneBuilder.click();
|
|
113557
|
-
} else {
|
|
113558
|
-
block.parentNode.appendChild(clonedDiv);
|
|
113559
|
-
}
|
|
113560
|
-
block.classList.remove('active');
|
|
113561
|
-
this.doc.querySelectorAll('.clone').forEach(elm => elm.parentNode.removeChild(elm));
|
|
113562
|
-
this.doc.querySelectorAll('.cloned').forEach(elm => elm.classList.remove('cloned'));
|
|
113563
|
-
this.eb.refresh();
|
|
113564
|
-
this.opts.onChange();
|
|
113565
|
-
}
|
|
113694
|
+
pasteBlock(e);
|
|
113566
113695
|
}
|
|
113567
113696
|
});
|
|
113568
113697
|
}
|
|
113698
|
+
if (this.canvas && this.isContentBox) {
|
|
113699
|
+
// Copy & Paste Block
|
|
113700
|
+
document.addEventListener('keydown', e => {
|
|
113701
|
+
if ((e.ctrlKey || e.metaKey) && e.which === 67) {
|
|
113702
|
+
copyBlock(e);
|
|
113703
|
+
}
|
|
113704
|
+
});
|
|
113705
|
+
document.addEventListener('keydown', e => {
|
|
113706
|
+
if ((e.ctrlKey || e.metaKey) && e.which === 86) {
|
|
113707
|
+
pasteBlock(e);
|
|
113708
|
+
}
|
|
113709
|
+
});
|
|
113710
|
+
if (this.iframe) {
|
|
113711
|
+
this.doc.addEventListener('keydown', e => {
|
|
113712
|
+
if ((e.ctrlKey || e.metaKey) && e.which === 67) {
|
|
113713
|
+
copyBlock(e);
|
|
113714
|
+
}
|
|
113715
|
+
});
|
|
113716
|
+
this.doc.addEventListener('keydown', e => {
|
|
113717
|
+
if ((e.ctrlKey || e.metaKey) && e.which === 86) {
|
|
113718
|
+
pasteBlock(e);
|
|
113719
|
+
}
|
|
113720
|
+
});
|
|
113721
|
+
}
|
|
113722
|
+
}
|
|
113569
113723
|
let previousWidth = this.win.innerWidth;
|
|
113570
113724
|
let timer;
|
|
113571
113725
|
const debounce = (func, delay) => {
|
|
@@ -117883,13 +118037,14 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
|
117883
118037
|
boxes = this.doc.querySelectorAll(this.blockContainer);
|
|
117884
118038
|
}
|
|
117885
118039
|
boxes.forEach(box => {
|
|
117886
|
-
box.insertAdjacentHTML('afterbegin', `
|
|
117887
|
-
|
|
117888
|
-
|
|
117889
|
-
|
|
117890
|
-
|
|
117891
|
-
|
|
117892
|
-
|
|
118040
|
+
// box.insertAdjacentHTML('afterbegin', `
|
|
118041
|
+
// <div class="is-block block-dummy" style="top: 0%; left: 0%; width: 100%; height: 20%;background:#eee;opacity:0"></div>
|
|
118042
|
+
// <div class="is-block block-dummy" style="top: 20%; left: 0%; width: 100%; height: 20%;background:#eee;opacity:0"></div>
|
|
118043
|
+
// <div class="is-block block-dummy" style="top: 40%; left: 0%; width: 100%; height: 20%;background:#eee;opacity:0"></div>
|
|
118044
|
+
// <div class="is-block block-dummy" style="top: 60%; left: 0%; width: 100%; height: 20%;background:#eee;opacity:0"></div>
|
|
118045
|
+
// <div class="is-block block-dummy" style="top: 80%; left: 0%; width: 100%; height: 20%;background:#eee;opacity:0"></div>
|
|
118046
|
+
// `);
|
|
118047
|
+
|
|
117893
118048
|
const obj = new Sortable(box, {
|
|
117894
118049
|
scroll: true,
|
|
117895
118050
|
group: 'shared',
|
|
@@ -117987,9 +118142,11 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
|
117987
118142
|
bw = '540px';
|
|
117988
118143
|
}
|
|
117989
118144
|
}
|
|
118145
|
+
let containerClass = ''; // container's 'size-18 leading-14' is not for print
|
|
118146
|
+
if (this.isContentBox) containerClass = ' size-18 leading-14';
|
|
117990
118147
|
const blockTemplate = `
|
|
117991
118148
|
<div class="is-block block-steady height-auto" data-new-dummy="1" style="top: 20%; left: 20%; width: ${bw};">
|
|
117992
|
-
<div class="is-container container-new">
|
|
118149
|
+
<div class="is-container container-new${containerClass}">
|
|
117993
118150
|
[%CONTENT%]
|
|
117994
118151
|
</div>
|
|
117995
118152
|
</div>
|
|
@@ -118039,9 +118196,11 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
|
118039
118196
|
bw = '540px';
|
|
118040
118197
|
}
|
|
118041
118198
|
}
|
|
118199
|
+
let containerClass = ''; // container's 'size-18 leading-14' is not for print
|
|
118200
|
+
if (this.isContentBox) containerClass = ' size-18 leading-14';
|
|
118042
118201
|
const blockTemplate = `
|
|
118043
118202
|
<div class="is-block block-steady height-auto" data-new-dummy="1" style="top: 20%; left: 20%; width: ${bw};">
|
|
118044
|
-
<div class="is-container container-new">
|
|
118203
|
+
<div class="is-container container-new${containerClass}">
|
|
118045
118204
|
[%CONTENT%]
|
|
118046
118205
|
</div>
|
|
118047
118206
|
</div>
|
|
@@ -118077,6 +118236,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
|
118077
118236
|
});
|
|
118078
118237
|
let dummies = this.doc.querySelectorAll('.block-dummy');
|
|
118079
118238
|
dummies.forEach(elm => elm.parentNode.removeChild(elm));
|
|
118239
|
+
this.sortableOnCanvas = [];
|
|
118080
118240
|
}
|
|
118081
118241
|
if (this.sortableOnPage) this.sortableOnPage.destroy();
|
|
118082
118242
|
}
|
|
@@ -118294,6 +118454,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
|
118294
118454
|
});
|
|
118295
118455
|
let dummies = this.doc.querySelectorAll('.block-dummy');
|
|
118296
118456
|
dummies.forEach(elm => elm.parentNode.removeChild(elm));
|
|
118457
|
+
this.sortableOnCanvas = [];
|
|
118297
118458
|
}
|
|
118298
118459
|
if (this.sortableOnPage) this.sortableOnPage.destroy();
|
|
118299
118460
|
}
|
|
@@ -133571,6 +133732,8 @@ class Section {
|
|
|
133571
133732
|
this.builder.activeBox = section.querySelector('.box-select');
|
|
133572
133733
|
}
|
|
133573
133734
|
|
|
133735
|
+
if (this.builder.eb) this.builder.eb.refresh(); // freeform
|
|
133736
|
+
|
|
133574
133737
|
this.builder.onRender();
|
|
133575
133738
|
this.builder.onChange();
|
|
133576
133739
|
}
|
|
@@ -145384,7 +145547,7 @@ class ContentBox {
|
|
|
145384
145547
|
assetRefresh: false,
|
|
145385
145548
|
slider: '',
|
|
145386
145549
|
navbar: false,
|
|
145387
|
-
screenMode: '
|
|
145550
|
+
screenMode: 'fullview',
|
|
145388
145551
|
onRender: function () {},
|
|
145389
145552
|
onChange: function () {},
|
|
145390
145553
|
// onImageBrowseClick: function () { },
|
|
@@ -145454,7 +145617,7 @@ class ContentBox {
|
|
|
145454
145617
|
toolbar: 'top',
|
|
145455
145618
|
toolbarDisplay: 'auto',
|
|
145456
145619
|
toolbarAddSnippetButton: false,
|
|
145457
|
-
paste: '
|
|
145620
|
+
paste: 'text',
|
|
145458
145621
|
builderMode: '',
|
|
145459
145622
|
rowcolOutline: true,
|
|
145460
145623
|
elementSelection: true,
|
|
@@ -148817,6 +148980,7 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
|
|
|
148817
148980
|
this.editor = new ContentBuilder({
|
|
148818
148981
|
controlPanel: this.settings.controlPanel,
|
|
148819
148982
|
canvas: this.settings.canvas,
|
|
148983
|
+
docContainer: this.settings.wrapper,
|
|
148820
148984
|
consoleLog: this.settings.consoleLog,
|
|
148821
148985
|
isContentBox: true,
|
|
148822
148986
|
speechTranscribeUrl: this.settings.speechTranscribeUrl,
|
|
@@ -149285,10 +149449,14 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
|
|
|
149285
149449
|
display: none !important;
|
|
149286
149450
|
}
|
|
149287
149451
|
.hard-select .box-select {
|
|
149288
|
-
|
|
149289
|
-
|
|
149290
|
-
|
|
149452
|
+
outline: #00da89 1px solid;
|
|
149453
|
+
outline-offset: -1px;
|
|
149454
|
+
z-index: 1;
|
|
149291
149455
|
}
|
|
149456
|
+
.hard-select .box-select.box-canvas {
|
|
149457
|
+
outline: #ff9fda 1px solid;
|
|
149458
|
+
}
|
|
149459
|
+
|
|
149292
149460
|
.hard-select .box-select .is-box-tool {
|
|
149293
149461
|
display: flex !important;
|
|
149294
149462
|
}
|