From 99e619dcb20cdafe24dadc912a3b963b1d25b48b Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Sun, 26 Dec 2021 17:17:39 +0100 Subject: [PATCH] ~ allow for starting playback from preview mode. ~ fix errors that show up on android(even as the plugin will be disabled) --- manifest.json | 2 +- package.json | 2 +- src/TTSService.ts | 3 +++ src/main.ts | 4 ++-- versions.json | 3 ++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/manifest.json b/manifest.json index 49ecd00..18d2c9f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-tts", "name": "Text to Speech", - "version": "0.3.5", + "version": "0.4.0", "minAppVersion": "0.12.0", "description": "Text to speech for Obsidian. Hear your notes.", "author": "Johannes Theiner", diff --git a/package.json b/package.json index fbfbf90..d53b96e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-tts", - "version": "0.3.5", + "version": "0.4.0", "description": "Text to speech for Obsidian. Hear your notes.", "main": "main.js", "scripts": { diff --git a/src/TTSService.ts b/src/TTSService.ts index 3e81b08..3db71c7 100644 --- a/src/TTSService.ts +++ b/src/TTSService.ts @@ -41,6 +41,9 @@ export class TTSService { content = content.replace(/\*/g, ""); content = content.replace(/\^/g, ""); content = content.replace(/==/g, ""); + + //block references + content = content.replace(/^\S{6}/g, ""); } if (!this.plugin.settings.speakLinks) { //regex from https://stackoverflow.com/a/37462442/5589264 diff --git a/src/main.ts b/src/main.ts index c6def7c..409b2f7 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,7 +19,7 @@ export default class TTSPlugin extends Plugin { //https://bugs.chromium.org/p/chromium/issues/detail?id=487255 if (Platform.isAndroidApp) { new Notice("TTS: due to a bug in android this plugin does not work on this platform"); - throw Error("TTS: due to a bug in android this plugin does not work on this platform"); + this.unload(); } await this.loadSettings(); @@ -31,7 +31,7 @@ export default class TTSPlugin extends Plugin { const markdownView = this.app.workspace.getActiveViewOfType(MarkdownView); if(!checking && markdownView) this.ttsService.play(markdownView); - return markdownView ? true : false; + return !!markdownView; } }); diff --git a/versions.json b/versions.json index 0675d2d..5978886 100644 --- a/versions.json +++ b/versions.json @@ -4,5 +4,6 @@ "0.3.2": "0.12.0", "0.3.3": "0.12.0", "0.3.4": "0.12.0", - "0.3.5": "0.12.0" + "0.3.5": "0.12.0", + "0.4.0": "0.12.0" }