Skip to content

Commit

Permalink
use emoji-regex package to check for emojis
Browse files Browse the repository at this point in the history
  • Loading branch information
txdv committed Apr 6, 2024
1 parent 5a494a0 commit cbc3573
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
14 changes: 10 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -20,8 +20,8 @@
"karma-jasmine": "^5.1.0",
"karma-junit-reporter": "^2.0.1",
"karma-webpack": "^5.0.0",
"linkifyjs": "^4.1.1",
"linkify-string": "^4.1.1",
"linkifyjs": "^4.1.1",
"protractor": "^7.0.0",
"webpack": "^5.88.1",
"webpack-cli": "^5.1.4",
Expand All @@ -47,6 +47,7 @@
"angular-sanitize": "^1.8.3",
"angular-touch": "^1.8.3",
"bootstrap": "^3.4.1",
"emoji-regex": "^10.3.0",
"emojione": "^4.5.0",
"favico.js": "^0.3.10",
"zlibjs": "^0.3.1"
Expand Down
6 changes: 3 additions & 3 deletions src/js/inputbar.js
@@ -1,6 +1,7 @@
'use strict';


import emojiRegexFunction from "emoji-regex"
const emojiRegex = emojiRegexFunction()

var weechat = angular.module('weechat');

Expand Down Expand Up @@ -36,8 +37,7 @@ weechat.directive('inputBar', function() {
// Cancel any command completion that was still ongoing
commandCompletionInputChanged = true;

var emojiRegex = /^(?:[\uD800-\uDBFF][\uDC00-\uDFFF])+$/, // *only* emoji
changed = false, // whether a segment was modified
var changed = false, // whether a segment was modified
inputNode = $scope.getInputNode(),
caretPos = inputNode.selectionStart,
position = 0; // current position in text
Expand Down

0 comments on commit cbc3573

Please sign in to comment.