Parcourir la source

[bugfix] emoji fallback

B Thibault il y a 8 ans
Parent
commit
8154ba5cdf
1 fichiers modifiés avec 7 ajouts et 3 suppressions
  1. 7 3
      msgFormatter.js

+ 7 - 3
msgFormatter.js

@@ -383,9 +383,13 @@ var formatText = (function() {
             var _parent = this._parent;
             while (_parent && !_parent.isEmoji)
                 _parent = _parent._parent;
-            if (_parent)
-                return opts.emojiFormatFunction(_parent.trigger +this.text +_parent.trigger);
-            return opts.emojiFormatFunction(this.text);
+            if (_parent) {
+                var fallback = _parent.trigger +this.text +_parent.trigger;
+                var formatted = opts.emojiFormatFunction(fallback);
+                return formatted ? formatted : fallback;
+            }
+            var formatted = opts.emojiFormatFunction(this.text);
+            return formatted ? formatted : this.text;
         }
         if (this._parent.checkIsCodeBlock())
             return this.text.replace(/\n/g, '<br/>'); // TODO syntax highlight