Archived
1
0

chore(vscode): update to 1.53.2

These conflicts will be resolved in the following commits. We do it this way so
that PR review is possible.
This commit is contained in:
Joe Previte
2021-02-25 11:27:27 -07:00
1900 changed files with 83066 additions and 64589 deletions

View File

@ -0,0 +1,12 @@
test/**
test-workspace/**
src/**
tsconfig.json
out/test/**
out/**
extension.webpack.config.js
extension-browser.webpack.config.js
cgmanifest.json
yarn.lock
preview-src/**
webpack.config.js

View File

@ -0,0 +1,3 @@
# Simple Browser files
**Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.

View File

@ -0,0 +1,17 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//@ts-check
'use strict';
const withBrowserDefaults = require('../shared.webpack.config').browser;
module.exports = withBrowserDefaults({
context: __dirname,
entry: {
extension: './src/extension.ts'
}
});

View File

@ -0,0 +1,20 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//@ts-check
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
resolve: {
mainFields: ['module', 'main']
},
entry: {
extension: './src/extension.ts',
}
});

View File

@ -0,0 +1,210 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./preview-src/index.ts");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./preview-src/events.ts":
/*!*******************************!*\
!*** ./preview-src/events.ts ***!
\*******************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.onceDocumentLoaded = void 0;
function onceDocumentLoaded(f) {
if (document.readyState === 'loading' || document.readyState === 'uninitialized') {
document.addEventListener('DOMContentLoaded', f);
}
else {
f();
}
}
exports.onceDocumentLoaded = onceDocumentLoaded;
/***/ }),
/***/ "./preview-src/index.ts":
/*!******************************!*\
!*** ./preview-src/index.ts ***!
\******************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
const events_1 = __webpack_require__(/*! ./events */ "./preview-src/events.ts");
const vscode = acquireVsCodeApi();
function getSettings() {
const element = document.getElementById('simple-browser-settings');
if (element) {
const data = element.getAttribute('data-settings');
if (data) {
return JSON.parse(data);
}
}
throw new Error(`Could not load settings`);
}
const settings = getSettings();
const iframe = document.querySelector('iframe');
const header = document.querySelector('.header');
const input = header.querySelector('.url-input');
const forwardButton = header.querySelector('.forward-button');
const backButton = header.querySelector('.back-button');
const reloadButton = header.querySelector('.reload-button');
const openExternalButton = header.querySelector('.open-external-button');
window.addEventListener('message', e => {
switch (e.data.type) {
case 'focus':
{
iframe.focus();
break;
}
case 'didChangeFocusLockIndicatorEnabled':
{
toggleFocusLockIndicatorEnabled(e.data.enabled);
break;
}
}
});
events_1.onceDocumentLoaded(() => {
setInterval(() => {
var _a;
const iframeFocused = ((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.tagName) === 'IFRAME';
document.body.classList.toggle('iframe-focused', iframeFocused);
}, 50);
iframe.addEventListener('load', () => {
// Noop
});
input.addEventListener('change', e => {
const url = e.target.value;
navigateTo(url);
});
forwardButton.addEventListener('click', () => {
history.forward();
});
backButton.addEventListener('click', () => {
history.back();
});
openExternalButton.addEventListener('click', () => {
vscode.postMessage({
type: 'openExternal',
url: input.value
});
});
reloadButton.addEventListener('click', () => {
// This does not seem to trigger what we want
// history.go(0);
// This incorrectly adds entries to the history but does reload
iframe.src = input.value;
});
navigateTo(settings.url);
toggleFocusLockIndicatorEnabled(settings.focusLockIndicatorEnabled);
function navigateTo(url) {
iframe.src = url;
}
});
function toggleFocusLockIndicatorEnabled(enabled) {
document.body.classList.toggle('enable-focus-lock-indicator', enabled);
}
/***/ })
/******/ });
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,115 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
:root {
--container-paddding: 20px;
--input-padding-vertical: 2px;
--input-padding-horizontal: 4px;
--input-margin-vertical: 4px;
--input-margin-horizontal: 0;
}
html, body {
height: 100%;
min-height: 100%;
padding: 0;
margin: 0;
}
body {
display: grid;
grid-template-rows: auto 1fr;
}
input:not([type='checkbox']),
textarea {
display: block;
width: 100%;
border: none;
font-family: var(--vscode-font-family);
padding: var(--input-padding-vertical) var(--input-padding-horizontal);
color: var(--vscode-input-foreground);
outline-color: var(--vscode-input-border);
background-color: var(--vscode-input-background);
}
input::placeholder,
textarea::placeholder {
color: var(--vscode-input-placeholderForeground);
}
button {
border: none;
padding: var(--input-padding-vertical) var(--input-padding-horizontal);
text-align: center;
outline: 1px solid transparent;
outline-offset: 2px !important;
color: var(--vscode-icon-foreground);
background: none;
}
button:hover:not(:disabled) {
cursor: pointer;
background: var(--vscode-button-hoverBackground);
}
button:disabled {
opacity: 0.5;
background: var(--vscode-button-background);
}
button:focus {
outline-color: var(--vscode-focusBorder);
}
.header {
display: flex;
margin: 0.4em 1em;
}
.url-input {
flex: 1;
}
.controls {
display: flex;
}
.controls button {
display: flex;
margin-right: 0.3em;
}
.content {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
}
iframe {
width: 100%;
height: 100%;
border: none;
}
.iframe-focused-alert {
display: none;
position: absolute;
bottom: 1em;
background: var(--vscode-editorWidget-background);
color: var(--vscode-editorWidget-foreground);
padding: 0.2em 0.2em;
border-radius: 4px;
font-size: 8px;
font-family: monospace;
user-select: none;
pointer-events: none;
}
.iframe-focused.enable-focus-lock-indicator .iframe-focused-alert {
display: block;
}

