mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
Rename .js.es6
to .js
in the admin application
This commit is contained in:
37
app/assets/javascripts/admin/components/site-text-summary.js
Normal file
37
app/assets/javascripts/admin/components/site-text-summary.js
Normal file
@ -0,0 +1,37 @@
|
||||
import Component from "@ember/component";
|
||||
import { on } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["site-text"],
|
||||
classNameBindings: ["siteText.overridden"],
|
||||
|
||||
@on("didInsertElement")
|
||||
highlightTerm() {
|
||||
const term = this._searchTerm();
|
||||
|
||||
if (term) {
|
||||
$(
|
||||
this.element.querySelector(".site-text-id, .site-text-value")
|
||||
).highlight(term, {
|
||||
className: "text-highlight"
|
||||
});
|
||||
}
|
||||
$(this.element.querySelector(".site-text-value")).ellipsis();
|
||||
},
|
||||
|
||||
click() {
|
||||
this.editAction(this.siteText);
|
||||
},
|
||||
|
||||
_searchTerm() {
|
||||
const regex = this.searchRegex;
|
||||
const siteText = this.siteText;
|
||||
|
||||
if (regex && siteText) {
|
||||
const matches = siteText.value.match(new RegExp(regex, "i"));
|
||||
if (matches) return matches[0];
|
||||
}
|
||||
|
||||
return this.term;
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user