@innovastudio/contentbox 1.4.2 → 1.4.4

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.
@@ -499,7 +499,7 @@ class SideBar {
499
499
  sideIndex++;
500
500
  });
501
501
  html += '</div>';
502
- html += '' + '<div id="divSidebarSections" class="is-sidebar-content" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true" style="-webkit-transition-duration:0.2s;transition-duration:0.2s;">' + '<div>' + '<iframe id="ifrIdeasPanel" src="about:blank" style="width:100%;height:100%;box-sizing:border-box;border:none;">' + '</iframe>' + '</div>' + '</div>' + '<div id="divSidebarSnippets" class="is-sidebar-content scroll-darker" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true" style="max-width:275px;border-left: transparent 50px solid;box-sizing: border-box;">' + '' + '</div>' + '<div id="divSidebarSource" class="is-sidebar-content" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true" style="-webkit-transition-duration:0.2s;transition-duration:0.2s;">' + '<div>' + '<div style="position:absolute;width:240px;height:35px;right:10px;top:5px;z-index:1;display:flex;">' + '<button title="' + out('Cancel') + '" id="btnViewHtmlCancel" tabindex="-1" style="height:38px" class="classic-secondary"> ' + out('Cancel') + ' </button>' + '<button title="' + out('Ok') + '" id="btnViewHtmlOk" tabindex="-1" style="height:38px" class="classic-primary"> ' + out('Ok') + ' </button>' + '</div>' + '<div style="height:100%;box-sizing:border-box;border-top:#f3f3f3 50px solid;position:relative">' + '<textarea id="inpViewHtml" tabindex="-1" style="width:100%;height:100%;resize: none;"></textarea>' + '</div>' + '</div>' + '</div>' + '<div id="divSidebarTypography" class="is-sidebar-content" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true" style="-webkit-transition-duration:0.2s;transition-duration:0.2s;">' + '<div class="scroll-darker">' + '<div style="padding: 15px 0 0 20px">' + '<div class="is-sidebar-title" style="margin-bottom:12px;">' + out('Typography Styles') + '</div>' + '<div>' + out('Apply to') + ':</div>' + '<div style="display:flex;justify-content:space-between;align-items: center;">' + '<div class="typo-target-default" style="display:flex">' + '<label><input type="radio" tabindex="0" name="typoTarget" value="page"> <span>' + out('Page') + '</span></label>' + '<label><input type="radio" tabindex="0" name="typoTarget" value="section" checked> <span>' + out('Section') + '</span></label>' + '</div>' + '<div class="typo-target-box" style="display: flex;">' + '<span>' + out('Active Box') + '</span>' + '</div>' + '<button title="' + out('Clear') + '" tabindex="0" id="btnTypoClear"><svg class="is-icon-flex" style="width:11px;height:11px;"><use xlink:href="#icon-clean"></use></svg></button>' + '</div>' + '</div>' + '<div id="divSelector"></div>' + '<div id="divStyles"></div>' + '</div>' + '</div>' + '<div id="divCustomSidebarArea1" class="is-sidebar-content" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true" style="max-width:500px;">' + '<div style="padding:0 0 0 50px;box-sizing:border-box;">' + '<iframe id="ifrCustomSidebarArea1" src="about:blank" style="width:100%;height:100%;box-sizing:border-box;border:none;">' + '</iframe>' + '</div>' + '</div>' + '<div id="divCustomSidebarArea2" class="is-sidebar-content" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true" style="max-width:500px;">' + '<div style="padding:0 0 0 50px;box-sizing:border-box;">' + '<iframe id="ifrCustomSidebarArea2" src="about:blank" style="width:100%;height:100%;box-sizing:border-box;border:none;">' + '</iframe>' + '</div>' + '</div>';
502
+ html += '' + '<div id="divSidebarSections" class="is-sidebar-content ' + this.builder.templateThumbnailSize + '" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true" style="-webkit-transition-duration:0.2s;transition-duration:0.2s;">' + '<div>' + '<iframe id="ifrIdeasPanel" src="about:blank" style="width:100%;height:100%;box-sizing:border-box;border:none;">' + '</iframe>' + '</div>' + '</div>' + '<div id="divSidebarSnippets" class="is-sidebar-content scroll-darker" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true" style="max-width:275px;border-left: transparent 50px solid;box-sizing: border-box;">' + '' + '</div>' + '<div id="divSidebarSource" class="is-sidebar-content" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true" style="-webkit-transition-duration:0.2s;transition-duration:0.2s;">' + '<div>' + '<div style="position:absolute;width:240px;height:35px;right:10px;top:5px;z-index:1;display:flex;">' + '<button title="' + out('Cancel') + '" id="btnViewHtmlCancel" tabindex="-1" style="height:38px" class="classic-secondary"> ' + out('Cancel') + ' </button>' + '<button title="' + out('Ok') + '" id="btnViewHtmlOk" tabindex="-1" style="height:38px" class="classic-primary"> ' + out('Ok') + ' </button>' + '</div>' + '<div style="height:100%;box-sizing:border-box;border-top:#f3f3f3 50px solid;position:relative">' + '<textarea id="inpViewHtml" tabindex="-1" style="width:100%;height:100%;resize: none;"></textarea>' + '</div>' + '</div>' + '</div>' + '<div id="divSidebarTypography" class="is-sidebar-content" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true" style="-webkit-transition-duration:0.2s;transition-duration:0.2s;">' + '<div class="scroll-darker">' + '<div style="padding: 15px 0 0 20px">' + '<div class="is-sidebar-title" style="margin-bottom:12px;">' + out('Typography Styles') + '</div>' + '<div>' + out('Apply to') + ':</div>' + '<div style="display:flex;justify-content:space-between;align-items: center;">' + '<div class="typo-target-default" style="display:flex">' + '<label><input type="radio" tabindex="0" name="typoTarget" value="page"> <span>' + out('Page') + '</span></label>' + '<label><input type="radio" tabindex="0" name="typoTarget" value="section" checked> <span>' + out('Section') + '</span></label>' + '</div>' + '<div class="typo-target-box" style="display: flex;">' + '<span>' + out('Active Box') + '</span>' + '</div>' + '<button title="' + out('Clear') + '" tabindex="0" id="btnTypoClear"><svg class="is-icon-flex" style="width:11px;height:11px;"><use xlink:href="#icon-clean"></use></svg></button>' + '</div>' + '</div>' + '<div id="divSelector"></div>' + '<div id="divStyles"></div>' + '</div>' + '</div>' + '<div id="divCustomSidebarArea1" class="is-sidebar-content" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true" style="max-width:500px;">' + '<div style="padding:0 0 0 50px;box-sizing:border-box;">' + '<iframe id="ifrCustomSidebarArea1" src="about:blank" style="width:100%;height:100%;box-sizing:border-box;border:none;">' + '</iframe>' + '</div>' + '</div>' + '<div id="divCustomSidebarArea2" class="is-sidebar-content" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true" style="max-width:500px;">' + '<div style="padding:0 0 0 50px;box-sizing:border-box;">' + '<iframe id="ifrCustomSidebarArea2" src="about:blank" style="width:100%;height:100%;box-sizing:border-box;border:none;">' + '</iframe>' + '</div>' + '</div>';
503
503
  } else {
504
504
  html = '<div id="divSections" style="display:none"></div>' + '<div class="is-modal addsection" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">' + '<div style="max-width: 900px;">' + '<div id="divSectionList" class="is-section-list"></div>' + '</div>' + '</div>';
505
505
  }
