MOBILE-3213 database: Do not allow to set widths or heights

main
Pau Ferrer Ocaña 2019-12-18 11:32:38 +01:00
parent a0cd139d9c
commit bd4db3ff01
3 changed files with 20 additions and 3 deletions

View File

@ -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 = {

View File

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

View File

@ -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(/<a ([^>]*href="[^>]*)>/ig, (match, attributes) => {