mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-07 05:20:32 +03:00
replace window with lang/global
This commit is contained in:
parent
1880d91eee
commit
0dfac8590e
|
@ -4,9 +4,10 @@ import {RedocComponent, BaseComponent} from '../base';
|
|||
import SchemaManager from '../../utils/SchemaManager';
|
||||
import {NgZone, ChangeDetectionStrategy} from 'angular2/core';
|
||||
import {redocEvents} from '../../events';
|
||||
import scrollParent from 'scrollparent';
|
||||
import detectScollParent from 'scrollparent';
|
||||
|
||||
import {BrowserDomAdapter} from 'angular2/platform/browser';
|
||||
import {global} from 'angular2/src/facade/lang';
|
||||
|
||||
const CHANGE = {
|
||||
NEXT : 1,
|
||||
|
@ -33,10 +34,7 @@ export default class SideMenu extends BaseComponent {
|
|||
this.zone = zone;
|
||||
this.adapter = new BrowserDomAdapter();
|
||||
|
||||
this.scrollParent = scrollParent(document.querySelector('side-menu'));
|
||||
/*if (this.scrollParent.scrollHeight === this.scrollParent.clientHeight) {
|
||||
this.scrollParent = window;
|
||||
}*/
|
||||
this.scrollParent = detectScollParent(document.querySelector('side-menu'));
|
||||
|
||||
// for some reason constructor is not run inside zone
|
||||
// as workaround running it manually
|
||||
|
@ -55,7 +53,7 @@ export default class SideMenu extends BaseComponent {
|
|||
}
|
||||
|
||||
hashScroll(evt) {
|
||||
let hash = window.location.hash;
|
||||
let hash = global.location.hash;
|
||||
if (!hash) return;
|
||||
|
||||
hash = hash.substr(1);
|
||||
|
@ -71,7 +69,7 @@ export default class SideMenu extends BaseComponent {
|
|||
let view = document.querySelector('redoc');
|
||||
this.viewBoxTop = view.offsetTop;
|
||||
this.adapter.on(this.scrollParent, 'scroll', () => this.scrollHandler());
|
||||
this.adapter.on(window, 'hashchange', evt => this.hashScroll(evt));
|
||||
this.adapter.on(global, 'hashchange', evt => this.hashScroll(evt));
|
||||
}
|
||||
|
||||
activateAndScroll(idx, methodIdx) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user