Skip to content

Commit bd4db3f

Browse files
committed
MOBILE-3213 database: Do not allow to set widths or heights
1 parent a0cd139 commit bd4db3f

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

src/addon/mod/data/components/index/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
286286

287287
let entriesHTML = this.dataHelper.getTemplate(this.data, 'listtemplateheader', this.fieldsArray);
288288

289+
console.error(entriesHTML);
289290
// Get first entry from the whole list.
290291
if (!this.search.searching || !this.firstEntry) {
291292
this.firstEntry = this.entries[0].id;
@@ -305,7 +306,8 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
305306
});
306307
entriesHTML += this.dataHelper.getTemplate(this.data, 'listtemplatefooter', this.fieldsArray);
307308

308-
this.entriesRendered = entriesHTML;
309+
this.entriesRendered = this.domUtils.fixHtml(entriesHTML);
310+
console.error(entriesHTML);
309311

310312
// Pass the input data to the component.
311313
this.jsData = {

src/addon/mod/data/data.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
white-space: normal;
44
word-break: break-word;
55
padding: $content-padding;
6+
@include safe-area-padding-horizontal($content-padding !important, $content-padding !important);
67
background-color: $white;
78
border-top-width: 1px;
89
border-bottom-width: 1px;
@@ -31,6 +32,18 @@
3132
@extend .col;
3233
min-height: auto;
3334
}
35+
36+
// Do not let block elements to define widths or heights.
37+
address, article, aside, blockquote, canvas, dd, div, dl, dt, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6,
38+
header, hr, li, main, nav, noscript, ol, p, pre, section, table, tfoot, ul, video {
39+
width: auto !important;
40+
height: auto !important;
41+
min-width: auto !important;
42+
min-height: auto !important;
43+
// Avoid having one entry over another.
44+
max-height: none !important;
45+
46+
}
3447
}
3548

3649
page-addon-mod-data-search,

src/addon/mod/data/providers/helper.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,10 @@ export class AddonModDataHelperProvider {
599599
getTemplate(data: any, type: string, fields: any[]): string {
600600
let template = data[type] || this.getDefaultTemplate(type, fields);
601601

602-
// Try to fix syntax errors so the template can be parsed by Angular.
603-
template = this.domUtils.fixHtml(template);
602+
if (type != 'listtemplateheader' && type != 'listtemplatefooter') {
603+
// Try to fix syntax errors so the template can be parsed by Angular.
604+
template = this.domUtils.fixHtml(template);
605+
}
604606

605607
// Add core-link directive to links.
606608
template = template.replace(/<a ([^>]*href="[^>]*)>/ig, (match, attributes) => {

0 commit comments

Comments
 (0)