Fixed #3287 adding loading-spinner to markdown cell (#3505)

This commit is contained in:
Yurong He
2018-12-07 13:07:00 -08:00
committed by GitHub
parent 049678b32e
commit 944a77fe42
2 changed files with 16 additions and 1 deletions

View File

@@ -5,6 +5,7 @@
*--------------------------------------------------------------------------------------------*/
-->
<div style="overflow: hidden; width: 100%; height: 100%; display: flex; flex-flow: column">
<loading-spinner [loading]="isLoading"></loading-spinner>
<div class="notebook-text" style="flex: 0 0 auto;">
<code-component *ngIf="isEditMode" [cellModel]="cellModel" (onContentChanged)="handleContentChanged()" [model]="model" [activeCellId]="activeCellId" [hideVerticalToolbar]=true>
</code-component>

View File

@@ -16,6 +16,9 @@ import { ICellModel } from 'sql/parts/notebook/models/modelInterfaces';
import { ISanitizer, defaultSanitizer } from 'sql/parts/notebook/outputs/sanitizer';
import { localize } from 'vs/nls';
import { NotebookModel } from 'sql/parts/notebook/models/notebookModel';
import { Emitter } from 'vs/base/common/event';
import URI from 'vs/base/common/uri';
import { IOpenerService } from 'vs/platform/opener/common/opener';
export const TEXT_SELECTOR: string = 'text-cell-component';
@@ -40,15 +43,20 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges {
private _sanitizer: ISanitizer;
private _model: NotebookModel;
private _activeCellId: string;
private readonly _onDidClickLink = this._register(new Emitter<URI>());
public readonly onDidClickLink = this._onDidClickLink.event;
protected isLoading: boolean;
constructor(
@Inject(forwardRef(() => CommonServiceInterface)) private _bootstrapService: CommonServiceInterface,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
@Inject(ICommandService) private _commandService: ICommandService
@Inject(ICommandService) private _commandService: ICommandService,
@Inject(IOpenerService) private readonly openerService: IOpenerService,
) {
super();
this.isEditMode = false;
this.isLoading = true;
}
//Gets sanitizer from ISanitizer interface
@@ -67,8 +75,14 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges {
return this._activeCellId;
}
private setLoading(isLoading: boolean): void {
this.isLoading = isLoading;
this._changeRef.detectChanges();
}
ngOnInit() {
this.updatePreview();
this.setLoading(false);
this._register(this.themeService.onDidColorThemeChange(this.updateTheme, this));
this.updateTheme(this.themeService.getColorTheme());
this.cellModel.onOutputsChanged(e => {