From 814e46743551f8edbf6ef2fd6806a0af32729161 Mon Sep 17 00:00:00 2001 From: it33 Date: Sun, 20 Sep 2015 21:24:27 -0700 Subject: Shorten description help text Currently it word wraps, this prevents word-wrapping --- web/react/components/new_channel_modal.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web/react') diff --git a/web/react/components/new_channel_modal.jsx b/web/react/components/new_channel_modal.jsx index fc7b8c183..fdc4a1273 100644 --- a/web/react/components/new_channel_modal.jsx +++ b/web/react/components/new_channel_modal.jsx @@ -150,7 +150,7 @@ export default class NewChannelModal extends React.Component { tabIndex='2' />

- {'This is the purpose of your channel and helps others decide whether to join.'} + {'Channel description helps others decide whether to join.'}

{serverError} -- cgit v1.2.3-1-g7c22 From 80488dec22a8b61302a2630946051c8d90ded833 Mon Sep 17 00:00:00 2001 From: it33 Date: Mon, 21 Sep 2015 15:26:44 -0700 Subject: Adjusting sentence --- web/react/components/new_channel_modal.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web/react') diff --git a/web/react/components/new_channel_modal.jsx b/web/react/components/new_channel_modal.jsx index fdc4a1273..a8d137bac 100644 --- a/web/react/components/new_channel_modal.jsx +++ b/web/react/components/new_channel_modal.jsx @@ -150,7 +150,7 @@ export default class NewChannelModal extends React.Component { tabIndex='2' />

- {'Channel description helps others decide whether to join.'} + {'Description helps others decide whether to join this channel.'}

