From e65ac7026e72f38a8553bf8ed5df8ffa0eb64711 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 3 Mar 2020 13:09:23 +0100 Subject: [PATCH] MOBILE-3348 glossary: Filter concepts and fix divider with HTML --- .../components/index/addon-mod-glossary-index.html | 4 ++-- src/addon/mod/glossary/components/index/index.ts | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/addon/mod/glossary/components/index/addon-mod-glossary-index.html b/src/addon/mod/glossary/components/index/addon-mod-glossary-index.html index 4ab42f08d..235c51297 100644 --- a/src/addon/mod/glossary/components/index/addon-mod-glossary-index.html +++ b/src/addon/mod/glossary/components/index/addon-mod-glossary-index.html @@ -41,7 +41,7 @@ {{ 'addon.mod_glossary.entriestobesynced' | translate }} -

{{entry.concept}}

+

@@ -53,7 +53,7 @@ -

{{entry.concept}}

+

diff --git a/src/addon/mod/glossary/components/index/index.ts b/src/addon/mod/glossary/components/index/index.ts index c12178ba2..41bfbd760 100644 --- a/src/addon/mod/glossary/components/index/index.ts +++ b/src/addon/mod/glossary/components/index/index.ts @@ -320,7 +320,12 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity this.fetchFunction = this.glossaryProvider.getEntriesByLetter; this.fetchInvalidate = this.glossaryProvider.invalidateEntriesByLetter; this.fetchArguments = [this.glossary.id, 'ALL']; - this.getDivider = (entry: any): string => entry.concept.substr(0, 1).toUpperCase(); + this.getDivider = (entry: any): string => { + // Try to get the first letter without HTML tags. + const noTags = this.textUtils.cleanTags(entry.concept); + + return (noTags || entry.concept).substr(0, 1).toUpperCase(); + }; this.showDivider = (entry?: any, previous?: any): boolean => { return !previous || this.getDivider(entry) != this.getDivider(previous); };