mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Notebooks cleanup: Remove old out of proc markdown option (#8394)
* Remove old out of proc markdown option * Revert change to stats.js
This commit is contained in:
@@ -25,7 +25,6 @@
|
|||||||
"onCommand:markdown.showSource",
|
"onCommand:markdown.showSource",
|
||||||
"onCommand:markdown.showPreviewSecuritySelector",
|
"onCommand:markdown.showPreviewSecuritySelector",
|
||||||
"onCommand:markdown.api.render",
|
"onCommand:markdown.api.render",
|
||||||
"onCommand:notebook.showPreview",
|
|
||||||
"onWebviewPanel:markdown.preview"
|
"onWebviewPanel:markdown.preview"
|
||||||
],
|
],
|
||||||
"contributes": {
|
"contributes": {
|
||||||
@@ -80,11 +79,6 @@
|
|||||||
"command": "markdown.preview.toggleLock",
|
"command": "markdown.preview.toggleLock",
|
||||||
"title": "%markdown.preview.toggleLock.title%",
|
"title": "%markdown.preview.toggleLock.title%",
|
||||||
"category": "Markdown"
|
"category": "Markdown"
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "notebook.showPreview",
|
|
||||||
"title": "notebook.showPreview",
|
|
||||||
"category": "Notebook"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"menus": {
|
"menus": {
|
||||||
@@ -170,10 +164,6 @@
|
|||||||
{
|
{
|
||||||
"command": "markdown.preview.refresh",
|
"command": "markdown.preview.refresh",
|
||||||
"when": "markdownPreviewFocus"
|
"when": "markdownPreviewFocus"
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "notebook.showPreview",
|
|
||||||
"when": "false"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,5 +10,4 @@ export { RefreshPreviewCommand } from './refreshPreview';
|
|||||||
export { ShowPreviewSecuritySelectorCommand } from './showPreviewSecuritySelector';
|
export { ShowPreviewSecuritySelectorCommand } from './showPreviewSecuritySelector';
|
||||||
export { MoveCursorToPositionCommand } from './moveCursorToPosition';
|
export { MoveCursorToPositionCommand } from './moveCursorToPosition';
|
||||||
export { ToggleLockCommand } from './toggleLock';
|
export { ToggleLockCommand } from './toggleLock';
|
||||||
export { ShowNotebookPreview } from './showNotebookPreview'; // {{SQL CARBON EDIT}}
|
|
||||||
export { RenderDocument } from './renderDocument';
|
export { RenderDocument } from './renderDocument';
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
import * as vscode from 'vscode';
|
|
||||||
|
|
||||||
import { Command } from '../commandManager';
|
|
||||||
import { MarkdownEngine } from '../markdownEngine';
|
|
||||||
|
|
||||||
export class ShowNotebookPreview implements Command {
|
|
||||||
public readonly id = 'notebook.showPreview';
|
|
||||||
|
|
||||||
public constructor(
|
|
||||||
private readonly engine: MarkdownEngine
|
|
||||||
) { }
|
|
||||||
|
|
||||||
public async execute(document: vscode.Uri, textContent: string): Promise<string> {
|
|
||||||
return this.engine.renderText(document, textContent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -83,7 +83,6 @@ function registerMarkdownCommands(
|
|||||||
commandManager.register(new commands.ShowPreviewSecuritySelectorCommand(previewSecuritySelector, previewManager));
|
commandManager.register(new commands.ShowPreviewSecuritySelectorCommand(previewSecuritySelector, previewManager));
|
||||||
commandManager.register(new commands.OpenDocumentLinkCommand(engine));
|
commandManager.register(new commands.OpenDocumentLinkCommand(engine));
|
||||||
commandManager.register(new commands.ToggleLockCommand(previewManager));
|
commandManager.register(new commands.ToggleLockCommand(previewManager));
|
||||||
commandManager.register(new commands.ShowNotebookPreview(engine)); // {{SQL CARBON EDIT}}
|
|
||||||
commandManager.register(new commands.RenderDocument(engine));
|
commandManager.register(new commands.RenderDocument(engine));
|
||||||
return commandManager;
|
return commandManager;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,13 +11,11 @@ import { OnInit, Component, Input, Inject, forwardRef, ElementRef, ChangeDetecto
|
|||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
import { IColorTheme, IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
import { IColorTheme, IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||||
import * as themeColors from 'vs/workbench/common/theme';
|
import * as themeColors from 'vs/workbench/common/theme';
|
||||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import { Emitter } from 'vs/base/common/event';
|
import { Emitter } from 'vs/base/common/event';
|
||||||
import { URI } from 'vs/base/common/uri';
|
import { URI } from 'vs/base/common/uri';
|
||||||
import * as DOM from 'vs/base/browser/dom';
|
import * as DOM from 'vs/base/browser/dom';
|
||||||
|
|
||||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
|
||||||
import { toDisposable } from 'vs/base/common/lifecycle';
|
import { toDisposable } from 'vs/base/common/lifecycle';
|
||||||
import { IMarkdownRenderResult } from 'vs/editor/contrib/markdown/markdownRenderer';
|
import { IMarkdownRenderResult } from 'vs/editor/contrib/markdown/markdownRenderer';
|
||||||
import { NotebookMarkdownRenderer } from 'sql/workbench/contrib/notebook/browser/outputs/notebookMarkdown';
|
import { NotebookMarkdownRenderer } from 'sql/workbench/contrib/notebook/browser/outputs/notebookMarkdown';
|
||||||
@@ -26,7 +24,6 @@ import { ICellModel } from 'sql/workbench/contrib/notebook/browser/models/modelI
|
|||||||
import { NotebookModel } from 'sql/workbench/contrib/notebook/browser/models/notebookModel';
|
import { NotebookModel } from 'sql/workbench/contrib/notebook/browser/models/notebookModel';
|
||||||
import { ISanitizer, defaultSanitizer } from 'sql/workbench/contrib/notebook/browser/outputs/sanitizer';
|
import { ISanitizer, defaultSanitizer } from 'sql/workbench/contrib/notebook/browser/outputs/sanitizer';
|
||||||
import { CellToggleMoreActions } from 'sql/workbench/contrib/notebook/browser/cellToggleMoreActions';
|
import { CellToggleMoreActions } from 'sql/workbench/contrib/notebook/browser/cellToggleMoreActions';
|
||||||
import { useInProcMarkdown, convertVscodeResourceToFileInSubDirectories } from 'sql/workbench/contrib/notebook/browser/models/notebookUtils';
|
|
||||||
|
|
||||||
export const TEXT_SELECTOR: string = 'text-cell-component';
|
export const TEXT_SELECTOR: string = 'text-cell-component';
|
||||||
const USER_SELECT_CLASS = 'actionselect';
|
const USER_SELECT_CLASS = 'actionselect';
|
||||||
@@ -83,9 +80,6 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges {
|
|||||||
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
|
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
|
||||||
@Inject(IInstantiationService) private _instantiationService: IInstantiationService,
|
@Inject(IInstantiationService) private _instantiationService: IInstantiationService,
|
||||||
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
|
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
|
||||||
@Inject(ICommandService) private _commandService: ICommandService,
|
|
||||||
@Inject(IConfigurationService) private configurationService: IConfigurationService,
|
|
||||||
|
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.isEditMode = true;
|
this.isEditMode = true;
|
||||||
@@ -171,7 +165,6 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges {
|
|||||||
this._content = this.cellModel.source;
|
this._content = this.cellModel.source;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useInProcMarkdown(this.configurationService)) {
|
|
||||||
this.markdownRenderer.setNotebookURI(this.cellModel.notebookModel.notebookUri);
|
this.markdownRenderer.setNotebookURI(this.cellModel.notebookModel.notebookUri);
|
||||||
this.markdownResult = this.markdownRenderer.render({
|
this.markdownResult = this.markdownRenderer.render({
|
||||||
isTrusted: true,
|
isTrusted: true,
|
||||||
@@ -181,15 +174,6 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges {
|
|||||||
this.setLoading(false);
|
this.setLoading(false);
|
||||||
let outputElement = <HTMLElement>this.output.nativeElement;
|
let outputElement = <HTMLElement>this.output.nativeElement;
|
||||||
outputElement.innerHTML = this.markdownResult.element.innerHTML;
|
outputElement.innerHTML = this.markdownResult.element.innerHTML;
|
||||||
} else {
|
|
||||||
this._commandService.executeCommand<string>('notebook.showPreview', this.cellModel.notebookModel.notebookUri, this._content).then((htmlcontent) => {
|
|
||||||
htmlcontent = convertVscodeResourceToFileInSubDirectories(htmlcontent, this.cellModel);
|
|
||||||
htmlcontent = this.sanitizeContent(htmlcontent);
|
|
||||||
let outputElement = <HTMLElement>this.output.nativeElement;
|
|
||||||
outputElement.innerHTML = htmlcontent;
|
|
||||||
this.setLoading(false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import * as path from 'vs/base/common/path';
|
|||||||
import { nb, ServerInfo } from 'azdata';
|
import { nb, ServerInfo } from 'azdata';
|
||||||
import { DEFAULT_NOTEBOOK_PROVIDER, DEFAULT_NOTEBOOK_FILETYPE, INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
import { DEFAULT_NOTEBOOK_PROVIDER, DEFAULT_NOTEBOOK_FILETYPE, INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
|
||||||
import { ICellModel } from 'sql/workbench/contrib/notebook/browser/models/modelInterfaces';
|
import { ICellModel } from 'sql/workbench/contrib/notebook/browser/models/modelInterfaces';
|
||||||
import { URI } from 'vs/base/common/uri';
|
import { URI } from 'vs/base/common/uri';
|
||||||
import { startsWith } from 'vs/base/common/strings';
|
import { startsWith } from 'vs/base/common/strings';
|
||||||
@@ -129,10 +128,6 @@ export function convertVscodeResourceToFileInSubDirectories(htmlContent: string,
|
|||||||
return htmlContent;
|
return htmlContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useInProcMarkdown(configurationService: IConfigurationService): boolean {
|
|
||||||
return configurationService.getValue('notebook.useInProcMarkdown');
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getClusterEndpoints(serverInfo: ServerInfo): IEndpoint[] | undefined {
|
export function getClusterEndpoints(serverInfo: ServerInfo): IEndpoint[] | undefined {
|
||||||
let endpoints: RawEndpoint[] = serverInfo.options[clusterEndpointsProperty];
|
let endpoints: RawEndpoint[] = serverInfo.options[clusterEndpointsProperty];
|
||||||
if (!endpoints || endpoints.length === 0) { return []; }
|
if (!endpoints || endpoints.length === 0) { return []; }
|
||||||
|
|||||||
@@ -146,19 +146,6 @@ registerAction({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const configurationRegistry = <IConfigurationRegistry>Registry.as(ConfigExtensions.Configuration);
|
const configurationRegistry = <IConfigurationRegistry>Registry.as(ConfigExtensions.Configuration);
|
||||||
configurationRegistry.registerConfiguration({
|
|
||||||
'id': 'notebook',
|
|
||||||
'title': 'Notebook',
|
|
||||||
'type': 'object',
|
|
||||||
'properties': {
|
|
||||||
'notebook.useInProcMarkdown': {
|
|
||||||
'type': 'boolean',
|
|
||||||
'default': true,
|
|
||||||
'description': localize('notebook.inProcMarkdown', "Use in-process markdown viewer to render text cells more quickly (Experimental).")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
configurationRegistry.registerConfiguration({
|
configurationRegistry.registerConfiguration({
|
||||||
'id': 'notebook',
|
'id': 'notebook',
|
||||||
'title': 'Notebook',
|
'title': 'Notebook',
|
||||||
|
|||||||
@@ -7,18 +7,13 @@ import 'vs/css!../cellViews/textCell';
|
|||||||
import 'vs/css!../cellViews/media/markdown';
|
import 'vs/css!../cellViews/media/markdown';
|
||||||
import 'vs/css!../cellViews/media/highlight';
|
import 'vs/css!../cellViews/media/highlight';
|
||||||
|
|
||||||
import { OnInit, Component, Input, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild } from '@angular/core';
|
import { OnInit, Component, Input, Inject, ElementRef, ViewChild } from '@angular/core';
|
||||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
|
||||||
import { ISanitizer, defaultSanitizer } from 'sql/workbench/contrib/notebook/browser/outputs/sanitizer';
|
|
||||||
import { AngularDisposable } from 'sql/base/browser/lifecycle';
|
import { AngularDisposable } from 'sql/base/browser/lifecycle';
|
||||||
import { IMimeComponent } from 'sql/workbench/contrib/notebook/browser/outputs/mimeRegistry';
|
import { IMimeComponent } from 'sql/workbench/contrib/notebook/browser/outputs/mimeRegistry';
|
||||||
import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
|
||||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import { NotebookMarkdownRenderer } from 'sql/workbench/contrib/notebook/browser/outputs/notebookMarkdown';
|
import { NotebookMarkdownRenderer } from 'sql/workbench/contrib/notebook/browser/outputs/notebookMarkdown';
|
||||||
import { MimeModel } from 'sql/workbench/contrib/notebook/browser/models/mimemodel';
|
import { MimeModel } from 'sql/workbench/contrib/notebook/browser/models/mimemodel';
|
||||||
import { ICellModel } from 'sql/workbench/contrib/notebook/browser/models/modelInterfaces';
|
import { ICellModel } from 'sql/workbench/contrib/notebook/browser/models/modelInterfaces';
|
||||||
import { useInProcMarkdown, convertVscodeResourceToFileInSubDirectories } from 'sql/workbench/contrib/notebook/browser/models/notebookUtils';
|
|
||||||
import { URI } from 'vs/base/common/uri';
|
import { URI } from 'vs/base/common/uri';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -30,7 +25,6 @@ export class MarkdownOutputComponent extends AngularDisposable implements IMimeC
|
|||||||
|
|
||||||
@ViewChild('output', { read: ElementRef }) private output: ElementRef;
|
@ViewChild('output', { read: ElementRef }) private output: ElementRef;
|
||||||
|
|
||||||
private _sanitizer: ISanitizer;
|
|
||||||
private _lastTrustedMode: boolean;
|
private _lastTrustedMode: boolean;
|
||||||
|
|
||||||
private _bundleOptions: MimeModel.IOptions;
|
private _bundleOptions: MimeModel.IOptions;
|
||||||
@@ -40,15 +34,10 @@ export class MarkdownOutputComponent extends AngularDisposable implements IMimeC
|
|||||||
private _markdownRenderer: NotebookMarkdownRenderer;
|
private _markdownRenderer: NotebookMarkdownRenderer;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
|
|
||||||
@Inject(ICommandService) private _commandService: ICommandService,
|
|
||||||
@Inject(INotebookService) private _notebookService: INotebookService,
|
|
||||||
@Inject(IConfigurationService) private _configurationService: IConfigurationService,
|
|
||||||
@Inject(IInstantiationService) private _instantiationService: IInstantiationService
|
@Inject(IInstantiationService) private _instantiationService: IInstantiationService
|
||||||
|
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this._sanitizer = this._notebookService.getMimeRegistry().sanitizer;
|
|
||||||
this._markdownRenderer = this._instantiationService.createInstance(NotebookMarkdownRenderer);
|
this._markdownRenderer = this._instantiationService.createInstance(NotebookMarkdownRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,19 +69,6 @@ export class MarkdownOutputComponent extends AngularDisposable implements IMimeC
|
|||||||
return this.cellModel.notebookModel.notebookUri;
|
return this.cellModel.notebookModel.notebookUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Gets sanitizer from ISanitizer interface
|
|
||||||
private get sanitizer(): ISanitizer {
|
|
||||||
if (this._sanitizer) {
|
|
||||||
return this._sanitizer;
|
|
||||||
}
|
|
||||||
return this._sanitizer = defaultSanitizer;
|
|
||||||
}
|
|
||||||
|
|
||||||
private setLoading(isLoading: boolean): void {
|
|
||||||
this.loading = isLoading;
|
|
||||||
this._changeRef.detectChanges();
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.updatePreview();
|
this.updatePreview();
|
||||||
}
|
}
|
||||||
@@ -110,7 +86,6 @@ export class MarkdownOutputComponent extends AngularDisposable implements IMimeC
|
|||||||
if (trustedChanged || !this._initialized) {
|
if (trustedChanged || !this._initialized) {
|
||||||
this._lastTrustedMode = this.isTrusted;
|
this._lastTrustedMode = this.isTrusted;
|
||||||
let content = this._bundleOptions.data['text/markdown'];
|
let content = this._bundleOptions.data['text/markdown'];
|
||||||
if (useInProcMarkdown(this._configurationService)) {
|
|
||||||
this._markdownRenderer.setNotebookURI(this.cellModel.notebookModel.notebookUri);
|
this._markdownRenderer.setNotebookURI(this.cellModel.notebookModel.notebookUri);
|
||||||
let markdownResult = this._markdownRenderer.render({
|
let markdownResult = this._markdownRenderer.render({
|
||||||
isTrusted: this.cellModel.trustedMode,
|
isTrusted: this.cellModel.trustedMode,
|
||||||
@@ -118,32 +93,10 @@ export class MarkdownOutputComponent extends AngularDisposable implements IMimeC
|
|||||||
});
|
});
|
||||||
let outputElement = <HTMLElement>this.output.nativeElement;
|
let outputElement = <HTMLElement>this.output.nativeElement;
|
||||||
outputElement.innerHTML = markdownResult.element.innerHTML;
|
outputElement.innerHTML = markdownResult.element.innerHTML;
|
||||||
} else {
|
|
||||||
if (!content) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this._commandService.executeCommand<string>('notebook.showPreview', this._cellModel.notebookModel.notebookUri, content).then((htmlcontent) => {
|
|
||||||
htmlcontent = convertVscodeResourceToFileInSubDirectories(htmlcontent, this._cellModel);
|
|
||||||
htmlcontent = this.sanitizeContent(htmlcontent);
|
|
||||||
let outputElement = <HTMLElement>this.output.nativeElement;
|
|
||||||
outputElement.innerHTML = htmlcontent;
|
|
||||||
this.setLoading(false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this._initialized = true;
|
this._initialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sanitizes the content based on trusted mode of Cell Model
|
|
||||||
private sanitizeContent(content: string): string {
|
|
||||||
if (this.isTrusted) {
|
|
||||||
content = this.sanitizer.sanitize(content);
|
|
||||||
}
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public layout() {
|
public layout() {
|
||||||
// Do we need to update on layout changed?
|
// Do we need to update on layout changed?
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user