forked from CIT/Vmeda.Online
		
	MOBILE-2650 format-text: Treat limks in Vimeo and Youtube iframes
This commit is contained in:
		
							parent
							
								
									ab8fddaaf3
								
							
						
					
					
						commit
						85c3d0fc7c
					
				| @ -519,6 +519,8 @@ export class CoreFormatTextDirective implements OnChanges { | |||||||
| 
 | 
 | ||||||
|         // Replace video tag by the iframe.
 |         // Replace video tag by the iframe.
 | ||||||
|         video.parentNode.replaceChild(iframe, video); |         video.parentNode.replaceChild(iframe, video); | ||||||
|  | 
 | ||||||
|  |         this.iframeUtils.treatFrame(iframe); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @ -554,7 +556,7 @@ export class CoreFormatTextDirective implements OnChanges { | |||||||
|      * |      * | ||||||
|      * @param {HTMLIFrameElement} iframe Iframe to treat. |      * @param {HTMLIFrameElement} iframe Iframe to treat. | ||||||
|      * @param {CoreSite} site Site instance. |      * @param {CoreSite} site Site instance. | ||||||
|      * @param  {Boolean} canTreatVimeo Whether Vimeo videos can be treated in the site. |      * @param {boolean} canTreatVimeo Whether Vimeo videos can be treated in the site. | ||||||
|      */ |      */ | ||||||
|     protected treatIframe(iframe: HTMLIFrameElement, site: CoreSite, canTreatVimeo: boolean): void { |     protected treatIframe(iframe: HTMLIFrameElement, site: CoreSite, canTreatVimeo: boolean): void { | ||||||
|         const src = iframe.src, |         const src = iframe.src, | ||||||
| @ -571,8 +573,9 @@ export class CoreFormatTextDirective implements OnChanges { | |||||||
|             }); |             }); | ||||||
| 
 | 
 | ||||||
|             return; |             return; | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         } else if (src && canTreatVimeo) { |         if (src && canTreatVimeo) { | ||||||
|             // Check if it's a Vimeo video. If it is, use the wsplayer script instead to make restricted videos work.
 |             // Check if it's a Vimeo video. If it is, use the wsplayer script instead to make restricted videos work.
 | ||||||
|             const matches = iframe.src.match(/https?:\/\/player\.vimeo\.com\/video\/([0-9]+)/); |             const matches = iframe.src.match(/https?:\/\/player\.vimeo\.com\/video\/([0-9]+)/); | ||||||
|             if (matches && matches[1]) { |             if (matches && matches[1]) { | ||||||
| @ -620,8 +623,6 @@ export class CoreFormatTextDirective implements OnChanges { | |||||||
|                         } |                         } | ||||||
|                     }); |                     }); | ||||||
|                 } |                 } | ||||||
| 
 |  | ||||||
|                 return; |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user