Procházet zdrojové kódy

emoji: Allow the assets path of Emojione to be overridden

JC Brand před 8 roky
rodič
revize
49f26d8e49
3 změnil soubory, kde provedl 30 přidání a 11 odebrání
  1. 9 3
      CHANGES.md
  2. 13 0
      docs/source/configuration.rst
  3. 8 8
      src/converse-chatview.js

+ 9 - 3
CHANGES.md

@@ -3,9 +3,15 @@
 ## 3.2.0 (Unreleased)
 
 ### New features
-- Add support for Emojis (either native, or via <a href="https://www.emojione.com/">Emojione</a>).
-  Therefore the `visible_toolbar_buttons.emoticons` configuration option is now changed
-  to `visible_toolbar_buttons.emoji`. [jcbrand]
+- Add support for Emojis (either native, or via <a href="https://www.emojione.com/">Emojione</a>). [jcbrand]
+
+### New configuration settings
+* The `visible_toolbar_buttons.emoticons` configuration option is now changed to `visible_toolbar_buttons.emoji`.
+* [use_emojione](https://conversejs.org/docs/html/configurations.html#use-emojione)
+  is used to determine whether Emojione should be used to render emojis,
+  otherwise rendering falls back to native browser or OS support.
+* [emojione_image_path](https://conversejs.org/docs/html/configurations.html#emojione-image-path)
+  is used to specify from where Emojione will load images for rendering emojis.
 
 ### Code changes
 - Removed jQuery from `converse-core`, `converse-vcard` and `converse-roomslist`. [jcbrand]

+ 13 - 0
docs/source/configuration.rst

@@ -516,6 +516,16 @@ domain_placeholder
 
 The placeholder text shown in the domain input on the registration form.
 
+
+emojione_image_path
+-------------------
+
+* Default: ``'https://cdn.jsdelivr.net/emojione/assets/' + emojioneVersion + '/png/'``
+
+When `use_emojione`_ is set to ``true``, then this is the URL from where PNG image files for
+displaying emojis will be fetched.
+
+
 expose_rid_and_sid
 ------------------
 
@@ -1001,6 +1011,9 @@ Determines whether `Emojione <https://www.emojione.com/>`_ should be used to
 render emojis. If set to ``false``, then rendering support will fall back to
 the operating system or browser (which might not support emoji).
 
+See also `emojione_image_path`_.
+
+
 show_only_online_users
 ----------------------
 

+ 8 - 8
src/converse-chatview.js

@@ -92,27 +92,27 @@
                 { __ } = _converse;
 
             _converse.api.settings.update({
-                use_emojione: true,
-                chatview_avatar_height: 32,
-                chatview_avatar_width: 32,
-                show_toolbar: true,
-                time_format: 'HH:mm',
-                visible_toolbar_buttons: {
+                'use_emojione': true,
+                'emojione_image_path': emojione.imagePathPNG,
+                'chatview_avatar_height': 32,
+                'chatview_avatar_width': 32,
+                'show_toolbar': true,
+                'time_format': 'HH:mm',
+                'visible_toolbar_buttons': {
                     'emoji': true,
                     'call': false,
                     'clear': true
                 },
             });
+            emojione.imagePathPNG = _converse.emojione_image_path;
 
             function onWindowStateChanged (data) {
                 _converse.chatboxviews.each(function (chatboxview) {
                     chatboxview.onWindowStateChanged(data.state);
                 });
             }
-
             _converse.api.listen.on('windowStateChanged', onWindowStateChanged);
 
-
             _converse.EmojiPicker = Backbone.Model.extend({ 
                 defaults: {
                     'current_category': 'people',