From ae243b0e44ca784ecff9c2399c951542a9c308bf Mon Sep 17 00:00:00 2001 From: Raptazure Date: Thu, 13 Feb 2020 10:08:20 +0800 Subject: [PATCH] v0.1.2 --- README.md | 6 +++++- changelog.md | 6 +++++- package.json | 2 +- src/dailyTarot.ts | 4 +++- src/drawCards.ts | 19 +++++++++---------- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 6c391c7..235854b 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,12 @@ ### 0.1.0 -Initial release. +- Initial release. +### 0.1.2 + +- Content of the status bar cannot be overwritten now. +- Auto close: Ask multiple questions. We will close previous panels for you. **Enjoy!** diff --git a/changelog.md b/changelog.md index a51fcbe..8680c1a 100644 --- a/changelog.md +++ b/changelog.md @@ -3,4 +3,8 @@ ### 0.1.0: 05 Feb 2020 - Initial release - Status bar and input box support -- Choices: `Ask a Question` and `Draw a Card` \ No newline at end of file +- Choices: `Ask a Question` and `Draw a Card` + +### 0.1.2: 13 Feb 2020 +- Content of the status bar cannot be overwritten now. +- Auto close: Ask multiple questions. We will close previous panels for you. \ No newline at end of file diff --git a/package.json b/package.json index 4ff7b92..84fb355 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "daily-tarot", "displayName": "Daily Tarot", "description": "Get your daily tarot reading - Prisma Visions", - "version": "0.1.1", + "version": "0.1.2", "publisher": "raptazure", "icon": "images/icon.jpg", "engines": { diff --git a/src/dailyTarot.ts b/src/dailyTarot.ts index d81b7f7..c6fc2ff 100644 --- a/src/dailyTarot.ts +++ b/src/dailyTarot.ts @@ -5,7 +5,9 @@ import { tarotDict } from './tarotDict' let statusBar: vscode.StatusBarItem | undefined; export function dailyTarot(context: vscode.ExtensionContext) { - DrawCards.show(context); + if (statusBar === undefined) { + DrawCards.show(context); + } const index = String(DrawCards.selector); vscode.window.showInformationMessage(`${tarotDict[index]}`); diff --git a/src/drawCards.ts b/src/drawCards.ts index 0715ab2..223877f 100644 --- a/src/drawCards.ts +++ b/src/drawCards.ts @@ -13,18 +13,17 @@ export class DrawCards { vscode.window.activeTextEditor.viewColumn : undefined; if (this.panel) { - this.panel.reveal(columnToShowIn); - } else { - this.panel = vscode.window.createWebviewPanel('dailyTarot', 'Daily Tarot', vscode.ViewColumn.Two, {}); - - DrawCards.selector = -1 + Math.floor(Math.random() * 79); + this.panel.dispose(); + } - if (this.panel !== undefined) { - const filePath: vscode.Uri = vscode.Uri.file(path.join(context.extensionPath, 'src', 'pages', `${DrawCards.selector}.html`)); - this.panel.webview.html = fs.readFileSync(filePath.fsPath, 'utf8'); - } + this.panel = vscode.window.createWebviewPanel('dailyTarot', 'Daily Tarot', vscode.ViewColumn.Two, {}); + DrawCards.selector = -1 + Math.floor(Math.random() * 79); - this.panel.onDidDispose(() => this.panel = undefined); + if (this.panel !== undefined) { + const filePath: vscode.Uri = vscode.Uri.file(path.join(context.extensionPath, 'src', 'pages', `${DrawCards.selector}.html`)); + this.panel.webview.html = fs.readFileSync(filePath.fsPath, 'utf8'); } + + this.panel.onDidDispose(() => this.panel = undefined); } } \ No newline at end of file