Commit 23b65f5f authored by JC Brand's avatar JC Brand

Lazily load emoji images

parent e35fceff
...@@ -60961,7 +60961,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -60961,7 +60961,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
initialize() { initialize() {
this.initDebounced(); this.initDebounced();
this.createEmojiPicker();
this.model.messages.on('add', this.onMessageAdded, this); this.model.messages.on('add', this.onMessageAdded, this);
this.model.messages.on('rendered', this.scrollDown, this); this.model.messages.on('rendered', this.scrollDown, this);
this.model.on('show', this.show, this); this.model.on('show', this.show, this);
...@@ -61006,7 +61005,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -61006,7 +61005,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
this.el.querySelector('.chat-toolbar').innerHTML = toolbar(options); this.el.querySelector('.chat-toolbar').innerHTML = toolbar(options);
this.addSpoilerButton(options); this.addSpoilerButton(options);
this.addFileUploadButton(); this.addFileUploadButton();
this.insertEmojiPicker();
_converse.emit('renderToolbar', this); _converse.emit('renderToolbar', this);
...@@ -61745,6 +61743,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -61745,6 +61743,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
toggleEmojiMenu(ev) { toggleEmojiMenu(ev) {
if (_.isUndefined(this.emoji_dropdown)) { if (_.isUndefined(this.emoji_dropdown)) {
ev.stopPropagation(); ev.stopPropagation();
this.createEmojiPicker();
this.insertEmojiPicker();
this.renderEmojiPicker();
const dropdown_el = this.el.querySelector('.toggle-smiley.dropup'); const dropdown_el = this.el.querySelector('.toggle-smiley.dropup');
this.emoji_dropdown = new bootstrap.Dropdown(dropdown_el, true); this.emoji_dropdown = new bootstrap.Dropdown(dropdown_el, true);
this.emoji_dropdown.toggle(); this.emoji_dropdown.toggle();
...@@ -61878,7 +61879,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -61878,7 +61879,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
afterShown() { afterShown() {
this.model.clearUnreadMsgCounter(); this.model.clearUnreadMsgCounter();
this.setChatState(_converse.ACTIVE); this.setChatState(_converse.ACTIVE);
this.renderEmojiPicker();
this.scrollDown(); this.scrollDown();
this.focus(); this.focus();
}, },
...@@ -102993,7 +102993,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -102993,7 +102993,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
/* will output unicode from shortname /* will output unicode from shortname
* useful for sending emojis back to mobile devices * useful for sending emojis back to mobile devices
*/ */
// replace regular shortnames first // Replace regular shortnames first
str = str.replace(SHORTNAMES_REGEX, shortname => { str = str.replace(SHORTNAMES_REGEX, shortname => {
if (typeof shortname === 'undefined' || shortname === '' || !(shortname in emoji_list)) { if (typeof shortname === 'undefined' || shortname === '' || !(shortname in emoji_list)) {
// if the shortname doesnt exist just return the entire matchhju // if the shortname doesnt exist just return the entire matchhju
...@@ -310,7 +310,6 @@ ...@@ -310,7 +310,6 @@
initialize () { initialize () {
this.initDebounced(); this.initDebounced();
this.createEmojiPicker();
this.model.messages.on('add', this.onMessageAdded, this); this.model.messages.on('add', this.onMessageAdded, this);
this.model.messages.on('rendered', this.scrollDown, this); this.model.messages.on('rendered', this.scrollDown, this);
...@@ -358,7 +357,6 @@ ...@@ -358,7 +357,6 @@
this.el.querySelector('.chat-toolbar').innerHTML = toolbar(options); this.el.querySelector('.chat-toolbar').innerHTML = toolbar(options);
this.addSpoilerButton(options); this.addSpoilerButton(options);
this.addFileUploadButton(); this.addFileUploadButton();
this.insertEmojiPicker();
_converse.emit('renderToolbar', this); _converse.emit('renderToolbar', this);
return this; return this;
}, },
...@@ -1057,6 +1055,10 @@ ...@@ -1057,6 +1055,10 @@
toggleEmojiMenu (ev) { toggleEmojiMenu (ev) {
if (_.isUndefined(this.emoji_dropdown)) { if (_.isUndefined(this.emoji_dropdown)) {
ev.stopPropagation(); ev.stopPropagation();
this.createEmojiPicker();
this.insertEmojiPicker();
this.renderEmojiPicker();
const dropdown_el = this.el.querySelector('.toggle-smiley.dropup'); const dropdown_el = this.el.querySelector('.toggle-smiley.dropup');
this.emoji_dropdown = new bootstrap.Dropdown(dropdown_el, true); this.emoji_dropdown = new bootstrap.Dropdown(dropdown_el, true);
this.emoji_dropdown.toggle(); this.emoji_dropdown.toggle();
...@@ -1179,7 +1181,6 @@ ...@@ -1179,7 +1181,6 @@
afterShown () { afterShown () {
this.model.clearUnreadMsgCounter(); this.model.clearUnreadMsgCounter();
this.setChatState(_converse.ACTIVE); this.setChatState(_converse.ACTIVE);
this.renderEmojiPicker();
this.scrollDown(); this.scrollDown();
this.focus(); this.focus();
}, },
......
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
/* will output unicode from shortname /* will output unicode from shortname
* useful for sending emojis back to mobile devices * useful for sending emojis back to mobile devices
*/ */
// replace regular shortnames first // Replace regular shortnames first
str = str.replace(SHORTNAMES_REGEX, (shortname) => { str = str.replace(SHORTNAMES_REGEX, (shortname) => {
if( (typeof shortname === 'undefined') || (shortname === '') || (!(shortname in emoji_list)) ) { if( (typeof shortname === 'undefined') || (shortname === '') || (!(shortname in emoji_list)) ) {
// if the shortname doesnt exist just return the entire matchhju // if the shortname doesnt exist just return the entire matchhju
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment