mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-03-14 00:50:14 -04:00
FEATURE: add 'enable_emoji' site setting
This commit is contained in:
parent
bb64c2236b
commit
205d61363d
4 changed files with 19 additions and 0 deletions
|
@ -1,4 +1,6 @@
|
|||
(function() {
|
||||
// disable the whole plugin
|
||||
|
||||
|
||||
var emoji = <%= Dir.glob(File.expand_path("../../../public/images/*.png", __FILE__)).map{|f| File.basename(f).split(".")[0]}.inspect %>;
|
||||
|
||||
|
@ -55,6 +57,7 @@
|
|||
} else {
|
||||
var replacement = translations[t];
|
||||
Discourse.Dialect.inlineReplace(t, function (token, match, prev) {
|
||||
if (!Discourse.SiteSettings.enable_emoji) { return; }
|
||||
return checkPrev(prev) ? imageFor(replacement) : token;
|
||||
});
|
||||
}
|
||||
|
@ -69,6 +72,8 @@
|
|||
}).join("|"));
|
||||
|
||||
Discourse.Dialect.registerInline(':', function(text, match, prev) {
|
||||
if (!Discourse.SiteSettings.enable_emoji) { return; }
|
||||
|
||||
var endPos = text.indexOf(':', 1),
|
||||
firstSpace = text.search(/\s/),
|
||||
contents;
|
||||
|
@ -104,6 +109,7 @@
|
|||
var ComposerView = (Discourse && Discourse.ComposerView) || (typeof require !== "undefined" && require('discourse/views/composer').default);
|
||||
if (ComposerView) {
|
||||
ComposerView.on("initWmdEditor", function(event){
|
||||
if (!Discourse.SiteSettings.enable_emoji) { return; }
|
||||
|
||||
var baseUrl = Discourse.getURL("/");
|
||||
|
||||
|
|
6
plugins/emoji/config/locales/client.en.yml
Normal file
6
plugins/emoji/config/locales/client.en.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
en:
|
||||
admin_js:
|
||||
admin:
|
||||
site_settings:
|
||||
categories:
|
||||
emoji: "Emoji"
|
3
plugins/emoji/config/locales/server.en.yml
Normal file
3
plugins/emoji/config/locales/server.en.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
en:
|
||||
site_settings:
|
||||
enable_emoji: "Enable the emoji plugin"
|
4
plugins/emoji/config/settings.yml
Normal file
4
plugins/emoji/config/settings.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
emoji:
|
||||
enable_emoji:
|
||||
default: true
|
||||
client: true
|
Loading…
Reference in a new issue