Skip to content

Commit 77dead7

Browse files
author
Yann Leflour
committed
fix close error
1 parent 32653d9 commit 77dead7

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

ui-sketcher-extension/CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# Change Log
22

3+
## [1.1.4] - 2023-26-09
4+
5+
### Fixed
6+
7+
- Error when closing the panel manually and closing the file after
8+
39
## [1.1.3] - 2023-23-09
410

5-
## Fixed
11+
### Fixed
612

713
- Allow pasting images from clipboard
814
- Allow embeddings from urls

ui-sketcher-extension/src/ui-sketcher-webview.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ export class UiSketcherWebview {
2525

2626
private watchActiveDocumentClose = () => {
2727
return vscode.workspace.onDidCloseTextDocument((document) => {
28-
if (this.lastDocument === document && this.panel) {
29-
this.panel.dispose();
30-
this.panel = undefined;
28+
if (this.lastDocument === document) {
29+
if (this.panel) this.panel.dispose();
3130
this.lastTextEditor = undefined;
3231
this.lastDocument = undefined;
3332
this.lastCursorPosition = undefined;
@@ -58,6 +57,10 @@ export class UiSketcherWebview {
5857
path.join(this.context.extensionPath, "images", "icon.png"),
5958
);
6059

60+
this.panel.onDidDispose(() => {
61+
this.panel = undefined;
62+
this.logChannel.appendLine("UI Sketcher: Panel closed");
63+
});
6164
this.panel.webview.html = this.getWebviewContent();
6265
this.panel.webview.onDidReceiveMessage(this.handleMessage);
6366
this.logChannel.appendLine("UI Sketcher: Panel opened");

0 commit comments

Comments
 (0)