FEATURE: Better handling of quotation marks in site text search

It also matches 3 dots with the ellipsis symbol.
This commit is contained in:
Gerhard Schlager
2018-11-10 01:17:07 +01:00
parent c7377e2f2d
commit 7c4d4331bc
6 changed files with 69 additions and 7 deletions
@@ -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"));