@innovastudio/contentbox 1.6.196 → 1.6.197
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,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@innovastudio/contentbox",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.197",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "public/contentbox/contentbox.esm.js",
|
|
7
7
|
"types": "index.d.ts",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"ws": "^8.13.0"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@innovastudio/contentbuilder": "^1.5.
|
|
70
|
+
"@innovastudio/contentbuilder": "^1.5.215",
|
|
71
71
|
"js-beautify": "^1.14.0",
|
|
72
72
|
"marked": "^17.0.0",
|
|
73
73
|
"sortablejs": "^1.15.2"
|
|
@@ -69763,11 +69763,23 @@ class Plugin {
|
|
|
69763
69763
|
}
|
|
69764
69764
|
};
|
|
69765
69765
|
if (!this.builder.handlePluginClick_) {
|
|
69766
|
-
document.addEventListener('click', handlePluginClick);
|
|
69767
|
-
if (this.builder.iframeDocument) {
|
|
69768
|
-
this.builder.doc.addEventListener('click', handlePluginClick);
|
|
69769
|
-
}
|
|
69770
69766
|
this.builder.handlePluginClick_ = true;
|
|
69767
|
+
// Register on the NEXT task, not now. showPluginEditor() can be
|
|
69768
|
+
// reached from a microtask inside the very click that opens the
|
|
69769
|
+
// panel: the RTE button runs convertSelectionToPlugin(), whose
|
|
69770
|
+
// runtime.reinitialize().then() resolves while that click is still
|
|
69771
|
+
// propagating towards document. A listener added mid-propagation
|
|
69772
|
+
// still receives that same click, so the panel was closed the
|
|
69773
|
+
// instant it opened — and only on a first open, because afterwards
|
|
69774
|
+
// the previous listener had already fired and removed itself.
|
|
69775
|
+
// Deferring means this listener can never see the click that
|
|
69776
|
+
// created it, whichever toolbar or panel opened the panel.
|
|
69777
|
+
setTimeout(() => {
|
|
69778
|
+
document.addEventListener('click', handlePluginClick);
|
|
69779
|
+
if (this.builder.iframeDocument) {
|
|
69780
|
+
this.builder.doc.addEventListener('click', handlePluginClick);
|
|
69781
|
+
}
|
|
69782
|
+
}, 0);
|
|
69771
69783
|
}
|
|
69772
69784
|
}
|
|
69773
69785
|
hidePluginEditor() {
|
|
@@ -107083,16 +107095,42 @@ class Resize {
|
|
|
107083
107095
|
enable() {
|
|
107084
107096
|
const col = this.element;
|
|
107085
107097
|
const row = col.parentNode;
|
|
107098
|
+
|
|
107099
|
+
// The builder injects its own elements into a row — tools, the add-row
|
|
107100
|
+
// bar, and the row overlay that appears once the row is selected in the
|
|
107101
|
+
// side panel. They are not columns, and measuring them as columns makes
|
|
107102
|
+
// the totals below nonsense. Filter them out in ONE place so a new
|
|
107103
|
+
// injected element can never silently break the maths again.
|
|
107104
|
+
const isBuilderUI = item => item.nodeType !== 1 || item.classList.contains('is-tool') || item.classList.contains('is-row-tool') || item.classList.contains('is-col-tool') || item.classList.contains('is-rowadd-tool') || item.classList.contains('is-row-overlay');
|
|
107105
|
+
const columnsOf = parent => Array.from(parent.children).filter(item => !isBuilderUI(item));
|
|
107106
|
+
|
|
107107
|
+
// A column width is only ever stored as a percentage; pixels are used
|
|
107108
|
+
// purely while a drag is in progress. resizeEnd normally converts them
|
|
107109
|
+
// back, but it does not run if the drag is interrupted — and pixel
|
|
107110
|
+
// widths saved into the page push content off screen on smaller
|
|
107111
|
+
// devices. This is the backstop for that: whatever happens to the drag,
|
|
107112
|
+
// a leftover pixel width is converted on the next tick. Capture phase,
|
|
107113
|
+
// so it still runs if something stops the event bubbling.
|
|
107114
|
+
const normalizeToPercent = () => {
|
|
107115
|
+
setTimeout(() => {
|
|
107116
|
+
if (!col.style.width || col.style.width.indexOf('px') === -1) return;
|
|
107117
|
+
const parent = col.parentNode;
|
|
107118
|
+
if (!parent || !parent.offsetWidth) return;
|
|
107119
|
+
const pct = col.offsetWidth / parent.offsetWidth * 100;
|
|
107120
|
+
if (isFinite(pct) && pct > 0) col.style.width = pct + '%';
|
|
107121
|
+
}, 0);
|
|
107122
|
+
};
|
|
107123
|
+
this.normalizeToPercent = normalizeToPercent;
|
|
107124
|
+
this.eventTarget = col.ownerDocument;
|
|
107125
|
+
this.eventTarget.addEventListener('mouseup', normalizeToPercent, true);
|
|
107126
|
+
this.eventTarget.addEventListener('touchend', normalizeToPercent, true);
|
|
107086
107127
|
this.resize = new Resizeable({
|
|
107087
107128
|
pane: col,
|
|
107088
107129
|
resizeHeight: this.builder.resizeHeight,
|
|
107089
107130
|
onResize: (width, height) => {
|
|
107090
107131
|
this.builder.util.hideControls();
|
|
107091
107132
|
let numOfCols = 1;
|
|
107092
|
-
|
|
107093
|
-
if (item.classList.contains('is-row-tool')) return;
|
|
107094
|
-
if (item.classList.contains('is-rowadd-tool')) return;
|
|
107095
|
-
if (item.classList.contains('is-col-tool')) return;
|
|
107133
|
+
columnsOf(col.parentNode).map(item => {
|
|
107096
107134
|
if (item === col) return;
|
|
107097
107135
|
numOfCols++;
|
|
107098
107136
|
});
|
|
@@ -107103,10 +107141,7 @@ class Resize {
|
|
|
107103
107141
|
// adjust others
|
|
107104
107142
|
const maxWidth = () => {
|
|
107105
107143
|
let otherWidth = 0;
|
|
107106
|
-
|
|
107107
|
-
if (item.classList.contains('is-row-tool')) return;
|
|
107108
|
-
if (item.classList.contains('is-rowadd-tool')) return;
|
|
107109
|
-
if (item.classList.contains('is-col-tool')) return;
|
|
107144
|
+
columnsOf(col.parentNode).map(item => {
|
|
107110
107145
|
// if(this.opts.filterSibling) if(item.classList.contains(this.opts.filterSibling)) return;
|
|
107111
107146
|
|
|
107112
107147
|
if (item === col) return;
|
|
@@ -107120,10 +107155,7 @@ class Resize {
|
|
|
107120
107155
|
// percentage = (max / row.offsetWidth) * 100;
|
|
107121
107156
|
// Or make others auto
|
|
107122
107157
|
|
|
107123
|
-
|
|
107124
|
-
if (item.classList.contains('is-row-tool')) return;
|
|
107125
|
-
if (item.classList.contains('is-rowadd-tool')) return;
|
|
107126
|
-
if (item.classList.contains('is-col-tool')) return;
|
|
107158
|
+
columnsOf(col.parentNode).map(item => {
|
|
107127
107159
|
// if(this.opts.filterSibling) if(item.classList.contains(this.opts.filterSibling)) return;
|
|
107128
107160
|
|
|
107129
107161
|
if (item === col) return;
|
|
@@ -107161,10 +107193,7 @@ class Resize {
|
|
|
107161
107193
|
}
|
|
107162
107194
|
} else {
|
|
107163
107195
|
// New: if other cols has no width, set to 100%
|
|
107164
|
-
|
|
107165
|
-
if (item.classList.contains('is-row-tool')) return;
|
|
107166
|
-
if (item.classList.contains('is-rowadd-tool')) return;
|
|
107167
|
-
if (item.classList.contains('is-col-tool')) return;
|
|
107196
|
+
columnsOf(col.parentNode).map(item => {
|
|
107168
107197
|
// if(this.opts.filterSibling) if(item.classList.contains(this.opts.filterSibling)) return;
|
|
107169
107198
|
|
|
107170
107199
|
if (item === col) return;
|
|
@@ -107194,10 +107223,7 @@ class Resize {
|
|
|
107194
107223
|
},
|
|
107195
107224
|
resizeEnd: () => {
|
|
107196
107225
|
let numOfCols = 1;
|
|
107197
|
-
|
|
107198
|
-
if (item.classList.contains('is-row-tool')) return;
|
|
107199
|
-
if (item.classList.contains('is-rowadd-tool')) return;
|
|
107200
|
-
if (item.classList.contains('is-col-tool')) return;
|
|
107226
|
+
columnsOf(col.parentNode).map(item => {
|
|
107201
107227
|
if (item === col) return;
|
|
107202
107228
|
numOfCols++;
|
|
107203
107229
|
});
|
|
@@ -107209,13 +107235,9 @@ class Resize {
|
|
|
107209
107235
|
// adjust others
|
|
107210
107236
|
const maxWidth = () => {
|
|
107211
107237
|
let otherWidth = 0;
|
|
107212
|
-
|
|
107213
|
-
if (item.classList.contains('is-row-tool')) return;
|
|
107214
|
-
if (item.classList.contains('is-rowadd-tool')) return;
|
|
107215
|
-
if (item.classList.contains('is-col-tool')) return;
|
|
107238
|
+
columnsOf(col.parentNode).map(item => {
|
|
107216
107239
|
// if(this.opts.filterSibling) if(item.classList.contains(this.opts.filterSibling)) return;
|
|
107217
107240
|
|
|
107218
|
-
if (item.classList.contains('row-tool')) return;
|
|
107219
107241
|
if (item === col) return;
|
|
107220
107242
|
otherWidth += item.offsetWidth;
|
|
107221
107243
|
});
|
|
@@ -107227,10 +107249,7 @@ class Resize {
|
|
|
107227
107249
|
// percentage = (max / row.offsetWidth) * 100;
|
|
107228
107250
|
// Or make others auto
|
|
107229
107251
|
|
|
107230
|
-
|
|
107231
|
-
if (item.classList.contains('is-row-tool')) return;
|
|
107232
|
-
if (item.classList.contains('is-rowadd-tool')) return;
|
|
107233
|
-
if (item.classList.contains('is-col-tool')) return;
|
|
107252
|
+
columnsOf(col.parentNode).map(item => {
|
|
107234
107253
|
// if(this.opts.filterSibling) if(item.classList.contains(this.opts.filterSibling)) return;
|
|
107235
107254
|
|
|
107236
107255
|
if (item === col) return;
|
|
@@ -107260,10 +107279,7 @@ class Resize {
|
|
|
107260
107279
|
// New: Final fix (if column resized exceeds its max)
|
|
107261
107280
|
let othersWidth = 0;
|
|
107262
107281
|
let activeColumnWidth = 0;
|
|
107263
|
-
|
|
107264
|
-
if (item.classList.contains('is-row-tool')) return;
|
|
107265
|
-
if (item.classList.contains('is-rowadd-tool')) return;
|
|
107266
|
-
if (item.classList.contains('is-col-tool')) return;
|
|
107282
|
+
columnsOf(col.parentNode).map(item => {
|
|
107267
107283
|
// if(this.opts.filterSibling) if(item.classList.contains(this.opts.filterSibling)) return;
|
|
107268
107284
|
|
|
107269
107285
|
// // Refresh Module
|
|
@@ -107281,13 +107297,23 @@ class Resize {
|
|
|
107281
107297
|
if (activeColumnWidth > maxResult) {
|
|
107282
107298
|
percentage = maxResult / row.offsetWidth * 100;
|
|
107283
107299
|
}
|
|
107284
|
-
|
|
107300
|
+
|
|
107301
|
+
// The column is carrying a pixel width at this point (set
|
|
107302
|
+
// just above, to measure it). A width is only ever stored as
|
|
107303
|
+
// a percentage, so if the maths produced something CSS will
|
|
107304
|
+
// reject — negative, zero, NaN, Infinity — the assignment
|
|
107305
|
+
// would silently fail and leave those pixels behind, which
|
|
107306
|
+
// then breaks the layout on smaller screens. Fall back to
|
|
107307
|
+
// the column's real share of the row instead.
|
|
107308
|
+
if (!isFinite(percentage) || percentage <= 0) {
|
|
107309
|
+
percentage = col.offsetWidth / row.offsetWidth * 100;
|
|
107310
|
+
}
|
|
107311
|
+
if (isFinite(percentage) && percentage > 0) {
|
|
107312
|
+
col.style.width = percentage + '%';
|
|
107313
|
+
}
|
|
107285
107314
|
|
|
107286
107315
|
// Refresh Module
|
|
107287
|
-
|
|
107288
|
-
if (item.classList.contains('is-row-tool')) return;
|
|
107289
|
-
if (item.classList.contains('is-rowadd-tool')) return;
|
|
107290
|
-
if (item.classList.contains('is-col-tool')) return;
|
|
107316
|
+
columnsOf(col.parentNode).map(item => {
|
|
107291
107317
|
if (item.getAttribute('data-html')) {
|
|
107292
107318
|
let moduleWidth = item.offsetWidth / row.offsetWidth * 100;
|
|
107293
107319
|
item.style.width = moduleWidth + '%';
|
|
@@ -107299,10 +107325,7 @@ class Resize {
|
|
|
107299
107325
|
if (col.style.height) {
|
|
107300
107326
|
col.style.minHeight = col.style.height;
|
|
107301
107327
|
col.style.height = '';
|
|
107302
|
-
|
|
107303
|
-
if (item.classList.contains('is-row-tool')) return;
|
|
107304
|
-
if (item.classList.contains('is-rowadd-tool')) return;
|
|
107305
|
-
if (item.classList.contains('is-col-tool')) return;
|
|
107328
|
+
columnsOf(col.parentNode).map(item => {
|
|
107306
107329
|
// if(this.opts.filterSibling) if(item.classList.contains(this.opts.filterSibling)) return;
|
|
107307
107330
|
|
|
107308
107331
|
if (item === col) return;
|
|
@@ -107322,6 +107345,10 @@ class Resize {
|
|
|
107322
107345
|
});
|
|
107323
107346
|
}
|
|
107324
107347
|
destroy() {
|
|
107348
|
+
if (this.eventTarget && this.normalizeToPercent) {
|
|
107349
|
+
this.eventTarget.removeEventListener('mouseup', this.normalizeToPercent, true);
|
|
107350
|
+
this.eventTarget.removeEventListener('touchend', this.normalizeToPercent, true);
|
|
107351
|
+
}
|
|
107325
107352
|
this.resize.destroy();
|
|
107326
107353
|
}
|
|
107327
107354
|
}
|