FEATURE: Better handling of quotation marks in site text search
It also matches 3 dots with the ellipsis symbol.
This commit is contained in:
@@ -6,7 +6,8 @@ export default Ember.Component.extend({
|
||||
|
||||
@on("didInsertElement")
|
||||
highlightTerm() {
|
||||
const term = this.get("term");
|
||||
const term = this._searchTerm();
|
||||
|
||||
if (term) {
|
||||
this.$(".site-text-id, .site-text-value").highlight(term, {
|
||||
className: "text-highlight"
|
||||
@@ -19,6 +20,18 @@ export default Ember.Component.extend({
|
||||
this.send("edit");
|
||||
},
|
||||
|
||||
_searchTerm() {
|
||||
const regex = this.get("searchRegex");
|
||||
const siteText = this.get("siteText");
|
||||
|
||||
if (regex && siteText) {
|
||||
const matches = siteText.value.match(new RegExp(regex, "i"));
|
||||
if (matches) return matches[0];
|
||||
}
|
||||
|
||||
return this.get("term");
|
||||
},
|
||||
|
||||
actions: {
|
||||
edit() {
|
||||
this.sendAction("editAction", this.get("siteText"));
|
||||
|
||||
Reference in New Issue
Block a user