Skip to content

Commit

Permalink
replace emojione with emoji-toolkit
Browse files Browse the repository at this point in the history
  • Loading branch information
rpetti committed Dec 8, 2022
1 parent 9cc2324 commit 008b334
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"angular2-hotkeys": "^2.1.5",
"bootstrap": "^4.1.3",
"core-js": "^2.5.4",
"emojione": "~4.5.0",
"emoji-toolkit": "^7.0.0",
"howler": "^2.1.2",
"ng-pick-datetime": "^7.0.0",
"ngx-contextmenu": "^5.2.0",
Expand Down
16 changes: 9 additions & 7 deletions src/app/tools/emoji.tools.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Emoji } from "../services/models/mastodon.interfaces";
// import { EmojiOne } from "./emoji-one";
import * as EmojiOne from 'emojione';
import * as EmojiToolkit from 'emoji-toolkit';

export class EmojiConverter {
// private emojiOne = new EmojiOne();
Expand Down Expand Up @@ -31,21 +31,23 @@ export class EmojiConverter {
}

private applyEmojiOne(className: string, text: string): string{
text = EmojiOne.toImage(text);
text = EmojiToolkit.toImage(text);

while (text.includes('class="emojione"')) {
text = text.replace('class="emojione"', `class="emojione ${className}"`);
while (text.includes('class="joypixels"')) {
text = text.replace('class="joypixels"', `class="joypixels ${className}"`);
}


/* Static asset copy of emojis need to be updated to joypixels 7.0, use CDN for now
while (
text.includes("https://cdn.jsdelivr.net/emojione/assets/4.5/png/32/")
text.includes("https://cdn.jsdelivr.net/joypixels/assets/7.0/png/")
) {
text = text.replace(
"https://cdn.jsdelivr.net/emojione/assets/4.5/png/32/",
"https://cdn.jsdelivr.net/joypixels/assets/7.0/png/",
"assets/emoji/72x72/"
);
// text = text.replace('.png', '.svg');
}
*/

return text;
}
Expand Down

0 comments on commit 008b334

Please sign in to comment.