Skip to content

Commit

Permalink
Ensure the page redraws if the user changes tab
Browse files Browse the repository at this point in the history
  • Loading branch information
ianabrown committed Nov 11, 2024
1 parent f10b667 commit 494f959
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [1.0.2]

- Ensure the page redraws if the user changes tab

## [1.0.1]

- Documentation tweaks
Expand All @@ -14,5 +18,6 @@
- The PGN viewer uses background and foreground colors from the current editor theme
- More layout and configuration options will be provided in a subsequent update

[1.0.2]: https://github.com/Motivesoft/vscode-pgn-viewer/releases/tag/v1.0.2
[1.0.1]: https://github.com/Motivesoft/vscode-pgn-viewer/releases/tag/v1.0.1
[1.0.0]: https://github.com/Motivesoft/vscode-pgn-viewer/releases/tag/v1.0.0
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Results are unknown if the provided PGN data is invalid.

## Release Notes

### 1.0.2

- Ensure the page redraws if the user changes tab

### 1.0.1

- Documentation tweaks
Expand Down
Binary file modified images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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-pgn-viewer",
"displayName": "Chess PGN Viewer",
"description": "Displays Portable Game Notation files on an interactive chess board",
"version": "1.0.1",
"version": "1.0.2",
"engines": {
"vscode": "^1.95.0"
},
Expand Down
15 changes: 13 additions & 2 deletions src/pgnViewerEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class PgnViewerEditorProvider implements vscode.CustomTextEditorProvider
content: document.getText(),
});
};

const changeDocumentSubscription = vscode.workspace.onDidChangeTextDocument(e => {
if (e.document.uri.toString() === document.uri.toString()) {
updateWebview();
Expand All @@ -41,6 +41,17 @@ export class PgnViewerEditorProvider implements vscode.CustomTextEditorProvider
changeDocumentSubscription.dispose();
});

webviewPanel.onDidChangeViewState( e => {
if (e.webviewPanel.visible) {
updateWebview();
}
},
null,
[
changeDocumentSubscription
]
);

updateWebview();
}

Expand Down Expand Up @@ -99,7 +110,7 @@ export class PgnViewerEditorProvider implements vscode.CustomTextEditorProvider
case 'update':
PGNV.pgnView('board', {
pgn: message.content,
figurine: "merida",
figurine: "alpha",
layout: "left",
notation: "long",
notationLayout: "list",
Expand Down

0 comments on commit 494f959

Please sign in to comment.