mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-18 11:32:24 -05:00
13 lines
378 B
JavaScript
13 lines
378 B
JavaScript
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);
|
|
});
|
|
}
|