mirror of
https://github.com/flarum/core.git
synced 2025-08-07 00:47:00 +02:00
PERF: Cache emojified post content
This commit is contained in:
@@ -5,8 +5,15 @@ import app from 'flarum/app';
|
||||
import Post from 'flarum/models/Post';
|
||||
|
||||
app.initializers.add('emoji', () => {
|
||||
override(Post.prototype, 'contentHtml', original => {
|
||||
return twemoji.parse(original());
|
||||
override(Post.prototype, 'contentHtml', function(original) {
|
||||
const contentHtml = original();
|
||||
|
||||
if (this.oldContentHtml !== contentHtml) {
|
||||
this.emojifiedContentHtml = twemoji.parse(contentHtml);
|
||||
this.oldContentHtml = contentHtml;
|
||||
}
|
||||
|
||||
return this.emojifiedContentHtml;
|
||||
});
|
||||
|
||||
override(s9e.TextFormatter, 'preview', (original, text, element) => {
|
||||
|
Reference in New Issue
Block a user