{serverError} -- cgit v1.2.3-1-g7c22 From 251d33ad23bd737c5b6954b6e5db14ee0b2611eb Mon Sep 17 00:00:00 2001 From: hmhealey Date: Mon, 21 Sep 2015 17:30:29 -0400 Subject: Added parsing for named emojis to TextFormatting and removed dependency on emojify --- web/react/components/post_body.jsx | 1 - web/react/components/rhs_comment.jsx | 1 - web/react/components/rhs_root_post.jsx | 1 - web/react/utils/emoticons.jsx | 159 +++++++++++++++++++++++++++++++++ web/react/utils/text_formatting.jsx | 6 ++ 5 files changed, 165 insertions(+), 3 deletions(-) create mode 100644 web/react/utils/emoticons.jsx (limited to 'web/react') diff --git a/web/react/components/post_body.jsx b/web/react/components/post_body.jsx index e0682e997..dbbcdc409 100644 --- a/web/react/components/post_body.jsx +++ b/web/react/components/post_body.jsx @@ -35,7 +35,6 @@ export default class PostBody extends React.Component { parseEmojis() { twemoji.parse(React.findDOMNode(this), {size: Constants.EMOJI_SIZE}); - global.window.emojify.run(React.findDOMNode(this.refs.message_span)); } componentDidMount() { diff --git a/web/react/components/rhs_comment.jsx b/web/react/components/rhs_comment.jsx index fe31ac381..8cc2d309b 100644 --- a/web/react/components/rhs_comment.jsx +++ b/web/react/components/rhs_comment.jsx @@ -56,7 +56,6 @@ export default class RhsComment extends React.Component { } parseEmojis() { twemoji.parse(React.findDOMNode(this), {size: Constants.EMOJI_SIZE}); - global.window.emojify.run(React.findDOMNode(this.refs.message_holder)); } componentDidMount() { this.parseEmojis(); diff --git a/web/react/components/rhs_root_post.jsx b/web/react/components/rhs_root_post.jsx index 2ea697c5b..86620a499 100644 --- a/web/react/components/rhs_root_post.jsx +++ b/web/react/components/rhs_root_post.jsx @@ -20,7 +20,6 @@ export default class RhsRootPost extends React.Component { } parseEmojis() { twemoji.parse(React.findDOMNode(this), {size: Constants.EMOJI_SIZE}); - global.window.emojify.run(React.findDOMNode(this.refs.message_holder)); } componentDidMount() { this.parseEmojis(); diff --git a/web/react/utils/emoticons.jsx b/web/react/utils/emoticons.jsx new file mode 100644 index 000000000..7210201ff --- /dev/null +++ b/web/react/utils/emoticons.jsx @@ -0,0 +1,159 @@ +// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// See License.txt for license information. + +const emoticonPatterns = { + smile: /:-?\)/g, // :) + open_mouth: /:o/gi, // :o + scream: /:-o/gi, // :-o + smirk: /[:;]-?]/g, // :] + grinning: /[:;]-?d/gi, // :D + stuck_out_tongue_closed_eyes: /x-d/gi, // x-d + stuck_out_tongue_winking_eye: /[:;]-?p/gi, // ;p + rage: /:-?[\[@]/g, // :@ + frowning: /:-?\(/g, // :( + sob: /:['’]-?\(|:'\(/g, // :`( + kissing_heart: /:-?\*/g, // :* + wink: /;-?\)/g, // ;) + pensive: /:-?\//g, // :/ + confounded: /:-?s/gi, // :s + flushed: /:-?\|/g, // :| + relaxed: /:-?\$/g, // :$ + mask: /:-x/gi, // :-x + heart: /<3|<3/g, // <3 + broken_heart: /<\/3|</3/g, // `, + originalText: match + }); + + return alias; + } + + return match; + } + + output = output.replace(/:([a-zA-Z0-9_-]+):/g, replaceEmoticonWithToken); + + $.each(emoticonPatterns, (name, pattern) => { + // this might look a bit funny, but since the name isn't contained in the actual match + // like with the named emoticons, we need to add it in manually + output = output.replace(pattern, (match) => replaceEmoticonWithToken(match, name)); + }); + + return output; +} + +function getImagePathForEmoticon(name) { + return `/static/images/emoji/${name}.png`; +} diff --git a/web/react/utils/text_formatting.jsx b/web/react/utils/text_formatting.jsx index 4e390f708..be82f7b9c 100644 --- a/web/react/utils/text_formatting.jsx +++ b/web/react/utils/text_formatting.jsx @@ -3,6 +3,7 @@ const Autolinker = require('autolinker'); const Constants = require('./constants.jsx'); +const Emoticons = require('./emoticons.jsx'); const Markdown = require('./markdown.jsx'); const UserStore = require('../stores/user_store.jsx'); const Utils = require('./utils.jsx'); @@ -17,6 +18,7 @@ const markdownRenderer = new Markdown.MattermostMarkdownRenderer(); // - searchTerm - If specified, this word is highlighted in the resulting html. Defaults to nothing. // - mentionHighlight - Specifies whether or not to highlight mentions of the current user. Defaults to true. // - singleline - Specifies whether or not to remove newlines. Defaults to false. +// - emoticons - Enables emoticon parsing. Defaults to true. // - markdown - Enables markdown parsing. Defaults to true. export function formatText(text, options = {}) { if (!('markdown' in options)) { @@ -34,6 +36,10 @@ export function formatText(text, options = {}) { const tokens = new Map(); // replace important words and phrases with tokens + if (!('emoticons' in options) || options.emoticon) { + output = Emoticons.handleEmoticons(output, tokens); + } + output = autolinkUrls(output, tokens, !!options.markdown); output = autolinkAtMentions(output, tokens); output = autolinkHashtags(output, tokens); -- cgit v1.2.3-1-g7c22 From e7d408585af5df35c6aff1558de246c8398ef71c Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Tue, 22 Sep 2015 13:21:58 -0400 Subject: Revert "PLT-289 Added parsing for named emojis to TextFormatting and removed emojify" --- web/react/components/post_body.jsx | 1 + web/react/components/rhs_comment.jsx | 1 + web/react/components/rhs_root_post.jsx | 1 + web/react/utils/emoticons.jsx | 159 --------------------------------- web/react/utils/text_formatting.jsx | 6 -- 5 files changed, 3 insertions(+), 165 deletions(-) delete mode 100644 web/react/utils/emoticons.jsx (limited to 'web/react') diff --git a/web/react/components/post_body.jsx b/web/react/components/post_body.jsx index dbbcdc409..e0682e997 100644 --- a/web/react/components/post_body.jsx +++ b/web/react/components/post_body.jsx @@ -35,6 +35,7 @@ export default class PostBody extends React.Component { parseEmojis() { twemoji.parse(React.findDOMNode(this), {size: Constants.EMOJI_SIZE}); + global.window.emojify.run(React.findDOMNode(this.refs.message_span)); } componentDidMount() { diff --git a/web/react/components/rhs_comment.jsx b/web/react/components/rhs_comment.jsx index 8cc2d309b..fe31ac381 100644 --- a/web/react/components/rhs_comment.jsx +++ b/web/react/components/rhs_comment.jsx @@ -56,6 +56,7 @@ export default class RhsComment extends React.Component { } parseEmojis() { twemoji.parse(React.findDOMNode(this), {size: Constants.EMOJI_SIZE}); + global.window.emojify.run(React.findDOMNode(this.refs.message_holder)); } componentDidMount() { this.parseEmojis(); diff --git a/web/react/components/rhs_root_post.jsx b/web/react/components/rhs_root_post.jsx index 86620a499..2ea697c5b 100644 --- a/web/react/components/rhs_root_post.jsx +++ b/web/react/components/rhs_root_post.jsx @@ -20,6 +20,7 @@ export default class RhsRootPost extends React.Component { } parseEmojis() { twemoji.parse(React.findDOMNode(this), {size: Constants.EMOJI_SIZE}); + global.window.emojify.run(React.findDOMNode(this.refs.message_holder)); } componentDidMount() { this.parseEmojis(); diff --git a/web/react/utils/emoticons.jsx b/web/react/utils/emoticons.jsx deleted file mode 100644 index 7210201ff..000000000 --- a/web/react/utils/emoticons.jsx +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. -// See License.txt for license information. - -const emoticonPatterns = { - smile: /:-?\)/g, // :) - open_mouth: /:o/gi, // :o - scream: /:-o/gi, // :-o - smirk: /[:;]-?]/g, // :] - grinning: /[:;]-?d/gi, // :D - stuck_out_tongue_closed_eyes: /x-d/gi, // x-d - stuck_out_tongue_winking_eye: /[:;]-?p/gi, // ;p - rage: /:-?[\[@]/g, // :@ - frowning: /:-?\(/g, // :( - sob: /:['’]-?\(|:'\(/g, // :`( - kissing_heart: /:-?\*/g, // :* - wink: /;-?\)/g, // ;) - pensive: /:-?\//g, // :/ - confounded: /:-?s/gi, // :s - flushed: /:-?\|/g, // :| - relaxed: /:-?\$/g, // :$ - mask: /:-x/gi, // :-x - heart: /<3|<3/g, // <3 - broken_heart: /<\/3|</3/g, // `, - originalText: match - }); - - return alias; - } - - return match; - } - - output = output.replace(/:([a-zA-Z0-9_-]+):/g, replaceEmoticonWithToken); - - $.each(emoticonPatterns, (name, pattern) => { - // this might look a bit funny, but since the name isn't contained in the actual match - // like with the named emoticons, we need to add it in manually - output = output.replace(pattern, (match) => replaceEmoticonWithToken(match, name)); - }); - - return output; -} - -function getImagePathForEmoticon(name) { - return `/static/images/emoji/${name}.png`; -} diff --git a/web/react/utils/text_formatting.jsx b/web/react/utils/text_formatting.jsx index be82f7b9c..4e390f708 100644 --- a/web/react/utils/text_formatting.jsx +++ b/web/react/utils/text_formatting.jsx @@ -3,7 +3,6 @@ const Autolinker = require('autolinker'); const Constants = require('./constants.jsx'); -const Emoticons = require('./emoticons.jsx'); const Markdown = require('./markdown.jsx'); const UserStore = require('../stores/user_store.jsx'); const Utils = require('./utils.jsx'); @@ -18,7 +17,6 @@ const markdownRenderer = new Markdown.MattermostMarkdownRenderer(); // - searchTerm - If specified, this word is highlighted in the resulting html. Defaults to nothing. // - mentionHighlight - Specifies whether or not to highlight mentions of the current user. Defaults to true. // - singleline - Specifies whether or not to remove newlines. Defaults to false. -// - emoticons - Enables emoticon parsing. Defaults to true. // - markdown - Enables markdown parsing. Defaults to true. export function formatText(text, options = {}) { if (!('markdown' in options)) { @@ -36,10 +34,6 @@ export function formatText(text, options = {}) { const tokens = new Map(); // replace important words and phrases with tokens - if (!('emoticons' in options) || options.emoticon) { - output = Emoticons.handleEmoticons(output, tokens); - } - output = autolinkUrls(output, tokens, !!options.markdown); output = autolinkAtMentions(output, tokens); output = autolinkHashtags(output, tokens); -- cgit v1.2.3-1-g7c22