Skip to content

Commit

Permalink
fix: $ref not being rendered correctly (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
aditygrg2 authored Oct 16, 2024
1 parent a7a2568 commit 8b1ffe8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/PreviewWebPanel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as vscode from 'vscode';
import * as path from 'path';
import * as fs from 'fs';

let position : {x:0,y:0} = {
x: 0,
Expand Down Expand Up @@ -105,6 +106,8 @@ function getWebviewContent(context: vscode.ExtensionContext, webview: vscode.Web
);
const asyncapiWebviewUri = webview.asWebviewUri(asyncapiFile);
const asyncapiBasePath = asyncapiWebviewUri.toString().replace('%2B', '+'); // this is loaded by a different library so it requires unescaping the + character
const asyncapiContent = fs.readFileSync(asyncapiFile.fsPath, 'utf-8');

const html = `
<!DOCTYPE html>
<html>
Expand All @@ -131,11 +134,9 @@ function getWebviewContent(context: vscode.ExtensionContext, webview: vscode.Web
<script src="${asyncapiComponentJs}"></script>
<script>
const vscode = acquireVsCodeApi();
const schema = ${JSON.stringify(asyncapiContent)};
AsyncApiStandalone.render({
schema: {
url: '${asyncapiWebviewUri}',
options: { method: "GET", mode: "cors" },
},
schema: schema,
config: {
show: {
sidebar: true,
Expand Down

0 comments on commit 8b1ffe8

Please sign in to comment.