Skip to content

Commit

Permalink
Fix hide/scroll recent on skinnable tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
mervick committed Sep 7, 2016
1 parent 2bd9077 commit fb7b1bc
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/function/updateRecent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ define([
'function/saveSelection',
'function/pasteHtmlAtCaret',
'function/shortnameTo',
'function/getRecent',
'function/attach'
'function/getRecent'
],
function(saveSelection, pasteHtmlAtCaret, shortnameTo, getRecent, attach) {
function(saveSelection, pasteHtmlAtCaret, shortnameTo, getRecent) {
return function(self) {
var emojis = getRecent();
if (!self.recent || self.recent !== emojis) {
if (emojis.length) {
var scrollTop = self.scrollArea.scrollTop(),
height = self.recentCategory.is(":visible") ? self.recentCategory.height() : 0
var skinnable = self.scrollArea.is(".skinnable"),
scrollTop, height;

if (!skinnable) {
scrollTop = self.scrollArea.scrollTop();
height = self.recentCategory.is(":visible") ? self.recentCategory.height() : 0;
}

var items = shortnameTo(emojis, self.emojiBtnTemplate, true).split('|').join('');
self.recentCategory.children(".emojibtn").remove();
Expand All @@ -21,15 +25,17 @@ function(saveSelection, pasteHtmlAtCaret, shortnameTo, getRecent, attach) {
self.recentCategory.children(".emojibtn").on("click", function() {
self.trigger("emojibtn.click", $(this));
});
// attach(self, , { click: "emojibtn.click" });

self.recentCategory.show();
self.recentFilter.show();

var height2 = self.recentCategory.height();
if (!skinnable) {
self.recentCategory.show();

var height2 = self.recentCategory.height();

if (height !== height2) {
self.scrollArea.scrollTop(scrollTop + height2 - height);
if (height !== height2) {
self.scrollArea.scrollTop(scrollTop + height2 - height);
}
}
} else {
if (self.recentFilter.hasClass("active")) {
Expand Down

0 comments on commit fb7b1bc

Please sign in to comment.