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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +49 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisichatbot",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "exports": {
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
- // Always hide first
100
- editIcon.style.display = 'none';
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 = 'inline';
110
- console.log(`āœļø Edit icon shown for step ${stepNumber} (has input)`);
120
+ editIcon.style.setProperty('display', 'inline', 'important');
121
+ console.log(` āœļø Edit icon SHOWN (step ${stepNumber} has input)`);
111
122
  } else {
112
- console.log(`⚪ Edit icon hidden for step ${stepNumber} (no input)`);
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;