[FIX] Empty message if contains only a link (#787)

* Fix empty message if contains only a link

* 🐛 Fix empty space
This commit is contained in:
Djorkaeff Alexandre 2019-06-27 14:49:44 -03:00 committed by Diego Mello
parent 013c151c10
commit d017348dfe
1 changed files with 4 additions and 2 deletions

View File

@ -57,8 +57,10 @@ const Markdown = React.memo(({
if (m) { if (m) {
m = emojify(m, { output: 'unicode' }); m = emojify(m, { output: 'unicode' });
} }
const matched = m.match(/^\[([^\]]*)\]\(([^)]*)\)\1/);
if (matched && matched[0] !== msg) {
m = m.replace(/^\[([^\]]*)\]\(([^)]*)\)/, '').trim(); m = m.replace(/^\[([^\]]*)\]\(([^)]*)\)/, '').trim();
}
if (numberOfLines > 0) { if (numberOfLines > 0) {
m = m.replace(/[\n]+/g, '\n').trim(); m = m.replace(/[\n]+/g, '\n').trim();
} }