From bd4db3ff014507bede7100095364a0d16495fe86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Wed, 18 Dec 2019 11:32:38 +0100 Subject: [PATCH] MOBILE-3213 database: Do not allow to set widths or heights --- src/addon/mod/data/components/index/index.ts | 4 +++- src/addon/mod/data/data.scss | 13 +++++++++++++ src/addon/mod/data/providers/helper.ts | 6 ++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/addon/mod/data/components/index/index.ts b/src/addon/mod/data/components/index/index.ts index af1ab14b6..ebd311e52 100644 --- a/src/addon/mod/data/components/index/index.ts +++ b/src/addon/mod/data/components/index/index.ts @@ -286,6 +286,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp let entriesHTML = this.dataHelper.getTemplate(this.data, 'listtemplateheader', this.fieldsArray); + console.error(entriesHTML); // Get first entry from the whole list. if (!this.search.searching || !this.firstEntry) { this.firstEntry = this.entries[0].id; @@ -305,7 +306,8 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp }); entriesHTML += this.dataHelper.getTemplate(this.data, 'listtemplatefooter', this.fieldsArray); - this.entriesRendered = entriesHTML; + this.entriesRendered = this.domUtils.fixHtml(entriesHTML); + console.error(entriesHTML); // Pass the input data to the component. this.jsData = { diff --git a/src/addon/mod/data/data.scss b/src/addon/mod/data/data.scss index 1bce48a43..f99ba5150 100644 --- a/src/addon/mod/data/data.scss +++ b/src/addon/mod/data/data.scss @@ -3,6 +3,7 @@ white-space: normal; word-break: break-word; padding: $content-padding; + @include safe-area-padding-horizontal($content-padding !important, $content-padding !important); background-color: $white; border-top-width: 1px; border-bottom-width: 1px; @@ -31,6 +32,18 @@ @extend .col; min-height: auto; } + + // Do not let block elements to define widths or heights. + address, article, aside, blockquote, canvas, dd, div, dl, dt, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, + header, hr, li, main, nav, noscript, ol, p, pre, section, table, tfoot, ul, video { + width: auto !important; + height: auto !important; + min-width: auto !important; + min-height: auto !important; + // Avoid having one entry over another. + max-height: none !important; + + } } page-addon-mod-data-search, diff --git a/src/addon/mod/data/providers/helper.ts b/src/addon/mod/data/providers/helper.ts index f59e62e5d..2d48ef390 100644 --- a/src/addon/mod/data/providers/helper.ts +++ b/src/addon/mod/data/providers/helper.ts @@ -599,8 +599,10 @@ export class AddonModDataHelperProvider { getTemplate(data: any, type: string, fields: any[]): string { let template = data[type] || this.getDefaultTemplate(type, fields); - // Try to fix syntax errors so the template can be parsed by Angular. - template = this.domUtils.fixHtml(template); + if (type != 'listtemplateheader' && type != 'listtemplatefooter') { + // Try to fix syntax errors so the template can be parsed by Angular. + template = this.domUtils.fixHtml(template); + } // Add core-link directive to links. template = template.replace(/]*href="[^>]*)>/ig, (match, attributes) => {