mirror of
				https://github.com/avatao-content/frontend-tutorial-framework
				synced 2025-11-04 12:12:55 +00:00 
			
		
		
		
	Fix flickering bug
This commit is contained in:
		@@ -18,7 +18,7 @@
 | 
				
			|||||||
           <input type="text"
 | 
					           <input type="text"
 | 
				
			||||||
                  #urlbar
 | 
					                  #urlbar
 | 
				
			||||||
                  class="urlbar"
 | 
					                  class="urlbar"
 | 
				
			||||||
                  value="{{iframeUrl}}"
 | 
					                  value="{{actualIframeUrl}}"
 | 
				
			||||||
                  (keyup.enter)="changeIframeURL()">
 | 
					                  (keyup.enter)="changeIframeURL()">
 | 
				
			||||||
           <button class="go" (click)="changeIframeURL()">G</button>
 | 
					           <button class="go" (click)="changeIframeURL()">G</button>
 | 
				
			||||||
           </div>
 | 
					           </div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,6 +26,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
 | 
				
			|||||||
  layout: string = config.dashboard.currentLayout;
 | 
					  layout: string = config.dashboard.currentLayout;
 | 
				
			||||||
  hideMessages: boolean = config.dashboard.hideMessages;
 | 
					  hideMessages: boolean = config.dashboard.hideMessages;
 | 
				
			||||||
  iframeUrl: string = config.dashboard.iframeUrl;
 | 
					  iframeUrl: string = config.dashboard.iframeUrl;
 | 
				
			||||||
 | 
					  actualIframeUrl: string = this.iframeUrl;
 | 
				
			||||||
  selectedTerminalMenuItem: string = config.dashboard.terminalOrConsole;
 | 
					  selectedTerminalMenuItem: string = config.dashboard.terminalOrConsole;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  command_handlers = {
 | 
					  command_handlers = {
 | 
				
			||||||
@@ -117,6 +118,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  reloadIframe() {
 | 
					  reloadIframe() {
 | 
				
			||||||
    setTimeout(() => {
 | 
					    setTimeout(() => {
 | 
				
			||||||
 | 
					      console.log('reload timeout');
 | 
				
			||||||
      this.webiframe.nativeElement.contentWindow.location.reload(true);
 | 
					      this.webiframe.nativeElement.contentWindow.location.reload(true);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -143,10 +145,14 @@ export class DashboardComponent implements OnInit, OnDestroy {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  iframeLoad(): void {
 | 
					  iframeLoad(): void {
 | 
				
			||||||
    this.iframeUrl = this.webiframe.nativeElement.contentDocument.location.href.replace(document.baseURI, '/');
 | 
					    if (this.webiframe) {
 | 
				
			||||||
 | 
					      this.actualIframeUrl = this.webiframe.nativeElement.contentWindow.frames.location.pathname;
 | 
				
			||||||
 | 
					      console.log('load');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  changeIframeURL() {
 | 
					  changeIframeURL() {
 | 
				
			||||||
    this.webiframe.nativeElement.contentDocument.location.href = document.baseURI + this.urlbar.nativeElement.value.substr(1);
 | 
					    this.webiframe.nativeElement.contentWindow.frames.location.pathname = this.actualIframeUrl;
 | 
				
			||||||
 | 
					    console.log('change url');
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user