View File

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 2L1 3V13L2 14H14L15 13V3L14 2H2ZM2 13V3H14V13H2ZM12 5H4V6H12V5ZM3 4V7H13V4H3ZM7 9H3V8H7V9ZM3 12H7V11H3V12ZM12 9H10V11H12V9ZM9 8V12H13V8H9Z" fill="#C5C5C5"/>
</svg>

After

Width:  |  Height:  |  Size: 312 B

View File

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 2L1 3V13L2 14H14L15 13V3L14 2H2ZM2 13V3H14V13H2ZM12 5H4V6H12V5ZM3 4V7H13V4H3ZM7 9H3V8H7V9ZM3 12H7V11H3V12ZM12 9H10V11H12V9ZM9 8V12H13V8H9Z" fill="#424242"/>
</svg>

After

Width:  |  Height:  |  Size: 312 B

View File

@ -0,0 +1,69 @@
{
"name": "simple-browser",
"displayName": "%displayName%",
"description": "%description%",
"enableProposedApi": true,
"version": "1.0.0",
"icon": "icon.png",
"publisher": "vscode",
"license": "MIT",
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
"engines": {
"vscode": "^1.53.0"
},
"main": "./out/extension",
"browser": "./dist/browser/extension",
"categories": [
"Other"
],
"activationEvents": [
"onCommand:simpleBrowser.show",
"onCommand:simpleBrowser.api.open",
"onUriOpen:http",
"onUriOpen:https"
],
"contributes": {
"commands": [
{
"command": "simpleBrowser.show",
"title": "Show",
"category": "Simple Browser"
}
],
"configuration": [
{
"title": "Simple Browser",
"properties": {
"simpleBrowser.focusLockIndicator.enabled": {
"type": "boolean",
"default": true,
"title": "Focus Lock Indicator Enabled",
"description": "%configuration.focusLockIndicator.enabled.description%"
}
}
}
]
},
"scripts": {
"compile": "gulp compile-extension:markdown-language-features && npm run build-preview",
"watch": "npm run build-preview && gulp watch-extension:markdown-language-features",
"vscode:prepublish": "npm run build-ext && npm run build-preview",
"build-ext": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:markdown-language-features ./tsconfig.json",
"build-preview": "webpack --mode development",
"build-preview-production": "webpack --mode production",
"compile-web": "npx webpack-cli --config extension-browser.webpack.config --mode none",
"watch-web": "npx webpack-cli --config extension-browser.webpack.config --mode none --watch --info-verbosity verbose"
},
"dependencies": {
"vscode-codicons": "^0.0.12",
"vscode-extension-telemetry": "0.1.1",
"vscode-nls": "^4.0.0"
},
"devDependencies": {
"@types/node": "^12.11.7",
"ts-loader": "^6.2.1",
"typescript": "^3.7.3",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.0"
}
}

