fix: 自定义编辑器 url 异常

This commit is contained in:
chitanda 2021-12-09 10:02:31 +08:00
parent 15d8d20b07
commit 7ca40bea6d
1 changed files with 1 additions and 12 deletions

View File

@ -2,7 +2,7 @@ import { APIMessageItem } from '@ibiz/vscode-editor-api';
import { CancellationToken, CustomTextEditorProvider, Disposable, ExtensionContext, TextDocument, Uri, ViewColumn, Webview, WebviewPanel, window } from 'vscode';
import { ctx } from '../../context';
import { PSMosFile } from '../../entities';
import { getPackageJson, notNilEmpty } from '../../util';
import { notNilEmpty } from '../../util';
/**
*
@ -63,17 +63,6 @@ export abstract class CustomEditorBase implements CustomTextEditorProvider {
protected abstract getHtmlForWebview(_document: TextDocument, _webview: Webview): string;
protected getIframeElement(href: string): string {
const json = getPackageJson();
const version = json.version;
if (href.indexOf('?') !== -1) {
if (href.endsWith('&')) {
href = `${href}v=${version}`;
} else {
href = `${href}&v=${version}`;
}
} else {
href = `${href}?v=${version}`;
}
return `<iframe id='iframe' src='${href}' frameborder='0' style='width:100%;height:100%;'></iframe>`;
}