fix strange memory debuging issue
This commit is contained in:
parent
877f142238
commit
5ed1e562e4
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "sengi",
|
"name": "sengi",
|
||||||
"version": "0.9.0",
|
"version": "0.9.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -3892,6 +3892,11 @@
|
||||||
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
|
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"emojione": {
|
||||||
|
"version": "4.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/emojione/-/emojione-4.5.0.tgz",
|
||||||
|
"integrity": "sha512-Tq55Y3UgPOnayFDN+Qd6QMP0rpoH10a1nhSFN27s8gXW3qymgFIHiXys2ECYYAI134BafmI3qP9ni2rZOe9BjA=="
|
||||||
|
},
|
||||||
"emojis-list": {
|
"emojis-list": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz",
|
||||||
|
@ -6322,11 +6327,6 @@
|
||||||
"integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=",
|
"integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"ionicons": {
|
|
||||||
"version": "4.5.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/ionicons/-/ionicons-4.5.5.tgz",
|
|
||||||
"integrity": "sha512-dIGI73XG6Fg2Ps77ry5Ywe36Pq7wUGkDkl0pBhC4uhsiyoW+oXe+pplmarXEnKEcB5fmlkRrBOxYYzZaoRiUGw=="
|
|
||||||
},
|
|
||||||
"ip": {
|
"ip": {
|
||||||
"version": "1.1.5",
|
"version": "1.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
|
"start-mem": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng serve",
|
||||||
"build": "ng build --prod",
|
"build": "ng build --prod",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"test-nowatch": "ng test --watch=false",
|
"test-nowatch": "ng test --watch=false",
|
||||||
|
@ -45,6 +46,7 @@
|
||||||
"bootstrap": "^4.1.3",
|
"bootstrap": "^4.1.3",
|
||||||
"core-js": "^2.5.4",
|
"core-js": "^2.5.4",
|
||||||
"ionicons": "^4.4.3",
|
"ionicons": "^4.4.3",
|
||||||
|
"emojione": "~4.5.0",
|
||||||
"rxjs": "^6.4.0",
|
"rxjs": "^6.4.0",
|
||||||
"tslib": "^1.9.0",
|
"tslib": "^1.9.0",
|
||||||
"zone.js": "^0.8.29"
|
"zone.js": "^0.8.29"
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import { Emoji } from "../services/models/mastodon.interfaces";
|
import { Emoji } from "../services/models/mastodon.interfaces";
|
||||||
import { EmojiOne } from "./emoji-one";
|
// import { EmojiOne } from "./emoji-one";
|
||||||
|
import * as EmojiOne from 'emojione';
|
||||||
|
|
||||||
export class EmojiConverter {
|
export class EmojiConverter {
|
||||||
private emojiOne = new EmojiOne();
|
// private emojiOne = new EmojiOne();
|
||||||
|
|
||||||
applyEmojis(emojis: Emoji[], text: string, type: EmojiTypeEnum): string {
|
applyEmojis(emojis: Emoji[], text: string, type: EmojiTypeEnum): string {
|
||||||
if (!text) return text;
|
if (!text) return text;
|
||||||
|
@ -14,12 +15,38 @@ export class EmojiConverter {
|
||||||
|
|
||||||
if (emojis) {
|
if (emojis) {
|
||||||
emojis.forEach(emoji => {
|
emojis.forEach(emoji => {
|
||||||
text = this.replaceAll(text, `:${emoji.shortcode}:`, `<img class="${className}" src="${emoji.url}" title=":${
|
try {
|
||||||
emoji.shortcode }:" alt=":${emoji.shortcode}:" />`)
|
text = this.replaceAll(text, `:${emoji.shortcode}:`, `<img class="${className}" src="${emoji.url}" title=":${
|
||||||
|
emoji.shortcode}:" alt=":${emoji.shortcode}:" />`);
|
||||||
|
} catch (err) {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
text = this.emojiOne.toImage(text, className);
|
text = this.applyEmojiOne(className, text);
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// text = this.emojiOne.toImage(text, className);
|
||||||
|
// } catch (err) {}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
private applyEmojiOne(className: string, text: string): string{
|
||||||
|
text = EmojiOne.toImage(text);
|
||||||
|
|
||||||
|
while (text.includes('class="emojione"')) {
|
||||||
|
text = text.replace('class="emojione"', `class="emojione ${className}"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (
|
||||||
|
text.includes("https://cdn.jsdelivr.net/emojione/assets/4.5/png/32/")
|
||||||
|
) {
|
||||||
|
text = text.replace(
|
||||||
|
"https://cdn.jsdelivr.net/emojione/assets/4.5/png/32/",
|
||||||
|
"assets/emoji/72x72/"
|
||||||
|
);
|
||||||
|
// text = text.replace('.png', '.svg');
|
||||||
|
}
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue