@innovastudio/contentbox 1.2.17 → 1.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbox",
3
- "version": "1.2.17",
4
- "type": "module",
3
+ "version": "1.2.20",
5
4
  "description": "",
6
5
  "main": "public/contentbox/contentbox.esm.js",
7
6
  "files": [
@@ -27,26 +26,26 @@
27
26
  "@rollup/plugin-eslint": "^8.0.1",
28
27
  "@rollup/plugin-image": "^2.1.1",
29
28
  "@rollup/plugin-node-resolve": "^13.0.6",
29
+ "axios": "^0.21.4",
30
30
  "babel-loader": "^8.2.2",
31
31
  "concurrently": "^6.3.0",
32
+ "cors": "^2.8.5",
32
33
  "css-loader": "^6.2.0",
34
+ "express": "^4.17.1",
35
+ "express-session": "^1.17.2",
36
+ "formidable-serverless": "^1.1.1",
33
37
  "mini-css-extract-plugin": "^2.2.0",
34
38
  "rollup": "^2.59.0",
35
39
  "rollup-plugin-terser": "^7.0.2",
36
40
  "sass": "^1.38.1",
37
41
  "sass-loader": "^12.1.0",
42
+ "sharp": "^0.30.3",
38
43
  "webpack": "^5.51.1",
39
44
  "webpack-cli": "^4.8.0",
40
45
  "webpack-dev-server": "^4.0.0"
41
46
  },
42
47
  "dependencies": {
43
- "@innovastudio/contentbuilder": "^1.1.17",
44
- "axios": "^0.21.4",
45
- "cors": "^2.8.5",
46
- "express": "^4.17.1",
47
- "express-session": "^1.17.2",
48
- "formidable-serverless": "^1.1.1",
49
- "js-beautify": "^1.14.0",
50
- "sharp": "^0.30.3"
48
+ "@innovastudio/contentbuilder": "^1.1.20",
49
+ "js-beautify": "^1.14.0"
51
50
  }
52
51
  }
