add: 上下文加入 package 文件内容

This commit is contained in:
chitanda 2021-12-09 11:32:22 +08:00
parent 7ca40bea6d
commit 92938fb0a2
3 changed files with 31 additions and 2 deletions

View File

@ -2,6 +2,7 @@ import { commands, ExtensionContext, workspace, WorkspaceConfiguration } from 'v
import { ConfigConst, RTContextConst } from '../constants';
import { IBizMosFSCustom } from '../file-system';
import { GlobalContextData } from '../interface';
import { getPackageJson } from '../util';
import { Websocket } from '../ws';
/**
@ -63,6 +64,34 @@ export class GlobalContext {
return this._mosFS;
}
/**
* package.json
*
* @author chitanda
* @date 2021-12-09 11:12:21
* @private
* @type {Record<string, any>}
*/
private _package?: Record<string, any>;
get package(): Record<string, any> {
if (!this._package) {
this._package = getPackageJson();
}
return this._package;
}
/**
*
*
* @author chitanda
* @date 2021-12-09 11:12:42
* @readonly
* @type {string}
*/
get version(): string {
return this.package.version;
}
/**
*
*

View File

@ -23,7 +23,7 @@ export class IBizModelRuntimeEditorProvider extends CustomEditorBase {
const resetCssUri = this.getResourcesUri('css/custom-editor-reset.css');
const cssUri = this.getResourcesUri('css/custom-iframe-editor.css');
const jsUri = this.getResourcesUri('js/custom-iframe-editor.js');
const iframe = this.getIframeElement(`${address}/model-runtime/`);
const iframe = this.getIframeElement(`${address}/model-runtime/?${ctx.version}`);
return `<!DOCTYPE html>
<html lang='en'>
<head>

View File

@ -74,7 +74,7 @@ export class IBizModelUIEditorProvider extends CustomEditorBase {
} else if (!url.endsWith('&')) {
url += '&';
}
url += `platform=vscode`;
url += `platform=vscode&version=${ctx.version}`;
urls[0] = url;
iframeUrl = urls.join('#');
}