@innovastudio/contentbuilder 1.5.207 → 1.5.208
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
|
@@ -1252,17 +1252,15 @@ const renderQuickAdd = builder => {
|
|
|
1252
1252
|
let elm = quickadd.querySelector('.add-paragraph');
|
|
1253
1253
|
dom.addEventListener(elm, 'click', () => {
|
|
1254
1254
|
const mode = quickadd.getAttribute('data-mode');
|
|
1255
|
-
const html = `<p
|
|
1256
|
-
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
|
|
1257
|
-
when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>`;
|
|
1255
|
+
const html = `<p>${util.out(`Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.${''}`)}</p>`;
|
|
1258
1256
|
util.addContent(html, mode);
|
|
1259
1257
|
});
|
|
1260
1258
|
elm = quickadd.querySelector('.add-headline');
|
|
1261
1259
|
dom.addEventListener(elm, 'click', () => {
|
|
1262
1260
|
const mode = quickadd.getAttribute('data-mode');
|
|
1263
1261
|
const html = `<div class="display">
|
|
1264
|
-
<h1
|
|
1265
|
-
<p
|
|
1262
|
+
<h1>${util.out('Headline Goes Here')}</h1>
|
|
1263
|
+
<p>${util.out('Lorem Ipsum is simply dummy text')}</p>
|
|
1266
1264
|
</div>`;
|
|
1267
1265
|
util.addContent(html, mode);
|
|
1268
1266
|
});
|
|
@@ -1278,41 +1276,39 @@ const renderQuickAdd = builder => {
|
|
|
1278
1276
|
elm = quickadd.querySelector('.add-heading1');
|
|
1279
1277
|
dom.addEventListener(elm, 'click', () => {
|
|
1280
1278
|
const mode = quickadd.getAttribute('data-mode');
|
|
1281
|
-
const html = '
|
|
1279
|
+
const html = `<h1>${util.out('Heading 1 here')}</h1>`;
|
|
1282
1280
|
util.addContent(html, mode);
|
|
1283
1281
|
});
|
|
1284
1282
|
elm = quickadd.querySelector('.add-heading2');
|
|
1285
1283
|
dom.addEventListener(elm, 'click', () => {
|
|
1286
1284
|
const mode = quickadd.getAttribute('data-mode');
|
|
1287
|
-
const html = '
|
|
1285
|
+
const html = `<h2>${util.out('Heading 2 here')}</h2>`;
|
|
1288
1286
|
util.addContent(html, mode);
|
|
1289
1287
|
});
|
|
1290
1288
|
elm = quickadd.querySelector('.add-heading3');
|
|
1291
1289
|
dom.addEventListener(elm, 'click', () => {
|
|
1292
1290
|
const mode = quickadd.getAttribute('data-mode');
|
|
1293
|
-
const html = '
|
|
1291
|
+
const html = `<h3>${util.out('Heading 3 here')}</h3>`;
|
|
1294
1292
|
util.addContent(html, mode);
|
|
1295
1293
|
});
|
|
1296
1294
|
elm = quickadd.querySelector('.add-heading4');
|
|
1297
1295
|
dom.addEventListener(elm, 'click', () => {
|
|
1298
1296
|
const mode = quickadd.getAttribute('data-mode');
|
|
1299
|
-
const html = '
|
|
1297
|
+
const html = `<h4>${util.out('Heading 4 here')}</h4>`;
|
|
1300
1298
|
util.addContent(html, mode);
|
|
1301
1299
|
});
|
|
1302
1300
|
elm = quickadd.querySelector('.add-preformatted');
|
|
1303
1301
|
dom.addEventListener(elm, 'click', () => {
|
|
1304
1302
|
const mode = quickadd.getAttribute('data-mode');
|
|
1305
|
-
const html = `<pre
|
|
1306
|
-
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
|
|
1307
|
-
when an unknown printer took a galley of type and scrambled it to make a type specimen book.</pre>`;
|
|
1303
|
+
const html = `<pre>${util.out(`Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.${''}`)}</pre>`;
|
|
1308
1304
|
util.addContent(html, mode);
|
|
1309
1305
|
});
|
|
1310
1306
|
elm = quickadd.querySelector('.add-list');
|
|
1311
1307
|
dom.addEventListener(elm, 'click', () => {
|
|
1312
1308
|
const mode = quickadd.getAttribute('data-mode');
|
|
1313
1309
|
const html = `<ul>
|
|
1314
|
-
<li
|
|
1315
|
-
<li
|
|
1310
|
+
<li>${util.out('Lorem Ipsum is simply dummy text')}</li>
|
|
1311
|
+
<li>${util.out('Lorem Ipsum is simply dummy text')}</li>
|
|
1316
1312
|
</ul>`;
|
|
1317
1313
|
util.addContent(html, mode);
|
|
1318
1314
|
});
|
|
@@ -1325,7 +1321,7 @@ const renderQuickAdd = builder => {
|
|
|
1325
1321
|
<div class="text-left">
|
|
1326
1322
|
<i class="icon ion-quote size-28"></i>
|
|
1327
1323
|
</div>
|
|
1328
|
-
<p class="size-21 leading-14"
|
|
1324
|
+
<p class="size-21 leading-14">${util.out(`It's easy to use, customizable, and user-friendly. A truly amazing features.${''}`)}</p>
|
|
1329
1325
|
`;
|
|
1330
1326
|
util.addContent(html, mode);
|
|
1331
1327
|
});
|
|
@@ -1333,10 +1329,10 @@ const renderQuickAdd = builder => {
|
|
|
1333
1329
|
dom.addEventListener(elm, 'click', () => {
|
|
1334
1330
|
const mode = quickadd.getAttribute('data-mode');
|
|
1335
1331
|
let html = `<div>
|
|
1336
|
-
<a href="#" role="button" class="transition-all inline-block whitespace-nowrap cursor-pointer no-underline border-2 border-solid mt-2 mb-1 font-normal tracking-normal rounded-full py-2 px-6 size-15 leading-14 border-transparent hover:border-transparent" style="color: rgb(24, 24, 27); background-color: rgb(240, 240, 241);" onmouseover="if(this.getAttribute('data-hover-bg'))this.style.backgroundColor=this.getAttribute('data-hover-bg');" onmouseout="if(this.getAttribute('data-bg'))this.style.backgroundColor=this.getAttribute('data-bg');else this.style.backgroundColor='';" data-bg="rgb(240, 240, 241)" data-hover-bg="rgb(236, 236, 238)"
|
|
1332
|
+
<a href="#" role="button" class="transition-all inline-block whitespace-nowrap cursor-pointer no-underline border-2 border-solid mt-2 mb-1 font-normal tracking-normal rounded-full py-2 px-6 size-15 leading-14 border-transparent hover:border-transparent" style="color: rgb(24, 24, 27); background-color: rgb(240, 240, 241);" onmouseover="if(this.getAttribute('data-hover-bg'))this.style.backgroundColor=this.getAttribute('data-hover-bg');" onmouseout="if(this.getAttribute('data-bg'))this.style.backgroundColor=this.getAttribute('data-bg');else this.style.backgroundColor='';" data-bg="rgb(240, 240, 241)" data-hover-bg="rgb(236, 236, 238)">${util.out('Read More')}</a>
|
|
1337
1333
|
</div>`;
|
|
1338
1334
|
if (builder.opts.emailMode) {
|
|
1339
|
-
html =
|
|
1335
|
+
html = `<div><a href="#" role="button" style="margin-top: ;margin-right: ;margin-bottom: ;margin-left: ;display: inline-block; text-decoration: none; transition: all 0.16s ease 0s; border-style: solid; cursor: pointer; background-color: rgb(220, 220, 220); color: rgb(0, 0, 0); border-color: rgb(220, 220, 220); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 400; font-size: 14px; letter-spacing: 3px;">${util.out('Read More')}</a></div>`;
|
|
1340
1336
|
}
|
|
1341
1337
|
util.addContent(html, mode);
|
|
1342
1338
|
});
|
|
@@ -1344,13 +1340,13 @@ const renderQuickAdd = builder => {
|
|
|
1344
1340
|
dom.addEventListener(elm, 'click', () => {
|
|
1345
1341
|
const mode = quickadd.getAttribute('data-mode');
|
|
1346
1342
|
let html = `<div class="space-x-1">
|
|
1347
|
-
<a href="#" role="button" class="transition-all inline-block whitespace-nowrap cursor-pointer no-underline border-2 border-solid mt-2 mb-1 font-normal tracking-normal rounded-full py-2 px-6 size-15 leading-14 border-transparent hover:border-transparent" style="color: rgb(24, 24, 27); background-color: rgb(240, 240, 241);" onmouseover="if(this.getAttribute('data-hover-bg'))this.style.backgroundColor=this.getAttribute('data-hover-bg');" onmouseout="if(this.getAttribute('data-bg'))this.style.backgroundColor=this.getAttribute('data-bg');else this.style.backgroundColor='';" data-bg="rgb(240, 240, 241)" data-hover-bg="rgb(236, 236, 238)"
|
|
1348
|
-
<a href="#" role="button" class="transition-all inline-block whitespace-nowrap cursor-pointer no-underline border-2 border-solid mt-2 mb-1 font-normal tracking-normal rounded-full py-2 px-6 size-15 leading-14 border-transparent hover:border-transparent" style="color: rgb(250, 250, 250); background-color: rgb(24, 24, 27);" onmouseover="if(this.getAttribute('data-hover-bg'))this.style.backgroundColor=this.getAttribute('data-hover-bg');" onmouseout="if(this.getAttribute('data-bg'))this.style.backgroundColor=this.getAttribute('data-bg');else this.style.backgroundColor='';" data-bg="rgb(24, 24, 27)" data-hover-bg="rgb(63, 63, 70)"
|
|
1343
|
+
<a href="#" role="button" class="transition-all inline-block whitespace-nowrap cursor-pointer no-underline border-2 border-solid mt-2 mb-1 font-normal tracking-normal rounded-full py-2 px-6 size-15 leading-14 border-transparent hover:border-transparent" style="color: rgb(24, 24, 27); background-color: rgb(240, 240, 241);" onmouseover="if(this.getAttribute('data-hover-bg'))this.style.backgroundColor=this.getAttribute('data-hover-bg');" onmouseout="if(this.getAttribute('data-bg'))this.style.backgroundColor=this.getAttribute('data-bg');else this.style.backgroundColor='';" data-bg="rgb(240, 240, 241)" data-hover-bg="rgb(236, 236, 238)">${util.out('Read More')}</a>
|
|
1344
|
+
<a href="#" role="button" class="transition-all inline-block whitespace-nowrap cursor-pointer no-underline border-2 border-solid mt-2 mb-1 font-normal tracking-normal rounded-full py-2 px-6 size-15 leading-14 border-transparent hover:border-transparent" style="color: rgb(250, 250, 250); background-color: rgb(24, 24, 27);" onmouseover="if(this.getAttribute('data-hover-bg'))this.style.backgroundColor=this.getAttribute('data-hover-bg');" onmouseout="if(this.getAttribute('data-bg'))this.style.backgroundColor=this.getAttribute('data-bg');else this.style.backgroundColor='';" data-bg="rgb(24, 24, 27)" data-hover-bg="rgb(63, 63, 70)">${util.out('Get Started')}</a>
|
|
1349
1345
|
</div>`;
|
|
1350
1346
|
if (builder.opts.emailMode) {
|
|
1351
1347
|
html = `<div>
|
|
1352
|
-
<a href="#" role="button" style="margin-top: ;margin-right: ;margin-bottom: ;margin-left: ;display: inline-block; text-decoration: none; transition: all 0.16s ease 0s; border-style: solid; cursor: pointer; background-color: rgb(220, 220, 220); color: rgb(0, 0, 0); border-color: rgb(220, 220, 220); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 400; font-size: 14px; letter-spacing: 3px;"
|
|
1353
|
-
<a href="#" role="button" style="display: inline-block; text-decoration: none; transition: all 0.16s ease 0s; border-style: solid; cursor: pointer; background-color: rgba(0, 0, 0, 0); border-color: rgb(53, 53, 53); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 600; font-size: 14px; letter-spacing: 3px; color: rgb(53, 53, 53);"
|
|
1348
|
+
<a href="#" role="button" style="margin-top: ;margin-right: ;margin-bottom: ;margin-left: ;display: inline-block; text-decoration: none; transition: all 0.16s ease 0s; border-style: solid; cursor: pointer; background-color: rgb(220, 220, 220); color: rgb(0, 0, 0); border-color: rgb(220, 220, 220); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 400; font-size: 14px; letter-spacing: 3px;">${util.out('Read More')}</a>
|
|
1349
|
+
<a href="#" role="button" style="display: inline-block; text-decoration: none; transition: all 0.16s ease 0s; border-style: solid; cursor: pointer; background-color: rgba(0, 0, 0, 0); border-color: rgb(53, 53, 53); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 600; font-size: 14px; letter-spacing: 3px; color: rgb(53, 53, 53);">${util.out('Get Started')}</a>
|
|
1354
1350
|
</div>`;
|
|
1355
1351
|
}
|
|
1356
1352
|
util.addContent(html, mode);
|
|
@@ -1375,7 +1371,7 @@ const renderQuickAdd = builder => {
|
|
|
1375
1371
|
dom.addEventListener(elm, 'click', () => {
|
|
1376
1372
|
// const mode = quickadd.getAttribute('data-mode');
|
|
1377
1373
|
|
|
1378
|
-
let html = '<div class="row">' + '<div class="column full" data-noedit data-html="' + encodeURIComponent('<h1 id="{id}">Lorem ipsum</h1>' + '
|
|
1374
|
+
let html = '<div class="row">' + '<div class="column full" data-noedit data-html="' + encodeURIComponent('<h1 id="{id}">Lorem ipsum</h1>' + `<p>${util.out('This is a code block. You can edit this block using the source dialog.')}</p>` + '<scr' + 'ipt>' + 'var docReady = function (fn) {' + 'var stateCheck = setInterval(function () {' + 'if (document.readyState !== "complete") return;' + 'clearInterval(stateCheck);' + 'try{fn()}catch(e){}' + '}, 1);' + '};' + 'docReady(function() {' + `document.querySelector('#{id}').innerHTML = '<b>${util.out('Hello World..!')}</b>';` + '});' + '</scr' + 'ipt>') + '">' + '</div>' + '</div>';
|
|
1379
1375
|
let noedit = true;
|
|
1380
1376
|
let bSnippet = false;
|
|
1381
1377
|
let snippetPathReplace = builder.opts.snippetPathReplace;
|
|
@@ -5463,16 +5459,32 @@ class Util {
|
|
|
5463
5459
|
if (mode === 'cell' || mode === 'cell-right') {
|
|
5464
5460
|
dom.moveAfter(cellElement, cell);
|
|
5465
5461
|
}
|
|
5462
|
+
|
|
5463
|
+
// Get firstChild
|
|
5464
|
+
// let element;
|
|
5465
|
+
// if (cellElement.children && cellElement.children[0]) {
|
|
5466
|
+
// element = cellElement.children[0];
|
|
5467
|
+
// }
|
|
5466
5468
|
let element;
|
|
5467
|
-
if (cellElement.
|
|
5468
|
-
|
|
5469
|
+
if (cellElement.children && cellElement.children[0]) {
|
|
5470
|
+
const priority = ['H1', 'H2', 'H3', 'H4', 'P', 'PRE', 'LI', 'TD'];
|
|
5471
|
+
for (let i = 0; i < priority.length; i++) {
|
|
5472
|
+
const found = cellElement.querySelector(priority[i]);
|
|
5473
|
+
if (found) {
|
|
5474
|
+
element = found;
|
|
5475
|
+
break;
|
|
5476
|
+
}
|
|
5477
|
+
}
|
|
5478
|
+
if (!element) {
|
|
5479
|
+
element = cellElement.children[0];
|
|
5480
|
+
}
|
|
5469
5481
|
}
|
|
5470
5482
|
let builderActive = this.builder.doc.querySelector('.builder-active');
|
|
5471
5483
|
if (builderActive) this.builder.applyBehaviorOn(builderActive);
|
|
5472
5484
|
this.fixLayout(row);
|
|
5473
5485
|
try {
|
|
5474
5486
|
// cellElement.click(); //change active block to the newly created
|
|
5475
|
-
if (element && element.tagName.toLowerCase() === 'img') {
|
|
5487
|
+
if (element && element.tagName && element.tagName.toLowerCase() === 'img') {
|
|
5476
5488
|
element.onload = () => {
|
|
5477
5489
|
element.click();
|
|
5478
5490
|
element.onload = null;
|
|
@@ -5481,6 +5493,16 @@ class Util {
|
|
|
5481
5493
|
}, 100);
|
|
5482
5494
|
};
|
|
5483
5495
|
} else if (element) {
|
|
5496
|
+
// element.click();
|
|
5497
|
+
|
|
5498
|
+
element.focus();
|
|
5499
|
+
const range = document.createRange();
|
|
5500
|
+
const selection = window.getSelection();
|
|
5501
|
+
range.selectNodeContents(element);
|
|
5502
|
+
range.collapse(false); // false = end of element
|
|
5503
|
+
|
|
5504
|
+
selection.removeAllRanges();
|
|
5505
|
+
selection.addRange(range);
|
|
5484
5506
|
element.click();
|
|
5485
5507
|
}
|
|
5486
5508
|
} catch (e) {
|
|
@@ -5524,24 +5546,54 @@ class Util {
|
|
|
5524
5546
|
}
|
|
5525
5547
|
row.parentNode.insertBefore(rowElement, row);
|
|
5526
5548
|
dom.moveAfter(rowElement, row);
|
|
5549
|
+
|
|
5550
|
+
// Get firstChild
|
|
5551
|
+
// let element;
|
|
5552
|
+
// if (rowElement.children && rowElement.children[0] && rowElement.children[0].children && rowElement.children[0].children[0]) {
|
|
5553
|
+
// element = rowElement.children[0].children[0];
|
|
5554
|
+
// }
|
|
5527
5555
|
let element;
|
|
5528
|
-
if (rowElement.
|
|
5529
|
-
|
|
5556
|
+
if (rowElement.children && rowElement.children[0] && rowElement.children[0].children && rowElement.children[0].children[0]) {
|
|
5557
|
+
const parent = rowElement.children[0];
|
|
5558
|
+
const priority = ['H1', 'H2', 'H3', 'H4', 'P', 'PRE', 'LI', 'TD'];
|
|
5559
|
+
for (let i = 0; i < priority.length; i++) {
|
|
5560
|
+
const found = parent.querySelector(priority[i]);
|
|
5561
|
+
if (found) {
|
|
5562
|
+
element = found;
|
|
5563
|
+
break;
|
|
5564
|
+
}
|
|
5565
|
+
}
|
|
5566
|
+
if (!element) {
|
|
5567
|
+
element = parent.children[0];
|
|
5568
|
+
}
|
|
5530
5569
|
}
|
|
5531
5570
|
let builderActive = this.builder.doc.querySelector('.builder-active');
|
|
5532
5571
|
if (builderActive) this.builder.applyBehaviorOn(builderActive);
|
|
5572
|
+
try {
|
|
5573
|
+
// cellElement.click(); //change active block to the newly created
|
|
5574
|
+
if (element && element.tagName && element.tagName.toLowerCase() === 'img') {
|
|
5575
|
+
element.onload = () => {
|
|
5576
|
+
element.click();
|
|
5577
|
+
element.onload = null;
|
|
5578
|
+
setTimeout(() => {
|
|
5579
|
+
this.builder.element.image.repositionImageTool();
|
|
5580
|
+
}, 100);
|
|
5581
|
+
};
|
|
5582
|
+
} else if (element) {
|
|
5583
|
+
// element.click();
|
|
5533
5584
|
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5585
|
+
element.focus();
|
|
5586
|
+
const range = document.createRange();
|
|
5587
|
+
const selection = window.getSelection();
|
|
5588
|
+
range.selectNodeContents(element);
|
|
5589
|
+
range.collapse(false); // false = end of element
|
|
5590
|
+
|
|
5591
|
+
selection.removeAllRanges();
|
|
5592
|
+
selection.addRange(range);
|
|
5537
5593
|
element.click();
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
}, 100);
|
|
5542
|
-
};
|
|
5543
|
-
} else if (element) {
|
|
5544
|
-
element.click();
|
|
5594
|
+
}
|
|
5595
|
+
} catch (e) {
|
|
5596
|
+
// Do Nothing
|
|
5545
5597
|
}
|
|
5546
5598
|
}
|
|
5547
5599
|
let editingInsidePlugin = false;
|
|
@@ -5592,7 +5644,29 @@ class Util {
|
|
|
5592
5644
|
}
|
|
5593
5645
|
}, 30);
|
|
5594
5646
|
} else {
|
|
5595
|
-
newelement.click();
|
|
5647
|
+
// newelement.click();
|
|
5648
|
+
|
|
5649
|
+
const priority = ['H1', 'H2', 'H3', 'H4', 'P', 'PRE', 'LI', 'TD'];
|
|
5650
|
+
let targetElement;
|
|
5651
|
+
if (priority.indexOf(newelement.tagName) !== -1) {
|
|
5652
|
+
targetElement = newelement;
|
|
5653
|
+
} else {
|
|
5654
|
+
targetElement = newelement.querySelector('h1, h2, h3, h4, p, pre, li, td');
|
|
5655
|
+
if (!targetElement && newelement.children && newelement.children[0]) {
|
|
5656
|
+
targetElement = newelement.children[0];
|
|
5657
|
+
}
|
|
5658
|
+
}
|
|
5659
|
+
if (targetElement) {
|
|
5660
|
+
const range = document.createRange();
|
|
5661
|
+
const selection = window.getSelection();
|
|
5662
|
+
range.selectNodeContents(targetElement);
|
|
5663
|
+
range.collapse(false);
|
|
5664
|
+
selection.removeAllRanges();
|
|
5665
|
+
selection.addRange(range);
|
|
5666
|
+
targetElement.click();
|
|
5667
|
+
} else {
|
|
5668
|
+
newelement.click();
|
|
5669
|
+
}
|
|
5596
5670
|
}
|
|
5597
5671
|
|
|
5598
5672
|
// LATER: auto scroll
|
|
@@ -5628,6 +5702,64 @@ class Util {
|
|
|
5628
5702
|
template.innerHTML = html;
|
|
5629
5703
|
return template.content.firstChild;
|
|
5630
5704
|
}
|
|
5705
|
+
autoSelect(rowElement) {
|
|
5706
|
+
let element;
|
|
5707
|
+
if (rowElement.children && rowElement.children[0] && rowElement.children[0].children && rowElement.children[0].children[0]) {
|
|
5708
|
+
const parent = rowElement.children[0];
|
|
5709
|
+
if (parent.hasAttribute('data-html')) {
|
|
5710
|
+
// Module
|
|
5711
|
+
setTimeout(() => {
|
|
5712
|
+
parent.click();
|
|
5713
|
+
}, 100);
|
|
5714
|
+
} else if (parent.children[0].hasAttribute('data-cb-type')) {
|
|
5715
|
+
// plugin (do not auto select)
|
|
5716
|
+
setTimeout(() => {
|
|
5717
|
+
parent.click();
|
|
5718
|
+
}, 10);
|
|
5719
|
+
} else {
|
|
5720
|
+
const priority = ['H1', 'H2', 'H3', 'H4', 'P', 'PRE', 'LI', 'TD'];
|
|
5721
|
+
for (let i = 0; i < priority.length; i++) {
|
|
5722
|
+
const found = rowElement.querySelector(priority[i]);
|
|
5723
|
+
if (found) {
|
|
5724
|
+
element = found;
|
|
5725
|
+
break;
|
|
5726
|
+
}
|
|
5727
|
+
}
|
|
5728
|
+
if (!element) {
|
|
5729
|
+
element = parent.children[0]; // can be anything (img, etc)
|
|
5730
|
+
}
|
|
5731
|
+
|
|
5732
|
+
try {
|
|
5733
|
+
// cellElement.click(); //change active block to the newly created
|
|
5734
|
+
if (element && element.tagName && element.tagName.toLowerCase() === 'img') {
|
|
5735
|
+
element.onload = () => {
|
|
5736
|
+
element.click();
|
|
5737
|
+
element.onload = null;
|
|
5738
|
+
setTimeout(() => {
|
|
5739
|
+
this.builder.element.image.repositionImageTool();
|
|
5740
|
+
}, 100);
|
|
5741
|
+
};
|
|
5742
|
+
} else if (element) {
|
|
5743
|
+
// element.click();
|
|
5744
|
+
|
|
5745
|
+
element.focus();
|
|
5746
|
+
const range = document.createRange();
|
|
5747
|
+
const selection = window.getSelection();
|
|
5748
|
+
range.selectNodeContents(element);
|
|
5749
|
+
range.collapse(false); // false = end of element
|
|
5750
|
+
|
|
5751
|
+
selection.removeAllRanges();
|
|
5752
|
+
selection.addRange(range);
|
|
5753
|
+
setTimeout(() => {
|
|
5754
|
+
element.click();
|
|
5755
|
+
}, 100);
|
|
5756
|
+
}
|
|
5757
|
+
} catch (e) {
|
|
5758
|
+
// Do Nothing
|
|
5759
|
+
}
|
|
5760
|
+
}
|
|
5761
|
+
}
|
|
5762
|
+
}
|
|
5631
5763
|
addSnippet(html, bSnippet, noedit) {
|
|
5632
5764
|
this.builder.uo.saveForUndo();
|
|
5633
5765
|
const dom = this.dom;
|
|
@@ -5704,10 +5836,13 @@ class Util {
|
|
|
5704
5836
|
builderActive = this.builder.doc.querySelector('.is-builder');
|
|
5705
5837
|
this.builder.applyBehaviorOn(builderActive);
|
|
5706
5838
|
}
|
|
5707
|
-
cellElement.click(); //change active block to the newly created
|
|
5708
5839
|
|
|
5709
|
-
//
|
|
5710
|
-
|
|
5840
|
+
// cellElement.click(); //change active block to the newly created
|
|
5841
|
+
|
|
5842
|
+
// // Change to row selection
|
|
5843
|
+
// rowElement.className = rowElement.className.replace('row-outline', '');
|
|
5844
|
+
|
|
5845
|
+
this.autoSelect(rowElement);
|
|
5711
5846
|
|
|
5712
5847
|
//Hide Column tool (new!)
|
|
5713
5848
|
this.builder.util.hideColumnTool();
|
|
@@ -5857,9 +5992,11 @@ class Util {
|
|
|
5857
5992
|
builderActive = this.builder.doc.querySelector('.is-builder');
|
|
5858
5993
|
this.builder.applyBehaviorOn(builderActive);
|
|
5859
5994
|
}
|
|
5860
|
-
cellElement = rowElement.querySelector('div');
|
|
5861
|
-
if (cellElement) cellElement.click(); //change active block to the newly created
|
|
5862
5995
|
|
|
5996
|
+
// cellElement = rowElement.querySelector('div');
|
|
5997
|
+
// if(cellElement) cellElement.click(); //change active block to the newly created
|
|
5998
|
+
|
|
5999
|
+
this.autoSelect(rowElement);
|
|
5863
6000
|
const builderStuff = this.builder.builderStuff;
|
|
5864
6001
|
let quickadd = builderStuff.querySelector('.quickadd');
|
|
5865
6002
|
if (quickadd) this.hidePop(quickadd); // hide pop
|
|
@@ -95849,34 +95986,38 @@ class ContentBuilder {
|
|
|
95849
95986
|
if (this.win.builderRuntime) this.win.builderRuntime.reinitialize(builder);
|
|
95850
95987
|
if (newRows.length > 0) {
|
|
95851
95988
|
let newRow = newRows[0]; // get first added row
|
|
95852
|
-
|
|
95853
|
-
|
|
95854
|
-
|
|
95855
|
-
|
|
95856
|
-
|
|
95857
|
-
|
|
95858
|
-
|
|
95859
|
-
|
|
95860
|
-
|
|
95861
|
-
|
|
95862
|
-
|
|
95863
|
-
|
|
95864
|
-
|
|
95865
|
-
|
|
95866
|
-
|
|
95867
|
-
|
|
95868
|
-
|
|
95869
|
-
|
|
95870
|
-
|
|
95871
|
-
|
|
95872
|
-
|
|
95873
|
-
|
|
95874
|
-
|
|
95989
|
+
|
|
95990
|
+
this.util.autoSelect(newRow);
|
|
95991
|
+
/*
|
|
95992
|
+
if(newRow.children.length>0) {
|
|
95993
|
+
const newCol = newRow.children[0];
|
|
95994
|
+
const isPlugin = newCol.querySelector('[data-cb-type]');
|
|
95995
|
+
if(newCol.children.length>0) {
|
|
95996
|
+
if(isPlugin) {
|
|
95997
|
+
setTimeout(()=>{ // give time for plugin to render (apply style) => for correct elm tool position
|
|
95998
|
+
newCol.children[0].click();
|
|
95999
|
+
}, 400);
|
|
96000
|
+
} else {
|
|
96001
|
+
const spacer = newCol.querySelector('.spacer');
|
|
96002
|
+
setTimeout(()=>{
|
|
96003
|
+
try {
|
|
96004
|
+
if(spacer) {
|
|
96005
|
+
if(newCol.parentNode.nextElementSibling) {
|
|
96006
|
+
const elm = newCol.parentNode.nextElementSibling.querySelector('h1,h2,h3,h4,h5,h6,p,img,[data-cb-type]');
|
|
96007
|
+
if(elm) elm.click();
|
|
96008
|
+
else newCol.click();
|
|
96009
|
+
}
|
|
96010
|
+
} else{
|
|
96011
|
+
newCol.children[0].click(); // Focus on first element
|
|
96012
|
+
}
|
|
96013
|
+
} catch(e) {
|
|
96014
|
+
// Do Nothing
|
|
96015
|
+
}
|
|
96016
|
+
}, 400);
|
|
95875
96017
|
}
|
|
95876
|
-
}, 400);
|
|
95877
96018
|
}
|
|
95878
|
-
}
|
|
95879
96019
|
}
|
|
96020
|
+
*/
|
|
95880
96021
|
}
|
|
95881
96022
|
|
|
95882
96023
|
//Trigger Change event
|