We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fab356e commit d63616dCopy full SHA for d63616d
Modern Development/Service Portal Widgets/Emoji Replacer Widget/Client Script.cs
@@ -0,0 +1,25 @@
1
+api.controller=function($scope,$sce) {
2
+ /* widget controller */
3
+ var c = this;
4
+
5
+ c.emojiMap ={
6
+ ':smile:' :'😊',
7
+ ':sad:':'😓',
8
+ ":heart:":'❤️',
9
+ ":thumbsup:":'👍',
10
+ ":laugh:":"😀",
11
+ ":wink:":"😉",
12
+ ":clap:":"👏",
13
+ ":party:" :"🥳"
14
+ };
15
16
+ c.replaceEmojis = function(){
17
+ var text = $scope.data.inputText || '';
18
19
+ for(var key in c.emojiMap){
20
+ var regex = new RegExp(key.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1"),'g');
21
+ text = text.replace(regex,c.emojiMap[key]);
22
+ }
23
+ c.outputText= $sce.trustAsHtml(text);
24
25
+};
0 commit comments