@innovastudio/contentbuilder 1.4.94 → 1.4.95

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.4.94",
4
+ "version": "1.4.95",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -2077,7 +2077,7 @@ button:focus-visible {
2077
2077
  .is-ui .is-modal.imageadjust2,
2078
2078
  .is-ui .is-modal.audioselect,
2079
2079
  .is-ui .is-modal.mediasource {
2080
- z-index: 10005 !important;
2080
+ z-index: 10006 !important;
2081
2081
  }
2082
2082
  #_cbhtml .is-modal.previewcontent,
2083
2083
  .is-ui .is-modal.previewcontent {
@@ -15886,10 +15886,6 @@ const prepareSvgIcons = builder => {
15886
15886
  <path d="M4 12h4"></path>
15887
15887
  <path d="M4 18h4"></path>
15888
15888
  </symbol>
15889
- <symbol id="icon-folder" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
15890
- <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
15891
- <path d="M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2"></path>
15892
- </symbol>
15893
15889
  <symbol id="icon-folder-media" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
15894
15890
  <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
15895
15891
  <path d="M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2"></path>
@@ -15958,6 +15954,23 @@ const prepareSvgIcons = builder => {
15958
15954
  <path d="M18 18m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"></path>
15959
15955
  <path d="M20.2 20.2l1.8 1.8"></path>
15960
15956
  </symbol>
15957
+
15958
+ <symbol id="icon-folder-old" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
15959
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
15960
+ <path d="M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2"></path>
15961
+ </symbol>
15962
+ <symbol id="icon-folder" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
15963
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
15964
+ <path d="M11 19h-6a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v2.5"></path>
15965
+ <path d="M18 18m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"></path>
15966
+ <path d="M20.2 20.2l1.8 1.8"></path>
15967
+ </symbol>
15968
+ <symbol id="icon-folder2" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
15969
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
15970
+ <path d="M11 19h-6a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v2.5"></path>
15971
+ <path d="M18 18m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"></path>
15972
+ <path d="M20.2 20.2l1.8 1.8"></path>
15973
+ </symbol>
15961
15974
 
15962
15975
  </defs>
15963
15976
  </svg>`;
@@ -49551,6 +49564,7 @@ class Image$1 {
49551
49564
  <input title="${util.out('Change Image')}" data-title="${util.out('Change Image')}" id="fileEmbedImage" type="file" accept="image/*" style="position:absolute;top:-20px;left:0;width:40px;height:60px;opacity: 0;cursor: pointer;"/>
49552
49565
  </div>
49553
49566
  <button tabindex="0" title="${util.out('Link')}" data-title="${util.out('Link')}" class="image-link" style="width:40px;height:40px;"><svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-link"></use></svg></button>
49567
+ <button tabindex="0" title="${util.out('Select')}" data-title="${util.out('Select')}" class="open-asset" style="display:none;width:40px;height:40px;"><svg class="is-icon-flex" style="width:17px;height:17px;color:#fff"><use xlink:href="#icon-folder2"></use></svg></button>
49554
49568
  <button tabindex="0" title="${util.out('Edit')}" data-title="${util.out('Edit')}" class="image-edit" style="width:40px;height:40px;"><svg class="is-icon-flex" style="width:14px;height:14px;"><use xlink:href="#ion-android-create"></use></svg></button>
49555
49569
  </div>
49556
49570
  <div id="divImageProgress">
@@ -50067,6 +50081,35 @@ class Image$1 {
50067
50081
  util.hideModal(modalImageLink);
50068
50082
  this.builder.elmTool.refresh();
50069
50083
  });
50084
+ const btnOpenAsset = imageTool.querySelector('.open-asset');
50085
+ if (this.builder.opts.onImageSelectClick || this.builder.opts.imageselect) {
50086
+ btnOpenAsset.style.display = 'block';
50087
+ dom.addEventListener(btnOpenAsset, 'click', () => {
50088
+ this.builder.openImageSelect(src => {
50089
+ this.builder.uo.saveForUndo();
50090
+ let img = this.builder.activeImage;
50091
+ img.setAttribute('src', src);
50092
+ setTimeout(() => {
50093
+ img.click();
50094
+ let divImageResizer = document.querySelector('#divImageResizer');
50095
+ if (divImageResizer) divImageResizer.click();
50096
+ setTimeout(() => {
50097
+ img.click();
50098
+ let divImageResizer = document.querySelector('#divImageResizer');
50099
+ if (divImageResizer) divImageResizer.click();
50100
+ }, 600);
50101
+ }, 10);
50102
+
50103
+ //Trigger Change event
50104
+ this.builder.opts.onChange();
50105
+
50106
+ //Trigger Render event
50107
+ this.builder.opts.onRender();
50108
+ });
50109
+ });
50110
+ } else {
50111
+ btnOpenAsset.style.display = 'none';
50112
+ }
50070
50113
 
50071
50114
  // Select image (opens Asset Manager plugin or custom dialog)
50072
50115
  let divImageSrc = modalImageLink.querySelector('.image-src');
@@ -80895,6 +80938,35 @@ class ContentBuilder {
80895
80938
  return this.targetAssetType; // not used yet
80896
80939
  }
80897
80940
 
80941
+ openImageSelect(callback) {
80942
+ const inpUrl = document.createElement('input');
80943
+
80944
+ // dummy button (for the openAsset() method, for the old Asset Manager. Not needed for the new.)
80945
+ const btn = document.createElement('button');
80946
+ this.openAsset(inpUrl, 'image', btn);
80947
+ let out = s => this.util.out(s);
80948
+ const desc = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
80949
+ Object.defineProperty(inpUrl, 'value', {
80950
+ get: desc.get,
80951
+ set: function (s) {
80952
+ // Additional protection if normal selectAsset() is not used in asset dialog.
80953
+ // This is used if onImageSelectClick or onFileSelectClick are used.
80954
+ const filename = s.substring(s.lastIndexOf('/') + 1);
80955
+ let extension = filename.split('.').pop();
80956
+ extension = extension.toLowerCase();
80957
+ let ok = false;
80958
+ if (extension === 'jpg' || extension === 'jpeg' || extension === 'png' || extension === 'gif' || extension === 'webm' || extension === 'webp') {
80959
+ ok = true;
80960
+ } else {
80961
+ alert(out('Please select an image file.'));
80962
+ }
80963
+ if (ok) {
80964
+ if (callback) callback(s);
80965
+ }
80966
+ desc.set.call(this, s);
80967
+ }
80968
+ });
80969
+ }
80898
80970
  renderSelectAsset(btn, targetAssetType, callback) {
80899
80971
  const _id = 'inp_' + this.util.makeId();
80900
80972
  btn.insertAdjacentHTML('afterend', `<input type="hidden" id="${_id}">`);