livechat 0.4.7 → 0.4.8
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/livechat/dashboard.js +16 -1
- data/lib/livechat/version.rb +1 -1
- data/lib/livechat/widget.js +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7f0dd913b9f9ac88756a298d2ad57cf69c78d3f8bf31c08941171a6d13626a16
|
|
4
|
+
data.tar.gz: 1148803aaf1b0d465afd5526ee6196d0814f23f0a3c75d4f9a7cfbd3ba96f6ee
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8eff7b6fff9df34b825dd647d41eabc4e415572bd5dd282465f52de3e2ac4fa3ee648a6123b426dc67615f064d82e3354762b0cc9103ea9d724d251de5e769c8
|
|
7
|
+
data.tar.gz: 57905952ca50aaa60b2103577ab54f6ee433f0729329ee5ea999e7a4bade5100a9e585ce9702842857962209f3b63369db9dde0b03358a723d4a9bb960e48251
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.8
|
|
4
|
+
|
|
5
|
+
- A conversation with image attachments now opens scrolled to the bottom, not
|
|
6
|
+
mid-thread. Images load after the initial scroll and grow the thread, so both
|
|
7
|
+
the inbox and the widget now re-pin to the bottom as each image loads (and
|
|
8
|
+
the inbox keeps you pinned until you scroll up). Fixes threads with
|
|
9
|
+
screenshots opening somewhere in the middle.
|
|
10
|
+
|
|
3
11
|
## 0.4.7
|
|
4
12
|
|
|
5
13
|
- The inbox reply composer now matches the visitor widget: one bordered box
|
data/lib/livechat/dashboard.js
CHANGED
|
@@ -130,7 +130,21 @@
|
|
|
130
130
|
var thread = document.getElementById("thread");
|
|
131
131
|
if (!thread) return;
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
// Stick to the bottom until the agent scrolls up. Images (screenshots and
|
|
134
|
+
// attachments) finish loading after DOMContentLoaded and grow the thread,
|
|
135
|
+
// so a single scroll-to-bottom now would land mid-thread once they expand
|
|
136
|
+
// — re-pin as each image loads and once the page has fully loaded.
|
|
137
|
+
var stick = true;
|
|
138
|
+
var keepBottom = function () { if (stick) thread.scrollTop = thread.scrollHeight; };
|
|
139
|
+
thread.addEventListener("scroll", function () {
|
|
140
|
+
stick = thread.scrollHeight - thread.scrollTop - thread.clientHeight < 80;
|
|
141
|
+
});
|
|
142
|
+
keepBottom();
|
|
143
|
+
var images = thread.querySelectorAll("img");
|
|
144
|
+
for (var i = 0; i < images.length; i++) {
|
|
145
|
+
if (!images[i].complete) images[i].addEventListener("load", keepBottom);
|
|
146
|
+
}
|
|
147
|
+
window.addEventListener("load", keepBottom);
|
|
134
148
|
|
|
135
149
|
var replyBox = document.querySelector(".reply textarea");
|
|
136
150
|
var latest = parseInt(thread.getAttribute("data-latest"), 10) || 0;
|
|
@@ -204,6 +218,7 @@
|
|
|
204
218
|
img.src = att.url;
|
|
205
219
|
img.alt = att.name;
|
|
206
220
|
img.loading = "lazy";
|
|
221
|
+
img.addEventListener("load", keepBottom); // a live image grows the thread
|
|
207
222
|
link.appendChild(img);
|
|
208
223
|
} else {
|
|
209
224
|
link.className = "att-file";
|
data/lib/livechat/version.rb
CHANGED
data/lib/livechat/widget.js
CHANGED
|
@@ -681,6 +681,9 @@
|
|
|
681
681
|
img.src = att.url;
|
|
682
682
|
img.alt = att.name;
|
|
683
683
|
img.loading = "lazy";
|
|
684
|
+
// The image loads after its bubble is placed and grows the panel —
|
|
685
|
+
// re-pin to the bottom so a just-arrived image stays in view.
|
|
686
|
+
img.addEventListener("load", scrollToBottom);
|
|
684
687
|
link.appendChild(img);
|
|
685
688
|
} else {
|
|
686
689
|
link.className = "lvc-att-file";
|