Merge pull request #2329 from dpalou/MOBILE-3351

MOBILE-3351 core: Display image viewer in fullscreen
main
Juan Leyva 2020-03-31 11:10:34 +02:00 committed by GitHub
commit b5a8c7c605
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 11 deletions

View File

@ -99,7 +99,7 @@ export class CoreEmulatorCaptureHelperProvider {
params.maxTime = options.duration * 1000; params.maxTime = options.duration * 1000;
} }
modal = this.modalCtrl.create('CoreEmulatorCaptureMediaPage', params); modal = this.modalCtrl.create('CoreEmulatorCaptureMediaPage', params, { cssClass: 'core-modal-fullscreen' });
modal.present(); modal.present();
modal.onDidDismiss((data: any, role: string) => { modal.onDidDismiss((data: any, role: string) => {
if (role == 'success') { if (role == 'success') {

View File

@ -221,7 +221,7 @@ export class CoreFormatTextDirective implements OnChanges {
anchor.addEventListener('click', (e: Event) => { anchor.addEventListener('click', (e: Event) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this.domUtils.viewImage(imgSrc, img.getAttribute('alt'), this.component, this.componentId); this.domUtils.viewImage(imgSrc, img.getAttribute('alt'), this.component, this.componentId, true);
}); });
img.parentNode.appendChild(anchor); img.parentNode.appendChild(anchor);

View File

@ -1561,25 +1561,26 @@ export class CoreDomUtilsProvider {
} }
/** /**
* View an image in a new page or modal. * View an image in a modal.
* *
* @param image URL of the image. * @param image URL of the image.
* @param title Title of the page or modal. * @param title Title of the page or modal.
* @param component Component to link the image to if needed. * @param component Component to link the image to if needed.
* @param componentId An ID to use in conjunction with the component. * @param componentId An ID to use in conjunction with the component.
* @param fullScreen Whether the modal should be full screen.
*/ */
viewImage(image: string, title?: string, component?: string, componentId?: string | number): void { viewImage(image: string, title?: string, component?: string, componentId?: string | number, fullScreen?: boolean): void {
if (image) { if (image) {
const params: any = { const params: any = {
title: title, title: title,
image: image, image: image,
component: component, component: component,
componentId: componentId componentId: componentId,
}, };
modal = this.modalCtrl.create('CoreViewerImagePage', params); const options = fullScreen ? { cssClass: 'core-modal-fullscreen' } : {};
const modal = this.modalCtrl.create('CoreViewerImagePage', params, options);
modal.present(); modal.present();
} }
} }
/** /**