Sfoglia il codice sorgente

Remove the need for emojione

JC Brand 6 anni fa
parent
commit
e35fceff1a
10 ha cambiato i file con 29 aggiunte e 34 eliminazioni
  1. 1 0
      .eslintrc.json
  2. 4 0
      README.md
  3. 0 15
      dist/converse.js
  4. 0 6
      package-lock.json
  5. 0 1
      package.json
  6. 4 4
      src/converse-chatboxes.js
  7. 4 4
      src/converse-muc.js
  8. 3 3
      src/utils/core.js
  9. 13 0
      src/utils/emoji.js
  10. 0 1
      webpack.config.js

+ 1 - 0
.eslintrc.json

@@ -29,6 +29,7 @@
         "lodash/prefer-constant": "off",
         "lodash/prefer-noop": "off",
         "lodash/prefer-lodash-typecheck": "off",
+        "lodash/prefer-includes": "off",
         "lodash/preferred-alias": "off",
         "lodash/prefer-get": "off",
         "accessor-pairs": "error",

+ 4 - 0
README.md

@@ -97,6 +97,10 @@ Open [tests.html](https://github.com/conversejs/converse.js/blob/master/tests.ht
 
 `Converse.js` is released under the [Mozilla Public License (MPL)](https://www.mozilla.org/MPL/2.0/index.txt).
 
+## Attribution
+
+Emoji images are courtesy of [Twemoji](https://emojitwo.github.io/).
+
 ## Support
 
 For support queries and discussions, please join the mailing list: <conversejs@librelist.com>

File diff suppressed because it is too large
+ 0 - 15
dist/converse.js


+ 0 - 6
package-lock.json

@@ -3530,12 +3530,6 @@
         "minimalistic-crypto-utils": "1.0.1"
       }
     },
-    "emojione": {
-      "version": "3.1.7",
-      "resolved": "https://registry.npmjs.org/emojione/-/emojione-3.1.7.tgz",
-      "integrity": "sha1-LTxyXGlvF5yd3jrLZVxiHulCmx4=",
-      "dev": true
-    },
     "emojis-list": {
       "version": "2.1.0",
       "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz",

+ 0 - 1
package.json

@@ -48,7 +48,6 @@
     "bourbon": "^4.3.2",
     "bytebuffer": "^3.5.5",
     "clean-css-cli": "^4.0.10",
-    "emojione": "^3.0.3",
     "es6-promise": "^4.1.0",
     "eslint": "4.19.1",
     "eslint-plugin-lodash": "^2.3.3",

+ 4 - 4
src/converse-chatboxes.js

@@ -7,13 +7,13 @@
 (function (root, factory) {
     define([
         "converse-core",
-        "emojione",
         "filesize",
         "templates/chatboxes.html",
         "backbone.overview",
-        "utils/form"
+        "utils/form",
+        "utils/emoji"
     ], factory);
-}(this, function (converse, emojione, filesize, tpl_chatboxes) {
+}(this, function (converse, filesize, tpl_chatboxes) {
     "use strict";
 
     const { $msg, Backbone, Promise, Strophe, b64_sha1, moment, sizzle, utils, _ } = converse.env;
@@ -389,7 +389,7 @@
                         'from': _converse.bare_jid,
                         'sender': 'me',
                         'time': moment().format(),
-                        'message': text ? u.httpToGeoUri(emojione.shortnameToUnicode(text), _converse) : undefined,
+                        'message': text ? u.httpToGeoUri(u.shortnameToUnicode(text), _converse) : undefined,
                         'is_spoiler': is_spoiler,
                         'spoiler_hint': is_spoiler ? spoiler_hint : undefined,
                         'type': this.get('message_type')

+ 4 - 4
src/converse-muc.js

@@ -8,14 +8,14 @@
     define([
             "utils/form",
             "converse-core",
-            "emojione",
             "converse-disco",
             "backbone.overview",
             "backbone.orderedlistview",
             "backbone.vdomview",
-            "utils/muc"
+            "utils/muc",
+            "utils/emoji"
     ], factory);
-}(this, function (u, converse, emojione) {
+}(this, function (u, converse) {
     "use strict";
 
     const MUC_ROLE_WEIGHTS = {
@@ -380,7 +380,7 @@
                         'from': `${this.get('jid')}/${this.get('nick')}`,
                         'fullname': this.get('nick'),
                         'is_spoiler': is_spoiler,
-                        'message': text ? u.httpToGeoUri(emojione.shortnameToUnicode(text), _converse) : undefined,
+                        'message': text ? u.httpToGeoUri(u.shortnameToUnicode(text), _converse) : undefined,
                         'nick': this.get('nick'),
                         'references': references,
                         'sender': 'me',

+ 3 - 3
src/utils/core.js

@@ -205,15 +205,15 @@
         return matches;
     }
 
-    u.unescapeHTML = function (htmlEscapedText) {
+    u.unescapeHTML = function (string) {
         /* Helper method that replace HTML-escaped symbols with equivalent characters
          * (e.g. transform occurrences of '&amp;' to '&')
          *
          * Parameters:
-         *  (String) htmlEscapedText: a String containing the HTML-escaped symbols.
+         *  (String) string: a String containing the HTML-escaped symbols.
          */
         var div = document.createElement('div');
-        div.innerHTML = htmlEscapedText;
+        div.innerHTML = string;
         return div.innerText;
     };
 

File diff suppressed because it is too large
+ 13 - 0
src/utils/emoji.js


+ 0 - 1
webpack.config.js

@@ -88,7 +88,6 @@ const config = {
             "backbone.vdomview":        path.resolve(__dirname, "node_modules/backbone.vdomview/backbone.vdomview"),
             "bootstrap":                path.resolve(__dirname, "node_modules/bootstrap.native/dist/bootstrap-native-v4"),
             "crypto":                   path.resolve(__dirname, "node_modules/otr/build/dep/crypto"),
-            "emojione":                 path.resolve(__dirname, "node_modules/emojione/lib/js/emojione"),
             "es6-promise":              path.resolve(__dirname, "node_modules/es6-promise/dist/es6-promise.auto"),
             "filesize":                 path.resolve(__dirname, "node_modules/filesize/lib/filesize"),
             "jed":                      path.resolve(__dirname, "node_modules/jed/jed"),

Some files were not shown because too many files changed in this diff