mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-09 16:16:41 +08:00
chore(): sync with main
This commit is contained in:
@ -3,6 +3,7 @@ import { Component, Host, Prop, h } from '@stencil/core';
|
||||
|
||||
import { config } from '../../global/config';
|
||||
import { getIonMode } from '../../global/ionic-global';
|
||||
import { ENABLE_HTML_CONTENT_DEFAULT } from '../../utils/config';
|
||||
import type { IonicSafeString } from '../../utils/sanitization';
|
||||
import { sanitizeDOMString } from '../../utils/sanitization';
|
||||
import type { SpinnerTypes } from '../spinner/spinner-configs';
|
||||
@ -15,6 +16,8 @@ import type { SpinnerTypes } from '../spinner/spinner-configs';
|
||||
},
|
||||
})
|
||||
export class InfiniteScrollContent implements ComponentInterface {
|
||||
private customHTMLEnabled = config.get('innerHTMLTemplatesEnabled', ENABLE_HTML_CONTENT_DEFAULT);
|
||||
|
||||
/**
|
||||
* An animated SVG spinner that shows while loading.
|
||||
*/
|
||||
@ -28,6 +31,11 @@ export class InfiniteScrollContent implements ComponentInterface {
|
||||
* `<Ionic>`
|
||||
*
|
||||
* For more information: [Security Documentation](https://ionicframework.com/docs/faq/security)
|
||||
*
|
||||
* This property accepts custom HTML as a string.
|
||||
* Developers who only want to pass plain text
|
||||
* can disable the custom HTML functionality
|
||||
* by setting `innerHTMLTemplatesEnabled: false` in the Ionic config.
|
||||
*/
|
||||
@Prop() loadingText?: string | IonicSafeString;
|
||||
|
||||
@ -41,6 +49,15 @@ export class InfiniteScrollContent implements ComponentInterface {
|
||||
}
|
||||
}
|
||||
|
||||
private renderLoadingText() {
|
||||
const { customHTMLEnabled, loadingText } = this;
|
||||
if (customHTMLEnabled) {
|
||||
return <div class="infinite-loading-text" innerHTML={sanitizeDOMString(loadingText)}></div>;
|
||||
}
|
||||
|
||||
return <div class="infinite-loading-text">{this.loadingText}</div>;
|
||||
}
|
||||
|
||||
render() {
|
||||
const mode = getIonMode(this);
|
||||
return (
|
||||
@ -58,9 +75,7 @@ export class InfiniteScrollContent implements ComponentInterface {
|
||||
<ion-spinner name={this.loadingSpinner} />
|
||||
</div>
|
||||
)}
|
||||
{this.loadingText !== undefined && (
|
||||
<div class="infinite-loading-text" innerHTML={sanitizeDOMString(this.loadingText)} />
|
||||
)}
|
||||
{this.loadingText !== undefined && this.renderLoadingText()}
|
||||
</div>
|
||||
</Host>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user