MOBILE-3947 chore: Allow inner HTML templates
parent
47d5eb5eaa
commit
2db3635882
|
@ -52,6 +52,8 @@ export function createTranslateLoader(http: HttpClient): TranslateHttpLoader {
|
||||||
IonicModule.forRoot(
|
IonicModule.forRoot(
|
||||||
{
|
{
|
||||||
navAnimation: moodleTransitionAnimation,
|
navAnimation: moodleTransitionAnimation,
|
||||||
|
innerHTMLTemplatesEnabled: true,
|
||||||
|
sanitizerEnabled: true,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
HttpClientModule, // HttpClient is used to make JSON requests. It fails for HEAD requests because there is no content.
|
HttpClientModule, // HttpClient is used to make JSON requests. It fails for HEAD requests because there is no content.
|
||||||
|
|
|
@ -459,8 +459,8 @@ export class CoreLoginSitePage implements OnInit {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (errorDetails) {
|
if (errorDetails) {
|
||||||
|
// Avoid sanitizing JS.
|
||||||
const containerElement = alertElement.querySelector('.core-error-info-container');
|
const containerElement = alertElement.querySelector('.core-error-info-container');
|
||||||
|
|
||||||
if (containerElement) {
|
if (containerElement) {
|
||||||
containerElement.innerHTML = CoreErrorInfoComponent.render(errorDetails, errorCode);
|
containerElement.innerHTML = CoreErrorInfoComponent.render(errorDetails, errorCode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -815,14 +815,20 @@ export class CoreDomUtilsProvider {
|
||||||
* @returns Promise resolved with the alert modal.
|
* @returns Promise resolved with the alert modal.
|
||||||
*/
|
*/
|
||||||
async showAlertWithOptions(options: AlertOptions = {}, autocloseTime?: number): Promise<HTMLIonAlertElement> {
|
async showAlertWithOptions(options: AlertOptions = {}, autocloseTime?: number): Promise<HTMLIonAlertElement> {
|
||||||
const hasHTMLTags = CoreTextUtils.hasHTMLTags(<string> options.message || '');
|
let message = typeof options.message == 'string'
|
||||||
|
? options.message
|
||||||
|
: options.message?.value || '';
|
||||||
|
|
||||||
|
const hasHTMLTags = CoreTextUtils.hasHTMLTags(message);
|
||||||
|
|
||||||
if (hasHTMLTags && !CoreSites.getCurrentSite()?.isVersionGreaterEqualThan('3.7')) {
|
if (hasHTMLTags && !CoreSites.getCurrentSite()?.isVersionGreaterEqualThan('3.7')) {
|
||||||
// Treat multilang.
|
// Treat multilang.
|
||||||
options.message = await CoreLang.filterMultilang(<string> options.message);
|
message = await CoreLang.filterMultilang(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
const alertId = <string> Md5.hashAsciiStr((options.header || '') + '#' + (options.message || ''));
|
options.message = message;
|
||||||
|
|
||||||
|
const alertId = Md5.hashAsciiStr((options.header || '') + '#' + (message|| ''));
|
||||||
|
|
||||||
if (this.displayedAlerts[alertId]) {
|
if (this.displayedAlerts[alertId]) {
|
||||||
// There's already an alert with the same message and title. Return it.
|
// There's already an alert with the same message and title. Return it.
|
||||||
|
|
Loading…
Reference in New Issue