lisichatbot 1.1.4 ā 1.1.6
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 +49 -6
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -78,6 +78,12 @@ function addMessage(content, type = 'bot', hasInput = false, stepNumber = null)
|
|
|
78
78
|
|
|
79
79
|
// Clone the existing wrapper
|
|
80
80
|
const clone = existingWrapper.cloneNode(true);
|
|
81
|
+
|
|
82
|
+
// Immediately hide any edit icons in the clone (regardless of template state)
|
|
83
|
+
const allEditIcons = clone.querySelectorAll('[data-chat-element="bot-edit-icon"]');
|
|
84
|
+
allEditIcons.forEach(icon => {
|
|
85
|
+
icon.style.setProperty('display', 'none', 'important');
|
|
86
|
+
});
|
|
81
87
|
|
|
82
88
|
// Add step number if provided
|
|
83
89
|
if (stepNumber !== null) {
|
|
@@ -94,10 +100,15 @@ function addMessage(content, type = 'bot', hasInput = false, stepNumber = null)
|
|
|
94
100
|
|
|
95
101
|
// Handle edit icon for bot messages
|
|
96
102
|
if (type === 'bot') {
|
|
103
|
+
console.log(`\nš Processing bot message - Step ${stepNumber || 'N/A'}, hasInput: ${hasInput}`);
|
|
104
|
+
|
|
97
105
|
const editIcon = clone.querySelector('[data-chat-element="bot-edit-icon"]');
|
|
98
106
|
if (editIcon) {
|
|
99
|
-
|
|
100
|
-
|
|
107
|
+
console.log(' ā Edit icon element found');
|
|
108
|
+
|
|
109
|
+
// ALWAYS hide first with !important to override any CSS
|
|
110
|
+
editIcon.style.setProperty('display', 'none', 'important');
|
|
111
|
+
console.log(' ā Edit icon hidden (display: none !important)');
|
|
101
112
|
|
|
102
113
|
// Only show if this step has input
|
|
103
114
|
if (hasInput && stepNumber !== null) {
|
|
@@ -106,14 +117,21 @@ function addMessage(content, type = 'bot', hasInput = false, stepNumber = null)
|
|
|
106
117
|
e.stopPropagation();
|
|
107
118
|
editStep(stepNumber);
|
|
108
119
|
};
|
|
109
|
-
editIcon.style.display
|
|
110
|
-
console.log(
|
|
120
|
+
editIcon.style.setProperty('display', 'inline', 'important');
|
|
121
|
+
console.log(` āļø Edit icon SHOWN (step ${stepNumber} has input)`);
|
|
111
122
|
} else {
|
|
112
|
-
console.log(
|
|
123
|
+
console.log(` āŖ Edit icon HIDDEN (step ${stepNumber || 'N/A'} has no input)`);
|
|
113
124
|
}
|
|
114
125
|
} else {
|
|
115
|
-
console.warn('ā ļø Edit icon element not found in bot-message-wrapper');
|
|
126
|
+
console.warn(' ā ļø Edit icon element not found in bot-message-wrapper!');
|
|
127
|
+
console.warn(' ā Make sure you have: <span data-chat-element="bot-edit-icon">āļø</span>');
|
|
116
128
|
}
|
|
129
|
+
|
|
130
|
+
// Ensure wrapper has correct flex properties for spacing
|
|
131
|
+
clone.style.setProperty('display', 'inline-flex', 'important');
|
|
132
|
+
clone.style.setProperty('align-items', 'center', 'important');
|
|
133
|
+
clone.style.setProperty('gap', '8px', 'important');
|
|
134
|
+
console.log(' ā Wrapper flex properties set (gap: 8px)');
|
|
117
135
|
}
|
|
118
136
|
|
|
119
137
|
// Make clone visible
|
|
@@ -121,6 +139,30 @@ function addMessage(content, type = 'bot', hasInput = false, stepNumber = null)
|
|
|
121
139
|
|
|
122
140
|
// Append to messages container
|
|
123
141
|
elements.messages.appendChild(clone);
|
|
142
|
+
|
|
143
|
+
// IMPORTANT: Set edit icon display AFTER appending to DOM
|
|
144
|
+
// This ensures our styles override any CSS rules
|
|
145
|
+
if (type === 'bot') {
|
|
146
|
+
const editIconAfterAppend = clone.querySelector('[data-chat-element="bot-edit-icon"]');
|
|
147
|
+
if (editIconAfterAppend) {
|
|
148
|
+
// Force hide with !important AFTER append
|
|
149
|
+
editIconAfterAppend.style.setProperty('display', 'none', 'important');
|
|
150
|
+
editIconAfterAppend.style.setProperty('margin-left', '8px', 'important');
|
|
151
|
+
|
|
152
|
+
// Only show if has input
|
|
153
|
+
if (hasInput && stepNumber !== null) {
|
|
154
|
+
editIconAfterAppend.style.setProperty('display', 'inline', 'important');
|
|
155
|
+
|
|
156
|
+
// Debug: Check spacing
|
|
157
|
+
setTimeout(() => {
|
|
158
|
+
const computedMargin = window.getComputedStyle(editIconAfterAppend).marginLeft;
|
|
159
|
+
const computedGap = window.getComputedStyle(clone).gap;
|
|
160
|
+
console.log(` š Spacing check - Margin: ${computedMargin}, Gap: ${computedGap}`);
|
|
161
|
+
}, 100);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
124
166
|
scrollToBottom();
|
|
125
167
|
}
|
|
126
168
|
|
|
@@ -777,6 +819,7 @@ function injectStyles() {
|
|
|
777
819
|
/* Bot edit icon styling */
|
|
778
820
|
[data-chat-element="bot-edit-icon"] {
|
|
779
821
|
display: none;
|
|
822
|
+
margin-left: 8px !important;
|
|
780
823
|
cursor: pointer;
|
|
781
824
|
opacity: 0.6;
|
|
782
825
|
transition: opacity 0.2s ease;
|