grape-web
Advanced tools
Comparing version 0.28.0 to 0.29.0
@@ -21,2 +21,6 @@ 'use strict'; | ||
var _grapeJsEmoji = require('grape-js-emoji'); | ||
var _grapeJsEmoji2 = _interopRequireDefault(_grapeJsEmoji); | ||
var _web = require('./web'); | ||
@@ -38,2 +42,18 @@ | ||
// http://crocodillon.com/blog/parsing-emoji-unicode-in-javascript | ||
var emojiRegExp = new RegExp(['\\ud83c[\\udf00-\\udfff]', // U+1F300 to U+1F3FF | ||
'\\ud83d[\\udc00-\\ude4f]', // U+1F400 to U+1F64F | ||
'\\ud83d[\\ude80-\\udeff]' // U+1F680 to U+1F6FF | ||
].join('|'), 'g'); | ||
/** | ||
* Replaces emoji symbol with it's text representation. | ||
* '👍' => ':+1:' | ||
*/ | ||
function replaceEmojisWithText(content) { | ||
return content.replace(emojiRegExp, function (match) { | ||
return ':' + _grapeJsEmoji2['default'].data[match.codePointAt().toString(16)][3][0] + ':'; | ||
}); | ||
} | ||
function createNotification(options) { | ||
@@ -58,3 +78,3 @@ var callback = arguments.length <= 1 || arguments[1] === undefined ? _lodashUtilityNoop2['default'] : arguments[1]; | ||
title: title, | ||
message: content | ||
message: replaceEmojisWithText(content) | ||
}); | ||
@@ -61,0 +81,0 @@ setTimeout(function () { |
{ | ||
"name": "grape-web", | ||
"version": "0.28.0", | ||
"version": "0.29.0", | ||
"dependencies": { | ||
@@ -28,2 +28,3 @@ "jss": "^3.3.0", | ||
"expect.js": "^0.3.1", | ||
"grape-js-emoji": "^0.0.1", | ||
"karma": "^0.13.8", | ||
@@ -30,0 +31,0 @@ "karma-chrome-launcher": "^0.1.10", |
122288
1360
27