@innovastudio/contentbuilder 1.4.95 → 1.4.97

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.95",
4
+ "version": "1.4.97",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -14404,9 +14404,9 @@ class HtmlUtil {
14404
14404
  </div>
14405
14405
 
14406
14406
  <div class="is-modal viewhtmlmonaco" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
14407
- <div class="is-modal-content" style="max-width: 55vw;padding:0">
14407
+ <div class="is-modal-content" style="width:${this.builder.blockCodeEditorWidth};max-width:${this.builder.blockCodeEditorMaxWidth};padding:0">
14408
14408
  <textarea style="position:absolute;display:none;"></textarea>
14409
- <div class="input-code-editor" style="width:100%;height:65vh;"></div>
14409
+ <div class="input-code-editor" style="width:100%;height:${this.builder.blockCodeEditorHeight};"></div>
14410
14410
  <div class="is-modal-footer" style="display:flex;justify-content:flex-end;border-top:1px solid ${this.builder.styleSeparatorColor};">
14411
14411
  <button title="${util.out('Cancel')}" class="input-cancel classic-secondary">${util.out('Cancel')}</button>
14412
14412
  <button title="${util.out('Ok')}" class="input-ok classic-primary">${util.out('Ok')}</button>
@@ -14415,8 +14415,8 @@ class HtmlUtil {
14415
14415
  </div>
14416
14416
 
14417
14417
  <div class="is-modal viewhtmlexternal" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
14418
- <div class="is-modal-content" style="max-width: 55vw;padding:0">
14419
- <div class="input-code-editor" style="width:100%;height:65vh;"></div>
14418
+ <div class="is-modal-content" style="width:${this.builder.codeEditorWidth};max-width:${this.builder.codeEditorMaxWidth};padding:0">
14419
+ <div class="input-code-editor" style="width:100%;height:${this.builder.codeEditorHeight};"></div>
14420
14420
  <div class="is-modal-footer" style="display:flex;justify-content:flex-end;border-top:1px solid ${this.builder.styleSeparatorColor};">
14421
14421
  <button title="${util.out('Cancel')}" class="input-cancel classic-secondary">${util.out('Cancel')}</button>
14422
14422
  <button title="${util.out('Ok')}" class="input-ok classic-primary">${util.out('Ok')}</button>
@@ -14783,6 +14783,16 @@ class HtmlUtil {
14783
14783
  this.builder.codeEditorArea = area;
14784
14784
  let codeEditor = viewhtml.querySelector('.input-code-editor');
14785
14785
  codeEditor.style.opacity = '';
14786
+ let modelContent = viewhtml.querySelector('.is-modal-content');
14787
+ if (mode === 'full') {
14788
+ modelContent.style.width = this.builder.codeEditorWidth;
14789
+ modelContent.style.maxWidth = this.builder.codeEditorMaxWidth;
14790
+ codeEditor.style.height = this.builder.codeEditorHeight;
14791
+ } else {
14792
+ modelContent.style.width = this.builder.blockCodeEditorWidth;
14793
+ modelContent.style.maxWidth = this.builder.blockCodeEditorMaxWidth;
14794
+ codeEditor.style.height = this.builder.blockCodeEditorHeight;
14795
+ }
14786
14796
  }
14787
14797
  fromViewToActual(html) {
14788
14798
  for (var key in hash$1) {
@@ -49652,13 +49662,13 @@ class Image$1 {
49652
49662
  </div>
49653
49663
 
49654
49664
  <div class="is-modal imageselect" style="z-index:10005" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
49655
- <div style="max-width:${this.builder.imageSelectWidth};height:${this.builder.imageSelectHeight};padding:0;">
49665
+ <div style="width:${this.builder.imageSelectWidth};max-width:${this.builder.imageSelectMaxWidth};height:${this.builder.imageSelectHeight};padding:0;">
49656
49666
  <iframe tabindex="0" style="width:100%;height:100%;border: none;display: block;" src="about:blank"></iframe>
49657
49667
  </div>
49658
49668
  </div>
49659
49669
 
49660
49670
  <div class="is-modal mediaselect" style="z-index:10005" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
49661
- <div style="max-width:${this.builder.mediaSelectWidth};height:${this.builder.mediaSelectHeight};padding:0;">
49671
+ <div style="width:${this.builder.mediaSelectWidth};max-width:${this.builder.mediaSelectMaxWidth};height:${this.builder.mediaSelectHeight};padding:0;">
49662
49672
  <iframe tabindex="0" style="width:100%;height:100%;border: none;display: block;" src="about:blank"></iframe>
49663
49673
  </div>
49664
49674
  </div>
@@ -50085,6 +50095,8 @@ class Image$1 {
50085
50095
  if (this.builder.opts.onImageSelectClick || this.builder.opts.imageselect) {
50086
50096
  btnOpenAsset.style.display = 'block';
50087
50097
  dom.addEventListener(btnOpenAsset, 'click', () => {
50098
+ let img = this.builder.activeImage;
50099
+ let currentSrc = img ? img.getAttribute('src') : '';
50088
50100
  this.builder.openImageSelect(src => {
50089
50101
  this.builder.uo.saveForUndo();
50090
50102
  let img = this.builder.activeImage;
@@ -50105,7 +50117,7 @@ class Image$1 {
50105
50117
 
50106
50118
  //Trigger Render event
50107
50119
  this.builder.opts.onRender();
50108
- });
50120
+ }, currentSrc);
50109
50121
  });
50110
50122
  } else {
50111
50123
  btnOpenAsset.style.display = 'none';
@@ -52731,12 +52743,12 @@ class Hyperlink {
52731
52743
  </div>
52732
52744
 
52733
52745
  <div class="is-modal fileselect" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
52734
- <div class="is-modal-content" style="max-width:${this.builder.fileSelectWidth};height:${this.builder.fileSelectHeight};padding:0;">
52746
+ <div class="is-modal-content" style="width:${this.builder.fileSelectWidth};max-width:${this.builder.fileSelectMaxWidth};height:${this.builder.fileSelectHeight};padding:0;">
52735
52747
  <iframe tabindex="0" style="width:100%;height:100%;border: none;display: block;" src="about:blank"></iframe>
52736
52748
  </div>
52737
52749
  </div>
52738
52750
  <div class="is-modal otherselect" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
52739
- <div class="is-modal-content" style="max-width:${this.builder.otherSelectWidth};height:${this.builder.otherSelectHeight};padding:0;">
52751
+ <div class="is-modal-content" style="width:${this.builder.otherSelectWidth};max-width:${this.builder.otherSelectMaxWidth};height:${this.builder.otherSelectHeight};padding:0;">
52740
52752
  <iframe tabindex="0" style="width:100%;height:100%;border: none;display: block;" src="about:blank"></iframe>
52741
52753
  </div>
52742
52754
  </div>
@@ -54849,7 +54861,7 @@ class Video {
54849
54861
  </div>
54850
54862
 
54851
54863
  <div class="is-modal videoselect" style="z-index:10005" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
54852
- <div style="max-width:${this.builder.videoSelectWidth};height:${this.builder.videoSelectHeight};padding:0;">
54864
+ <div style="width:${this.builder.videoSelectWidth};max-width:${this.builder.videoSelectMaxWidth};height:${this.builder.videoSelectHeight};padding:0;">
54853
54865
  <iframe tabindex="0" style="width:100%;height:100%;border: none;display: block;" src="about:blank"></iframe>
54854
54866
  </div>
54855
54867
  </div>
@@ -55060,7 +55072,7 @@ class Audio {
55060
55072
  </div>
55061
55073
 
55062
55074
  <div class="is-modal audioselect" style="z-index:10005" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
55063
- <div style="max-width:${this.builder.audioSelectWidth};height:${this.builder.audioSelectHeight};padding:0;">
55075
+ <div style="width:${this.builder.audioSelectWidth};max-width:${this.builder.audioSelectMaxWidth};height:${this.builder.audioSelectHeight};padding:0;">
55064
55076
  <iframe tabindex="0" style="width:100%;height:100%;border: none;display: block;" src="about:blank"></iframe>
55065
55077
  </div>
55066
55078
  </div>
@@ -60112,6 +60124,8 @@ class ColumnTool {
60112
60124
  const inpSrc = this.cellSettings.querySelector('.input-src');
60113
60125
  elm = this.divCellClick.querySelector('.input-select');
60114
60126
  if (elm) dom.addEventListener(elm, 'click', () => {
60127
+ //TODO: Simplify using openAsset
60128
+
60115
60129
  //---default
60116
60130
  this.builder.targetInput = inpSrc; // used by selectAsset() (see contentbuilder.js)
60117
60131
  this.builder.targetCallback = () => {
@@ -78970,18 +78984,30 @@ class ContentBuilder {
78970
78984
  otherSelectCaption: 'Select Document',
78971
78985
  // otherSelectIcon: '<svg class="is-icon-flex"><use xlink:href="#ion-ios-folder-outline"></use></svg>',
78972
78986
  otherSelectIcon: '<svg class="is-icon-flex" style="width:16px;height:16px;"><use xlink:href="#icon-list-search"></use></svg>',
78973
- imageSelectWidth: '1024px',
78987
+ imageSelectWidth: '80vw',
78974
78988
  imageSelectHeight: '80vh',
78975
- fileSelectWidth: '1024px',
78989
+ fileSelectWidth: '80vw',
78976
78990
  fileSelectHeight: '80vh',
78977
- videoSelectWidth: '1024px',
78991
+ videoSelectWidth: '80vw',
78978
78992
  videoSelectHeight: '80vh',
78979
- audioSelectWidth: '1024px',
78993
+ audioSelectWidth: '80vw',
78980
78994
  audioSelectHeight: '80vh',
78981
- mediaSelectWidth: '1024px',
78995
+ mediaSelectWidth: '80vw',
78982
78996
  mediaSelectHeight: '80vh',
78983
- otherSelectWidth: '1024px',
78997
+ otherSelectWidth: '80vw',
78984
78998
  otherSelectHeight: '80vh',
78999
+ imageSelectMaxWidth: '1600px',
79000
+ fileSelectMaxWidth: '1600px',
79001
+ videoSelectMaxWidth: '1600px',
79002
+ audioSelectMaxWidth: '1600px',
79003
+ mediaSelectMaxWidth: '1600px',
79004
+ otherSelectMaxWidth: '1600px',
79005
+ codeEditorWidth: '80vw',
79006
+ codeEditorHeight: '80vh',
79007
+ codeEditorMaxWidth: '1600px',
79008
+ blockCodeEditorWidth: '80vw',
79009
+ blockCodeEditorHeight: '45vh',
79010
+ blockCodeEditorMaxWidth: '960px',
78985
79011
  assetRefresh: false,
78986
79012
  // asset manager specified in imageSelect, fileSelect & videoSelect will always refreshed on click/open
78987
79013
  customTags: [],
@@ -80938,12 +80964,12 @@ class ContentBuilder {
80938
80964
  return this.targetAssetType; // not used yet
80939
80965
  }
80940
80966
 
80941
- openImageSelect(callback) {
80967
+ openImageSelect(callback, defaultValue) {
80942
80968
  const inpUrl = document.createElement('input');
80943
80969
 
80944
80970
  // dummy button (for the openAsset() method, for the old Asset Manager. Not needed for the new.)
80945
80971
  const btn = document.createElement('button');
80946
- this.openAsset(inpUrl, 'image', btn);
80972
+ this.openAsset(inpUrl, 'image', btn, defaultValue);
80947
80973
  let out = s => this.util.out(s);
80948
80974
  const desc = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
80949
80975
  Object.defineProperty(inpUrl, 'value', {
@@ -81036,7 +81062,9 @@ class ContentBuilder {
81036
81062
  this.targetAssetType = targetAssetType;
81037
81063
  }
81038
81064
  }
81039
- openAsset(targetInput, targetAssetType, theTrigger) {
81065
+ openAsset(targetInput, targetAssetType, theTrigger, defaultValue) {
81066
+ let iframe;
81067
+ let modal;
81040
81068
  if (targetAssetType === 'media' && (this.opts.onMediaSelectClick || this.opts.onImageSelectClick)) {
81041
81069
  if (this.opts.onMediaSelectClick) {
81042
81070
  this.opts.onMediaSelectClick({
@@ -81070,8 +81098,6 @@ class ContentBuilder {
81070
81098
  theTrigger: theTrigger
81071
81099
  });
81072
81100
  } else {
81073
- let iframe;
81074
- let modal;
81075
81101
  if (targetAssetType === 'media') {
81076
81102
  modal = this.builderStuff.querySelector('.is-modal.mediaselect');
81077
81103
  iframe = modal.querySelector('iframe');
@@ -81100,6 +81126,23 @@ class ContentBuilder {
81100
81126
  this.targetCallback = null;
81101
81127
  this.targetAssetType = targetAssetType;
81102
81128
  }
81129
+ if (!defaultValue) defaultValue = '';
81130
+ if (targetInput && targetInput.value) {
81131
+ defaultValue = targetInput.value;
81132
+ }
81133
+ if (this.onAssetOpen) {
81134
+ if (iframe) {
81135
+ if (iframe.contentWindow.document.body.innerHTML !== '') {
81136
+ this.onAssetOpen(defaultValue, iframe.contentWindow);
81137
+ } else {
81138
+ iframe.addEventListener('load', () => {
81139
+ this.onAssetOpen(defaultValue, iframe.contentWindow);
81140
+ });
81141
+ }
81142
+ } else {
81143
+ this.onAssetOpen(defaultValue, iframe);
81144
+ }
81145
+ }
81103
81146
  }
81104
81147
 
81105
81148
  // Grid