@innovastudio/contentbuilder 1.0.80 → 1.0.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/public/contentbuilder/contentbuilder.css +80 -0
- package/public/contentbuilder/contentbuilder.esm.js +142 -25
- package/public/contentbuilder/contentbuilder.min.js +8 -8
- package/public/contentbuilder/themes/colored-blue.css +38 -0
- package/public/contentbuilder/themes/colored-blue2.css +38 -0
- package/public/contentbuilder/themes/colored-blue3.css +38 -0
- package/public/contentbuilder/themes/colored-blue4.css +38 -0
- package/public/contentbuilder/themes/colored-blue5.css +38 -0
- package/public/contentbuilder/themes/colored-blue6.css +38 -0
- package/public/contentbuilder/themes/colored-blue7.css +38 -0
- package/public/contentbuilder/themes/colored-blue8.css +38 -0
- package/public/contentbuilder/themes/colored-dark.css +38 -0
- package/public/contentbuilder/themes/colored-darkblue.css +38 -0
- package/public/contentbuilder/themes/colored-gray.css +38 -0
- package/public/contentbuilder/themes/colored-green.css +38 -0
- package/public/contentbuilder/themes/colored-green2.css +38 -0
- package/public/contentbuilder/themes/colored-green3.css +38 -0
- package/public/contentbuilder/themes/colored-green4.css +38 -0
- package/public/contentbuilder/themes/colored-green5.css +38 -0
- package/public/contentbuilder/themes/colored-magenta.css +38 -0
- package/public/contentbuilder/themes/colored-orange.css +38 -0
- package/public/contentbuilder/themes/colored-orange2.css +38 -0
- package/public/contentbuilder/themes/colored-orange3.css +38 -0
- package/public/contentbuilder/themes/colored-pink.css +38 -0
- package/public/contentbuilder/themes/colored-pink2.css +38 -0
- package/public/contentbuilder/themes/colored-pink3.css +38 -0
- package/public/contentbuilder/themes/colored-pink4.css +38 -0
- package/public/contentbuilder/themes/colored-purple.css +38 -0
- package/public/contentbuilder/themes/colored-purple2.css +38 -0
- package/public/contentbuilder/themes/colored-red.css +38 -0
- package/public/contentbuilder/themes/colored-red2.css +38 -0
- package/public/contentbuilder/themes/colored-red3.css +38 -0
- package/public/contentbuilder/themes/colored-red4.css +38 -0
- package/public/contentbuilder/themes/colored-red5.css +38 -0
- package/public/contentbuilder/themes/colored-yellow.css +38 -0
- package/public/contentbuilder/themes/colored-yellow2.css +38 -0
- package/public/contentbuilder/themes/dark-blue.css +38 -0
- package/public/contentbuilder/themes/dark-blue2.css +38 -0
- package/public/contentbuilder/themes/dark-blue3.css +38 -0
- package/public/contentbuilder/themes/dark-gray.css +38 -0
- package/public/contentbuilder/themes/dark-pink.css +38 -0
- package/public/contentbuilder/themes/dark-purple.css +38 -0
- package/public/contentbuilder/themes/dark-red.css +38 -0
- package/public/contentbuilder/themes/dark.css +38 -0
- package/public/contentbuilder/themes/light-blue.css +38 -0
- package/public/contentbuilder/themes/light-blue2.css +38 -0
- package/public/contentbuilder/themes/light-blue3.css +38 -0
- package/public/contentbuilder/themes/light-cyan.css +38 -0
- package/public/contentbuilder/themes/light-gray.css +38 -0
- package/public/contentbuilder/themes/light-gray2.css +38 -0
- package/public/contentbuilder/themes/light-gray3.css +38 -0
- package/public/contentbuilder/themes/light-green.css +38 -0
- package/public/contentbuilder/themes/light-pink.css +38 -0
- package/public/contentbuilder/themes/light-pink2.css +38 -0
- package/public/contentbuilder/themes/light-purple.css +38 -0
- package/public/contentbuilder/themes/light-purple2.css +38 -0
- package/public/contentbuilder/themes/light-red.css +38 -0
- package/public/contentbuilder/themes/light-yellow.css +38 -0
- package/public/contentbuilder/themes/light-yellow2.css +38 -0
- package/readme.txt +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@innovastudio/contentbuilder",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.83",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "public/contentbuilder/contentbuilder.esm.js",
|
|
6
6
|
"files": [
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"express-session": "^1.17.2",
|
|
49
49
|
"js-beautify": "^1.14.0",
|
|
50
50
|
"moveable": "^0.26.0",
|
|
51
|
+
"nodemailer": "^6.7.2",
|
|
51
52
|
"serve-static": "^1.14.1",
|
|
52
53
|
"sortablejs": "^1.14.0"
|
|
53
54
|
}
|
|
@@ -195,6 +195,7 @@ button:focus {
|
|
|
195
195
|
font-size: 13px;
|
|
196
196
|
letter-spacing: 1px;
|
|
197
197
|
font-weight: 300px;
|
|
198
|
+
/* general use */
|
|
198
199
|
/*
|
|
199
200
|
.rte-align-options,
|
|
200
201
|
.rte-formatting-options,
|
|
@@ -543,6 +544,40 @@ button:focus {
|
|
|
543
544
|
.is-ui .is-elementrte-tool > div:not(.is-draggable) {
|
|
544
545
|
padding: 8px 10px 8px 10px;
|
|
545
546
|
}
|
|
547
|
+
#_cbhtml .is-general-options,
|
|
548
|
+
.is-ui .is-general-options {
|
|
549
|
+
color: #000;
|
|
550
|
+
background: #fff;
|
|
551
|
+
}
|
|
552
|
+
#_cbhtml .is-general-options button,
|
|
553
|
+
#_cbhtml .is-general-options div[role=button],
|
|
554
|
+
.is-ui .is-general-options button,
|
|
555
|
+
.is-ui .is-general-options div[role=button] {
|
|
556
|
+
background-color: transparent;
|
|
557
|
+
color: #121212;
|
|
558
|
+
width: 45px;
|
|
559
|
+
height: 40px;
|
|
560
|
+
margin: 0;
|
|
561
|
+
box-shadow: none;
|
|
562
|
+
}
|
|
563
|
+
#_cbhtml .is-general-options button.on,
|
|
564
|
+
#_cbhtml .is-general-options div[role=button].on,
|
|
565
|
+
.is-ui .is-general-options button.on,
|
|
566
|
+
.is-ui .is-general-options div[role=button].on {
|
|
567
|
+
background: whitesmoke;
|
|
568
|
+
}
|
|
569
|
+
#_cbhtml .is-general-options button:hover,
|
|
570
|
+
#_cbhtml .is-general-options div[role=button]:hover,
|
|
571
|
+
.is-ui .is-general-options button:hover,
|
|
572
|
+
.is-ui .is-general-options div[role=button]:hover {
|
|
573
|
+
background: whitesmoke !important;
|
|
574
|
+
}
|
|
575
|
+
#_cbhtml .is-general-options button svg,
|
|
576
|
+
#_cbhtml .is-general-options div[role=button] svg,
|
|
577
|
+
.is-ui .is-general-options button svg,
|
|
578
|
+
.is-ui .is-general-options div[role=button] svg {
|
|
579
|
+
fill: #000;
|
|
580
|
+
}
|
|
546
581
|
#_cbhtml .is-rte-tool,
|
|
547
582
|
#_cbhtml .is-elementrte-tool,
|
|
548
583
|
#_cbhtml .is-rte-pop.rte-more-options,
|
|
@@ -557,6 +592,51 @@ button:focus {
|
|
|
557
592
|
background: #fff;
|
|
558
593
|
box-shadow: rgba(0, 0, 0, 0.05) 0px 5px 9px 0px;
|
|
559
594
|
}
|
|
595
|
+
#_cbhtml .is-rte-tool div[role=button],
|
|
596
|
+
#_cbhtml .is-elementrte-tool div[role=button],
|
|
597
|
+
#_cbhtml .is-rte-pop.rte-more-options div[role=button],
|
|
598
|
+
#_cbhtml .is-rte-pop.elementrte-more-options div[role=button],
|
|
599
|
+
.is-ui .is-rte-tool div[role=button],
|
|
600
|
+
.is-ui .is-elementrte-tool div[role=button],
|
|
601
|
+
.is-ui .is-rte-pop.rte-more-options div[role=button],
|
|
602
|
+
.is-ui .is-rte-pop.elementrte-more-options div[role=button] {
|
|
603
|
+
background-color: transparent;
|
|
604
|
+
color: #121212;
|
|
605
|
+
width: 45px;
|
|
606
|
+
height: 40px;
|
|
607
|
+
margin: 0;
|
|
608
|
+
box-shadow: none;
|
|
609
|
+
}
|
|
610
|
+
#_cbhtml .is-rte-tool div[role=button].on,
|
|
611
|
+
#_cbhtml .is-elementrte-tool div[role=button].on,
|
|
612
|
+
#_cbhtml .is-rte-pop.rte-more-options div[role=button].on,
|
|
613
|
+
#_cbhtml .is-rte-pop.elementrte-more-options div[role=button].on,
|
|
614
|
+
.is-ui .is-rte-tool div[role=button].on,
|
|
615
|
+
.is-ui .is-elementrte-tool div[role=button].on,
|
|
616
|
+
.is-ui .is-rte-pop.rte-more-options div[role=button].on,
|
|
617
|
+
.is-ui .is-rte-pop.elementrte-more-options div[role=button].on {
|
|
618
|
+
background: whitesmoke;
|
|
619
|
+
}
|
|
620
|
+
#_cbhtml .is-rte-tool div[role=button]:hover,
|
|
621
|
+
#_cbhtml .is-elementrte-tool div[role=button]:hover,
|
|
622
|
+
#_cbhtml .is-rte-pop.rte-more-options div[role=button]:hover,
|
|
623
|
+
#_cbhtml .is-rte-pop.elementrte-more-options div[role=button]:hover,
|
|
624
|
+
.is-ui .is-rte-tool div[role=button]:hover,
|
|
625
|
+
.is-ui .is-elementrte-tool div[role=button]:hover,
|
|
626
|
+
.is-ui .is-rte-pop.rte-more-options div[role=button]:hover,
|
|
627
|
+
.is-ui .is-rte-pop.elementrte-more-options div[role=button]:hover {
|
|
628
|
+
background: whitesmoke;
|
|
629
|
+
}
|
|
630
|
+
#_cbhtml .is-rte-tool div[role=button] svg,
|
|
631
|
+
#_cbhtml .is-elementrte-tool div[role=button] svg,
|
|
632
|
+
#_cbhtml .is-rte-pop.rte-more-options div[role=button] svg,
|
|
633
|
+
#_cbhtml .is-rte-pop.elementrte-more-options div[role=button] svg,
|
|
634
|
+
.is-ui .is-rte-tool div[role=button] svg,
|
|
635
|
+
.is-ui .is-elementrte-tool div[role=button] svg,
|
|
636
|
+
.is-ui .is-rte-pop.rte-more-options div[role=button] svg,
|
|
637
|
+
.is-ui .is-rte-pop.elementrte-more-options div[role=button] svg {
|
|
638
|
+
fill: #000;
|
|
639
|
+
}
|
|
560
640
|
#_cbhtml .is-rte-tool button,
|
|
561
641
|
#_cbhtml .is-elementrte-tool button,
|
|
562
642
|
#_cbhtml .is-rte-pop.rte-more-options button,
|
|
@@ -253,14 +253,26 @@ class Util {
|
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
confirm(message, callback) {
|
|
256
|
+
confirm(message, callback, yesno, yestext) {
|
|
257
257
|
const dom = this.dom;
|
|
258
|
-
let html =
|
|
258
|
+
let html = '';
|
|
259
|
+
html = `<div class="is-modal is-confirm">
|
|
259
260
|
<div class="is-modal-content" style="padding-bottom:20px;">
|
|
260
261
|
<p>${message}</p>
|
|
261
262
|
<button title="${this.out('Delete')}" class="input-ok classic">${this.out('Delete')}</button>
|
|
262
263
|
</div>
|
|
263
264
|
</div>`;
|
|
265
|
+
|
|
266
|
+
if (yesno) {
|
|
267
|
+
html = `<div class="is-modal is-confirm">
|
|
268
|
+
<div class="is-modal-content" style="padding-bottom:20px;">
|
|
269
|
+
<p>${message}</p>
|
|
270
|
+
<button title="${this.out('Cancel')}" class="input-cancel classic-secondary">${this.out('Cancel')}</button>
|
|
271
|
+
<button title="${yestext}" class="input-ok classic-primary">${yestext}</button>
|
|
272
|
+
</div>
|
|
273
|
+
</div>`;
|
|
274
|
+
}
|
|
275
|
+
|
|
264
276
|
const builderStuff = this.builder.builderStuff;
|
|
265
277
|
let confirmmodal = builderStuff.querySelector('.is-confirm');
|
|
266
278
|
|
|
@@ -283,6 +295,16 @@ class Util {
|
|
|
283
295
|
|
|
284
296
|
callback(true);
|
|
285
297
|
});
|
|
298
|
+
let buttoncancel = confirmmodal.querySelector('.is-confirm .input-cancel');
|
|
299
|
+
dom.addEventListener(buttoncancel, 'click', e => {
|
|
300
|
+
this.hideModal(confirmmodal);
|
|
301
|
+
confirmmodal.parentNode.removeChild(confirmmodal); //remove modal
|
|
302
|
+
//do task
|
|
303
|
+
|
|
304
|
+
callback(false);
|
|
305
|
+
e.preventDefault();
|
|
306
|
+
e.stopImmediatePropagation();
|
|
307
|
+
});
|
|
286
308
|
}
|
|
287
309
|
/*
|
|
288
310
|
Note:
|
|
@@ -39927,7 +39949,7 @@ class Image {
|
|
|
39927
39949
|
// if(initialWidth <200 && initialHeight<200) {
|
|
39928
39950
|
|
|
39929
39951
|
|
|
39930
|
-
if (initialWidth <= 1600 && initialHeight <= 1600) {
|
|
39952
|
+
if (initialWidth <= 1600 && initialHeight <= 1600 && this.builder.opts.maxEmbedImageWidth >= 1600) {
|
|
39931
39953
|
let reader = new FileReader();
|
|
39932
39954
|
reader.addEventListener('load', e => {
|
|
39933
39955
|
if (!document.getElementById('__preview')) {
|
|
@@ -60289,14 +60311,48 @@ class ContentBuilder {
|
|
|
60289
60311
|
sPastedText = util.cleanHTML(sPastedText, true);
|
|
60290
60312
|
}
|
|
60291
60313
|
|
|
60292
|
-
contentword.innerHTML = sPastedText;
|
|
60293
|
-
|
|
60294
|
-
|
|
60295
|
-
|
|
60296
|
-
|
|
60297
|
-
|
|
60298
|
-
|
|
60299
|
-
|
|
60314
|
+
contentword.innerHTML = sPastedText;
|
|
60315
|
+
|
|
60316
|
+
if (this.opts.paste === 'html') {
|
|
60317
|
+
//with styles
|
|
60318
|
+
let elms = contentword.querySelectorAll('*');
|
|
60319
|
+
Array.prototype.forEach.call(elms, elm => {
|
|
60320
|
+
for (let n = 0; n < elm.attributes.length; n++) {
|
|
60321
|
+
if (elm.attributes[n].name !== 'style') elm.removeAttribute(elm.attributes[n].name);
|
|
60322
|
+
}
|
|
60323
|
+
});
|
|
60324
|
+
} else {
|
|
60325
|
+
//html-without-styles (default)
|
|
60326
|
+
const removeAttributes = element => {
|
|
60327
|
+
while (element.attributes.length > 0) {
|
|
60328
|
+
element.removeAttribute(element.attributes[0].name);
|
|
60329
|
+
}
|
|
60330
|
+
};
|
|
60331
|
+
|
|
60332
|
+
let elms = contentword.querySelectorAll('*');
|
|
60333
|
+
Array.prototype.forEach.call(elms, elm => {
|
|
60334
|
+
removeAttributes(elm);
|
|
60335
|
+
});
|
|
60336
|
+
}
|
|
60337
|
+
/*
|
|
60338
|
+
Additional Cleanup:
|
|
60339
|
+
- Remove p inside li
|
|
60340
|
+
- Remove li with white-space: pre
|
|
60341
|
+
*/
|
|
60342
|
+
|
|
60343
|
+
|
|
60344
|
+
let elms = contentword.querySelectorAll('li');
|
|
60345
|
+
Array.prototype.forEach.call(elms, elm => {
|
|
60346
|
+
elm.style.whiteSpace = '';
|
|
60347
|
+
const childNodes = elm.childNodes;
|
|
60348
|
+
let i = childNodes.length;
|
|
60349
|
+
|
|
60350
|
+
while (i--) {
|
|
60351
|
+
if (childNodes[i].tagName === 'P') {
|
|
60352
|
+
childNodes[i].outerHTML = childNodes[i].innerHTML;
|
|
60353
|
+
}
|
|
60354
|
+
}
|
|
60355
|
+
}); // NOTE: paste <h1><p> jadi nempel
|
|
60300
60356
|
// // Source: https://gist.github.com/sbrin/6801034
|
|
60301
60357
|
// jQuery('p', $editor).each(function(){
|
|
60302
60358
|
// var str = jQuery(this).attr('style');
|
|
@@ -60354,10 +60410,7 @@ class ContentBuilder {
|
|
|
60354
60410
|
}
|
|
60355
60411
|
|
|
60356
60412
|
contentword = document.querySelector('#idContentWord');
|
|
60357
|
-
if (contentword) contentword.parentNode.removeChild(contentword);
|
|
60358
|
-
// jQuery('.cell-active').find('.elm-active').removeClass('elm-active');
|
|
60359
|
-
// jQuery("#divElementTool").css("display", "none"); //force hide ellement tool
|
|
60360
|
-
|
|
60413
|
+
if (contentword) contentword.parentNode.removeChild(contentword);
|
|
60361
60414
|
util.restoreSelection();
|
|
60362
60415
|
var oSel = window.getSelection();
|
|
60363
60416
|
var range = oSel.getRangeAt(0);
|
|
@@ -60365,16 +60418,80 @@ class ContentBuilder {
|
|
|
60365
60418
|
range.collapse(true);
|
|
60366
60419
|
var docFrag = range.createContextualFragment(sPastedText);
|
|
60367
60420
|
var lastNode = docFrag.lastChild;
|
|
60368
|
-
range.insertNode(docFrag);
|
|
60369
|
-
|
|
60370
|
-
|
|
60371
|
-
|
|
60372
|
-
|
|
60373
|
-
|
|
60374
|
-
|
|
60375
|
-
|
|
60376
|
-
|
|
60377
|
-
|
|
60421
|
+
range.insertNode(docFrag);
|
|
60422
|
+
|
|
60423
|
+
if (this.activeCol) {
|
|
60424
|
+
/*
|
|
60425
|
+
Additional Cleanup:
|
|
60426
|
+
- Remove empty elements (empty p, etc)
|
|
60427
|
+
*/
|
|
60428
|
+
// $block.find('h1:empty,h2:empty,h3:empty,h4:empty,h5:empty,h6:empty,p:empty').remove();
|
|
60429
|
+
this.activeCol.querySelectorAll('*:empty').forEach(x => {
|
|
60430
|
+
x.remove();
|
|
60431
|
+
});
|
|
60432
|
+
/*
|
|
60433
|
+
Additional Cleanup:
|
|
60434
|
+
Fix HTML structure. The problem:
|
|
60435
|
+
<p class="elm-active">
|
|
60436
|
+
...Sometimes h1, h2, p can be pasted here..
|
|
60437
|
+
</p>
|
|
60438
|
+
*/
|
|
60439
|
+
|
|
60440
|
+
let elmActive = this.activeCol.querySelector('p.elm-active,h1.elm-active,h2.elm-active,h3.elm-active,h4.elm-active,h5.elm-active,h6.elm-active');
|
|
60441
|
+
|
|
60442
|
+
if (elmActive) {
|
|
60443
|
+
let elms = elmActive.querySelectorAll('p,h1,h2,h3,h4,h5,h6');
|
|
60444
|
+
|
|
60445
|
+
if (elms.length > 0) {
|
|
60446
|
+
let elmClosestElement = elmActive.nextElementSibling; //Fix text that doesn't have paragraph
|
|
60447
|
+
|
|
60448
|
+
let textNodes = Array.from(elmActive.childNodes).filter(node => node.nodeType === 3 && node.textContent.trim().length > 1);
|
|
60449
|
+
textNodes.forEach(node => {
|
|
60450
|
+
const span = document.createElement('p');
|
|
60451
|
+
node.after(span);
|
|
60452
|
+
span.appendChild(node);
|
|
60453
|
+
});
|
|
60454
|
+
|
|
60455
|
+
if (elmActive.firstElementChild && elmActive.childNodes.length === 1) {
|
|
60456
|
+
if (elmActive.firstElementChild.tagName === 'SPAN') {
|
|
60457
|
+
// Paste HTML with styles
|
|
60458
|
+
elmActive.outerHTML = elmActive.firstElementChild.innerHTML; //fix
|
|
60459
|
+
// Re-clean empty elements
|
|
60460
|
+
|
|
60461
|
+
this.activeCol.querySelectorAll('*:empty').forEach(x => {
|
|
60462
|
+
x.remove();
|
|
60463
|
+
}); //place cursor
|
|
60464
|
+
|
|
60465
|
+
if (elmClosestElement) dom.moveCursorToElement(elmClosestElement.previousElementSibling);else dom.moveCursorToElement(this.activeCol);
|
|
60466
|
+
let builderActive = document.querySelector('.builder-active');
|
|
60467
|
+
if (builderActive) this.applyBehaviorOn(builderActive); //Trigger Change event
|
|
60468
|
+
|
|
60469
|
+
this.opts.onChange(); //Trigger Render event
|
|
60470
|
+
|
|
60471
|
+
this.opts.onRender();
|
|
60472
|
+
return;
|
|
60473
|
+
}
|
|
60474
|
+
} // Paste HTML without styles
|
|
60475
|
+
|
|
60476
|
+
|
|
60477
|
+
elmActive.outerHTML = elmActive.innerHTML; //fix
|
|
60478
|
+
// Re-clean empty elements
|
|
60479
|
+
|
|
60480
|
+
this.activeCol.querySelectorAll('*:empty').forEach(x => {
|
|
60481
|
+
x.remove();
|
|
60482
|
+
}); //place cursor
|
|
60483
|
+
|
|
60484
|
+
if (elmClosestElement) dom.moveCursorToElement(elmClosestElement.previousElementSibling);else dom.moveCursorToElement(this.activeCol);
|
|
60485
|
+
let builderActive = document.querySelector('.builder-active');
|
|
60486
|
+
if (builderActive) this.applyBehaviorOn(builderActive); //Trigger Change event
|
|
60487
|
+
|
|
60488
|
+
this.opts.onChange(); //Trigger Render event
|
|
60489
|
+
|
|
60490
|
+
this.opts.onRender();
|
|
60491
|
+
return;
|
|
60492
|
+
}
|
|
60493
|
+
}
|
|
60494
|
+
}
|
|
60378
60495
|
|
|
60379
60496
|
range.setStartAfter(lastNode);
|
|
60380
60497
|
range.setEndAfter(lastNode);
|