DEV: Convert HighlightSearch to gjs (#30406)

This commit is contained in:
Jarek Radosz 2024-12-23 08:54:59 +01:00 committed by GitHub
parent df9de3022f
commit 6175562cb2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 14 deletions

View File

@ -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>
}

View File

@ -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);
}
}