mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
Image viewer scrolls background #258
This commit is contained in:
parent
bbd4198850
commit
277e24d787
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ng2-alfresco-viewer",
|
"name": "ng2-alfresco-viewer",
|
||||||
"description": "Alfresco documents viewer",
|
"description": "Alfresco documents viewer",
|
||||||
"version": "0.1.26",
|
"version": "0.1.27",
|
||||||
"author": "Eugenio Romano",
|
"author": "Eugenio Romano",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rimraf dist node_modules typings",
|
"clean": "rimraf dist node_modules typings",
|
||||||
|
@ -15,9 +15,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, ElementRef, Input, Output, HostListener, EventEmitter } from '@angular/core';
|
import { Component, ElementRef, Input, Output, HostListener, EventEmitter, Inject } from '@angular/core';
|
||||||
import { PdfViewerComponent } from './pdfViewer.component';
|
import { PdfViewerComponent } from './pdfViewer.component';
|
||||||
import { NotSupportedFormat } from './notSupportedFormat.component';
|
import { NotSupportedFormat } from './notSupportedFormat.component';
|
||||||
|
import { DOCUMENT } from '@angular/platform-browser';
|
||||||
|
|
||||||
declare let __moduleName: string;
|
declare let __moduleName: string;
|
||||||
|
|
||||||
@ -54,12 +55,13 @@ export class ViewerComponent {
|
|||||||
|
|
||||||
extension: string;
|
extension: string;
|
||||||
|
|
||||||
constructor(private element: ElementRef) {
|
constructor(private element: ElementRef, @Inject(DOCUMENT) private document) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes) {
|
ngOnChanges(changes) {
|
||||||
if (this.showViewer) {
|
if (this.showViewer) {
|
||||||
this.hideOtherHeaderBar();
|
this.hideOtherHeaderBar();
|
||||||
|
this.blockOtherScrollBar();
|
||||||
if (!this.urlFile) {
|
if (!this.urlFile) {
|
||||||
throw new Error('Attribute urlFile is required');
|
throw new Error('Attribute urlFile is required');
|
||||||
}
|
}
|
||||||
@ -78,6 +80,7 @@ export class ViewerComponent {
|
|||||||
* close the viewer
|
* close the viewer
|
||||||
*/
|
*/
|
||||||
close() {
|
close() {
|
||||||
|
this.unblockOtherScrollBar();
|
||||||
if (this.otherMenu) {
|
if (this.otherMenu) {
|
||||||
this.otherMenu.hidden = false;
|
this.otherMenu.hidden = false;
|
||||||
}
|
}
|
||||||
@ -167,6 +170,32 @@ export class ViewerComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if in the document there are scrollable main area and disable it
|
||||||
|
*
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
private blockOtherScrollBar() {
|
||||||
|
let mainElements: any = document.getElementsByTagName('main');
|
||||||
|
|
||||||
|
for (let i = 0; i < mainElements.length; i++) {
|
||||||
|
mainElements[i].style.overflow = 'hidden';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if in the document there are scrollable main area and renable it
|
||||||
|
*
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
private unblockOtherScrollBar() {
|
||||||
|
let mainElements: any = document.getElementsByTagName('main');
|
||||||
|
|
||||||
|
for (let i = 0; i < mainElements.length; i++) {
|
||||||
|
mainElements[i].style.overflow = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the viewer is used inside and header element
|
* Check if the viewer is used inside and header element
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user