Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/NbtEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,24 @@ export class NbtEditorProvider implements vscode.CustomEditorProvider<NbtDocumen
): Promise<void> {
this.webviews.add(document.uri, webviewPanel)

const assets = await getAssets(document.dataVersion, this.logger)

webviewPanel.webview.options = {
enableScripts: true,
localResourceRoots: [
vscode.Uri.file(mcmetaRoot),
vscode.Uri.file(this._context.extensionPath),
],
}
webviewPanel.webview.html = this.getHtmlForWebview(webviewPanel.webview, assets.version, document.isStructure, document.documentData instanceof NbtRegion)

const isStructure = document.isStructure
const isRegion = document.documentData instanceof NbtRegion
let version = ''

if (isStructure || isRegion) {
const assets = await getAssets(document.dataVersion, this.logger)
version = assets.version
}

webviewPanel.webview.html = this.getHtmlForWebview(webviewPanel.webview, version, isStructure, isRegion)

webviewPanel.webview.onDidReceiveMessage(e => this.onMessage(e, document, webviewPanel))
}
Expand Down