This preview was created with an earlier version of Excel Viewer, and cannot be restored.
26 |Please close this tab and reopen the preview as you normally would.
27 |Alternatively, you can open a custom editor as follows:
28 |Excel Viewer now supports Visual Studio Code for the Web. To get started, go to https://vscode.dev.
33 | 34 | `; 35 | } 36 | 37 | get viewType(): string { 38 | return "gc-excelviewer-csv"; 39 | } 40 | 41 | get configurable(): boolean { 42 | return false; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/license.ts: -------------------------------------------------------------------------------- 1 | export function getLicenseKey() { 2 | return "Wijmo-license-key"; 3 | } -------------------------------------------------------------------------------- /src/serializer.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | import { WebviewPanel, WebviewPanelSerializer, ExtensionContext, Uri } from 'vscode'; 3 | import CsvDocumentView from './csvDocumentView'; 4 | import ExcelDocumentView from './excelDocumentView'; 5 | import LegacyDocumentView from './legacyDocumentView'; 6 | 7 | export class CsvSerializer implements WebviewPanelSerializer { 8 | 9 | private _context: ExtensionContext; 10 | 11 | constructor(context: ExtensionContext) { 12 | this._context = context; 13 | } 14 | 15 | public async deserializeWebviewPanel(webviewPanel: WebviewPanel, state: any) { 16 | CsvDocumentView.revive(this._context, Uri.parse(state.uri), webviewPanel); 17 | } 18 | } 19 | 20 | export class ExcelSerializer implements WebviewPanelSerializer { 21 | 22 | private _context: ExtensionContext; 23 | 24 | constructor(context: ExtensionContext) { 25 | this._context = context; 26 | } 27 | 28 | public async deserializeWebviewPanel(webviewPanel: WebviewPanel, state: any) { 29 | ExcelDocumentView.revive(this._context, Uri.parse(state.uri), webviewPanel); 30 | } 31 | } 32 | 33 | export class LegacySerializer implements WebviewPanelSerializer { 34 | 35 | private _context: ExtensionContext; 36 | 37 | constructor(context: ExtensionContext) { 38 | this._context = context; 39 | } 40 | 41 | public async deserializeWebviewPanel(webviewPanel: WebviewPanel, state: any) { 42 | LegacyDocumentView.revive(this._context, Uri.parse(state.uri), webviewPanel); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "outDir": "out", 6 | "lib": [ 7 | "es6", 8 | "dom" 9 | ], 10 | "sourceMap": true, 11 | "rootDir": "src" 12 | }, 13 | "include": [ 14 | "src/*.ts", 15 | "./node_modules/vscode/vscode.d.ts", 16 | "./node_modules/vscode/lib/*" 17 | ], 18 | "exclude": [ 19 | "node_modules" 20 | ] 21 | } -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | //@ts-check 7 | 'use strict'; 8 | 9 | const path = require('path'); 10 | const webpack = require('webpack'); 11 | 12 | /**@type {import('webpack').Configuration}*/ 13 | const nodeConfig = { 14 | target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/ 15 | mode: 'none', 16 | entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/ 17 | output: { // the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/ 18 | path: path.resolve(__dirname, 'dist'), 19 | filename: 'extension.js', 20 | libraryTarget: "commonjs2", 21 | devtoolModuleFilenameTemplate: "../[resource-path]", 22 | }, 23 | devtool: 'source-map', 24 | externals: { 25 | vscode: "commonjs vscode" // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/ 26 | }, 27 | resolve: { // support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader 28 | extensions: ['.ts', '.js'] 29 | }, 30 | stats: { 31 | warningsFilter: warning => RegExp("node_modules/express/lib/view.js").test(warning.message) 32 | }, 33 | module: { 34 | rules: [{ 35 | test: /\.ts$/, 36 | exclude: /node_modules/, 37 | use: [{ 38 | loader: 'ts-loader' 39 | }] 40 | }] 41 | }, 42 | } 43 | 44 | /**@type {import('webpack').Configuration}*/ 45 | const webConfig = { 46 | target: 'webworker', // web extensions run in a webworker context 47 | mode: 'none', 48 | entry: { 49 | 'extension': './src/extension.ts' // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/ 50 | }, 51 | output: { // the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/ 52 | path: path.resolve(__dirname, 'dist'), 53 | filename: 'extension.js', 54 | libraryTarget: "commonjs2", 55 | devtoolModuleFilenameTemplate: "../[resource-path]", 56 | }, 57 | devtool: 'source-map', 58 | externals: { 59 | vscode: "commonjs vscode" // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/ 60 | }, 61 | resolve: { // support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader 62 | mainFields: ['browser', 'module', 'main'], 63 | extensions: ['.ts', '.js'], 64 | alias: { 65 | // provides alternate implementation for node module and source files 66 | }, 67 | fallback: { 68 | // Webpack 5 no longer polyfills Node.js core modules automatically. 69 | // see https://webpack.js.org/configuration/resolve/#resolvefallback 70 | // for the list of Node.js core module polyfills. 71 | assert: require.resolve('assert'), 72 | path: require.resolve('path-browserify'), 73 | } 74 | }, 75 | stats: { 76 | warningsFilter: warning => RegExp("node_modules/express/lib/view.js").test(warning.message) 77 | }, 78 | plugins: [ 79 | new webpack.ProvidePlugin({ 80 | process: 'process/browser', // provide a shim for the global `process` variable 81 | }), 82 | ], 83 | module: { 84 | rules: [{ 85 | test: /\.ts$/, 86 | exclude: /node_modules/, 87 | use: [{ 88 | loader: 'ts-loader' 89 | }] 90 | }] 91 | }, 92 | } 93 | 94 | module.exports = [nodeConfig, webConfig]; 95 | --------------------------------------------------------------------------------