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) {
|
2020-09-22 10:28:28 -04:00
|
|
|
if (!value || !regexpString) {
|
|
|
|
return;
|
|
|
|
}
|
2019-08-02 05:53:03 -04:00
|
|
|
let censorRegexp = new RegExp(regexpString, "ig");
|
|
|
|
return value.match(censorRegexp);
|
|
|
|
},
|
|
|
|
});
|