refactor: filter anchor link in setting description when searching (#428)

Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
Andy Lee 2025-07-28 18:19:24 +08:00 committed by GitHub
parent be7e4bd80b
commit 98a6322c11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -98,8 +98,12 @@ export default {
return true;
}
const description = this.t(setting.description, this.getDocLinkParams(setting) || {}, true)?.toLowerCase() || '';
let description = this.t(setting.description, this.getDocLinkParams(setting) || {}, true)?.toLowerCase() || '';
// remove <a> tags from description
if (description.includes('<a')) {
description = description.replace(/<a[^>]*>(.*?)<\/a>/g, '$1');
}
// filter by description
if (description.includes(searchQuery)) {
return true;