@innovastudio/contentbuilder 1.4.95 → 1.4.96
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
|
@@ -50085,6 +50085,8 @@ class Image$1 {
|
|
|
50085
50085
|
if (this.builder.opts.onImageSelectClick || this.builder.opts.imageselect) {
|
|
50086
50086
|
btnOpenAsset.style.display = 'block';
|
|
50087
50087
|
dom.addEventListener(btnOpenAsset, 'click', () => {
|
|
50088
|
+
let img = this.builder.activeImage;
|
|
50089
|
+
let currentSrc = img ? img.getAttribute('src') : '';
|
|
50088
50090
|
this.builder.openImageSelect(src => {
|
|
50089
50091
|
this.builder.uo.saveForUndo();
|
|
50090
50092
|
let img = this.builder.activeImage;
|
|
@@ -50105,7 +50107,7 @@ class Image$1 {
|
|
|
50105
50107
|
|
|
50106
50108
|
//Trigger Render event
|
|
50107
50109
|
this.builder.opts.onRender();
|
|
50108
|
-
});
|
|
50110
|
+
}, currentSrc);
|
|
50109
50111
|
});
|
|
50110
50112
|
} else {
|
|
50111
50113
|
btnOpenAsset.style.display = 'none';
|
|
@@ -60112,6 +60114,8 @@ class ColumnTool {
|
|
|
60112
60114
|
const inpSrc = this.cellSettings.querySelector('.input-src');
|
|
60113
60115
|
elm = this.divCellClick.querySelector('.input-select');
|
|
60114
60116
|
if (elm) dom.addEventListener(elm, 'click', () => {
|
|
60117
|
+
//TODO: Simplify using openAsset
|
|
60118
|
+
|
|
60115
60119
|
//---default
|
|
60116
60120
|
this.builder.targetInput = inpSrc; // used by selectAsset() (see contentbuilder.js)
|
|
60117
60121
|
this.builder.targetCallback = () => {
|
|
@@ -80938,12 +80942,12 @@ class ContentBuilder {
|
|
|
80938
80942
|
return this.targetAssetType; // not used yet
|
|
80939
80943
|
}
|
|
80940
80944
|
|
|
80941
|
-
openImageSelect(callback) {
|
|
80945
|
+
openImageSelect(callback, defaultValue) {
|
|
80942
80946
|
const inpUrl = document.createElement('input');
|
|
80943
80947
|
|
|
80944
80948
|
// dummy button (for the openAsset() method, for the old Asset Manager. Not needed for the new.)
|
|
80945
80949
|
const btn = document.createElement('button');
|
|
80946
|
-
this.openAsset(inpUrl, 'image', btn);
|
|
80950
|
+
this.openAsset(inpUrl, 'image', btn, defaultValue);
|
|
80947
80951
|
let out = s => this.util.out(s);
|
|
80948
80952
|
const desc = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
|
|
80949
80953
|
Object.defineProperty(inpUrl, 'value', {
|
|
@@ -81036,7 +81040,9 @@ class ContentBuilder {
|
|
|
81036
81040
|
this.targetAssetType = targetAssetType;
|
|
81037
81041
|
}
|
|
81038
81042
|
}
|
|
81039
|
-
openAsset(targetInput, targetAssetType, theTrigger) {
|
|
81043
|
+
openAsset(targetInput, targetAssetType, theTrigger, defaultValue) {
|
|
81044
|
+
let iframe;
|
|
81045
|
+
let modal;
|
|
81040
81046
|
if (targetAssetType === 'media' && (this.opts.onMediaSelectClick || this.opts.onImageSelectClick)) {
|
|
81041
81047
|
if (this.opts.onMediaSelectClick) {
|
|
81042
81048
|
this.opts.onMediaSelectClick({
|
|
@@ -81070,8 +81076,6 @@ class ContentBuilder {
|
|
|
81070
81076
|
theTrigger: theTrigger
|
|
81071
81077
|
});
|
|
81072
81078
|
} else {
|
|
81073
|
-
let iframe;
|
|
81074
|
-
let modal;
|
|
81075
81079
|
if (targetAssetType === 'media') {
|
|
81076
81080
|
modal = this.builderStuff.querySelector('.is-modal.mediaselect');
|
|
81077
81081
|
iframe = modal.querySelector('iframe');
|
|
@@ -81100,6 +81104,23 @@ class ContentBuilder {
|
|
|
81100
81104
|
this.targetCallback = null;
|
|
81101
81105
|
this.targetAssetType = targetAssetType;
|
|
81102
81106
|
}
|
|
81107
|
+
if (!defaultValue) defaultValue = '';
|
|
81108
|
+
if (targetInput && targetInput.value) {
|
|
81109
|
+
defaultValue = targetInput.value;
|
|
81110
|
+
}
|
|
81111
|
+
if (this.onAssetOpen) {
|
|
81112
|
+
if (iframe) {
|
|
81113
|
+
if (iframe.contentWindow.document.body.innerHTML !== '') {
|
|
81114
|
+
this.onAssetOpen(defaultValue, iframe.contentWindow);
|
|
81115
|
+
} else {
|
|
81116
|
+
iframe.addEventListener('load', () => {
|
|
81117
|
+
this.onAssetOpen(defaultValue, iframe.contentWindow);
|
|
81118
|
+
});
|
|
81119
|
+
}
|
|
81120
|
+
} else {
|
|
81121
|
+
this.onAssetOpen(defaultValue, iframe);
|
|
81122
|
+
}
|
|
81123
|
+
}
|
|
81103
81124
|
}
|
|
81104
81125
|
|
|
81105
81126
|
// Grid
|