DEV: Convert HighlightSearch to gjs (#30406)
This commit is contained in:
parent
df9de3022f
commit
6175562cb2
|
@ -0,0 +1,13 @@
|
||||||
|
import Component from "@glimmer/component";
|
||||||
|
import { modifier } from "ember-modifier";
|
||||||
|
import highlightSearch from "discourse/lib/highlight-search";
|
||||||
|
|
||||||
|
export default class HighlightSearch extends Component {
|
||||||
|
highlight = modifier((element) => {
|
||||||
|
highlightSearch(element, this.args.highlight);
|
||||||
|
});
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<span {{this.highlight}}>{{yield}}</span>
|
||||||
|
</template>
|
||||||
|
}
|
|
@ -1,14 +0,0 @@
|
||||||
import Component from "@ember/component";
|
|
||||||
import { tagName } from "@ember-decorators/component";
|
|
||||||
import { observes, on } from "@ember-decorators/object";
|
|
||||||
import highlightSearch from "discourse/lib/highlight-search";
|
|
||||||
|
|
||||||
@tagName("span")
|
|
||||||
export default class HighlightSearch extends Component {
|
|
||||||
@on("didInsertElement")
|
|
||||||
@observes("highlight")
|
|
||||||
_highlightOnInsert() {
|
|
||||||
const term = this.highlight;
|
|
||||||
highlightSearch(this.element, term);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue