From 97ae52f937ef3303d0a791b98b67fc71c4504c82 Mon Sep 17 00:00:00 2001 From: Harsha Raghu Date: Tue, 23 May 2023 19:04:35 +0530 Subject: [PATCH 1/8] Update TTSServiceImplementation.ts --- src/TTSServiceImplementation.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/TTSServiceImplementation.ts b/src/TTSServiceImplementation.ts index 287303a..7831958 100644 --- a/src/TTSServiceImplementation.ts +++ b/src/TTSServiceImplementation.ts @@ -110,13 +110,9 @@ export class TTSServiceImplementation implements TTSService { async play(view: MarkdownView): Promise { const isPreview = view.getMode() === "preview"; - const previewText = view.previewMode.containerEl.innerText; const selectedText = view.editor.getSelection().length > 0 ? view.editor.getSelection() : window.getSelection().toString(); let content = selectedText.length > 0 ? selectedText : view.getViewData(); - if (isPreview) { - content = previewText; - } const title = selectedText.length > 0 ? null : view.getDisplayText(); let language = this.getLanguageFromFrontmatter(view); if (language === "") { From 08b857c9a18b17aa0446c8dff91342552f613f0a Mon Sep 17 00:00:00 2001 From: 1C0D <63018905+1C0D@users.noreply.github.com> Date: Wed, 12 Jul 2023 15:58:00 +0200 Subject: [PATCH 2/8] Start pause resume playback command --- a.bat | 9 +++++++++ src/main.ts | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 a.bat diff --git a/a.bat b/a.bat new file mode 100644 index 0000000..d056fa5 --- /dev/null +++ b/a.bat @@ -0,0 +1,9 @@ +@echo on +IF EXIST "src/main.ts" ( + start /B code src/main.ts +) ELSE ( + start /B code main.ts +) +call npm install +call npm run dev +pause \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 8a3775d..0784dfc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -68,6 +68,28 @@ export default class TTSPlugin extends Plugin { } }); + this.addCommand({ + id: 'start-pause-resume-tts-playback', + name: 'Start pause resume playback', + checkCallback: (checking: boolean) => { + const markdownView = this.app.workspace.getActiveViewOfType(MarkdownView); + if (!checking) { + if (markdownView) { + if (this.ttsService.isSpeaking() && !this.ttsService.isPaused()) { + this.ttsService.pause(); + } + else if (this.ttsService.isPaused()) { + this.ttsService.resume(); + } + else { + this.ttsService.play(markdownView); + } + } + } + return !!markdownView + } + }); + //clear statusbar text if not speaking this.registerInterval(window.setInterval(() => { if (!this.ttsService.isSpeaking()) { From 31d3928ca67c14bdc7fe75e1e492b0e70e20e63e Mon Sep 17 00:00:00 2001 From: 1C0D <63018905+1C0D@users.noreply.github.com> Date: Wed, 12 Jul 2023 17:41:19 +0200 Subject: [PATCH 3/8] deleted .bat --- a.bat | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 a.bat diff --git a/a.bat b/a.bat deleted file mode 100644 index d056fa5..0000000 --- a/a.bat +++ /dev/null @@ -1,9 +0,0 @@ -@echo on -IF EXIST "src/main.ts" ( - start /B code src/main.ts -) ELSE ( - start /B code main.ts -) -call npm install -call npm run dev -pause \ No newline at end of file From c314cd2ca53a303ccdc6ef0474d83704ef4cfe0d Mon Sep 17 00:00:00 2001 From: 1C0D <63018905+1C0D@users.noreply.github.com> Date: Thu, 13 Jul 2023 20:51:52 +0200 Subject: [PATCH 4/8] command name+version --- manifest.json | 2 +- package.json | 2 +- src/main.ts | 2 +- versions.json | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index e33e1d3..db4df69 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-tts", "name": "Text to Speech", - "version": "0.5.1", + "version": "0.5.2", "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 7209207..0e609a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-tts", - "version": "0.5.1", + "version": "0.5.2", "description": "Text to speech for Obsidian. Hear your notes.", "main": "main.js", "scripts": { diff --git a/src/main.ts b/src/main.ts index 0784dfc..9cd5415 100644 --- a/src/main.ts +++ b/src/main.ts @@ -70,7 +70,7 @@ export default class TTSPlugin extends Plugin { this.addCommand({ id: 'start-pause-resume-tts-playback', - name: 'Start pause resume playback', + name: 'Start/Pause/Resume playback', checkCallback: (checking: boolean) => { const markdownView = this.app.workspace.getActiveViewOfType(MarkdownView); if (!checking) { diff --git a/versions.json b/versions.json index 5c0934b..5356f7b 100644 --- a/versions.json +++ b/versions.json @@ -7,5 +7,6 @@ "0.3.5": "0.12.0", "0.4.0": "0.12.0", "0.5.0": "0.12.0", - "0.5.1": "0.12.0" + "0.5.1": "0.12.0", + "0.5.2": "0.12.0" } From 926d96045c529201a5adc7892ce0578e562b0cc6 Mon Sep 17 00:00:00 2001 From: joethei Date: Fri, 14 Jul 2023 22:09:15 +0200 Subject: [PATCH 5/8] remove anything that looks like a link if setting is diabled, fixes #22 --- src/TTSServiceImplementation.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/TTSServiceImplementation.ts b/src/TTSServiceImplementation.ts index 7831958..07612c1 100644 --- a/src/TTSServiceImplementation.ts +++ b/src/TTSServiceImplementation.ts @@ -50,6 +50,8 @@ export class TTSServiceImplementation implements TTSService { if (!this.plugin.settings.speakLinks) { //regex from https://stackoverflow.com/a/37462442/5589264 content = content.replace(/(?:__|[*#])|\[(.*?)]\(.*?\)/gm, '$1'); + content = content.replace(/http[s]:\/\/[^\s]*/gm, ''); + console.log(content); } if (!this.plugin.settings.speakCodeblocks) { content = content.replace(/```[\s\S]*?```/g, ''); From 481bd19dafa04405dfb387f03737d45ddd18ff0e Mon Sep 17 00:00:00 2001 From: joethei Date: Fri, 14 Jul 2023 22:12:18 +0200 Subject: [PATCH 6/8] Update readme & esbuild --- README.md | 2 +- esbuild.config.mjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8805be0..82ab336 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Plugin for [Obsidian](https://obsidian.md) -![Maintenance](https://shields.joethei.xyz/maintenance/yes/2022) +![Maintenance](https://shields.joethei.xyz/maintenance/yes/2023) ![GitHub manifest.json dynamic (path)](https://shields.joethei.xyz/github/manifest-json/minAppVersion/joethei/obsidian-tts?label=lowest%20supported%20app%20version) [![libera manifesto](https://shields.joethei.xyz/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com) --- diff --git a/esbuild.config.mjs b/esbuild.config.mjs index 575a560..69ca0f4 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -6,7 +6,7 @@ const banner = `/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin -https://github.com/joethei/obsidian-rss +https://github.com/joethei/obsidian-tts */ `; From 733e82d886e973986970960fec61660bb544460a Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Sun, 24 Sep 2023 18:05:53 +0200 Subject: [PATCH 7/8] Update README.md --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 82ab336..58dfe9f 100644 --- a/README.md +++ b/README.md @@ -36,11 +36,7 @@ This plugin uses the native API of your Operating System, to add a new language ## Installing the plugin -- `Settings > Third-party plugins > Community Plugins > Browse` and search for `Text to Speech` -- Using the [Beta Reviewers Auto-update Tester](https://github.com/TfTHacker/obsidian42-brat) plugin with the repo - path: `joethei/obsidian-tts` -- Copy over `main.js`, `styles.css`, `manifest.json` from the releases to your - vault `VaultFolder/.obsidian/plugins/obsidian-tts/`. +- `Settings > Community plugins > Community Plugins > Browse` and search for `Text to Speech` ## API From 3e5a517d15b2ae9c6186fb5b04e9ca8cde2d85d1 Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Fri, 8 Dec 2023 15:12:16 +0100 Subject: [PATCH 8/8] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 58dfe9f..ba9df5c 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ Plugin for [Obsidian](https://obsidian.md) -![Maintenance](https://shields.joethei.xyz/maintenance/yes/2023) -![GitHub manifest.json dynamic (path)](https://shields.joethei.xyz/github/manifest-json/minAppVersion/joethei/obsidian-tts?label=lowest%20supported%20app%20version) -[![libera manifesto](https://shields.joethei.xyz/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com) +![Maintenance](https://shields.io/maintenance/yes/2023) +![GitHub manifest.json dynamic (path)](https://shields.io/github/manifest-json/minAppVersion/joethei/obsidian-tts?label=lowest%20supported%20app%20version) +[![libera manifesto](https://shields.io/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com) --- Features: