joethei / obsidian-tts

Text to speech for Obsidian. Hear your notes.
GNU General Public License v3.0
71 stars 10 forks source link

Allow selected-text tts in Viewing mode #27

Closed ShootingKing-AM closed 1 year ago

joethei commented 1 year ago

Have you tested that this works as intended? It should not, as view.editor.getSelection() only works in source mode/Live preview.

I'd also rather keep this working as is, and add a separate option to read only the selected text.

ShootingKing-AM commented 1 year ago

Have you tested that this works as intended? It should not, as view.editor.getSelection() only works in source mode/Live preview.

I was also surprised at first but maybe the obsidian API updated though its versions (or its window.getSelection().toString()) . But yes tested and working.

I'd also rather keep this working as is, and add a separate option to read only the selected text.

In Viewing mode: If we don't select anything, it just reads the whole file (original behaviour). Only if we select something it will read the selected text only.

joethei commented 1 year ago

oh, I just noticed why, in my code, if there is no selection in the editor it falls back to window.getSelection()