mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 02:53:41 +08:00
14 lines
378 B
Plaintext
14 lines
378 B
Plaintext
|
import { censor } from 'pretty-text/censored-words';
|
||
|
import { registerOption } from 'pretty-text/pretty-text';
|
||
|
|
||
|
registerOption((siteSettings, opts) => {
|
||
|
opts.features.censored = true;
|
||
|
opts.censoredWords = siteSettings.censored_words;
|
||
|
});
|
||
|
|
||
|
export function setup(helper) {
|
||
|
helper.addPreProcessor(text => {
|
||
|
return censor(text, helper.getOptions().censoredWords);
|
||
|
});
|
||
|
}
|