View File

@ -0,0 +1,5 @@
{
"displayName": "Simple Browser",
"description": "A very basic built-in webview for displaying web content.",
"configuration.focusLockIndicator.enabled.description": "Enable/disable the floating indicator that shows when focused in the simple browser."
}

View File

@ -0,0 +1,12 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export function onceDocumentLoaded(f: () => void) {
if (document.readyState === 'loading' || document.readyState as string === 'uninitialized') {
document.addEventListener('DOMContentLoaded', f);
} else {
f();
}
}

View File

@ -0,0 +1,97 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { onceDocumentLoaded } from './events';
declare let acquireVsCodeApi: any;
const vscode = acquireVsCodeApi();
function getSettings() {
const element = document.getElementById('simple-browser-settings');
if (element) {
const data = element.getAttribute('data-settings');
if (data) {
return JSON.parse(data);
}
}
throw new Error(`Could not load settings`);
}
const settings = getSettings();
const iframe = document.querySelector('iframe')!;
const header = document.querySelector('.header')!;
const input = header.querySelector<HTMLInputElement>('.url-input')!;
const forwardButton = header.querySelector<HTMLButtonElement>('.forward-button')!;
const backButton = header.querySelector<HTMLButtonElement>('.back-button')!;
const reloadButton = header.querySelector<HTMLButtonElement>('.reload-button')!;
const openExternalButton = header.querySelector<HTMLButtonElement>('.open-external-button')!;
window.addEventListener('message', e => {
switch (e.data.type) {
case 'focus':
{
iframe.focus();
break;
}
case 'didChangeFocusLockIndicatorEnabled':
{
toggleFocusLockIndicatorEnabled(e.data.enabled);
break;
}
}
});
onceDocumentLoaded(() => {
setInterval(() => {
const iframeFocused = document.activeElement?.tagName === 'IFRAME';
document.body.classList.toggle('iframe-focused', iframeFocused);
}, 50);
iframe.addEventListener('load', () => {
// Noop
});
input.addEventListener('change', e => {
const url = (e.target as HTMLInputElement).value;
navigateTo(url);
});
forwardButton.addEventListener('click', () => {
history.forward();
});
backButton.addEventListener('click', () => {
history.back();
});
openExternalButton.addEventListener('click', () => {
vscode.postMessage({
type: 'openExternal',
url: input.value
});
});
reloadButton.addEventListener('click', () => {
// This does not seem to trigger what we want
// history.go(0);
// This incorrectly adds entries to the history but does reload
iframe.src = input.value;
});
navigateTo(settings.url);
toggleFocusLockIndicatorEnabled(settings.focusLockIndicatorEnabled);
function navigateTo(url: string): void {
iframe.src = url;
}
});
function toggleFocusLockIndicatorEnabled(enabled: boolean) {
document.body.classList.toggle('enable-focus-lock-indicator', enabled);
}

View File

@ -0,0 +1,12 @@
{
"extends": "../../shared.tsconfig.json",
"compilerOptions": {
"outDir": "./dist/",
"jsx": "react",
"lib": [
"es2018",
"DOM",
"DOM.Iterable"
]
}
}

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
export function disposeAll(disposables: vscode.Disposable[]) {
while (disposables.length) {
const item = disposables.pop();
if (item) {
item.dispose();
}
}
}
export abstract class Disposable {
private _isDisposed = false;
protected _disposables: vscode.Disposable[] = [];
public dispose(): any {
if (this._isDisposed) {
return;
}
this._isDisposed = true;
disposeAll(this._disposables);
}
protected _register<T extends vscode.Disposable>(value: T): T {
if (this._isDisposed) {
value.dispose();
} else {
this._disposables.push(value);
}
return value;
}
protected get isDisposed() {
return this._isDisposed;
}
}

