2019-10-23 13:06:54 -04:00
|
|
|
import Controller from "@ember/controller";
|
2020-01-16 12:56:53 -05:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2019-08-02 05:53:03 -04:00
|
|
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
|
|
|
|
2019-10-23 13:06:54 -04:00
|
|
|
export default Controller.extend(ModalFunctionality, {
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed("value", "model.compiledRegularExpression")
|
2019-08-02 05:53:03 -04:00
|
|
|
matches(value, regexpString) {
|
|
|
|
if (!value || !regexpString) return;
|
|
|
|
let censorRegexp = new RegExp(regexpString, "ig");
|
|
|
|
return value.match(censorRegexp);
|
|
|
|
}
|
|
|
|
});
|