Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

File preview working #141

Merged
merged 1 commit into from
Aug 17, 2019
Merged
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
23 changes: 18 additions & 5 deletions src/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,25 @@ export async function openHtmlDocument(html: string, title?: string, id?: any):
NEW_DOC.title = deploy_helpers.toStringSafe(title).trim();
}

if (HTML_DOCS) {
HTML_DOCS.push(NEW_DOC);
}
//Find eexisting column
const column = vscode.window.activeTextEditor
? vscode.window.activeTextEditor.viewColumn
: undefined;

//Create webview panel
const panel = vscode.window.createWebviewPanel(
"New files list",
NEW_DOC.title,
column || vscode.ViewColumn.One,
{
enableScripts: false,
}
);

//Load content into webview
panel.webview.html = NEW_DOC.body.toString();
return true;

return await vscode.commands.executeCommand(OPEN_HTML_DOC_COMMAND,
NEW_DOC, HTML_DOCS);
}

/**
Expand Down