@innovastudio/contentbox 1.2.9 → 1.2.12

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbox",
3
- "version": "1.2.9",
3
+ "version": "1.2.12",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
@@ -40,7 +40,7 @@
40
40
  "webpack-dev-server": "^4.0.0"
41
41
  },
42
42
  "dependencies": {
43
- "@innovastudio/contentbuilder": "^1.1.11",
43
+ "@innovastudio/contentbuilder": "^1.1.14",
44
44
  "axios": "^0.21.4",
45
45
  "cors": "^2.8.5",
46
46
  "express": "^4.17.1",
@@ -57219,6 +57219,12 @@ class Image {
57219
57219
  elm = imageTool.querySelector('.image-edit');
57220
57220
  dom$A.addEventListener(elm, 'click', () => {
57221
57221
  let img = this.builder.activeImage;
57222
+
57223
+ if (this.builder.onImageEditClick) {
57224
+ let result = this.builder.onImageEditClick(img);
57225
+ if (!result) return;
57226
+ }
57227
+
57222
57228
  util.showModal(modalImageEdit, true);
57223
57229
  let preview = modalImageEdit.querySelector('.imageedit-preview');
57224
57230
  const maxW = 800;
@@ -57241,9 +57247,15 @@ class Image {
57241
57247
  preview.innerHTML = '<img src="" style="max-width:100%;object-fit:contain;height:100%;"/>';
57242
57248
  let imagePreview = modalImageEdit.querySelector('img');
57243
57249
  imagePreview.src = img.src;
57244
- this.cropper = new Cropper(imagePreview, {
57245
- zoomable: false
57246
- });
57250
+
57251
+ if (this.builder.setCropperConfig) {
57252
+ this.cropper = new Cropper(imagePreview, this.builder.setCropperConfig);
57253
+ } else {
57254
+ this.cropper = new Cropper(imagePreview, {
57255
+ zoomable: false
57256
+ });
57257
+ }
57258
+
57247
57259
  document.querySelector('.moveable-control-box').style.display = 'none'; //needed by Safari (prevent z-index problem)
57248
57260
  }); // Set crop proportion
57249
57261
 
@@ -76571,6 +76583,22 @@ class ContentBuilder {
76571
76583
  // onPluginsLoaded: function () { },
76572
76584
  // onImageBrowseClick: function () { },
76573
76585
  // onImageSettingClick: function () { },
76586
+
76587
+ /*
76588
+ // onImageEditClick: function () { }, // used in elementimage.js
76589
+ // Example:
76590
+ onImageEditClick: (activeImage)=>{
76591
+ activeImage.setAttribute('crossorigin', 'anonymous');
76592
+ const cropperConfig = {
76593
+ checkCrossOrigin:false,
76594
+ checkOrientation:false,
76595
+ crossOrigin:'anonymous'
76596
+ };
76597
+ builder.setCropperConfig = cropperConfig;
76598
+ return true;
76599
+ },
76600
+ */
76601
+ // setCropperConfig: {}, // used in elementimage.js
76574
76602
  imageEmbed: true,
76575
76603
  imageselect: '',
76576
76604
  fileselect: '',
@@ -77230,10 +77258,7 @@ class ContentBuilder {
77230
77258
  let target = e.target || e.srcElement;
77231
77259
  if (!target) return;
77232
77260
  let rowClicked;
77233
- if (target.parentNode) rowClicked = dom$J.hasClass(target.parentNode, 'is-builder');else {
77234
- console.log(target);
77235
- console.log(target.parentNode);
77236
- }
77261
+ if (target.parentNode) rowClicked = dom$J.hasClass(target.parentNode, 'is-builder');
77237
77262
  let containerClicked = dom$J.hasClass(target, 'is-builder');
77238
77263
  let a = false,
77239
77264
  b = false,
@@ -79417,35 +79442,35 @@ class ContentBuilder {
79417
79442
  }
79418
79443
 
79419
79444
  contentword.innerHTML = sPastedText;
79420
-
79421
- if (this.opts.paste === 'html') {
79422
- //with styles
79423
- let elms = contentword.querySelectorAll('*');
79424
- Array.prototype.forEach.call(elms, elm => {
79425
- for (let n = 0; n < elm.attributes.length; n++) {
79426
- if (elm.attributes[n].name !== 'style') elm.removeAttribute(elm.attributes[n].name);
79427
- }
79428
- });
79429
- } else {
79430
- //html-without-styles (default)
79431
- const removeAttributes = element => {
79432
- while (element.attributes.length > 0) {
79433
- element.removeAttribute(element.attributes[0].name);
79434
- }
79435
- };
79436
-
79437
- let elms = contentword.querySelectorAll('*');
79438
- Array.prototype.forEach.call(elms, elm => {
79439
- removeAttributes(elm);
79440
- });
79445
+ /*
79446
+ // remove attributes
79447
+ if(this.opts.paste === 'html'){//with styles
79448
+ let elms = contentword.querySelectorAll('*');
79449
+ Array.prototype.forEach.call(elms, (elm) => {
79450
+ for(let n = 0;n<elm.attributes.length;n++) {
79451
+ if(elm.attributes[n].name!=='style') elm.removeAttribute(elm.attributes[n].name);
79452
+ }
79453
+ });
79454
+ } else { //html-without-styles (default)
79455
+
79456
+ const removeAttributes = (element) => {
79457
+ while (element.attributes.length > 0) {
79458
+ element.removeAttribute(element.attributes[0].name);
79459
+ }
79460
+ };
79461
+ let elms = contentword.querySelectorAll('*');
79462
+ Array.prototype.forEach.call(elms, (elm) => {
79463
+ removeAttributes(elm);
79464
+ });
79441
79465
  }
79466
+ */
79467
+
79442
79468
  /*
79443
79469
  Additional Cleanup:
79444
79470
  - Remove p inside li
79445
79471
  - Remove li with white-space: pre
79446
79472
  */
79447
79473
 
79448
-
79449
79474
  let elms = contentword.querySelectorAll('li');
79450
79475
  Array.prototype.forEach.call(elms, elm => {
79451
79476
  elm.style.whiteSpace = '';
@@ -83438,6 +83463,8 @@ class ContentBox {
83438
83463
  onVideoSelectClick: this.settings.onVideoSelectClick,
83439
83464
  onImageBrowseClick: this.settings.onImageBrowseClick,
83440
83465
  onImageSettingClick: this.settings.onImageSettingClick,
83466
+ onImageEditClick: this.settings.onImageEditClick,
83467
+ setCropperConfig: this.settings.setCropperConfig,
83441
83468
  onPluginsLoaded: this.settings.onPluginsLoaded,
83442
83469
  imageselect: this.settings.imageselect,
83443
83470
  fileselect: this.settings.fileselect,