From 28ad645153b206ba84ddc4935280eaed94bb0138 Mon Sep 17 00:00:00 2001 From: bonespiked Date: Fri, 24 Mar 2017 09:09:51 -0400 Subject: Ticket 4665 - Emoji Picker (#5157) * #4665 Added EmojiPicker Work primarily by @broernr-de and @harrison on pre-release.mattermost.com * Final fixes to handle custom emojis from internal review and single merge error * ESLint fixes * CSS changes and other code to support emoji picker in reply window * Fix for file upload and emoji picker icon positions on post and comment. RHS emoji picker appearing see-through at this time. * Fix for two ESLint issues. * covered most of feedback: RHS emoji picker looks correct color-wise RHS emoji picker dynamically positions against height of thread size (post + reply messages) escape closes emoji window search box focused on open ESLint fixes against other files oversized emoji preview fixes * Adding in 'outside click' eventing to dismiss the emoji window * Changing some formatting to fix mismatch between my local eslant rules and jenkins. * adding alternative import method due to downstream testing errors * yet another attempt to retain functionality and pass tests - skipping import of browser store * fix for feedback items 5 and 7: * move search to float on top with stylistic changes * whitespace in the header (+1 squashed commit) Squashed commits: [6a26d32] changes that address items 1, 2, 6, 8, and 9 of latest feedback * Fix for attachment preview location on mobile * Fix for latest rounds of feedback * fixing eslint issue * making emojipicker sprite based, fixing alignments * Fix for emoji quality, fixing some behavior (hover background and cursor settings) undoing config changes * Preview feature for emojis * Adjustments to config file, and changing layout/design of attachment and emoji icon. * manual revert from master branch for config.json * reverting paperclip and fixing alignments. Additionally fixing inadvertent display of picker on mobile. * CSS changes to try to fix the hover behavior - currently working for emoji picker (when enabled), but hover for attachment isn't working * Made suggested changes by jwilander except for jQuery removal * Adding hover for both icons * removal of some usages of jQuery * Fix for two layout issues on IE11/Edge * UI improvements for emoji picker * Fix for many minor display issues * fix for additional appearance items * fix to two minor UI items * A little extra padding for IE11 * fix for IE11 scroll issue, and removing align attribute on img tag which was throwing js error * fixes some display issues on firefox * fix for uneven sides of emojis * fix for eslint issues that I didn't introduce * fix for missing bottom edge of RHS emojipicker. also fixing text overlapping icons on text area (including RHS) * Update "emoji selector" to "emoji picker" * changes for code review - removal of ..getDOMNode - use sprite imagery for emoji preview - remove lastBlurAt from state as it wasn't used * fixes for: - fake custom emoji preview in picker - RHS scrollbar on preview * fix for minor alignment of preview emoji --- webapp/actions/post_actions.jsx | 7 + webapp/components/autosize_textarea.jsx | 3 + webapp/components/create_comment.jsx | 99 +- webapp/components/create_post.jsx | 98 +- .../components/emoji_picker_category.jsx | 42 + .../emoji_picker/components/emoji_picker_item.jsx | 70 + .../components/emoji_picker_preview.jsx | 66 + webapp/components/emoji_picker/emoji_picker.jsx | 417 +++ .../emoji_picker/emoji_picker_container.jsx | 46 + webapp/components/file_upload.jsx | 43 +- webapp/components/rhs_root_post.jsx | 5 +- webapp/components/textbox.jsx | 5 +- .../user_settings/user_settings_advanced.jsx | 7 + webapp/i18n/en.json | 13 + webapp/images/emoji/emojilarge.png | Bin 0 -> 4245270 bytes webapp/images/emoji/img_trans.gif | Bin 0 -> 43 bytes webapp/package.json | 1 + webapp/sass/components/_emojisprite.scss | 3519 ++++++++++++++++++++ webapp/sass/components/_emoticons.scss | 208 +- webapp/sass/components/_module.scss | 1 + webapp/sass/layout/_post-right.scss | 5 +- webapp/sass/layout/_post.scss | 97 +- webapp/sass/responsive/_mobile.scss | 16 + webapp/sass/responsive/_tablet.scss | 35 +- webapp/stores/emoji_store.jsx | 49 +- webapp/utils/constants.jsx | 8 +- webapp/utils/emoji.jsx | 2 +- webapp/utils/utils.jsx | 18 + 28 files changed, 4827 insertions(+), 53 deletions(-) create mode 100644 webapp/components/emoji_picker/components/emoji_picker_category.jsx create mode 100644 webapp/components/emoji_picker/components/emoji_picker_item.jsx create mode 100644 webapp/components/emoji_picker/components/emoji_picker_preview.jsx create mode 100644 webapp/components/emoji_picker/emoji_picker.jsx create mode 100644 webapp/components/emoji_picker/emoji_picker_container.jsx create mode 100644 webapp/images/emoji/emojilarge.png create mode 100644 webapp/images/emoji/img_trans.gif create mode 100644 webapp/sass/components/_emojisprite.scss (limited to 'webapp') diff --git a/webapp/actions/post_actions.jsx b/webapp/actions/post_actions.jsx index 0c837621f..494cbc454 100644 --- a/webapp/actions/post_actions.jsx +++ b/webapp/actions/post_actions.jsx @@ -417,6 +417,13 @@ export function removePostFromStore(post) { PostStore.emitChange(); } +export function emitEmojiPosted(emoji) { + AppDispatcher.handleServerAction({ + type: ActionTypes.EMOJI_POSTED, + alias: emoji + }); +} + export function deletePost(channelId, post, success, error) { Client.deletePost( channelId, diff --git a/webapp/components/autosize_textarea.jsx b/webapp/components/autosize_textarea.jsx index a55a27aef..e14835737 100644 --- a/webapp/components/autosize_textarea.jsx +++ b/webapp/components/autosize_textarea.jsx @@ -62,6 +62,7 @@ export default class AutosizeTextarea extends React.Component { const { value, placeholder, + id, ...otherProps } = props; @@ -77,12 +78,14 @@ export default class AutosizeTextarea extends React.Component {