Only bind preview "More" buttons on link previews
This commit is contained in:
parent
1ccdeb015c
commit
8d255fc331
@ -73,9 +73,8 @@ function appendPreview(preview, msg, template) {
|
|||||||
const previewContent = previewContainer.find(".toggle-content");
|
const previewContent = previewContainer.find(".toggle-content");
|
||||||
|
|
||||||
const showMoreIfNeeded = () => {
|
const showMoreIfNeeded = () => {
|
||||||
// Only applies on:
|
// Only applies on previews:
|
||||||
if (preview.type === "link" && // link previews
|
if (channel.hasClass("active") && // in the current channel
|
||||||
channel.hasClass("active") && // in the current channels
|
|
||||||
previewContent.hasClass("show") // that are expanded
|
previewContent.hasClass("show") // that are expanded
|
||||||
) {
|
) {
|
||||||
const isVisible = moreBtn.is(":visible");
|
const isVisible = moreBtn.is(":visible");
|
||||||
@ -90,12 +89,13 @@ function appendPreview(preview, msg, template) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (preview.type === "link") {
|
||||||
$(window).on("resize", debounce(showMoreIfNeeded, 150));
|
$(window).on("resize", debounce(showMoreIfNeeded, 150));
|
||||||
window.requestAnimationFrame(showMoreIfNeeded);
|
window.requestAnimationFrame(showMoreIfNeeded);
|
||||||
previewContent.on(
|
previewContent.on("showMoreIfNeeded",
|
||||||
"showMoreIfNeeded",
|
|
||||||
() => window.requestAnimationFrame(showMoreIfNeeded)
|
() => window.requestAnimationFrame(showMoreIfNeeded)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (activeChannelId === channelId) {
|
if (activeChannelId === channelId) {
|
||||||
container.trigger("keepToBottom");
|
container.trigger("keepToBottom");
|
||||||
|
Loading…
Reference in New Issue
Block a user