View File

@ -0,0 +1,74 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { SimpleBrowserManager } from './simpleBrowserManager';
declare const URL: typeof import('url').URL;
const localize = nls.loadMessageBundle();
const openApiCommand = 'simpleBrowser.api.open';
const showCommand = 'simpleBrowser.show';
const enabledHosts = new Set<string>([
'localhost',
'127.0.0.1'
]);
const openerId = 'simpleBrowser.open';
export function activate(context: vscode.ExtensionContext) {
const manager = new SimpleBrowserManager(context.extensionUri);
context.subscriptions.push(manager);
context.subscriptions.push(vscode.commands.registerCommand(showCommand, async (url?: string) => {
if (!url) {
url = await vscode.window.showInputBox({
placeHolder: localize('simpleBrowser.show.placeholder', "https://example.com"),
prompt: localize('simpleBrowser.show.prompt', "Enter url to visit")
});
}
if (url) {
manager.show(url);
}
}));
context.subscriptions.push(vscode.commands.registerCommand(openApiCommand, (url: vscode.Uri, showOptions?: {
preserveFocus?: boolean,
viewColumn: vscode.ViewColumn,
}) => {
manager.show(url.toString(), showOptions);
}));
context.subscriptions.push(vscode.window.registerExternalUriOpener(openerId, {
canOpenExternalUri(uri: vscode.Uri) {
const originalUri = new URL(uri.toString());
if (enabledHosts.has(originalUri.hostname)) {
return isWeb()
? vscode.ExternalUriOpenerPriority.Default
: vscode.ExternalUriOpenerPriority.Option;
}
return vscode.ExternalUriOpenerPriority.None;
},
openExternalUri(resolveUri: vscode.Uri) {
return manager.show(resolveUri.toString(), {
viewColumn: vscode.window.activeTextEditor ? vscode.ViewColumn.Beside : vscode.ViewColumn.Active
});
}
}, {
schemes: ['http', 'https'],
label: localize('openTitle', "Open in simple browser"),
}));
}
function isWeb(): boolean {
// @ts-expect-error
return typeof navigator !== 'undefined' && vscode.env.uiKind === vscode.UIKind.Web;
}

View File

@ -0,0 +1,38 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { ShowOptions, SimpleBrowserView } from './simpleBrowserView';
export class SimpleBrowserManager {
private _activeView?: SimpleBrowserView;
constructor(
private readonly extensionUri: vscode.Uri,
) { }
dispose() {
this._activeView?.dispose();
this._activeView = undefined;
}
public show(url: string, options?: ShowOptions): void {
if (this._activeView) {
this._activeView.show(url, options);
} else {
const view = new SimpleBrowserView(this.extensionUri, url, options);
view.onDispose(() => {
if (this._activeView === view) {
this._activeView = undefined;
}
});
this._activeView = view;
}
}
}

View File

