lisichatbot 1.7.3 → 1.7.5

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 +40 -24
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisichatbot",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "exports": {
package/src/index.js CHANGED
@@ -51,27 +51,9 @@ let flowData = null;
51
51
  function scrollToBottom() {
52
52
  if (!elements.messages) return;
53
53
 
54
- // ✅ NEW: Ensure the very last child is fully visible
55
- const scrollToLastElement = () => {
56
- const lastChild = elements.messages.lastElementChild;
57
- if (lastChild) {
58
- lastChild.scrollIntoView({ behavior: 'smooth', block: 'end', inline: 'nearest' });
59
- console.log(` 📜 Scrolled last element into view`);
60
- } else {
61
- // Fallback to scrollHeight
62
- elements.messages.scrollTop = elements.messages.scrollHeight;
63
- }
64
- };
65
-
66
- // Immediate scroll
67
- scrollToLastElement();
68
-
69
- // ✅ Use requestAnimationFrame to ensure DOM layout is complete
70
- requestAnimationFrame(() => {
71
- requestAnimationFrame(() => {
72
- scrollToLastElement();
73
- });
74
- });
54
+ // ✅ Scroll to absolute bottom instantly (no smooth animation)
55
+ elements.messages.scrollTop = elements.messages.scrollHeight;
56
+ console.log(` 📜 Scrolled to bottom: ${elements.messages.scrollHeight}px`);
75
57
  }
76
58
 
77
59
  function enableNextButton() {
@@ -981,7 +963,29 @@ function renderCustomSelectOptions(options, field, customConfig) {
981
963
 
982
964
  elements.messages.appendChild(optionsWrapper);
983
965
  renderMinMaxInputs(field, customConfig, existingData);
966
+
967
+ // ✅ Very aggressive scrolling to ensure all options are visible
984
968
  scrollToBottom();
969
+
970
+ setTimeout(() => {
971
+ scrollToBottom();
972
+ }, 50);
973
+
974
+ setTimeout(() => {
975
+ scrollToBottom();
976
+ }, 150);
977
+
978
+ setTimeout(() => {
979
+ scrollToBottom();
980
+ }, 300);
981
+
982
+ setTimeout(() => {
983
+ scrollToBottom();
984
+ }, 500);
985
+
986
+ setTimeout(() => {
987
+ scrollToBottom();
988
+ }, 800);
985
989
 
986
990
  const optionElements = optionsWrapper.querySelectorAll('[data-chat-input-element="container"]');
987
991
  optionElements.forEach(el => {
@@ -2940,18 +2944,30 @@ async function showNextStep() {
2940
2944
  nextStep.input.custom
2941
2945
  );
2942
2946
 
2943
- // ✅ Delayed scrolls to ensure all options are visible
2947
+ // ✅ Very aggressive delayed scrolls to ensure all options are visible
2944
2948
  setTimeout(() => {
2945
2949
  scrollToBottom();
2946
2950
  }, 100);
2947
2951
 
2948
2952
  setTimeout(() => {
2949
2953
  scrollToBottom();
2950
- }, 250);
2954
+ }, 200);
2955
+
2956
+ setTimeout(() => {
2957
+ scrollToBottom();
2958
+ }, 350);
2959
+
2960
+ setTimeout(() => {
2961
+ scrollToBottom();
2962
+ }, 500);
2963
+
2964
+ setTimeout(() => {
2965
+ scrollToBottom();
2966
+ }, 700);
2951
2967
 
2952
2968
  setTimeout(() => {
2953
2969
  scrollToBottom();
2954
- }, 400);
2970
+ }, 1000);
2955
2971
 
2956
2972
  // ✅ Check if pre-filled - renderCustomSelectOptions handles enabling if pre-filled
2957
2973
  const existingData = chatState.data[nextStep.input.field];