lisichatbot 1.7.8 โ 1.8.0
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 +1 -1
- package/src/index.js +43 -11
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1051,7 +1051,7 @@ function renderMinMaxInputs(field, customConfig, existingData) {
|
|
|
1051
1051
|
rangeWrapper.setAttribute('data-field', field);
|
|
1052
1052
|
rangeWrapper.style.marginBottom = '16px';
|
|
1053
1053
|
rangeWrapper.style.display = 'flex';
|
|
1054
|
-
rangeWrapper.style.gap = '
|
|
1054
|
+
rangeWrapper.style.gap = '0px';
|
|
1055
1055
|
rangeWrapper.style.flexWrap = 'wrap';
|
|
1056
1056
|
|
|
1057
1057
|
const showMinMax = existingData !== undefined &&
|
|
@@ -1062,7 +1062,7 @@ function renderMinMaxInputs(field, customConfig, existingData) {
|
|
|
1062
1062
|
|
|
1063
1063
|
const minClone = minTemplate.cloneNode(true);
|
|
1064
1064
|
minClone.style.display = '';
|
|
1065
|
-
minClone.style.marginRight = '
|
|
1065
|
+
minClone.style.marginRight = '0px';
|
|
1066
1066
|
minClone.style.marginBottom = '12px';
|
|
1067
1067
|
minClone.style.width = 'auto';
|
|
1068
1068
|
minClone.style.flex = 'none';
|
|
@@ -2517,12 +2517,37 @@ async function showNextStep() {
|
|
|
2517
2517
|
const nextStep = flowData.flow[chatState.step];
|
|
2518
2518
|
|
|
2519
2519
|
// โ
NEW: Clean up any previously injected elements (from addElements)
|
|
2520
|
-
//
|
|
2520
|
+
// Restore them to their original location instead of deleting
|
|
2521
2521
|
if (elements.messages) {
|
|
2522
2522
|
const injectedElements = elements.messages.querySelectorAll('[data-chat-injected="true"]');
|
|
2523
2523
|
if (injectedElements.length > 0) {
|
|
2524
|
-
console.log(` ๐งน
|
|
2525
|
-
injectedElements.forEach(el =>
|
|
2524
|
+
console.log(` ๐งน Restoring ${injectedElements.length} previously injected element(s) to original location`);
|
|
2525
|
+
injectedElements.forEach(el => {
|
|
2526
|
+
// Remove the injected marker
|
|
2527
|
+
el.removeAttribute('data-chat-injected');
|
|
2528
|
+
|
|
2529
|
+
// Restore to original location
|
|
2530
|
+
if (el._originalParent) {
|
|
2531
|
+
if (el._originalNextSibling) {
|
|
2532
|
+
el._originalParent.insertBefore(el, el._originalNextSibling);
|
|
2533
|
+
} else {
|
|
2534
|
+
el._originalParent.appendChild(el);
|
|
2535
|
+
}
|
|
2536
|
+
// Hide it again
|
|
2537
|
+
el.style.display = 'none';
|
|
2538
|
+
|
|
2539
|
+
// Clean up references
|
|
2540
|
+
delete el._originalParent;
|
|
2541
|
+
delete el._originalNextSibling;
|
|
2542
|
+
el.removeAttribute('data-original-parent');
|
|
2543
|
+
|
|
2544
|
+
console.log(` โ
Restored element to original location`);
|
|
2545
|
+
} else {
|
|
2546
|
+
// Fallback: just remove if no original parent stored
|
|
2547
|
+
el.remove();
|
|
2548
|
+
console.log(` โ ๏ธ No original parent - removed element`);
|
|
2549
|
+
}
|
|
2550
|
+
});
|
|
2526
2551
|
}
|
|
2527
2552
|
}
|
|
2528
2553
|
|
|
@@ -2889,17 +2914,24 @@ async function showNextStep() {
|
|
|
2889
2914
|
const element = document.querySelector(selector);
|
|
2890
2915
|
|
|
2891
2916
|
if (element) {
|
|
2892
|
-
//
|
|
2893
|
-
|
|
2917
|
+
// โ
NEW: Move element instead of cloning to preserve event listeners
|
|
2918
|
+
// Save original parent and position for restoration
|
|
2919
|
+
const originalParent = element.parentNode;
|
|
2920
|
+
const originalNextSibling = element.nextSibling;
|
|
2921
|
+
|
|
2922
|
+
// Store restoration info on the element
|
|
2923
|
+
element.setAttribute('data-original-parent', 'true');
|
|
2924
|
+
element._originalParent = originalParent;
|
|
2925
|
+
element._originalNextSibling = originalNextSibling;
|
|
2894
2926
|
|
|
2895
2927
|
// Make it visible (in case it was hidden)
|
|
2896
|
-
|
|
2928
|
+
element.style.display = '';
|
|
2897
2929
|
|
|
2898
2930
|
// โ
Mark as injected for cleanup
|
|
2899
|
-
|
|
2931
|
+
element.setAttribute('data-chat-injected', 'true');
|
|
2900
2932
|
|
|
2901
|
-
//
|
|
2902
|
-
elements.messages.appendChild(
|
|
2933
|
+
// Move to messages container (preserves event listeners!)
|
|
2934
|
+
elements.messages.appendChild(element);
|
|
2903
2935
|
|
|
2904
2936
|
console.log(` โ
Added element ${index + 1}: ${selector}`);
|
|
2905
2937
|
} else {
|