@ -0,0 +1,154 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { Disposable } from './dispose';
const localize = nls.loadMessageBundle();
export interface ShowOptions {
readonly preserveFocus?: boolean;
readonly viewColumn?: vscode.ViewColumn;
}
export class SimpleBrowserView extends Disposable {
public static readonly viewType = 'simpleBrowser.view';
private static readonly title = localize('view.title', "Simple Browser");
private readonly _webviewPanel: vscode.WebviewPanel;
private readonly _onDidDispose = this._register(new vscode.EventEmitter<void>());
public readonly onDispose = this._onDidDispose.event;
constructor(
private readonly extensionUri: vscode.Uri,
url: string,
showOptions?: ShowOptions
) {
super();
this._webviewPanel = this._register(vscode.window.createWebviewPanel(SimpleBrowserView.viewType, SimpleBrowserView.title, {
viewColumn: showOptions?.viewColumn ?? vscode.ViewColumn.Active,
preserveFocus: showOptions?.preserveFocus
}, {
enableScripts: true,
retainContextWhenHidden: true,
}));
this._register(this._webviewPanel.webview.onDidReceiveMessage(e => {
switch (e.type) {
case 'openExternal':
try {
const url = vscode.Uri.parse(e.url);
vscode.env.openExternal(url);
} catch {
// Noop
}
break;
}
}));
this._register(this._webviewPanel.onDidDispose(() => {
this.dispose();
}));
this._register(vscode.workspace.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('simpleBrowser.focusLockIndicator.enabled')) {
const configuration = vscode.workspace.getConfiguration('simpleBrowser');
this._webviewPanel.webview.postMessage({
type: 'didChangeFocusLockIndicatorEnabled',
focusLockEnabled: configuration.get<boolean>('focusLockIndicator.enabled', true)
});
}
}));
this.show(url);
}
public dispose() {
this._onDidDispose.fire();
super.dispose();
}
public show(url: string, options?: ShowOptions) {
this._webviewPanel.webview.html = this.getHtml(url);
this._webviewPanel.reveal(options?.viewColumn, options?.preserveFocus);
}
private getHtml(url: string) {
const configuration = vscode.workspace.getConfiguration('simpleBrowser');
const nonce = new Date().getTime() + '' + new Date().getMilliseconds();
const mainJs = this.extensionResourceUrl('media', 'index.js');
const mainCss = this.extensionResourceUrl('media', 'main.css');
const codiconsUri = this.extensionResourceUrl('node_modules', 'vscode-codicons', 'dist', 'codicon.css');
const codiconsFontUri = this.extensionResourceUrl('node_modules', 'vscode-codicons', 'dist', 'codicon.ttf');
return /* html */ `<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<meta http-equiv="Content-Security-Policy" content="
default-src 'none';
font-src ${codiconsFontUri};
style-src ${this._webviewPanel.webview.cspSource};
script-src 'nonce-${nonce}';
frame-src *;
">
<meta id="simple-browser-settings" data-settings="${escapeAttribute(JSON.stringify({
url: url,
focusLockEnabled: configuration.get<boolean>('focusLockIndicator.enabled', true)
}))}">
<link rel="stylesheet" type="text/css" href="${mainCss}">
<link rel="stylesheet" type="text/css" href="${codiconsUri}">
</head>
<body>
<header class="header">
<nav class="controls">
<button
title="${localize('control.back.title', "Back")}"
class="back-button icon"><i class="codicon codicon-arrow-left"></i></button>
<button
title="${localize('control.forward.title', "Forward")}"
class="forward-button icon"><i class="codicon codicon-arrow-right"></i></button>
<button
title="${localize('control.reload.title', "Reload")}"
class="reload-button icon"><i class="codicon codicon-refresh"></i></button>
</nav>
<input class="url-input" type="text" value=${url}>
<nav class="controls">
<button
title="${localize('control.openExternal.title', "Open in browser")}"
class="open-external-button icon"><i class="codicon codicon-link-external"></i></button>
</nav>
</header>
<div class="content">
<div class="iframe-focused-alert">${localize('view.iframe-focused', "Focus Lock")}</div>
<iframe sandbox="allow-scripts allow-forms allow-same-origin"></iframe>
</div>
<script src="${mainJs}" nonce="${nonce}"></script>
</body>
</html>`;
}
private extensionResourceUrl(...parts: string[]): vscode.Uri {
return this._webviewPanel.webview.asWebviewUri(vscode.Uri.joinPath(this.extensionUri, ...parts));
}
}
function escapeAttribute(value: string | vscode.Uri): string {
return value.toString().replace(/"/g, '&quot;');
}

View File

@ -0,0 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/// <reference path='../../../../src/vs/vscode.d.ts'/>
/// <reference path='../../../../src/vs/vscode.proposed.d.ts'/>

View File

@ -0,0 +1,10 @@
{
"extends": "../shared.tsconfig.json",
"compilerOptions": {
"outDir": "./out",
"experimentalDecorators": true
},
"include": [
"src/**/*"
]
}

View File

@ -0,0 +1,28 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const path = require('path');
module.exports = {
entry: {
index: './preview-src/index.ts',
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js']
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'media')
}
};

File diff suppressed because it is too large Load Diff