mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
Workaround for search box viewer instance not appearing on result click
Refs #173
This commit is contained in:
parent
0028f91fd4
commit
ef8fde5c6f
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, Output, HostListener } from 'angular2/core';
|
||||
import { Component, ElementRef, Input, Output, HostListener } from 'angular2/core';
|
||||
import { EventEmitter } from 'angular2/src/facade/async';
|
||||
import { PdfViewerComponent } from './pdfViewer.component';
|
||||
import { NotSupportedFormat } from './notSupportedFormat.component';
|
||||
@ -59,6 +59,9 @@ export class ViewerComponent {
|
||||
|
||||
extension: string;
|
||||
|
||||
constructor(private element: ElementRef) {
|
||||
}
|
||||
|
||||
ngOnChanges(changes) {
|
||||
if (this.showViewer) {
|
||||
this.hideOtherMenu();
|
||||
@ -158,11 +161,24 @@ export class ViewerComponent {
|
||||
}
|
||||
}
|
||||
|
||||
private closestElement(el: HTMLElement, nodeName: string) {
|
||||
let parent = el.parentElement;
|
||||
if (parent) {
|
||||
if (parent.nodeName.toLowerCase() === nodeName) {
|
||||
return parent;
|
||||
} else {
|
||||
return this.closestElement(parent, nodeName);
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide the othe possible menu in th eapplication
|
||||
* Hide the other possible menu in the application
|
||||
*/
|
||||
private hideOtherMenu() {
|
||||
if (this.overlayMode) {
|
||||
if (this.overlayMode && !this.closestElement(this.element.nativeElement, 'header')) {
|
||||
this.otherMenu = document.querySelector('header');
|
||||
if (this.otherMenu) {
|
||||
this.otherMenu.hidden = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user