Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow selected-text tts in Viewing mode #27

Merged
merged 1 commit into from
Jul 14, 2023

Conversation

ShootingKing-AM
Copy link
Contributor

No description provided.

@joethei
Copy link
Owner

joethei commented May 24, 2023

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
Copy link
Contributor Author

ShootingKing-AM commented May 24, 2023

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
Copy link
Owner

joethei commented Jul 14, 2023

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

@joethei joethei merged commit 6f21430 into joethei:master Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants