mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 07:42:48 +08:00
Use TextFormatter Emoji plugin
This commit is contained in:
parent
df125862bb
commit
e9ea22d591
|
@ -3,8 +3,5 @@ var gulp = require('flarum-gulp');
|
|||
gulp({
|
||||
modules: {
|
||||
'flarum/emoji': 'src/**/*.js'
|
||||
},
|
||||
files: [
|
||||
'bower_components/twemoji/index.js'
|
||||
]
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"name": "flarum-emoji",
|
||||
"devDependencies": {
|
||||
"twemoji": "https://raw.githubusercontent.com/twitter/twemoji/gh-pages/twemoji.js"
|
||||
}
|
||||
}
|
608
extensions/emoji/js/forum/dist/extension.js
vendored
608
extensions/emoji/js/forum/dist/extension.js
vendored
File diff suppressed because one or more lines are too long
|
@ -4,21 +4,4 @@ import { override } from 'flarum/extend';
|
|||
import app from 'flarum/app';
|
||||
import Post from 'flarum/models/Post';
|
||||
|
||||
app.initializers.add('flarum-emoji', () => {
|
||||
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) => {
|
||||
original(text, element);
|
||||
|
||||
twemoji.parse(element);
|
||||
});
|
||||
});
|
||||
app.initializers.add('flarum-emoji', () => {});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -28,17 +28,21 @@ class FormatEmoticons
|
|||
*/
|
||||
public function addEmoticons(ConfigureFormatter $event)
|
||||
{
|
||||
$event->configurator->Emoticons->add(':)', '😄');
|
||||
$event->configurator->Emoticons->add(':D', '😃');
|
||||
$event->configurator->Emoticons->add(':P', '😜');
|
||||
$event->configurator->Emoticons->add(':(', '😟');
|
||||
$event->configurator->Emoticons->add(':|', '😐');
|
||||
$event->configurator->Emoticons->add(';)', '😉');
|
||||
$event->configurator->Emoticons->add(':*', '😘');
|
||||
$event->configurator->Emoticons->add(':\'(', '😢');
|
||||
$event->configurator->Emoticons->add(':\')', '😂');
|
||||
$event->configurator->Emoticons->add(':O', '😮');
|
||||
$event->configurator->Emoticons->add('B)', '😎');
|
||||
$event->configurator->Emoticons->add('>:(', '😡');
|
||||
$event->configurator->Emoji->useTwemoji();
|
||||
$event->configurator->Emoji->setImageSize(32);
|
||||
$event->configurator->Emoji->omitImageSize();
|
||||
|
||||
$event->configurator->Emoji->addAlias(':)', '😄');
|
||||
$event->configurator->Emoji->addAlias(':D', '😃');
|
||||
$event->configurator->Emoji->addAlias(':P', '😜');
|
||||
$event->configurator->Emoji->addAlias(':(', '😟');
|
||||
$event->configurator->Emoji->addAlias(':|', '😐');
|
||||
$event->configurator->Emoji->addAlias(';)', '😉');
|
||||
$event->configurator->Emoji->addAlias(':*', '😘');
|
||||
$event->configurator->Emoji->addAlias(':\'(', '😢');
|
||||
$event->configurator->Emoji->addAlias(':\')', '😂');
|
||||
$event->configurator->Emoji->addAlias(':O', '😮');
|
||||
$event->configurator->Emoji->addAlias('B)', '😎');
|
||||
$event->configurator->Emoji->addAlias('>:(', '😡');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user