Skip to content

Commit

Permalink
#24 retain theme selection on preview refresh patch
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomFractals committed Apr 2, 2019
1 parent 2894d9e commit b5bb61a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-vega-viewer",
"displayName": "Vega Viewer",
"description": "Vega Viewer",
"version": "4.2.0",
"version": "4.2.1",
"publisher": "RandomFractalsInc",
"author": "Taras Novak",
"contributors": [
Expand Down
7 changes: 4 additions & 3 deletions templates/vega.preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ <h3 id="title">loading...</h3>
<div id="vis"></div>
<script type="text/javascript">
// start with blank vega spec
let vscode, view, message, data, title, themeSelector;
let vscode, view, message, data, title, themeSelector, theme;
let spec = {
"$schema": "https://vega.github.io/schema/vega/v4.json",
"width": 400,
Expand Down Expand Up @@ -122,7 +122,7 @@ <h3 id="title">loading...</h3>
title.innerText = event.data.fileName.replace('.json', '');
spec = JSON.parse(event.data.spec);
data = event.data.data;
view = preview(spec);
view = preview(spec, theme);
}
catch (error) {
console.error('vega.preview:', error.message);
Expand All @@ -133,7 +133,8 @@ <h3 id="title">loading...</h3>
});

function changeTheme() {
preview(spec, themeSelector.value);
theme = themeSelector.value;
preview(spec, theme);
}

// vega preview update
Expand Down

0 comments on commit b5bb61a

Please sign in to comment.