Skip to content

Commit

Permalink
fix emoji bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Pandao committed Mar 11, 2015
1 parent 91351a0 commit 0bf73ca
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 27 deletions.
20 changes: 13 additions & 7 deletions editormd.amd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2844,13 +2844,14 @@
};

editormd.regexs = {
atLink : /@(\w+)/g,
email : /(\w+)@(\w+)\.(\w+)\.?(\w+)?/g,
emailLink : /(mailto:)?([\w\.\_]+)@(\w+)\.(\w+)\.?(\w+)?/g,
emoji : /:([\-\w]+):/g,
twemoji : /:(tw-([\w]+)-?(\w+)?):/g,
fontAwesome : /:(fa-([\w]+)(-(\w+)){0,}):/g,
editormdLogo : /:(editormd-logo-?(\w+)?):/g
atLink : /@(\w+)/g,
email : /(\w+)@(\w+)\.(\w+)\.?(\w+)?/g,
emailLink : /(mailto:)?([\w\.\_]+)@(\w+)\.(\w+)\.?(\w+)?/g,
emoji : /:([\-\w]+):/g,
emojiDatetime : /(\d{2}:\d{2}:\d{2})/g,
twemoji : /:(tw-([\w]+)-?(\w+)?):/g,
fontAwesome : /:(fa-([\w]+)(-(\w+)){0,}):/g,
editormdLogo : /:(editormd-logo-?(\w+)?):/g
};

// Emoji graphics files url path
Expand Down Expand Up @@ -2900,6 +2901,11 @@
var editormdLogoReg = editormd.regexs.editormdLogo;

markedRenderer.emoji = function(text) {

text = text.replace(editormd.regexs.emojiDatetime, function($1) {
return $1.replace(/:/g, ":");
});

var matchs = text.match(emojiReg);

if (!matchs || !settings.emoji) {
Expand Down
4 changes: 2 additions & 2 deletions editormd.amd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion editormd.amd.min.js.map

Large diffs are not rendered by default.

20 changes: 13 additions & 7 deletions editormd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2774,13 +2774,14 @@
};

editormd.regexs = {
atLink : /@(\w+)/g,
email : /(\w+)@(\w+)\.(\w+)\.?(\w+)?/g,
emailLink : /(mailto:)?([\w\.\_]+)@(\w+)\.(\w+)\.?(\w+)?/g,
emoji : /:([\-\w]+):/g,
twemoji : /:(tw-([\w]+)-?(\w+)?):/g,
fontAwesome : /:(fa-([\w]+)(-(\w+)){0,}):/g,
editormdLogo : /:(editormd-logo-?(\w+)?):/g
atLink : /@(\w+)/g,
email : /(\w+)@(\w+)\.(\w+)\.?(\w+)?/g,
emailLink : /(mailto:)?([\w\.\_]+)@(\w+)\.(\w+)\.?(\w+)?/g,
emoji : /:([\-\w]+):/g,
emojiDatetime : /(\d{2}:\d{2}:\d{2})/g,
twemoji : /:(tw-([\w]+)-?(\w+)?):/g,
fontAwesome : /:(fa-([\w]+)(-(\w+)){0,}):/g,
editormdLogo : /:(editormd-logo-?(\w+)?):/g
};

// Emoji graphics files url path
Expand Down Expand Up @@ -2830,6 +2831,11 @@
var editormdLogoReg = editormd.regexs.editormdLogo;

markedRenderer.emoji = function(text) {

text = text.replace(editormd.regexs.emojiDatetime, function($1) {
return $1.replace(/:/g, ":");
});

var matchs = text.match(emojiReg);

if (!matchs || !settings.emoji) {
Expand Down
4 changes: 2 additions & 2 deletions editormd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion editormd.min.js.map

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions examples/emoji.html
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ <h1>Emoji表情</h1>

&gt; dd:smiley:引用文本(Blockquotes:smiley:)fdasfad :fa-star:: dfd :fa-truck: @pandao

#### Datetime test

02:21:47

2015-03-12 02:21:47

###Table

|:100: First Header | Second:smiley: Header:smiley: |
Expand Down
20 changes: 13 additions & 7 deletions src/editormd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2762,13 +2762,14 @@
};

editormd.regexs = {
atLink : /@(\w+)/g,
email : /(\w+)@(\w+)\.(\w+)\.?(\w+)?/g,
emailLink : /(mailto:)?([\w\.\_]+)@(\w+)\.(\w+)\.?(\w+)?/g,
emoji : /:([\-\w]+):/g,
twemoji : /:(tw-([\w]+)-?(\w+)?):/g,
fontAwesome : /:(fa-([\w]+)(-(\w+)){0,}):/g,
editormdLogo : /:(editormd-logo-?(\w+)?):/g
atLink : /@(\w+)/g,
email : /(\w+)@(\w+)\.(\w+)\.?(\w+)?/g,
emailLink : /(mailto:)?([\w\.\_]+)@(\w+)\.(\w+)\.?(\w+)?/g,
emoji : /:([\-\w]+):/g,
emojiDatetime : /(\d{2}:\d{2}:\d{2})/g,
twemoji : /:(tw-([\w]+)-?(\w+)?):/g,
fontAwesome : /:(fa-([\w]+)(-(\w+)){0,}):/g,
editormdLogo : /:(editormd-logo-?(\w+)?):/g
};

// Emoji graphics files url path
Expand Down Expand Up @@ -2818,6 +2819,11 @@
var editormdLogoReg = editormd.regexs.editormdLogo;

markedRenderer.emoji = function(text) {

text = text.replace(editormd.regexs.emojiDatetime, function($1) {
return $1.replace(/:/g, "&#58;");
});

var matchs = text.match(emojiReg);

if (!matchs || !settings.emoji) {
Expand Down

0 comments on commit 0bf73ca

Please sign in to comment.