@@ -15702,7 +15702,7 @@ class Util {
15702
15702
  let emptyinfo = builder.querySelector('.row-add-initial');
15703
15703
 
15704
15704
  if (!emptyinfo) {
15705
- builder.innerHTML = `<button type="button" class="row-add-initial">${this.out('Empty')}<br><span>${this.out('+ Click to add content')}</span></div>`;
15705
+ builder.innerHTML = `<button type="button" class="row-add-initial">${this.out('Empty')}<br><span class="block">${this.out('+ Click to add content')}</span></div>`;
15706
15706
  emptyinfo = builder.querySelector('.row-add-initial');
15707
15707
  }
15708
15708
 
@@ -18455,6 +18455,9 @@ class Dom {
18455
18455
 
18456
18456
 
18457
18457
  cleanUnusedSpan(area) {
18458
+ // for specific element only (during execCommand),
18459
+ // not for the entire ContentBuilder container,
18460
+ // because there can be custom blocks
18458
18461
  let spans = area.querySelectorAll('span');
18459
18462
  const filter = Array.prototype.filter;
18460
18463
  let children = filter.call(spans, element => {
@@ -24132,9 +24135,8 @@ class HtmlUtil {
24132
24135
  dom$I.removeClass(elm, this.builder.cssClasses.extend.unset);
24133
24136
  });
24134
24137
  } // Clean unused spans
24138
+ // dom.cleanUnusedSpan(content); // REVIEW
24135
24139
 
24136
-
24137
- dom$I.cleanUnusedSpan(content); // REVIEW
24138
24140
  }
24139
24141
 
24140
24142
  const util = this.builder.util;
@@ -24537,12 +24539,12 @@ class HtmlUtil {
24537
24539
  background-color: ${this.builder.styleButtonClassicBackgroundHover};
24538
24540
  }
24539
24541
  button:focus {outline:none;}
24540
- textarea {font-family: courier;font-size: 17px;line-height: 2;letter-spacing: 1px;padding:8px 16px;box-sizing:border-box;border:1px solid rgb(199, 199, 199);}
24542
+ textarea {font-family: courier, monospace;font-size: 17px;line-height: 2;letter-spacing: 1px;padding:8px 16px;box-sizing:border-box;border:1px solid rgb(199, 199, 199);}
24541
24543
  textarea:focus {outline:none}
24542
24544
 
24543
24545
  #code {display:none;}
24544
24546
  .CodeMirror {
24545
- font-family: courier;
24547
+ font-family: courier, monospace;
24546
24548
  font-size: 15px;
24547
24549
  line-height:1.9;
24548
24550
  width:100%;height:100%;
@@ -57300,14 +57302,16 @@ class Image {
57300
57302
  elm = imageTool.querySelector('.image-edit');
57301
57303
  dom$A.addEventListener(elm, 'click', () => {
57302
57304
  let img = this.builder.activeImage;
57305
+ let preview = modalImageEdit.querySelector('.imageedit-preview');
57306
+ preview.innerHTML = '<img style="max-width:100%;object-fit:contain;height:100%;"/>';
57307
+ let imagePreview = modalImageEdit.querySelector('img');
57303
57308
 
57304
57309
  if (this.builder.onImageEditClick) {
57305
- let result = this.builder.onImageEditClick(img);
57310
+ let result = this.builder.onImageEditClick(img, imagePreview);
57306
57311
  if (!result) return;
57307
57312
  }
57308
57313
 
57309
57314
  util.showModal(modalImageEdit, true);
57310
- let preview = modalImageEdit.querySelector('.imageedit-preview');
57311
57315
  const maxW = 800;
57312
57316
  const maxH = 550;
57313
57317
  preview.style.height = '';
@@ -57323,11 +57327,14 @@ class Image {
57323
57327
  } else {
57324
57328
  preview.style.height = maxH + 'px';
57325
57329
  }
57326
- }
57330
+ } // imagePreview.src = img.src;
57327
57331
 
57328
- preview.innerHTML = '<img src="" style="max-width:100%;object-fit:contain;height:100%;"/>';
57329
- let imagePreview = modalImageEdit.querySelector('img');
57330
- imagePreview.src = img.src;
57332
+
57333
+ if (img.src.indexOf('base64') === -1) {
57334
+ imagePreview.src = img.src + (img.src.indexOf('?') === -1 ? '?' : '&') + `timestamp=${new Date().getTime()}`;
57335
+ } else {
57336
+ imagePreview.src = img.src;
57337
+ }
57331
57338
 
57332
57339
  if (this.builder.setCropperConfig) {
57333
57340
  this.cropper = new Cropper(imagePreview, this.builder.setCropperConfig);
@@ -65213,7 +65220,7 @@ class ELementStyleEditor {
65213
65220
  <div class="is-settings clearfix" style="display:inline-block;width:100%;margin-bottom:0;">
65214
65221
  <div>${util.out('Class')}:</div>
65215
65222
  <div>
65216
- <input type="text" id="inpElmClassName" value="" style="width:100%;padding-left: 16px;font-family: courier;font-size: 14px;line-height: 2;letter-spacing: 1px;border:none;"/>
65223
+ <input type="text" id="inpElmClassName" value="" style="width:100%;padding-left: 16px;font-family: courier, monospace;font-size: 14px;line-height: 2;letter-spacing: 1px;border:none;"/>
65217
65224
  </div>
65218
65225
  </div>
65219
65226
  </div>
@@ -71614,7 +71621,7 @@ class Rte {
71614
71621
  <div title="${util.out('Heading 3')}" data-block="h3" role="button" tabindex="0"><h3>Heading 3</h3></div>
71615
71622
  <div title="${util.out('Heading 4')}" data-block="h4" role="button" tabindex="0"><h4>Heading 4</h4></div>
71616
71623
  <div title="${util.out('Paragraph')}" data-block="p" role="button" tabindex="0"><p>Paragraph</p></div>
71617
- <div title="${util.out('Preformatted')}" data-block="pre" role="button" tabindex="0"><p style="font-family:courier;">Preformatted</p></div>
71624
+ <div title="${util.out('Preformatted')}" data-block="pre" role="button" tabindex="0"><p style="font-family:courier, monospace;">Preformatted</p></div>
71618
71625
  </div>
71619
71626
  </div>
71620
71627
 
@@ -76701,7 +76708,9 @@ class ContentBuilder {
76701
76708
  const cropperConfig = {
76702
76709
  checkCrossOrigin:false,
76703
76710
  checkOrientation:false,
76704
- crossOrigin:'anonymous'
76711
+ crossOrigin:'anonymous',
76712
+ zoomable: false,
76713
+ viewMode: 1
76705
76714
  };
76706
76715
  builder.setCropperConfig = cropperConfig;
76707
76716
  return true;
@@ -79665,10 +79674,8 @@ class ContentBuilder {
79665
79674
  Additional Cleanup:
79666
79675
  - Remove empty elements (empty p, etc)
79667
79676
  */
79668
- // $block.find('h1:empty,h2:empty,h3:empty,h4:empty,h5:empty,h6:empty,p:empty').remove();
79669
- this.activeCol.querySelectorAll('*:empty').forEach(x => {
79670
- x.remove();
79671
- });
79677
+ this.activeCol.find('h1:empty,h2:empty,h3:empty,h4:empty,h5:empty,h6:empty,p:empty').remove(); // this.activeCol.querySelectorAll('*:empty').forEach((x)=>{x.remove();}); // Makes <img> removed
79678
+
79672
79679
  /*
79673
79680
  Additional Cleanup:
79674
79681
  Fix HTML structure. The problem:
@@ -79716,10 +79723,9 @@ class ContentBuilder {
79716
79723
 
79717
79724
  elmActive.outerHTML = elmActive.innerHTML; //fix
79718
79725
  // Re-clean empty elements
79726
+ // this.activeCol.querySelectorAll('*:empty').forEach((x)=>{x.remove();}); // Makes <img> removed
79719
79727
 
79720
- this.activeCol.querySelectorAll('*:empty').forEach(x => {
79721
- x.remove();
79722
- }); //place cursor
79728
+ this.activeCol.find('h1:empty,h2:empty,h3:empty,h4:empty,h5:empty,h6:empty,p:empty').remove(); //place cursor
79723
79729
 
79724
79730
  if (elmClosestElement) dom$J.moveCursorToElement(elmClosestElement.previousElementSibling);else dom$J.moveCursorToElement(this.activeCol);
79725
79731
  let builderActive = document.querySelector('.builder-active');