@@ -762,8 +762,14 @@ class SideBar {
762
762
  var doc = ifr.contentWindow.document;
763
763
 
764
764
  if (doc.body.innerHTML === '') {
765
- doc.open();
766
- doc.write(this.getTemplatesHtml());
765
+ doc.open(); // doc.write(this.getTemplatesHtml());
766
+
767
+ if (this.builder.templates.length === 0) {
768
+ doc.write(this.getTemplatesHtml_OLD());
769
+ } else {
770
+ doc.write(this.getTemplatesHtml());
771
+ }
772
+
767
773
  doc.close();
768
774
  }
769
775
  } else if (designPath) {
@@ -1121,6 +1127,840 @@ class SideBar {
1121
1127
  }
1122
1128
 
1123
1129
  getTemplatesHtml() {
1130
+ let sTemplateJSON = '';
1131
+ this.builder.templateJSON.forEach(item => {
1132
+ sTemplateJSON += `{
1133
+ url: '${item.url}',
1134
+ path: '${item.path}',
1135
+ pathReplace: '${item.pathReplace}',
1136
+ },`;
1137
+ });
1138
+ let sTemplates = '';
1139
+ this.builder.templates.forEach(item => {
1140
+ sTemplates += `{
1141
+ url: '${item.url}',
1142
+ path: '${item.path}',
1143
+ pathReplace: '${item.pathReplace}',
1144
+ },`;
1145
+ });
1146
+ let sCategories = '';
1147
+ this.builder.featuredCategories.forEach(item => {
1148
+ sCategories += `{
1149
+ id: '${item.id}',
1150
+ name: '${item.name}',
1151
+ },`;
1152
+ });
1153
+ let thumbWidth = '';
1154
+ let thumbMargin = '';
1155
+
1156
+ if (this.builder.templateThumbnailSize === 'small') {
1157
+ thumbWidth = '250px';
1158
+ thumbMargin = '30px 0 0 30px';
1159
+ } else if (this.builder.templateThumbnailSize === 'medium') {
1160
+ thumbWidth = '350px';
1161
+ thumbMargin = '40px 0 0 40px';
1162
+ } else {
1163
+ thumbWidth = '450px'; // '500px';
1164
+
1165
+ thumbMargin = '50px 0 0 50px'; // '62px 0 0 60px';
1166
+ }
1167
+
1168
+ let html = `
1169
+ <!DOCTYPE html>
1170
+ <html lang="en">
1171
+ <head>
1172
+ <meta charset="utf-8">
1173
+ <title>Browse</title>
1174
+ <meta name="viewport" content="width=device-width, initial-scale=1">
1175
+ <meta name="description" content="">
1176
+ <link rel="shortcut icon" href="#" />
1177
+ <style>
1178
+ body {
1179
+ margin: 0;
1180
+ background: #fff;
1181
+ font-family: sans-serif;
1182
+ font-weight: 300;
1183
+ }
1184
+ h2 {
1185
+ font-weight: 300;
1186
+ }
1187
+ button {
1188
+ cursor: pointer;
1189
+ border: none;
1190
+ background: #fdfdfd;
1191
+ padding: 12px 25px;
1192
+ border-radius: 500px;
1193
+ font-size: 11px;
1194
+ text-transform: uppercase;
1195
+ letter-spacing: 1px;;
1196
+ color: #333;
1197
+ }
1198
+ button.on {
1199
+ background: #f5f5f5;
1200
+ }
1201
+
1202
+ .featured-categories {
1203
+ background-color: #f5f5f5;
1204
+ position: absolute;
1205
+ width: 100%;
1206
+ height: 88px;
1207
+ z-index: 1;
1208
+ padding: 14px 15px 0 25px;
1209
+ box-sizing: border-box;
1210
+ /* box-shadow: 0 5px 15px rgb(0 0 0 / 5%); */
1211
+ }
1212
+ .featured-categories button {
1213
+ margin: 10px 15px 0 0;
1214
+ font-size: 11px;
1215
+ }
1216
+
1217
+ .is-design-list {
1218
+ position: fixed;
1219
+ top: 0px;
1220
+ left: 0px;
1221
+ border-top: transparent 88px solid;
1222
+ width: 100%;
1223
+ height: 100%;
1224
+ overflow-y: auto;
1225
+ padding: 0px 0px 30px 0px;
1226
+ box-sizing: border-box;
1227
+ overflow: auto;
1228
+ transition: all 200ms ease;
1229
+ }
1230
+ .is-design-list > button {
1231
+ position: relative;
1232
+ width: ${thumbWidth};;
1233
+ overflow: hidden;
1234
+ margin: ${thumbMargin};
1235
+ cursor: pointer;
1236
+ display: inline-block;
1237
+ padding: 0px;
1238
+ border: rgba(219, 219, 219, 0.39) 1px solid;
1239
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
1240
+ border-radius: 2px;
1241
+ }
1242
+ .is-design-list > button img {
1243
+ box-shadow: none;
1244
+ opacity: 1;
1245
+ display: block;
1246
+ box-sizing: border-box;
1247
+ transition: all 0.2s ease-in-out;
1248
+ max-width: 500px;
1249
+ width: 100%
1250
+ }
1251
+ .is-design-list > button .is-overlay {
1252
+ position: absolute;
1253
+ top:0px;
1254
+ left:0px;
1255
+ width:100%;
1256
+ height:100%;
1257
+ }
1258
+ .is-design-list > button .is-overlay:after {
1259
+ background: rgba(0, 0, 0, 0.05);
1260
+ position: absolute;
1261
+ content: "";
1262
+ display: block;
1263
+ top: 0;
1264
+ left: 0;
1265
+ right: 0;
1266
+ bottom: 0;
1267
+ transition: all 0.2s ease-in-out;
1268
+ opacity: 0;
1269
+ }
1270
+ .is-design-list > button:hover .is-overlay:after {
1271
+ opacity: 0.5;
1272
+ }
1273
+
1274
+ .mega-menu {
1275
+ display: none;
1276
+ transform: translateY(-100%);
1277
+ background: #f5f5f5;
1278
+ overflow-x: hidden;
1279
+ overflow-y: auto;
1280
+ position: fixed;
1281
+ top: 88px;
1282
+ left: 0;
1283
+ right: 0;
1284
+ width: 100%;
1285
+ height: auto;
1286
+ z-index: 1;
1287
+ padding: 10px 50px 40px 40px;
1288
+ box-sizing: border-box;
1289
+ transition: all 300ms ease;
1290
+ min-width:400px;
1291
+ /* box-shadow: 0 5px 15px rgb(0 0 0 / 5%); */
1292
+ }
1293
+ .mega-menu.active {
1294
+ opacity: 1;
1295
+ transform: scale(1);
1296
+ transform: translateY(0);
1297
+ }
1298
+ .mega-menu h2 {
1299
+ margin-top:30px;
1300
+ font-size: 21px
1301
+ }
1302
+ .mega-menu button {
1303
+ margin:15px 15px 0 0;
1304
+ }
1305
+ .mega-menu .close {
1306
+ position: absolute;
1307
+ top: 0px; right: 0px;
1308
+ background: transparent;
1309
+ width: 50px;
1310
+ height: 50px;
1311
+ display: flex;
1312
+ justify-content: center;
1313
+ align-items: center;
1314
+ border-radius: 2px;;
1315
+ }
1316
+ </style>
1317
+ </head>
1318
+ <body style="touch-action: pan-y">`;
1319
+ html += `
1320
+ <div class="mega-menu">
1321
+ <button class="close" tabindex="0"><svg style="width:40px;height:40px;flex:none;"><use xlink:href="#iconclose"></use></svg></button>
1322
+
1323
+ <div class="mega-menu-content">
1324
+ </div>
1325
+ </div>
1326
+
1327
+ <div class="featured-categories">
1328
+ </div>
1329
+
1330
+ <div class="is-design-list">
1331
+ </div>
1332
+
1333
+
1334
+ <svg width="0" height="0" style="position:absolute;display:none;">
1335
+ <defs>
1336
+ <symbol viewBox="0 0 24 24" id="iconclose" stroke-width="0.7" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
1337
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line>
1338
+ </symbol>
1339
+ </defs>
1340
+ </svg>
1341
+
1342
+ <script>
1343
+ var template_list = [];
1344
+ </script>
1345
+ <!-- <script src="basic.js" type="text/javascript"></script>
1346
+ <script src="examples.js" type="text/javascript"></script> -->
1347
+
1348
+ <script>
1349
+
1350
+ // Configuration
1351
+ const featuredCategories = [
1352
+ ${sCategories}
1353
+ ];
1354
+ const defaultCat = ${this.builder.defaultDesignCategory};
1355
+ const navbar = ${this.builder.navbar ? 'true' : 'false'};
1356
+
1357
+ const slider = '${this.builder.slider}';
1358
+
1359
+ const framework = '${this.builder.framework}';
1360
+ const contentStylePath = '${this.builder.contentStylePath}';
1361
+
1362
+ let templates = [
1363
+ ${sTemplates}
1364
+ ];
1365
+
1366
+ let templateJSON = [
1367
+ ${sTemplateJSON}
1368
+ ];
1369
+ // /Configuration
1370
+
1371
+ if(templates.length > 0) templateJSON = [...templates];
1372
+
1373
+ const loadJsFiles = (list, callback) => {
1374
+ if(list.length===0) {
1375
+ return;
1376
+ } else {
1377
+ const url = list[0].url;
1378
+ const script = document.createElement('script');
1379
+ script.src = url;
1380
+ script.async = true;
1381
+ script.onload = () => {
1382
+ callback(list[0]);
1383
+ loadJsFiles(list.slice(1), callback);
1384
+ };
1385
+ document.body.appendChild(script);
1386
+ }
1387
+ }
1388
+
1389
+ const imageObserver = new IntersectionObserver((entries, imgObserver) => {
1390
+ entries.forEach((entry) => {
1391
+ if (entry.isIntersecting) {
1392
+ const lazyImage = entry.target
1393
+ // console.log("lazy loading ", lazyImage)
1394
+ lazyImage.src = lazyImage.dataset.src
1395
+ lazyImage.classList.remove("lzy-img");
1396
+ imgObserver.unobserve(lazyImage);
1397
+ }
1398
+ })
1399
+ });
1400
+
1401
+ const makeid = () => { //http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript
1402
+ var text = "";
1403
+ var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
1404
+ for (var i = 0; i < 2; i++)
1405
+ text += possible.charAt(Math.floor(Math.random() * possible.length));
1406
+
1407
+ var text2 = "";
1408
+ var possible2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
1409
+ for (var i = 0; i < 5; i++)
1410
+ text2 += possible2.charAt(Math.floor(Math.random() * possible2.length));
1411
+
1412
+ return text + text2;
1413
+ }
1414
+
1415
+ const addDesign = (designid) => {
1416
+
1417
+ const wrapper = parent._cb.doc.querySelector('.is-wrapper');
1418
+
1419
+ let nIndex = 0;
1420
+ template_list.forEach(gallery=>{
1421
+ let designs = gallery.designs;
1422
+ designs.forEach(item=>{
1423
+
1424
+ item.id = nIndex; //Give id
1425
+
1426
+ if(nIndex===parseInt(designid)) {
1427
+ // alert(item.html);
1428
+ // alert(gallery.path);
1429
+ // alert(gallery.pathReplace);
1430
+
1431
+ let html = item.html;
1432
+ let googleFonts = item.googleFonts;
1433
+ let contentCss = item.contentCss;
1434
+ let contentClass = item.contentClass;
1435
+
1436
+ let designPath = gallery.path;
1437
+ let snippetPathReplace = gallery.pathReplace;
1438
+
1439
+ //To Tailwind
1440
+ if (framework == 'tailwind') {
1441
+ html = html.replace(new RegExp(' container', 'g'), ' container');
1442
+ html = html.replace(new RegExp('row clearfix', 'g'), 'flex flex-col md:flex-row');
1443
+ html = html.replace(new RegExp('column full', 'g'), 'w-full px-4');
1444
+ html = html.replace(new RegExp('column half', 'g'), 'w-full md:w-6/12 px-4');
1445
+ html = html.replace(new RegExp('column third', 'g'), 'w-full md:w-4/12 px-4');
1446
+ html = html.replace(new RegExp('column fourth', 'g'), 'w-full md:w-3/12 px-4');
1447
+ html = html.replace(new RegExp('column fifth', 'g'), 'w-full md:w-2/12 px-4'); //not needed
1448
+ html = html.replace(new RegExp('column sixth', 'g'), 'w-full md:w-2/12 px-4');
1449
+ html = html.replace(new RegExp('column two-third', 'g'), 'w-full md:w-8/12 px-4');
1450
+ html = html.replace(new RegExp('column two-fourth', 'g'), 'w-full md:w-9/12 px-4');
1451
+ html = html.replace(new RegExp('column two-sixth', 'g'), 'w-full md:w-10/12 px-4');
1452
+ }
1453
+
1454
+ //To Bootstrap
1455
+ if (framework == 'bootstrap') {
1456
+ html = html.replace(new RegExp(' container', 'g'), ' container-fluid');
1457
+ html = html.replace(new RegExp('row clearfix', 'g'), 'row');
1458
+ html = html.replace(new RegExp('column full', 'g'), 'col-md-12');
1459
+ html = html.replace(new RegExp('column half', 'g'), 'col-md-6');
1460
+ html = html.replace(new RegExp('column third', 'g'), 'col-md-4');
1461
+ html = html.replace(new RegExp('column fourth', 'g'), 'col-md-3');
1462
+ html = html.replace(new RegExp('column fifth', 'g'), 'col-md-2');
1463
+ html = html.replace(new RegExp('column sixth', 'g'), 'col-md-2');
1464
+ html = html.replace(new RegExp('column two-third', 'g'), 'col-md-8');
1465
+ html = html.replace(new RegExp('column two-fourth', 'g'), 'col-md-9');
1466
+ html = html.replace(new RegExp('column two-sixth', 'g'), 'col-md-10');
1467
+ html = html.replace(new RegExp('btn btn-primary', 'g'), 'btn btn-primary btn-lg');
1468
+ html = html.replace(new RegExp('btn btn-default', 'g'), 'btn btn-default btn-lg');
1469
+ }`;
1470
+ html += `
1471
+ //To Foundation
1472
+ if (framework == 'foundation') {
1473
+ //html = html.replace(new RegExp(' container', 'g'), ' container');
1474
+ html = html.replace(new RegExp('row clearfix', 'g'), 'row');
1475
+ html = html.replace(new RegExp('column full', 'g'), 'large-12 columns');
1476
+ html = html.replace(new RegExp('column half', 'g'), 'large-6 columns');
1477
+ html = html.replace(new RegExp('column third', 'g'), 'large-4 columns');
1478
+ html = html.replace(new RegExp('column fourth', 'g'), 'large-3 columns');
1479
+ html = html.replace(new RegExp('column fifth', 'g'), 'large-2 columns');
1480
+ html = html.replace(new RegExp('column sixth', 'g'), 'large-2 columns');
1481
+ html = html.replace(new RegExp('column two-third', 'g'), 'large-8 columns');
1482
+ html = html.replace(new RegExp('column two-fourth', 'g'), 'large-9 columns');
1483
+ html = html.replace(new RegExp('column two-sixth', 'g'), 'large-10 columns');
1484
+ html = html.replace(new RegExp('btn btn-primary', 'g'), 'button');
1485
+ html = html.replace(new RegExp('btn btn-default', 'g'), 'secondary button');
1486
+ }
1487
+
1488
+ //To UIKit
1489
+ if (framework == 'uikit') {
1490
+ html = html.replace(new RegExp(' container', 'g'), ' uk-container uk-container-center');
1491
+ html = html.replace(new RegExp('row clearfix', 'g'), 'uk-grid');
1492
+ html = html.replace(new RegExp('column full', 'g'), 'uk-width-1-1');
1493
+ html = html.replace(new RegExp('column half', 'g'), 'uk-width-1-2');
1494
+ html = html.replace(new RegExp('column third', 'g'), 'uk-width-1-3');
1495
+ html = html.replace(new RegExp('column fourth', 'g'), 'uk-width-1-4');
1496
+ html = html.replace(new RegExp('column fifth', 'g'), 'uk-width-1-5');
1497
+ html = html.replace(new RegExp('column sixth', 'g'), 'uk-width-1-6');
1498
+ html = html.replace(new RegExp('column two-third', 'g'), 'uk-width-2-3');
1499
+ html = html.replace(new RegExp('column two-fourth', 'g'), 'uk-width-3-4');
1500
+ html = html.replace(new RegExp('column two-sixth', 'g'), 'uk-width-5-6');
1501
+ html = html.replace(new RegExp('btn btn-primary', 'g'), 'uk-button uk-button-primary uk-button-large');
1502
+ html = html.replace(new RegExp('btn btn-default', 'g'), 'uk-button uk-button-large');
1503
+ }
1504
+
1505
+ //To Material
1506
+ if (framework == 'material') {
1507
+ html = html.replace(new RegExp(' container', 'g'), '');
1508
+ html = html.replace(new RegExp('row clearfix', 'g'), 'mdl-grid');
1509
+ html = html.replace(new RegExp('column full', 'g'), 'mdl-cell mdl-cell--12-col');
1510
+ html = html.replace(new RegExp('column half', 'g'), 'mdl-cell mdl-cell--6-col');
1511
+ html = html.replace(new RegExp('column third', 'g'), 'mdl-cell mdl-cell--4-col');
1512
+ html = html.replace(new RegExp('column fourth', 'g'), 'mdl-cell mdl-cell--3-col');
1513
+ html = html.replace(new RegExp('column fifth', 'g'), 'mdl-cell mdl-cell--2-col');
1514
+ html = html.replace(new RegExp('column sixth', 'g'), 'mdl-cell mdl-cell--2-col');
1515
+ html = html.replace(new RegExp('column two-third', 'g'), 'mdl-cell mdl-cell--8-col');
1516
+ html = html.replace(new RegExp('column two-fourth', 'g'), 'mdl-cell mdl-cell--9-col');
1517
+ html = html.replace(new RegExp('column two-sixth', 'g'), 'mdl-cell mdl-cell--10-col');
1518
+ html = html.replace(new RegExp('btn btn-primary', 'g'), 'mdl-button mdl-js-button mdl-button--raised mdl-button--accent');
1519
+ html = html.replace(new RegExp('btn btn-default', 'g'), 'mdl-button mdl-js-button mdl-button--raised');
1520
+ }
1521
+
1522
+ html = html.replace(/{id}/g, makeid());
1523
+
1524
+ if(snippetPathReplace.length>0) {
1525
+ if (snippetPathReplace[0] != '') {
1526
+ var regex = new RegExp(snippetPathReplace[0], 'g');
1527
+ html = html.replace(regex, snippetPathReplace[1]);
1528
+ }
1529
+ }
1530
+
1531
+ html = html.replace(/\\[%IMAGE_PATH%\\]/g, designPath);
1532
+ html = html.replace(/%5B%25IMAGE_PATH%25%5D/g, designPath); //If [%IMAGE_PATH%] is encoded (inside data-html)
1533
+
1534
+ //Add html
1535
+ parent.contentbox.addIdea(html);
1536
+
1537
+ //Add contentCss
1538
+ let exist = false;
1539
+ let links = parent._cb.doc.getElementsByTagName("link");
1540
+ for (let i = 0; i < links.length; i++) {
1541
+ let src = links[i].href.toLowerCase();
1542
+ if (src.indexOf(contentCss.toLowerCase()) != -1) exist = true;
1543
+ }
1544
+
1545
+ if (!exist) wrapper.insertAdjacentHTML('beforeend', '<link data-name="contentstyle" data-class="' + contentClass + '" href="' + contentStylePath + contentCss + '" rel="stylesheet">');
1546
+ }
1547
+
1548
+ nIndex++;
1549
+ });
1550
+ });
1551
+ }
1552
+
1553
+ const showDesigns = (catId) => {
1554
+
1555
+ const designList = document.querySelector('.is-design-list');
1556
+ designList.style.opacity = 0;
1557
+ setTimeout(()=>{
1558
+ designList.innerHTML = '';
1559
+ designList.style.opacity = 1;
1560
+
1561
+ let nIndex = 0;
1562
+
1563
+ template_list.forEach(gallery=>{
1564
+ let designs = gallery.designs;
1565
+ designs.forEach(item=>{
1566
+ let isSelected = false;
1567
+ let catSplit = item.category.split(',');
1568
+ for (let j = 0; j < catSplit.length; j++) {
1569
+ if (parseInt(catSplit[j]) === parseInt(catId)) {
1570
+ isSelected = true;
1571
+ }
1572
+ }
1573
+
1574
+ item.id = nIndex; //Give id
1575
+
1576
+ if (isSelected) {
1577
+
1578
+ let html = '<button tabindex="0" class="active" data-id="' + item.id + '" data-cat=""' + item.category + '">' +
1579
+ '<img class="lzy-img" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=" data-src="' + gallery.path + item.thumbnail + '">' +
1580
+ '<span class="is-overlay"></span>' +
1581
+ '</button>';
1582
+
1583
+ if(item.type === 'glide' || item.type === 'slick') {
1584
+ if(slider==='glide') {
1585
+ if(item.type === 'glide') {
1586
+ designList.insertAdjacentHTML('beforeend', html);
1587
+ const btn = designList.querySelector('[data-id="' + item.id + '"]');
1588
+ btn.addEventListener('click', (e)=>{
1589
+ const designid = btn.getAttribute('data-id');
1590
+ addDesign(designid);
1591
+ });
1592
+ }
1593
+ } else if(slider==='slick') {
1594
+ if(item.type === 'slick') {
1595
+ designList.insertAdjacentHTML('beforeend', html);
1596
+ const btn = designList.querySelector('[data-id="' + item.id + '"]');
1597
+ btn.addEventListener('click', (e)=>{
1598
+ const designid = btn.getAttribute('data-id');
1599
+ addDesign(designid);
1600
+ });
1601
+ }
1602
+ } else if(slider==='all') {
1603
+ designList.insertAdjacentHTML('beforeend', html);
1604
+ const btn = designList.querySelector('[data-id="' + item.id + '"]');
1605
+ btn.addEventListener('click', (e)=>{
1606
+ const designid = btn.getAttribute('data-id');
1607
+ addDesign(designid);
1608
+ });
1609
+ }
1610
+ } else if(item.type === 'navbar' ) {
1611
+ if(navbar) {
1612
+ designList.insertAdjacentHTML('beforeend', html);
1613
+ const btn = designList.querySelector('[data-id="' + item.id + '"]');
1614
+ btn.addEventListener('click', (e)=>{
1615
+ const designid = btn.getAttribute('data-id');
1616
+ addDesign(designid);
1617
+ });
1618
+ }
1619
+ } else {
1620
+ designList.insertAdjacentHTML('beforeend', html);
1621
+ const btn = designList.querySelector('[data-id="' + item.id + '"]');
1622
+ btn.addEventListener('click', (e)=>{
1623
+ const designid = btn.getAttribute('data-id');
1624
+ addDesign(designid);
1625
+ });
1626
+ }
1627
+ }`;
1628
+ html += `
1629
+ nIndex++;
1630
+ });
1631
+ });
1632
+
1633
+ const arr = document.querySelectorAll('img.lzy-img')
1634
+ arr.forEach((v) => {
1635
+ imageObserver.observe(v);
1636
+ });
1637
+
1638
+ closeMegaMenu();
1639
+
1640
+ }, 200);
1641
+
1642
+ // Set active Button
1643
+ const menu = document.querySelector('.mega-menu');
1644
+ menu.setAttribute('data-active-cat', catId);
1645
+ const featuredCat = document.querySelector('.featured-categories');
1646
+ const btnActive1 = menu.querySelector('button.on');
1647
+ const btnActive2 = featuredCat.querySelector('button.on');
1648
+ if(btnActive1) btnActive1.classList.remove('on');
1649
+ if(btnActive2) btnActive2.classList.remove('on');
1650
+ const btn1 = menu.querySelector('[data-cat="' + catId + '"]');
1651
+ const btn2 = featuredCat.querySelector('[data-cat="' + catId + '"]');
1652
+ if(btn1) btn1.classList.add('on');
1653
+ if(btn2) btn2.classList.add('on');
1654
+ }
1655
+
1656
+ const renderMegaMenu = () => {
1657
+
1658
+ const menu = document.querySelector('.mega-menu');
1659
+ const menuContent = document.querySelector('.mega-menu-content');
1660
+ menuContent.innerHTML = '';
1661
+
1662
+ let catNum = 0;
1663
+ template_list.forEach(gallery=>{
1664
+ let categories = gallery.categories;
1665
+ let html = '<h2>' + gallery.name + '</h2><div class="cat' +catNum+ '"></div>';
1666
+ menuContent.insertAdjacentHTML('beforeend', html);
1667
+ const catList = menuContent.querySelector('.cat'+catNum);
1668
+ categories.forEach(categoryItem=>{
1669
+ let html= '<button data-cat="'+categoryItem.id+'">'+categoryItem.name+'</button>';
1670
+ catList.insertAdjacentHTML('beforeend', html);
1671
+ const btn = catList.querySelector('[data-cat="'+categoryItem.id+'"]');
1672
+ btn.addEventListener('click', (e)=>{
1673
+ const catId = btn.getAttribute('data-cat');
1674
+ showDesigns(catId);
1675
+
1676
+ closeMegaMenu();
1677
+ });
1678
+ });
1679
+
1680
+ catNum++;
1681
+ });
1682
+
1683
+ // Set active Button
1684
+ const catId = menu.getAttribute('data-active-cat');
1685
+ if(catId) {
1686
+ const btnActive = menu.querySelector('button.on');
1687
+ if(btnActive) btnActive.classList.remove('on');
1688
+ const btn = menu.querySelector('[data-cat="' + catId + '"]');
1689
+ if(btn) btn.classList.add('on');
1690
+ }
1691
+ }
1692
+
1693
+ const handleClick = (e) => {
1694
+ if(!e.target.closest('.mega-menu') && !e.target.closest('[data-cat="0"]')) {
1695
+ closeMegaMenu();
1696
+ }
1697
+ };
1698
+
1699
+ const showMegaMenu = () => {
1700
+ const menu = document.querySelector('.mega-menu');
1701
+ menu.style.display = 'block';
1702
+ setTimeout(()=>{
1703
+ menu.classList.add('active');
1704
+ const menuClose = menu.querySelector('.close');
1705
+ menuClose.focus();
1706
+ }, 10);
1707
+ const btn = document.querySelector('[data-cat="0"]');
1708
+ btn.classList.add('on');
1709
+
1710
+ document.addEventListener('click', handleClick); // handleClick
1711
+ }
1712
+
1713
+ const closeMegaMenu = () => {
1714
+ const menu = document.querySelector('.mega-menu.active');
1715
+ if(!menu) return;
1716
+ menu.classList.remove('active');
1717
+ setTimeout(()=>{
1718
+ menu.style.display = '';
1719
+ }, 300);
1720
+ const btn = document.querySelector('[data-cat="0"]');
1721
+ btn.classList.remove('on');
1722
+
1723
+ document.removeEventListener('keydown', handleClick); // handleClick
1724
+ }
1725
+
1726
+ const renderResize = () => {
1727
+ const btns = document.querySelectorAll('.featured-categories button');
1728
+ let viewportWidth = document.body.clientWidth;
1729
+ if(viewportWidth < 1024 && viewportWidth>=800) {
1730
+ let n = 0;
1731
+ btns.forEach(btn=>{
1732
+ if(n>=5) {
1733
+ btns[n].style.display = 'none';
1734
+ } else {
1735
+ btns[n].style.display = '';
1736
+ }
1737
+ n++;
1738
+ });
1739
+ } else if(viewportWidth < 800) {
1740
+ let n = 0;
1741
+ btns.forEach(btn=>{
1742
+ if(n>=2) {
1743
+ btns[n].style.display = 'none';
1744
+ } else {
1745
+ btns[n].style.display = '';
1746
+ }
1747
+ n++;
1748
+ });
1749
+ } else {
1750
+ let n = 0;
1751
+ btns.forEach(btn=>{
1752
+ btns[n].style.display = '';
1753
+ n++;
1754
+ });
1755
+ }
1756
+ btns[btns.length-1].style.display = '';
1757
+ };
1758
+
1759
+ const renderFeaturedCategories= () => {
1760
+ let html = '';
1761
+ const div = document.querySelector('.featured-categories');
1762
+ featuredCategories.forEach(item=>{
1763
+ html += '<button data-cat="'+item.id+'">'+item.name+'</button>';
1764
+ });
1765
+ html += '<button data-cat="0">All Categories</button>';
1766
+ div.insertAdjacentHTML('beforeend', html);
1767
+
1768
+ const menu = document.querySelector('.mega-menu');
1769
+ const btns = div.querySelectorAll('[data-cat]');
1770
+ btns.forEach(btn=>{
1771
+ btn.addEventListener('click', (e)=>{
1772
+ const catId = btn.getAttribute('data-cat');
1773
+ if(catId==='0') {
1774
+ // Show All Categories' Mega Menu
1775
+ showMegaMenu();
1776
+ } else {
1777
+ showDesigns(catId);
1778
+ }
1779
+ });
1780
+ });`;
1781
+ html += `
1782
+ const menuClose = menu.querySelector('.close');
1783
+ menuClose.addEventListener('click',()=>{
1784
+ closeMegaMenu();
1785
+ });
1786
+
1787
+ renderResize();
1788
+ }
1789
+
1790
+ document.addEventListener("DOMContentLoaded", function() {
1791
+
1792
+ renderFeaturedCategories();
1793
+
1794
+ renderMegaMenu();
1795
+
1796
+ showDesigns(defaultCat); // If not ready (not loaded yet) will show empty
1797
+
1798
+ loadJsFiles(templateJSON, (template)=>{
1799
+ // console.log(template)
1800
+ const templateAdded = template_list[template_list.length-1];
1801
+ templateAdded.path = template.path;
1802
+ templateAdded.pathReplace = template.pathReplace;
1803
+ // console.log(templateAdded);
1804
+
1805
+ renderMegaMenu();
1806
+
1807
+ const designList = document.querySelector('.is-design-list');
1808
+ if(designList.innerHTML.trim()==='') { // first load
1809
+ const cats = templateAdded.categories;
1810
+ cats.forEach(cat=>{
1811
+ if(parseInt(cat.id)===defaultCat) {
1812
+ showDesigns(defaultCat);
1813
+ }
1814
+ });
1815
+ }
1816
+ });
1817
+ })
1818
+
1819
+
1820
+ document.addEventListener('keydown', (e)=>{
1821
+ if(e.keyCode === 27) { // escape key
1822
+
1823
+ const menu = document.querySelector('.mega-menu.active');
1824
+ if(menu) {
1825
+ closeMegaMenu();
1826
+
1827
+ e.preventDefault();
1828
+ return;
1829
+ }
1830
+ }
1831
+ });
1832
+
1833
+ window.addEventListener('resize', ()=>{
1834
+ renderResize();
1835
+ });
1836
+
1837
+ applyParentStyles();
1838
+
1839
+ // Style stuff
1840
+ function applyParentStyles() {
1841
+ var cssString = '' +
1842
+ 'body {' +
1843
+ 'background: ' + parent._cb.styleSnippetBackground + ';' +
1844
+ 'color: ' + parent._cb.styleSnippetColor + ';' +
1845
+ 'margin: 0;' +
1846
+ '}' +
1847
+
1848
+ 'button {' +
1849
+ 'background: ' + parent._cb.styleSnippetTabItemBackground + ';' +
1850
+ 'color: ' + parent._cb.styleSnippetTabItemColor + ';' +
1851
+ '}' +
1852
+ 'button.on {' +
1853
+ 'background: ' + parent._cb.styleSnippetTabItemBackgroundActive + ';' +
1854
+ '}' +
1855
+ '.featured-categories {' +
1856
+ 'background-color: ' + parent._cb.styleSnippetTabsBackground + ';' +
1857
+ '}' +
1858
+
1859
+ '.dark .is-design-list > button {' +
1860
+ 'border: transparent 1px solid;' +
1861
+ '}' +
1862
+
1863
+ '.mega-menu {' +
1864
+ 'background: ' + parent._cb.styleSnippetTabsBackground + ';' +
1865
+ '}' +
1866
+
1867
+ '/* Scrollbar for modal */' +
1868
+
1869
+ '/* Darker color, because background for snippet thumbnails is always light. */' +
1870
+ '.dark * {' +
1871
+ 'scrollbar-width: thin;' +
1872
+ 'scrollbar-color: rgb(78 78 78 / 62%) auto;' +
1873
+ '}' +
1874
+ '.dark *::-webkit-scrollbar {' +
1875
+ 'width: 12px;' +
1876
+ '}' +
1877
+ '.dark *::-webkit-scrollbar-track {' +
1878
+ 'background: transparent;' +
1879
+ '}' +
1880
+ '.dark *::-webkit-scrollbar-thumb {' +
1881
+ 'background-color:rgb(78 78 78 / 62%);' +
1882
+ '}' +
1883
+
1884
+ '.colored-dark * {' +
1885
+ 'scrollbar-width: thin;' +
1886
+ 'scrollbar-color: rgb(100, 100, 100) auto;' +
1887
+ '}' +
1888
+ '.colored-dark *::-webkit-scrollbar {' +
1889
+ 'width: 12px;' +
1890
+ '}' +
1891
+ '.colored-dark *::-webkit-scrollbar-track {' +
1892
+ 'background: transparent;' +
1893
+ '}' +
1894
+ '.colored-dark *::-webkit-scrollbar-thumb {' +
1895
+ 'background-color:rgb(100, 100, 100);' +
1896
+ '}' +
1897
+
1898
+ '.colored * {' +
1899
+ 'scrollbar-width: thin;' +
1900
+ 'scrollbar-color: rgba(0, 0, 0, 0.4) auto;' +
1901
+ '}' +
1902
+ '.colored *::-webkit-scrollbar {' +
1903
+ 'width: 12px;' +
1904
+ '}' +
1905
+ '.colored *::-webkit-scrollbar-track {' +
1906
+ 'background: transparent;' +
1907
+ '}' +
1908
+ '.colored *::-webkit-scrollbar-thumb {' +
1909
+ 'background-color: rgba(0, 0, 0, 0.4);' +
1910
+ '}' +
1911
+
1912
+ '.light * {' +
1913
+ 'scrollbar-width: thin;' +
1914
+ 'scrollbar-color: rgba(0, 0, 0, 0.4) auto;' +
1915
+ '}' +
1916
+ '.light *::-webkit-scrollbar {' +
1917
+ 'width: 12px;' +
1918
+ '}' +
1919
+ '.light *::-webkit-scrollbar-track {' +
1920
+ 'background: transparent;' +
1921
+ '}' +
1922
+ '.light *::-webkit-scrollbar-thumb {' +
1923
+ 'background-color: rgba(0, 0, 0, 0.4);' +
1924
+ '}' +
1925
+
1926
+ 'svg {' +
1927
+ 'fill: ' + parent._cb.styleSnippetColor + ';' +
1928
+ '}' +
1929
+
1930
+ '.dark .is-design-list>div .is-overlay:after {' +
1931
+ 'background: rgb(78 78 78 / 13%);' +
1932
+ '}' +
1933
+ '';
1934
+
1935
+ let themestyle = document.querySelector('[data-theme-style]');
1936
+ if(themestyle) themestyle.parentNode.removeChild(themestyle);
1937
+
1938
+ var style = document.createElement("style");
1939
+ style.setAttribute('data-theme-style','');
1940
+ style.type = "text/css";
1941
+ style.innerHTML = cssString;
1942
+ document.head.appendChild(style);
1943
+
1944
+ if(parent._cb.styleDark) {
1945
+ document.body.setAttribute('class', 'dark');
1946
+ } else if(parent._cb.styleColored) {
1947
+ document.body.setAttribute('class', 'colored');
1948
+ } else if(parent._cb.styleColoredDark) {
1949
+ document.body.setAttribute('class', 'colored-dark');
1950
+ } else if(parent._cb.styleLight) {
1951
+ document.body.setAttribute('class', 'light');
1952
+ } else {
1953
+ document.body.setAttribute('class', '');
1954
+ }
1955
+ }
1956
+ </script>
1957
+ </body>
1958
+ </html>
1959
+ `;
1960
+ return html;
1961
+ }
1962
+
1963
+ getTemplatesHtml_OLD() {
1124
1964
  const designUrl1 = this.builder.designUrl1;
1125
1965
  const designUrl2 = this.builder.designUrl2;
1126
1966
  let html = `
@@ -78403,22 +79243,20 @@ class Rte {
78403
79243
 
78404
79244
  this.builder.setZoomOnArea(); // hide tools
78405
79245
 
78406
- /*
78407
- let tools = this.builderStuff.querySelectorAll('.is-tool');
78408
- Array.prototype.forEach.call(tools, (tool) => {
78409
- tool.style.display = '';
79246
+ let tools = this.builder.doc.querySelectorAll('.is-tool');
79247
+ Array.prototype.forEach.call(tools, tool => {
79248
+ tool.style.display = '';
78410
79249
  });
78411
- let tool = this.builderStuff.querySelector('.is-column-tool');
79250
+ let tool = this.builder.doc.querySelector('.is-column-tool');
78412
79251
  tool.style.display = 'none';
78413
- tools = this.builder.doc.querySelectorAll('.is-row-tool');
78414
- tools.forEach(tool=>{
78415
- tool.style.display = 'none';
79252
+ tools = this.builder.doc.querySelectorAll('.is-row-tool');
79253
+ tools.forEach(tool => {
79254
+ tool.style.display = 'none';
78416
79255
  });
78417
- tools = this.builder.doc.querySelectorAll('.is-rowadd-tool');
78418
- tools.forEach(tool=>{
78419
- tool.style.opacity = 0;
79256
+ tools = this.builder.doc.querySelectorAll('.is-rowadd-tool');
79257
+ tools.forEach(tool => {
79258
+ tool.style.opacity = 0;
78420
79259
  });
78421
- */
78422
79260
 
78423
79261
  if (this.builder.onZoom) {
78424
79262
  let val = this.inpZoomSlider.value;
@@ -78440,23 +79278,27 @@ class Rte {
78440
79278
  });
78441
79279
  } // show & reposition
78442
79280
 
78443
- /*
79281
+
78444
79282
  this.builder.elmTool.repositionElementTool();
78445
- let col = this.builder.activeCol;
78446
- let tool = this.builderStuff.querySelector('.is-column-tool');
79283
+ let col = this.builder.activeCol;
79284
+ let tool = this.builder.doc.querySelector('.is-column-tool');
78447
79285
  tool.style.display = '';
78448
- tool.style.top = (col.getBoundingClientRect().top - 29 + window.pageYOffset) + 'px';
78449
- tool.style.left = (col.getBoundingClientRect().left - 1) + 'px';
78450
- let tools = this.builder.doc.querySelectorAll('.is-row-tool');
78451
- tools.forEach(tool=>{
78452
- tool.style.display = '';
79286
+ tool.style.top = col.getBoundingClientRect().top - 29 + window.pageYOffset + 'px';
79287
+ tool.style.left = col.getBoundingClientRect().left - 1 + 'px';
79288
+ let tools = this.builder.doc.querySelectorAll('.is-row-tool');
79289
+ tools.forEach(tool => {
79290
+ tool.style.display = '';
78453
79291
  });
78454
- tools = this.builder.doc.querySelectorAll('.is-rowadd-tool');
78455
- tools.forEach(tool=>{
78456
- tool.style.opacity = '';
79292
+ tools = this.builder.doc.querySelectorAll('.is-rowadd-tool');
79293
+ tools.forEach(tool => {
79294
+ tool.style.opacity = '';
78457
79295
  });
78458
- */
78459
79296
 
79297
+ if (this.builder.onZoomEnd) {
79298
+ let val = this.rteZoomSlider.value;
79299
+ let scale = val / 100;
79300
+ this.builder.onZoomEnd(scale);
79301
+ }
78460
79302
 
78461
79303
  if (this.builder.onZoomEnd) {
78462
79304
  let val = this.inpZoomSlider.value;
@@ -79616,6 +80458,7 @@ class Rte {
79616
80458
  }
79617
80459
  }
79618
80460
 
80461
+ if (this.builder.activeElement) this.builder.activeElement.style.letterSpacing = '';
79619
80462
  if (newClassName === classes.tracking_000) newClassName = ''; // clear for normal tracking
79620
80463
 
79621
80464
  dom.execCommandClass(newClassName, classes);
@@ -82256,6 +83099,7 @@ function isAChildOf(parent, child) {
82256
83099
  class Lightbox {
82257
83100
  constructor(builder) {
82258
83101
  this.builder = builder;
83102
+ this.arrow = this.builder.lightboxArrow;
82259
83103
  const util = this.builder.util;
82260
83104
  const builderStuff = this.builder.builderStuff;
82261
83105
  this.util = util;
@@ -82270,42 +83114,76 @@ class Lightbox {
82270
83114
  // }
82271
83115
  // this.builderStuff = builderStuff;
82272
83116
 
82273
- this.id = this.makeid();
83117
+ this.id = this.makeid(); // let html = `
83118
+ // <div class="is-lightbox lightbox-externalvideo-edit" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
83119
+ // <button class="cmd-lightbox-close" title="${util.out('Close')}" type="button" style="flex:none;position:absolute;top:0;right:0;background:none;z-index:1;">
83120
+ // <svg><use xlink:href="#_${this.id}svgIconClose"></use></svg>
83121
+ // </button>
83122
+ // <div class="lightbox-content" style="width:100%;">
83123
+ // <div class="embed-responsive embed-responsive-16by9" style="width:100%;">
83124
+ // <iframe tabindex="0" width="560" height="315" src="about:blank" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
83125
+ // </div>
83126
+ // </div>
83127
+ // </div>
83128
+ // <div class="is-lightbox lightbox-video-edit light" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
83129
+ // <button class="cmd-lightbox-close" title="${util.out('Close')}" type="button" style="flex:none;position:absolute;top:0;right:0;background:none;z-index:1;">
83130
+ // <svg><use xlink:href="#_${this.id}svgIconClose"></use></svg>
83131
+ // </button>
83132
+ // <div class="lightbox-content" style="width:100%;"></div>
83133
+ // </div>
83134
+ // <div class="is-lightbox lightbox-image-edit light" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
83135
+ // <button class="cmd-lightbox-close" title="${util.out('Close')}" type="button" style="flex:none;position:absolute;top:0;right:0;background:none;z-index:1;">
83136
+ // <svg><use xlink:href="#_${this.id}svgIconClose"></use></svg>
83137
+ // </button>
83138
+ // <div class="lightbox-content" style="width:100%;"></div>
83139
+ // </div>
83140
+ // <svg width="0" height="0" style="position:absolute;display:none;">
83141
+ // <defs>
83142
+ // <symbol viewBox="0 0 24 24" id="_${this.id}svgIconClose" stroke-width="0.7" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
83143
+ // <path stroke="none" d="M0 0h24v24H0z" fill="none"></path><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line>
83144
+ // </symbol>
83145
+ // </defs>
83146
+ // </svg>
83147
+ // `;
83148
+
82274
83149
  let html = `
82275
- <div class="is-lightbox lightbox-externalvideo-edit" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
82276
- <button class="cmd-lightbox-close" title="${util.out('Close')}" type="button" style="flex:none;position:absolute;top:0;right:0;background:none;z-index:1;">
82277
- <svg><use xlink:href="#_${this.id}svgIconClose"></use></svg>
82278
- </button>
82279
- <div class="lightbox-content" style="width:100%;">
82280
- <div class="embed-responsive embed-responsive-16by9" style="width:100%;">
82281
- <iframe tabindex="0" width="560" height="315" src="about:blank" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
83150
+
83151
+ <div class="is-lightbox lightbox-edit" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
83152
+ <button class="cmd-lightbox-close" title="${util.out('Close')}" type="button">
83153
+ <svg><use xlink:href="#__${this.id}svgLightboxClose"></use></svg>
83154
+ </button>
83155
+
83156
+ <div class="lightbox-content" style="width:100%;">
82282
83157
  </div>
83158
+
83159
+ <button class="cmd-lightbox-prev" title="${util.out('Previous')}" type="button" style="top:50%;left:3px;">
83160
+ <svg><use xlink:href="#__${this.id}svgLightboxLeft"></use></svg>
83161
+ </button>
83162
+ <button class="cmd-lightbox-next" title="${util.out('Next')}" type="button" style="top:50%;left:auto;right:3px">
83163
+ <svg><use xlink:href="#__${this.id}svgLightboxRight"></use></svg>
83164
+ </button>
82283
83165
  </div>
82284
- </div>
82285
- <div class="is-lightbox lightbox-video-edit light" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
82286
- <button class="cmd-lightbox-close" title="${util.out('Close')}" type="button" style="flex:none;position:absolute;top:0;right:0;background:none;z-index:1;">
82287
- <svg><use xlink:href="#_${this.id}svgIconClose"></use></svg>
82288
- </button>
82289
- <div class="lightbox-content" style="width:100%;"></div>
82290
- </div>
82291
- <div class="is-lightbox lightbox-image-edit light" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
82292
- <button class="cmd-lightbox-close" title="${util.out('Close')}" type="button" style="flex:none;position:absolute;top:0;right:0;background:none;z-index:1;">
82293
- <svg><use xlink:href="#_${this.id}svgIconClose"></use></svg>
82294
- </button>
82295
- <div class="lightbox-content" style="width:100%;"></div>
82296
- </div>
82297
- <svg width="0" height="0" style="position:absolute;display:none;">
82298
- <defs>
82299
- <symbol viewBox="0 0 24 24" id="_${this.id}svgIconClose" stroke-width="0.7" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
82300
- <path stroke="none" d="M0 0h24v24H0z" fill="none"></path><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line>
82301
- </symbol>
82302
- </defs>
82303
- </svg>
82304
- `;
83166
+
83167
+ <svg width="0" height="0" style="position:absolute;display:none;">
83168
+ <defs>
83169
+ <symbol viewBox="0 0 24 24" id="__${this.id}svgLightboxClose" stroke-width="0.7" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
83170
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line>
83171
+ </symbol>
83172
+ <symbol viewBox="0 0 24 24" id="__${this.id}svgLightboxLeft" stroke-width="0.7" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
83173
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
83174
+ <polyline points="15 6 9 12 15 18"></polyline>
83175
+ </symbol>
83176
+ <symbol viewBox="0 0 24 24" id="__${this.id}svgLightboxRight" stroke-width="0.7" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
83177
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
83178
+ <polyline points="9 6 15 12 9 18"></polyline>
83179
+ </symbol>
83180
+ </defs>
83181
+ </svg>
83182
+ `;
82305
83183
  dom.appendHtml(this.builderStuff, html);
82306
83184
 
82307
83185
  const close = () => {
82308
- let lightbox = document.querySelector('.is-lightbox.active');
83186
+ let lightbox = document.querySelector('.is-lightbox.lightbox-edit.active');
82309
83187
  dom.removeClass(lightbox, 'active');
82310
83188
  const btnClose = lightbox.querySelector('.cmd-lightbox-close');
82311
83189
  btnClose.style.opacity = 0;
@@ -82325,22 +83203,70 @@ class Lightbox {
82325
83203
  }, 300);
82326
83204
  };
82327
83205
 
82328
- const handleItemKeyDown = e => {
82329
- e.preventDefault();
82330
- e.stopImmediatePropagation();
83206
+ const prev = () => {
83207
+ const list = this.getList();
83208
+ let lightbox = document.querySelector('.is-lightbox.lightbox-edit.active');
83209
+ let url = lightbox.getAttribute('data-url');
83210
+ list.forEach(item => {
83211
+ if (url === item.url) {
83212
+ const currentIndex = list.indexOf(item);
83213
+ let prevIndex;
83214
+ prevIndex = (currentIndex - 1) % list.length;
83215
+
83216
+ if (prevIndex === -1) {
83217
+ prevIndex = list.length - 1;
83218
+ }
83219
+
83220
+ this.openThen(list[prevIndex]);
83221
+ const btnPrev = lightbox.querySelector('.cmd-lightbox-prev');
83222
+ btnPrev.focus();
83223
+ }
83224
+ });
83225
+ };
83226
+
83227
+ const next = () => {
83228
+ const list = this.getList();
83229
+ let lightbox = document.querySelector('.is-lightbox.lightbox-edit.active');
83230
+ let url = lightbox.getAttribute('data-url');
83231
+ list.forEach(item => {
83232
+ if (url === item.url) {
83233
+ const currentIndex = list.indexOf(item);
83234
+ const nextIndex = (currentIndex + 1) % list.length;
83235
+ this.openThen(list[nextIndex]);
83236
+ const btnNext = lightbox.querySelector('.cmd-lightbox-next');
83237
+ btnNext.focus();
83238
+ }
83239
+ });
83240
+ };
82331
83241
 
83242
+ const handleItemKeyDown = e => {
82332
83243
  if (e.keyCode === 27) {
82333
83244
  // escape key
82334
83245
  close();
82335
- } else if (e.which === 9 && !e.shiftKey) {
82336
- // tab key pressed
83246
+ e.preventDefault();
83247
+ }
83248
+ /*else if ((e.which === 9 && !e.shiftKey)) { // tab key pressed
82337
83249
  let lightbox = document.querySelector('.is-lightbox.active');
82338
83250
  const btnClose = lightbox.querySelector('.cmd-lightbox-close');
82339
83251
  btnClose.focus();
83252
+ e.preventDefault();
83253
+ }*/
83254
+
83255
+
83256
+ if (this.arrow) {
83257
+ if (e.which === 37 && !e.shiftKey) {
83258
+ // left
83259
+ prev();
83260
+ }
83261
+
83262
+ if (e.which === 39 && !e.shiftKey) {
83263
+ // right
83264
+ next();
83265
+ }
82340
83266
  }
82341
83267
  };
82342
83268
 
82343
- const lightboxes = this.builderStuff.querySelectorAll('.lightbox-externalvideo-edit,.lightbox-video-edit,.lightbox-image-edit');
83269
+ const lightboxes = this.builderStuff.querySelectorAll('div.lightbox-edit');
82344
83270
  lightboxes.forEach(lightbox => {
82345
83271
  lightbox.addEventListener('keydown', handleItemKeyDown);
82346
83272
  const btnClose = lightbox.querySelector('.cmd-lightbox-close');
@@ -82358,6 +83284,32 @@ class Lightbox {
82358
83284
  e.preventDefault();
82359
83285
  e.stopImmediatePropagation();
82360
83286
  });
83287
+ const btnPrev = lightbox.querySelector('.cmd-lightbox-prev');
83288
+ if (btnPrev) btnPrev.addEventListener('click', e => {
83289
+ prev();
83290
+ e.preventDefault();
83291
+ e.stopImmediatePropagation();
83292
+ });
83293
+ if (btnPrev) btnPrev.addEventListener('keydown', e => {
83294
+ if (e.keyCode === 13 || e.keyCode === 32) {
83295
+ // enter or spacebar key
83296
+ prev();
83297
+ e.preventDefault();
83298
+ }
83299
+ });
83300
+ const btnNext = lightbox.querySelector('.cmd-lightbox-next');
83301
+ if (btnNext) btnNext.addEventListener('click', e => {
83302
+ next();
83303
+ e.preventDefault();
83304
+ e.stopImmediatePropagation();
83305
+ });
83306
+ if (btnNext) btnNext.addEventListener('keydown', e => {
83307
+ if (e.keyCode === 13 || e.keyCode === 32) {
83308
+ // enter or spacebar key
83309
+ next();
83310
+ e.preventDefault();
83311
+ }
83312
+ });
82361
83313
  }); // this.init();
82362
83314
  } //constructor
82363
83315
 
@@ -82413,21 +83365,89 @@ class Lightbox {
82413
83365
  */
82414
83366
 
82415
83367
 
83368
+ openThen(item) {
83369
+ if (item.type === 'image') {
83370
+ this.programmatically = true;
83371
+ this.openImage(item.url, item.theme, item.color);
83372
+ }
83373
+
83374
+ if (item.type === 'video') {
83375
+ this.programmatically = true;
83376
+ this.openVideo(item.url, item.theme, item.color);
83377
+ }
83378
+
83379
+ if (item.type === 'externalvideo') {
83380
+ this.programmatically = true;
83381
+ this.openExternalVideo(item.url, item.theme, item.color);
83382
+ }
83383
+ }
83384
+
82416
83385
  openImage(url, theme, color) {
82417
83386
  const dom = this.dom;
82418
- if (document.activeElement) this.elmFocus = document.activeElement;
83387
+
83388
+ if (this.builder.doc.activeElement) {
83389
+ this.elmFocus = this.builder.doc.activeElement;
83390
+
83391
+ if (!this.programmatically) {
83392
+ const parent = this.builder.doc.activeElement.closest('[data-gallery]');
83393
+ this.parent = parent;
83394
+ }
83395
+ }
83396
+
82419
83397
  this.builder.preserveSelection = true;
82420
- let lightbox = this.builderStuff.querySelector('div.is-lightbox.lightbox-image-edit'); // in case opened in an iframe (ex. preview)
83398
+ let lightbox = document.querySelector('.is-lightbox.lightbox-edit'); // in case opened in an iframe (ex. preview)
82421
83399
 
82422
83400
  if (window.frameElement && !lightbox) {
82423
- lightbox = parent.document.querySelector('.is-lightbox.lightbox-image-edit');
83401
+ lightbox = parent.document.querySelector('.is-lightbox.lightbox-edit');
83402
+ }
83403
+
83404
+ if (!this.programmatically) {
83405
+ const list = this.getList();
83406
+ const btnPrev = lightbox.querySelector('.cmd-lightbox-prev');
83407
+ btnPrev.style.opacity = 0;
83408
+ const btnNext = lightbox.querySelector('.cmd-lightbox-next');
83409
+ btnNext.style.opacity = 0;
83410
+ btnPrev.style.display = 'none';
83411
+ btnNext.style.display = 'none';
83412
+
83413
+ if (list.length > 1 && this.arrow) {
83414
+ btnPrev.style.display = 'flex';
83415
+ btnNext.style.display = 'flex';
83416
+ setTimeout(() => {
83417
+ const btnPrev = lightbox.querySelector('.cmd-lightbox-prev');
83418
+ btnPrev.style.opacity = 1;
83419
+ const btnNext = lightbox.querySelector('.cmd-lightbox-next');
83420
+ btnNext.style.opacity = 1;
83421
+ }, 500);
83422
+ }
83423
+
83424
+ const btnClose = lightbox.querySelector('.cmd-lightbox-close');
83425
+ btnClose.style.opacity = 0;
83426
+ setTimeout(() => {
83427
+ dom.addClass(lightbox, 'active');
83428
+ setTimeout(() => {
83429
+ btnClose.style.opacity = 1;
83430
+ }, 450);
83431
+ }, 10);
82424
83432
  }
82425
83433
 
82426
- const btnClose = lightbox.querySelector('.cmd-lightbox-close');
82427
- btnClose.style.opacity = 0;
83434
+ lightbox.setAttribute('data-url', url);
83435
+ lightbox.classList.remove('lightbox-video');
83436
+ lightbox.classList.remove('lightbox-externalvideo');
83437
+ lightbox.classList.add('lightbox-image');
82428
83438
  if (color) lightbox.style.backgroundColor = color;
82429
83439
  const div = lightbox.querySelector('.lightbox-content');
82430
- div.innerHTML = `<img src="${url}">`;
83440
+
83441
+ if (!this.programmatically) {
83442
+ div.innerHTML = `<img src="${url}">`;
83443
+ } else {
83444
+ div.style.transition = 'all 200ms ease';
83445
+ div.style.opacity = '0';
83446
+ setTimeout(() => {
83447
+ div.innerHTML = `<img src="${url}">`;
83448
+ div.style.opacity = '1';
83449
+ }, 200);
83450
+ }
82431
83451
 
82432
83452
  if (theme === 'light') {
82433
83453
  dom.addClass(lightbox, 'light');
@@ -82439,34 +83459,82 @@ class Lightbox {
82439
83459
 
82440
83460
  lightbox.style.display = 'flex';
82441
83461
  if (!window.frameElement) document.body.style.overflowY = 'hidden';
82442
- setTimeout(() => {
82443
- dom.addClass(lightbox, 'active');
82444
- setTimeout(() => {
82445
- btnClose.style.opacity = 1;
82446
- }, 450);
82447
- }, 10);
82448
83462
  lightbox.focus({
82449
83463
  preventScroll: true
82450
83464
  });
83465
+ this.programmatically = false;
82451
83466
  }
82452
83467
 
82453
83468
  openVideo(url, theme, color) {
82454
83469
  const dom = this.dom;
82455
- if (document.activeElement) this.elmFocus = document.activeElement;
83470
+
83471
+ if (this.builder.doc.activeElement) {
83472
+ this.elmFocus = this.builder.doc.activeElement;
83473
+
83474
+ if (!this.programmatically) {
83475
+ const parent = this.builder.doc.activeElement.closest('[data-gallery]');
83476
+ this.parent = parent;
83477
+ }
83478
+ }
83479
+
82456
83480
  this.builder.preserveSelection = true;
82457
- let lightbox = document.querySelector('.is-lightbox.lightbox-video-edit'); // in case opened in an iframe (ex. preview)
83481
+ let lightbox = document.querySelector('.is-lightbox.lightbox-edit'); // in case opened in an iframe (ex. preview)
82458
83482
 
82459
83483
  if (window.frameElement && !lightbox) {
82460
- lightbox = parent.document.querySelector('.is-lightbox.lightbox-video-edit');
83484
+ lightbox = parent.document.querySelector('.is-lightbox.lightbox-edit');
83485
+ }
83486
+
83487
+ if (!this.programmatically) {
83488
+ const list = this.getList();
83489
+ const btnPrev = lightbox.querySelector('.cmd-lightbox-prev');
83490
+ btnPrev.style.opacity = 0;
83491
+ const btnNext = lightbox.querySelector('.cmd-lightbox-next');
83492
+ btnNext.style.opacity = 0;
83493
+ btnPrev.style.display = 'none';
83494
+ btnNext.style.display = 'none';
83495
+
83496
+ if (list.length > 1 && this.arrow) {
83497
+ btnPrev.style.display = 'flex';
83498
+ btnNext.style.display = 'flex';
83499
+ setTimeout(() => {
83500
+ const btnPrev = lightbox.querySelector('.cmd-lightbox-prev');
83501
+ btnPrev.style.opacity = 1;
83502
+ const btnNext = lightbox.querySelector('.cmd-lightbox-next');
83503
+ btnNext.style.opacity = 1;
83504
+ }, 500);
83505
+ }
83506
+
83507
+ const btnClose = lightbox.querySelector('.cmd-lightbox-close');
83508
+ btnClose.style.opacity = 0;
83509
+ setTimeout(() => {
83510
+ dom.addClass(lightbox, 'active');
83511
+ setTimeout(() => {
83512
+ btnClose.style.opacity = 1;
83513
+ }, 450);
83514
+ }, 10);
82461
83515
  }
82462
83516
 
82463
- const btnClose = lightbox.querySelector('.cmd-lightbox-close');
82464
- btnClose.style.opacity = 0;
83517
+ lightbox.setAttribute('data-url', url);
83518
+ lightbox.classList.add('lightbox-video');
83519
+ lightbox.classList.remove('lightbox-externalvideo');
83520
+ lightbox.classList.remove('lightbox-image');
82465
83521
  if (color) lightbox.style.backgroundColor = color;
82466
83522
  const div = lightbox.querySelector('.lightbox-content');
82467
- div.innerHTML = `<video class="is-video-bg" playsinline controls autoplay width="100%">
82468
- <source src="${url}" type="video/mp4">
82469
- </video>`;
83523
+
83524
+ if (!this.programmatically) {
83525
+ div.innerHTML = `<video playsinline controls autoplay width="100%">
83526
+ <source src="${url}" type="video/mp4">
83527
+ </video>`;
83528
+ } else {
83529
+ div.style.transition = 'all 200ms ease';
83530
+ div.style.opacity = '0';
83531
+ setTimeout(() => {
83532
+ div.innerHTML = `<video playsinline controls autoplay width="100%">
83533
+ <source src="${url}" type="video/mp4">
83534
+ </video>`;
83535
+ div.style.opacity = '1';
83536
+ }, 200);
83537
+ }
82470
83538
 
82471
83539
  if (theme === 'light') {
82472
83540
  dom.addClass(lightbox, 'light');
@@ -82478,29 +83546,65 @@ class Lightbox {
82478
83546
 
82479
83547
  lightbox.style.display = 'flex';
82480
83548
  if (!window.frameElement) document.body.style.overflowY = 'hidden';
82481
- setTimeout(() => {
82482
- dom.addClass(lightbox, 'active');
82483
- setTimeout(() => {
82484
- btnClose.style.opacity = 1;
82485
- }, 450);
82486
- }, 10);
82487
83549
  lightbox.focus({
82488
83550
  preventScroll: true
82489
83551
  });
83552
+ this.programmatically = false;
82490
83553
  }
82491
83554
 
82492
83555
  openExternalVideo(url, theme, color) {
82493
83556
  const dom = this.dom;
82494
- if (document.activeElement) this.elmFocus = document.activeElement;
83557
+
83558
+ if (this.builder.doc.activeElement) {
83559
+ this.elmFocus = this.builder.doc.activeElement;
83560
+
83561
+ if (!this.programmatically) {
83562
+ const parent = this.builder.doc.activeElement.closest('[data-gallery]');
83563
+ this.parent = parent;
83564
+ }
83565
+ }
83566
+
82495
83567
  this.builder.preserveSelection = true;
82496
- let lightbox = document.querySelector('.is-lightbox.lightbox-externalvideo-edit'); // in case opened in an iframe (ex. preview)
83568
+ let lightbox = document.querySelector('.is-lightbox.lightbox-edit'); // in case opened in an iframe (ex. preview)
82497
83569
 
82498
83570
  if (window.frameElement && !lightbox) {
82499
- lightbox = parent.document.querySelector('.is-lightbox.lightbox-externalvideo-edit');
83571
+ lightbox = parent.document.querySelector('.is-lightbox.lightbox-edit');
83572
+ }
83573
+
83574
+ if (!this.programmatically) {
83575
+ const list = this.getList();
83576
+ const btnPrev = lightbox.querySelector('.cmd-lightbox-prev');
83577
+ btnPrev.style.opacity = 0;
83578
+ const btnNext = lightbox.querySelector('.cmd-lightbox-next');
83579
+ btnNext.style.opacity = 0;
83580
+ btnPrev.style.display = 'none';
83581
+ btnNext.style.display = 'none';
83582
+
83583
+ if (list.length > 1 && this.arrow) {
83584
+ btnPrev.style.display = 'flex';
83585
+ btnNext.style.display = 'flex';
83586
+ setTimeout(() => {
83587
+ const btnPrev = lightbox.querySelector('.cmd-lightbox-prev');
83588
+ btnPrev.style.opacity = 1;
83589
+ const btnNext = lightbox.querySelector('.cmd-lightbox-next');
83590
+ btnNext.style.opacity = 1;
83591
+ }, 500);
83592
+ }
83593
+
83594
+ const btnClose = lightbox.querySelector('.cmd-lightbox-close');
83595
+ btnClose.style.opacity = 0;
83596
+ setTimeout(() => {
83597
+ dom.addClass(lightbox, 'active');
83598
+ setTimeout(() => {
83599
+ btnClose.style.opacity = 1;
83600
+ }, 450);
83601
+ }, 10);
82500
83602
  }
82501
83603
 
82502
- const btnClose = lightbox.querySelector('.cmd-lightbox-close');
82503
- btnClose.style.opacity = 0;
83604
+ lightbox.setAttribute('data-url', url);
83605
+ lightbox.classList.remove('lightbox-video');
83606
+ lightbox.classList.add('lightbox-externalvideo');
83607
+ lightbox.classList.remove('lightbox-image');
82504
83608
  if (color) lightbox.style.backgroundColor = color;
82505
83609
 
82506
83610
  if (theme === 'light') {
@@ -82511,22 +83615,37 @@ class Lightbox {
82511
83615
  dom.removeClass(lightbox, 'light');
82512
83616
  }
82513
83617
 
82514
- const iframe = lightbox.querySelector('iframe');
82515
- url = this.getIframeVideoUrl(url);
82516
- if (url !== '') iframe.setAttribute('src', url);
82517
- lightbox.style.display = 'flex';
82518
- if (!window.frameElement) document.body.style.overflowY = 'hidden';
82519
83618
  const div = lightbox.querySelector('.lightbox-content');
82520
- div.style.width = div.offsetHeight * 16 / 9 + 'px';
82521
- setTimeout(() => {
82522
- dom.addClass(lightbox, 'active');
83619
+
83620
+ if (!this.programmatically) {
83621
+ div.innerHTML = `<div class="embed-responsive embed-responsive-16by9" style="width:100%;">
83622
+ <iframe width="560" height="315" src="about:blank" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
83623
+ </div>`;
83624
+ const iframe = lightbox.querySelector('iframe');
83625
+ url = this.getIframeVideoUrl(url);
83626
+ if (url !== '') iframe.setAttribute('src', url);
83627
+ } else {
83628
+ div.style.transition = 'all 200ms ease';
83629
+ div.style.opacity = '0';
82523
83630
  setTimeout(() => {
82524
- btnClose.style.opacity = 1;
82525
- }, 450);
82526
- }, 10);
83631
+ div.innerHTML = `<div class="embed-responsive embed-responsive-16by9" style="width:100%;">
83632
+ <iframe width="560" height="315" src="about:blank" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
83633
+ </div>`;
83634
+ div.style.opacity = '1';
83635
+ const iframe = lightbox.querySelector('iframe');
83636
+ url = this.getIframeVideoUrl(url);
83637
+ if (url !== '') iframe.setAttribute('src', url);
83638
+ }, 200);
83639
+ }
83640
+
83641
+ lightbox.style.display = 'flex';
83642
+ if (!window.frameElement) document.body.style.overflowY = 'hidden'; // const div = lightbox.querySelector('.lightbox-content');
83643
+ // div.style.width=((div.offsetHeight*16)/9) + 'px';
83644
+
82527
83645
  lightbox.focus({
82528
83646
  preventScroll: true
82529
83647
  });
83648
+ this.programmatically = false;
82530
83649
  }
82531
83650
 
82532
83651
  getIframeVideoUrl(src) {
@@ -82570,6 +83689,88 @@ class Lightbox {
82570
83689
  return text + text2;
82571
83690
  }
82572
83691
 
83692
+ getList() {
83693
+ const arrGallery = [];
83694
+ let blockClickables = this.builder.doc.querySelectorAll('.block-click,.button-click,.is-lightbox');
83695
+
83696
+ if (this.parent) {
83697
+ blockClickables = this.parent.querySelectorAll('.block-click,.button-click,.is-lightbox');
83698
+ }
83699
+
83700
+ blockClickables.forEach(block => {
83701
+ if (!this.parent) {
83702
+ if (block.closest('[data-gallery')) return;
83703
+ }
83704
+
83705
+ let url;
83706
+ let extension;
83707
+
83708
+ if (block.tagName.toLowerCase() === 'a') {
83709
+ url = block.getAttribute('href');
83710
+ extension = url.split('.').pop().split('?')[0].split('#')[0];
83711
+ } else if (block.getAttribute('data-modal-url')) {
83712
+ url = block.getAttribute('data-modal-url');
83713
+ extension = url.split('.').pop().split('?')[0].split('#')[0];
83714
+ }
83715
+
83716
+ let theme = block.getAttribute('data-modal-theme');
83717
+ if (!theme) theme = 'light';
83718
+ const color = block.getAttribute('data-modal-color');
83719
+
83720
+ if (url) {
83721
+ if (extension === 'jpg' || extension === 'jpeg' || extension === 'png' || extension === 'gif' || extension === 'webm') {
83722
+ arrGallery.push({
83723
+ type: 'image',
83724
+ url: url,
83725
+ theme: theme,
83726
+ color: color
83727
+ });
83728
+ } else if (extension === 'mp4') {
83729
+ arrGallery.push({
83730
+ type: 'video',
83731
+ url: url,
83732
+ theme: 'dark',
83733
+ color: color
83734
+ });
83735
+ } else if (url.toLowerCase().indexOf('youtube.com') !== -1 || url.toLowerCase().indexOf('vimeo.com') !== -1) {
83736
+ arrGallery.push({
83737
+ type: 'externalvideo',
83738
+ url: url,
83739
+ theme: 'dark',
83740
+ color: color
83741
+ });
83742
+ }
83743
+ }
83744
+
83745
+ if (block.getAttribute('data-modal-image')) {
83746
+ url = block.getAttribute('data-modal-image');
83747
+ arrGallery.push({
83748
+ type: 'image',
83749
+ url: url,
83750
+ theme: theme,
83751
+ color: color
83752
+ });
83753
+ } else if (block.getAttribute('data-modal-video')) {
83754
+ url = block.getAttribute('data-modal-video');
83755
+ arrGallery.push({
83756
+ type: 'video',
83757
+ url: url,
83758
+ theme: 'dark',
83759
+ color: color
83760
+ });
83761
+ } else if (block.getAttribute('data-modal-externalvideo')) {
83762
+ url = block.getAttribute('data-modal-externalvideo');
83763
+ arrGallery.push({
83764
+ type: 'externalvideo',
83765
+ url: url,
83766
+ theme: 'dark',
83767
+ color: color
83768
+ });
83769
+ }
83770
+ });
83771
+ return arrGallery;
83772
+ }
83773
+
82573
83774
  } //Lightbox
82574
83775
 
82575
83776
  class ShortcutInfo {
@@ -83189,6 +84390,13 @@ class Resize {
83189
84390
  pane: col,
83190
84391
  onResize: (width, height) => {
83191
84392
  this.builder.util.hideControls();
84393
+ let numOfCols = 1;
84394
+ Array.from(col.parentNode.children).map(item => {
84395
+ if (item.classList.contains('is-row-tool')) return;
84396
+ if (item.classList.contains('is-rowadd-tool')) return;
84397
+ if (item === col) return;
84398
+ numOfCols++;
84399
+ });
83192
84400
 
83193
84401
  if (width) {
83194
84402
  col.style.flex = 'none';
@@ -83212,16 +84420,29 @@ class Resize {
83212
84420
  // Adjust to max
83213
84421
  // percentage = (max / row.offsetWidth) * 100;
83214
84422
  // Or make others auto
83215
- let numOfCols = 1;
83216
84423
  Array.from(col.parentNode.children).map(item => {
83217
84424
  if (item.classList.contains('is-row-tool')) return;
83218
84425
  if (item.classList.contains('is-rowadd-tool')) return; // if(this.opts.filterSibling) if(item.classList.contains(this.opts.filterSibling)) return;
83219
84426
 
83220
- if (item === col) return; // item.style.width = '100%';
84427
+ if (item === col) return; // // item.style.width = '100%';
84428
+ // if(!item.getAttribute('data-module')) item.style.width = '100%';
84429
+ // item.style.flex = '';
83221
84430
 
83222
- if (!item.getAttribute('data-module')) item.style.width = '100%';
83223
- item.style.flex = '';
83224
- numOfCols++;
84431
+ if (numOfCols === 2) {
84432
+ if (!item.getAttribute('data-module')) {
84433
+ item.style.width = '100%';
84434
+ item.style.flex = '';
84435
+ }
84436
+ } else {
84437
+ // if(!item.getAttribute('data-module') && !item.style.width) {
84438
+ // item.style.width = '100%';
84439
+ // item.style.flex = '';
84440
+ // }
84441
+ if (!item.getAttribute('data-module') && item === col.nextElementSibling) {
84442
+ item.style.width = '100%';
84443
+ item.style.flex = '';
84444
+ }
84445
+ }
83225
84446
  });
83226
84447
 
83227
84448
  if (numOfCols === 1) {
@@ -83251,6 +84472,14 @@ class Resize {
83251
84472
  }
83252
84473
  },
83253
84474
  resizeEnd: () => {
84475
+ let numOfCols = 1;
84476
+ Array.from(col.parentNode.children).map(item => {
84477
+ if (item.classList.contains('is-row-tool')) return;
84478
+ if (item.classList.contains('is-rowadd-tool')) return;
84479
+ if (item === col) return;
84480
+ numOfCols++;
84481
+ });
84482
+
83254
84483
  if (col.style.width) {
83255
84484
  col.style.width = col.offsetWidth + 'px'; // change from % to px
83256
84485
 
@@ -83279,10 +84508,25 @@ class Resize {
83279
84508
  if (item.classList.contains('is-row-tool')) return;
83280
84509
  if (item.classList.contains('is-rowadd-tool')) return; // if(this.opts.filterSibling) if(item.classList.contains(this.opts.filterSibling)) return;
83281
84510
 
83282
- if (item === col) return; // item.style.width = '100%';
84511
+ if (item === col) return; // // item.style.width = '100%';
84512
+ // if(!item.getAttribute('data-module')) item.style.width = '100%';
84513
+ // item.style.flex = '';
83283
84514
 
83284
- if (!item.getAttribute('data-module')) item.style.width = '100%';
83285
- item.style.flex = '';
84515
+ if (numOfCols === 2) {
84516
+ if (!item.getAttribute('data-module')) {
84517
+ item.style.width = '100%';
84518
+ item.style.flex = '';
84519
+ }
84520
+ } else {
84521
+ // if(!item.getAttribute('data-module') && !item.style.width) {
84522
+ // item.style.width = '100%';
84523
+ // item.style.flex = '';
84524
+ // }
84525
+ if (!item.getAttribute('data-module') && item === col.nextElementSibling) {
84526
+ item.style.width = '100%';
84527
+ item.style.flex = '';
84528
+ }
84529
+ }
83286
84530
  });
83287
84531
  } // /adjust others
83288
84532
  // New: Final fix (if column resized exceeds its max)
@@ -83336,12 +84580,11 @@ class Resize {
83336
84580
  item.style.height = '';
83337
84581
  item.style.minHeight = '';
83338
84582
  });
83339
- } // To position columnTool correctly, add delay.
84583
+ } // // To position columnTool correctly, add delay.
84584
+ // setTimeout(()=>{
84585
+ // col.click();
84586
+ // },30);
83340
84587
 
83341
-
83342
- setTimeout(() => {
83343
- col.click();
83344
- }, 30);
83345
84588
  }
83346
84589
  });
83347
84590
  }
@@ -84491,6 +85734,7 @@ class ContentBuilder {
84491
85734
  //set -1 for no max (use original image width)
84492
85735
  zoom: 1,
84493
85736
  useLightbox: false,
85737
+ lightboxArrow: true,
84494
85738
  imageRenameOnEdit: true,
84495
85739
  disableAutoEmbedVideo: false,
84496
85740
 
@@ -85234,6 +86478,8 @@ class ContentBuilder {
85234
86478
  util.clearControls();
85235
86479
  }
85236
86480
  }
86481
+
86482
+ this.element.hyperlink.buttonEditor.hide();
85237
86483
  } // Button Modal
85238
86484
 
85239
86485
 
@@ -89377,11 +90623,59 @@ class ContentBox {
89377
90623
  designUrl2: 'assets/designs/examples.js',
89378
90624
  designPath: 'assets/designs/',
89379
90625
  designPathReplace: [],
89380
- // Example:
89381
- // designUrl1: 'https://.../assets/designs/basic.js',
89382
- // designUrl2: 'https://.../assets/designs/examples.js',
89383
- // designPath: 'https://.../assets/designs/',
89384
- // designPathReplace: ['assets/', 'https://.../assets/'],
90626
+
90627
+ /*
90628
+ Example:
90629
+ designUrl1: 'https://.../assets/designs/basic.js',
90630
+ designUrl2: 'https://.../assets/designs/examples.js',
90631
+ designPath: 'https://.../assets/designs/',
90632
+ designPathReplace: ['assets/', 'https://.../assets/'],
90633
+ */
90634
+ templates: [],
90635
+ // ver.5.3
90636
+
90637
+ /*
90638
+ Example: => this will replace the previous approach (designUrl1, designUrl2, designPath & designPathReplace)
90639
+ templates: [
90640
+ {
90641
+ url: 'assets/designs/basic.js',
90642
+ path: 'assets/designs/',
90643
+ pathReplace: []
90644
+ },
90645
+ {
90646
+ url: 'assets/designs/examples.js',
90647
+ path: 'assets/designs/',
90648
+ pathReplace: []
90649
+ },
90650
+ {
90651
+ url: 'assets/writing-set/basic.js',
90652
+ path: 'assets/writing-set/',
90653
+ pathReplace: []
90654
+ }
90655
+ ]
90656
+ */
90657
+ featuredCategories: [{
90658
+ id: 5,
90659
+ name: 'Random'
90660
+ }, // If apos ' is used, use: \\\'
90661
+ {
90662
+ id: 1,
90663
+ name: 'Basic'
90664
+ }, {
90665
+ id: 2,
90666
+ name: 'Slider'
90667
+ }, {
90668
+ id: 101,
90669
+ name: 'Header'
90670
+ }, {
90671
+ id: 118,
90672
+ name: 'Article'
90673
+ }, {
90674
+ id: 102,
90675
+ name: 'Photos'
90676
+ }],
90677
+ templateThumbnailSize: '',
90678
+ //small, medium
89385
90679
  // ContentBuilder
89386
90680
  scriptPath: '',
89387
90681
  snippetUrl: 'assets/minimalist-blocks/content.js',
@@ -89411,6 +90705,7 @@ class ContentBox {
89411
90705
  }],
89412
90706
  disableConfig: false,
89413
90707
  useLightbox: true,
90708
+ lightboxArrow: true,
89414
90709
  themes: [['#ffffff', '', ''], ['#282828', 'dark', 'contentbuilder/themes/dark.css'], ['#0088dc', 'colored', 'contentbuilder/themes/colored-blue.css'], ['#006add', 'colored', 'contentbuilder/themes/colored-blue6.css'], ['#0a4d92', 'colored', 'contentbuilder/themes/colored-darkblue.css'], ['#96af16', 'colored', 'contentbuilder/themes/colored-green.css'], ['#f3522b', 'colored', 'contentbuilder/themes/colored-orange.css'], ['#b92ea6', 'colored', 'contentbuilder/themes/colored-magenta.css'], ['#e73171', 'colored', 'contentbuilder/themes/colored-pink.css'], ['#782ec5', 'colored', 'contentbuilder/themes/colored-purple.css'], ['#ed2828', 'colored', 'contentbuilder/themes/colored-red.css'], ['#f9930f', 'colored', 'contentbuilder/themes/colored-yellow.css'], ['#13b34b', 'colored', 'contentbuilder/themes/colored-green4.css'], ['#333333', 'colored-dark', 'contentbuilder/themes/colored-dark.css'], ['#dbe5f5', 'light', 'contentbuilder/themes/light-blue.css'], ['#fbe6f2', 'light', 'contentbuilder/themes/light-pink.css'], ['#dcdaf3', 'light', 'contentbuilder/themes/light-purple.css'], ['#ffe9e0', 'light', 'contentbuilder/themes/light-red.css'], ['#fffae5', 'light', 'contentbuilder/themes/light-yellow.css'], ['#ddf3dc', 'light', 'contentbuilder/themes/light-green.css'], ['#c7ebfd', 'light', 'contentbuilder/themes/light-blue2.css'], ['#ffd5f2', 'light', 'contentbuilder/themes/light-pink2.css'], ['#eadafb', 'light', 'contentbuilder/themes/light-purple2.css'], ['#c5d4ff', 'light', 'contentbuilder/themes/light-blue3.css'], ['#ffefb1', 'light', 'contentbuilder/themes/light-yellow2.css'], ['#fefefe', 'light', 'contentbuilder/themes/light-gray3.css'], ['#e5e5e5', 'light', 'contentbuilder/themes/light-gray2.css'], ['#dadada', 'light', 'contentbuilder/themes/light-gray.css'], ['#3f4ec9', 'colored', 'contentbuilder/themes/colored-blue2.css'], ['#6779d9', 'colored', 'contentbuilder/themes/colored-blue4.css'], ['#10b9d7', 'colored', 'contentbuilder/themes/colored-blue3.css'], ['#006add', 'colored', 'contentbuilder/themes/colored-blue5.css'], ['#e92f94', 'colored', 'contentbuilder/themes/colored-pink3.css'], ['#a761d9', 'colored', 'contentbuilder/themes/colored-purple2.css'], ['#f9930f', 'colored', 'contentbuilder/themes/colored-yellow2.css'], ['#f3522b', 'colored', 'contentbuilder/themes/colored-red3.css'], ['#36b741', 'colored', 'contentbuilder/themes/colored-green2.css'], ['#00c17c', 'colored', 'contentbuilder/themes/colored-green3.css'], ['#fb3279', 'colored', 'contentbuilder/themes/colored-pink2.css'], ['#ff6d13', 'colored', 'contentbuilder/themes/colored-orange2.css'], ['#f13535', 'colored', 'contentbuilder/themes/colored-red2.css'], ['#646464', 'colored', 'contentbuilder/themes/colored-gray.css'], ['#3f4ec9', 'dark', 'contentbuilder/themes/dark-blue.css'], ['#0b4d92', 'dark', 'contentbuilder/themes/dark-blue2.css'], ['#006add', 'dark', 'contentbuilder/themes/dark-blue3.css'], ['#5f3ebf', 'dark', 'contentbuilder/themes/dark-purple.css'], ['#e92f69', 'dark', 'contentbuilder/themes/dark-pink.css'], ['#4c4c4c', 'dark', 'contentbuilder/themes/dark-gray.css'], ['#ed2828', 'dark', 'contentbuilder/themes/dark-red.css'], ['#006add', 'colored', 'contentbuilder/themes/colored-blue8.css'], ['#ff7723', 'colored', 'contentbuilder/themes/colored-orange3.css'], ['#ff5722', 'colored', 'contentbuilder/themes/colored-red5.css'], ['#f13535', 'colored', 'contentbuilder/themes/colored-red4.css'], ['#00bd79', 'colored', 'contentbuilder/themes/colored-green5.css'], ['#557ae9', 'colored', 'contentbuilder/themes/colored-blue7.css'], ['#fb3279', 'colored', 'contentbuilder/themes/colored-pink4.css']],
89415
90710
  backgroundColor: '#f1f1f1',
89416
90711
  imageselect: '',
@@ -91746,6 +93041,19 @@ class ContentBox {
91746
93041
  contentHtmlEnd: '</div></div></div>'
91747
93042
  };
91748
93043
  this.settings = Object.assign(this, defaults, settings);
93044
+ this.templateJSON = [{
93045
+ url: this.settings.designUrl1,
93046
+ path: this.settings.designPath,
93047
+ pathReplace: this.settings.designPathReplace
93048
+ }, {
93049
+ url: this.settings.designUrl2,
93050
+ path: this.settings.designPath,
93051
+ pathReplace: this.settings.designPathReplace
93052
+ }];
93053
+
93054
+ if (this.settings.templates.length !== 0 && this.settings.templateThumbnailSize === '') {
93055
+ this.settings.templateThumbnailSize = 'large';
93056
+ }
91749
93057
 
91750
93058
  if (this.settings.imageSelect !== '') {
91751
93059
  this.settings.imageselect = this.settings.imageSelect;
@@ -91924,6 +93232,7 @@ class ContentBox {
91924
93232
  // }, 100);
91925
93233
  // },
91926
93234
  useLightbox: this.settings.useLightbox,
93235
+ lightboxArrow: this.settings.lightboxArrow,
91927
93236
  themes: this.settings.themes,
91928
93237
  moduleConfig: this.settings.moduleConfig,
91929
93238
  onImageSelectClick: this.settings.onImageSelectClick,